本文整理匯總了PHP中CronTask::updateInDB方法的典型用法代碼示例。如果您正苦於以下問題:PHP CronTask::updateInDB方法的具體用法?PHP CronTask::updateInDB怎麽用?PHP CronTask::updateInDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CronTask
的用法示例。
在下文中一共展示了CronTask::updateInDB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: pluginFusioninventoryUpdate
//.........這裏部分代碼省略.........
$input['00:a0:c6:00:00:00'] = '3';
$input['d2:6b:25:2f:2c:e7'] = '3';
$input['33:50:6f:45:30:30'] = '3';
$input['0a:00:27:00:00:00'] = '3';
$input['00:50:56:C0:00:01'] = '3';
$input['00:50:56:C0:00:02'] = '3';
$input['00:50:56:C0:00:03'] = '3';
$input['00:50:56:C0:00:04'] = '3';
$input['00:50:56:C0:00:08'] = '3';
$input['FE:FF:FF:FF:FF:FF'] = '3';
$input['00:00:00:00:00:00'] = '3';
$input['00:0b:ca:fe:00:00'] = '3';
$input['02:80:37:EC:02:00'] = '3';
$input['MB-1234567890'] = '1';
$input['Not Specified'] = '1';
$input['OEM_Serial'] = '1';
$input['SystemSerialNumb'] = '1';
$input['Not'] = '2';
foreach ($input as $value => $type) {
$query = "SELECT * FROM `glpi_plugin_fusioninventory_inventorycomputerblacklists`\n WHERE `plugin_fusioninventory_criterium_id`='" . $type . "'\n AND `value`='" . $value . "'";
$result = $DB->query($query);
if ($DB->numrows($result) == '0') {
$query = "INSERT INTO `glpi_plugin_fusioninventory_inventorycomputerblacklists`\n (`plugin_fusioninventory_criterium_id`, `value`) VALUES\n ( '" . $type . "', '" . $value . "')";
$DB->query($query);
}
}
$migration->displayMessage("Add Crontasks");
/*
* Add Crontask if not exist
*/
$crontask = new CronTask();
if ($crontask->getFromDBbyName('PluginFusioninventoryTaskjob', 'taskscheduler')) {
$crontask->fields['itemtype'] = 'PluginFusioninventoryTask';
$crontask->updateInDB(array('itemtype'));
}
if (!$crontask->getFromDBbyName('PluginFusioninventoryTask', 'taskscheduler')) {
CronTask::Register('PluginFusioninventoryTask', 'taskscheduler', '60', array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
if ($crontask->getFromDBbyName('PluginFusioninventoryTaskjobstate', 'cleantaskjob') and $crontask->getFromDBbyName('PluginFusioninventoryTaskjobstatus', 'cleantaskjob')) {
$crontask->getFromDBbyName('PluginFusioninventoryTaskjobstatus', 'cleantaskjob');
$crontask->delete($crontask->fields);
}
if ($crontask->getFromDBbyName('PluginFusioninventoryTaskjobstatus', 'cleantaskjob')) {
$query = "UPDATE `glpi_crontasks` SET `itemtype`='PluginFusioninventoryTaskjobstate'\n WHERE `itemtype`='PluginFusioninventoryTaskjobstatus'";
$DB->query($query);
}
if (!$crontask->getFromDBbyName('PluginFusioninventoryTaskjobstate', 'cleantaskjob')) {
Crontask::Register('PluginFusioninventoryTaskjobstate', 'cleantaskjob', 3600 * 24, array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
if ($crontask->getFromDBbyName('PluginFusinvsnmpNetworkPortLog', 'cleannetworkportlogs')) {
$crontask->delete($crontask->fields);
}
if (!$crontask->getFromDBbyName('PluginFusioninventoryNetworkPortLog', 'cleannetworkportlogs')) {
Crontask::Register('PluginFusioninventoryNetworkPortLog', 'cleannetworkportlogs', 3600 * 24, array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30));
}
if ($crontask->getFromDBbyName('PluginFusioninventoryConfigurationManagement', 'checkdevices')) {
$crontask->delete($crontask->fields);
}
if (!$crontask->getFromDBbyName('PluginFusioninventoryAgent', 'cleanoldagents')) {
Crontask::Register('PluginFusioninventoryAgent', 'cleanoldagents', 86400, array('mode' => 2, 'allowmode' => 3, 'logs_lifetime' => 30, 'hourmin' => 22, 'hourmax' => 6, 'comment' => 'Clean agents not contacted since xxx days'));
}
/*
* Update task's agents list from dynamic group periodically in order to automatically target new
* computer.
*/
if (!$crontask->getFromDBbyName('PluginFusioninventoryTaskjob', 'updatedynamictasks')) {