Cron - enabled mode CLI

SVN:trunk[1138]
This commit is contained in:
Romain Quetiez
2011-03-21 11:41:08 +00:00
parent de5ccf5908
commit 78396eafe3
2 changed files with 30 additions and 4 deletions

View File

@@ -50,7 +50,7 @@ function UsageAndExit($oP)
if ($bModeCLI)
{
$oP->p("USAGE:\n");
$oP->p("php -q synchro_exec.php auth_user=<login> auth_pwd=<password> data_sources=<comma_separated_list_of_data_sources>\n");
$oP->p("php -q synchro_exec.php --auth_user=<login> --auth_pwd=<password> --data_sources=<comma_separated_list_of_data_sources>\n");
}
else
{

View File

@@ -31,10 +31,36 @@ require_once(APPROOT.'/application/clipage.class.inc.php');
require_once(APPROOT.'/application/startup.inc.php');
function ReadMandatoryParam($oP, $sParam)
{
$sValue = utils::ReadParam($sParam, null, true /* Allow CLI */);
if (is_null($sValue))
{
$oP->p("ERROR: Missing argument '$sParam'\n");
UsageAndExit($oP);
}
return trim($sValue);
}
function UsageAndExit($oP)
{
$bModeCLI = utils::IsModeCLI();
if ($bModeCLI)
{
$oP->p("USAGE:\n");
$oP->p("php -q cron.php --auth_user=<login> --auth_pwd=<password> [--verbose=1]\n");
}
else
{
$oP->p("Optional parameter: verbose\n");
}
$oP->output();
exit -2;
}
// Known limitation - the background process periodicity is NOT taken into account
function CronExec($oP, $aBackgroundProcesses, $bVerbose)
{
$iStarted = time();
@@ -126,7 +152,7 @@ foreach(get_declared_classes() as $sPHPClass)
}
$bVerbose = utils::ReadParam('verbose', false);
$bVerbose = utils::ReadParam('verbose', false, true /* Allow CLI */);
if ($bVerbose)
{