BUG-12465 Se necesita una forma mas sencilla de rehabilitar el cron SOLVED

- No se tenia una opcion para borrar el archivo que se crea con el cron.
    - se agrega un parametro "+force", este parametro borra el archivo del cron y se puede continuar directamente con la ejecuci
    - php cron.php [+d"YYYY-MM-DD HH:MM:SS"] [+wWORKSPACE] [ACTIVITIES] [+force]
This commit is contained in:
Marco Antonio Nina
2013-07-30 11:45:16 -04:00
parent b481d5ba3e
commit 9779b436a8

View File

@@ -58,14 +58,14 @@ $sLastExecution = null;
$processcTimeProcess = 0; $processcTimeProcess = 0;
$processcTimeStart = 0; $processcTimeStart = 0;
if (file_exists(PATH_DATA . "cron")) { if (file_exists(PATH_DATA . "cron")) {
$reset = false; $force = false;
for ($i = 1; $i <= count($argv) - 1; $i++) { for ($i = 1; $i <= count($argv) - 1; $i++) {
if (strpos($argv[$i], "+reset") !== false) { if (strpos($argv[$i], "+force") !== false) {
$reset = true; $force = true;
break; break;
} }
} }
if (!$reset) { if (!$force) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]); $bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
$sLastExecution = $arrayCron["sLastExecution"]; $sLastExecution = $arrayCron["sLastExecution"];
@@ -146,6 +146,6 @@ if (!$bCronIsRunning) {
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
} else { } else {
eprintln("The cron is running, please wait for it to finish.\nStarted in $sLastExecution"); eprintln("The cron is running, please wait for it to finish.\nStarted in $sLastExecution");
eprintln("If do you want force the execution use the command '+reset'" ,"green"); eprintln("If do you want force the execution use the option '+force', example: php -f +wworkflow +force" ,"green");
} }