This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// @see http://fr2.php.net/manual/en/function.mb-convert-encoding.php#103300 | |
function memory_usage() { | |
$mem_usage = memory_get_usage(true); | |
if ($mem_usage < 1024) { | |
$mem_usage .= ' bytes'; | |
} elseif ($mem_usage < 1048576) { | |
$mem_usage = round($mem_usage/1024,2) . ' kilobytes'; | |
} else { | |
$mem_usage = round($mem_usage/1048576,2) . ' megabytes'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$rootPath = realpath(dirname(__FILE__) . '/../') . '/'; | |
function takeMutex($name) { | |
global $rootPath; | |
$filename = $rootPath . 'tmp/cron_' . $name . '.lock'; | |
if (($handle = @fopen($filename, 'x')) === false) { | |
die('Une autre instance de cette tâche est en cours d\'exécution, ou impossible de créer le fichier "' . $filename . '", vérifiez les droits d\'écriture !'); | |
} |
NewerOlder