diff --git a/core/asynctask.class.inc.php b/core/asynctask.class.inc.php index f64765747c..19cd59e710 100644 --- a/core/asynctask.class.inc.php +++ b/core/asynctask.class.inc.php @@ -33,7 +33,7 @@ class ExecAsyncTask implements iBackgroundProcess public function Process($iTimeLimit) { - $sOQL = "SELECT AsyncTask WHERE ISNULL(started)"; + $sOQL = "SELECT AsyncTask WHERE ISNULL(started) AND (ISNULL(planned) OR (planned < NOW()))"; $oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), array('created' => true) /* order by*/, array()); $iProcessed = 0; while ((time() < $iTimeLimit) && ($oTask = $oSet->Fetch())) @@ -83,6 +83,8 @@ abstract class AsyncTask extends DBObject // MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeDateTime("created", array("allowed_values"=>null, "sql"=>"created", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeDateTime("started", array("allowed_values"=>null, "sql"=>"started", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); + // planned... still not used - reserved for timer management + MetaModel::Init_AddAttribute(new AttributeDateTime("planned", array("allowed_values"=>null, "sql"=>"planned", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array()))); MetaModel::Init_AddAttribute(new AttributeExternalKey("event_id", array("targetclass"=>"Event", "jointype"=> "", "allowed_values"=>null, "sql"=>"event_id", "is_null_allowed"=>true, "on_target_delete"=>DEL_SILENT, "depends_on"=>array()))); // Display lists diff --git a/test/testlist.inc.php b/test/testlist.inc.php index 55b5c38133..e83ddc4dea 100644 --- a/test/testlist.inc.php +++ b/test/testlist.inc.php @@ -3240,7 +3240,7 @@ class TestEmailAsynchronous extends TestBizModel { $oMail = new Email(); $oMail->SetRecipientTO('romain.quetiez@combodo.com'); - //$oMail->SetRecipientFrom('romain.quetiez@combodo.com'); + $oMail->SetRecipientFrom('romain.quetiez@combodo.com'); $oMail->SetRecipientCC('romainquetiez@yahoo.fr'); $oMail->SetSubject('automated test - '.$i); $oMail->SetBody('this is one is entirely working fine '.time()); diff --git a/webservices/cron.php b/webservices/cron.php index 6652983904..bdb9674001 100644 --- a/webservices/cron.php +++ b/webservices/cron.php @@ -120,7 +120,7 @@ if (utils::IsModeCLI()) } else { - $oP->p("Access restricted or wrong credentials ('$sAuthUser')"); + $oP->p("Access wrong credentials ('$sAuthUser')"); exit; } } @@ -133,6 +133,13 @@ else $oP = new WebPage("iTop - CRON"); } +if (!UserRights::IsAdministrator()) +{ + $oP->p("Access restricted to administrators"); + $oP->Output(); + exit; +} + // Enumerate classes implementing BackgroundProcess //