mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-20 15:52:24 +02:00
CRON - admin only + queues with timer (field 'planned')
SVN:trunk[1139]
This commit is contained in:
@@ -33,7 +33,7 @@ class ExecAsyncTask implements iBackgroundProcess
|
|||||||
|
|
||||||
public function Process($iTimeLimit)
|
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());
|
$oSet = new CMDBObjectSet(DBObjectSearch::FromOQL($sOQL), array('created' => true) /* order by*/, array());
|
||||||
$iProcessed = 0;
|
$iProcessed = 0;
|
||||||
while ((time() < $iTimeLimit) && ($oTask = $oSet->Fetch()))
|
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 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("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())));
|
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())));
|
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
|
// Display lists
|
||||||
|
|||||||
@@ -3240,7 +3240,7 @@ class TestEmailAsynchronous extends TestBizModel
|
|||||||
{
|
{
|
||||||
$oMail = new Email();
|
$oMail = new Email();
|
||||||
$oMail->SetRecipientTO('romain.quetiez@combodo.com');
|
$oMail->SetRecipientTO('romain.quetiez@combodo.com');
|
||||||
//$oMail->SetRecipientFrom('romain.quetiez@combodo.com');
|
$oMail->SetRecipientFrom('romain.quetiez@combodo.com');
|
||||||
$oMail->SetRecipientCC('romainquetiez@yahoo.fr');
|
$oMail->SetRecipientCC('romainquetiez@yahoo.fr');
|
||||||
$oMail->SetSubject('automated test - '.$i);
|
$oMail->SetSubject('automated test - '.$i);
|
||||||
$oMail->SetBody('this is one is entirely working fine '.time());
|
$oMail->SetBody('this is one is entirely working fine '.time());
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ if (utils::IsModeCLI())
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oP->p("Access restricted or wrong credentials ('$sAuthUser')");
|
$oP->p("Access wrong credentials ('$sAuthUser')");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,6 +133,13 @@ else
|
|||||||
$oP = new WebPage("iTop - CRON");
|
$oP = new WebPage("iTop - CRON");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!UserRights::IsAdministrator())
|
||||||
|
{
|
||||||
|
$oP->p("Access restricted to administrators");
|
||||||
|
$oP->Output();
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Enumerate classes implementing BackgroundProcess
|
// Enumerate classes implementing BackgroundProcess
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user