当前位置: 首页>>代码示例>>PHP>>正文


PHP CronTask类代码示例

本文整理汇总了PHP中CronTask的典型用法代码示例。如果您正苦于以下问题:PHP CronTask类的具体用法?PHP CronTask怎么用?PHP CronTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CronTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: plugin_typology_install

function plugin_typology_install()
{
    global $DB;
    include_once GLPI_ROOT . "/plugins/typology/inc/profile.class.php";
    if (!TableExists("glpi_plugin_typology_typologies")) {
        // table sql creation
        $DB->runFile(GLPI_ROOT . "/plugins/typology/sql/empty-1.0.0.sql");
        $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginTypologyTypology' AND `name` = 'Alert no validated typology'";
        $result = $DB->query($query_id) or die($DB->error());
        $itemtype = $DB->result($result, 0, 'id');
        $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##typology.action## : ##typology.entity##',\n                        '##FOREACHitems##\n   ##lang.typology.name## : ##typology.name##\n   ##lang.typology.itemtype## : ##typology.itemtype##\n   ##lang.typology.items_id## : ##typology.items_id##\n   ##lang.typology.itemlocation## : ##typology.itemlocation##\n   ##lang.typology.itemuser## : ##typology.itemuser##\n   ##lang.typology.error## : ##typology.error##\n   ##ENDFOREACHitems##',\n   '<table class=\"tab_cadre\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\">\n   <tbody>\n   <tr>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.name##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.itemtype##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.items_id##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.itemlocation##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.itemuser##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.typology.error##</span></td>\n   </tr>\n   ##FOREACHtypologyitems##\n   <tr>\n   <td><a href=\"##typology.url##\" target=\"_blank\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.name##</span></a></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.itemtype##</span></td>\n   <td><a href=\"##typology.itemurl##\" target=\"_blank\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.items_id##</span></a></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.itemlocation##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.itemuser##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##typology.error##</span></td>\n   </tr>\n   ##ENDFOREACHtypologyitems##\n   </tbody>\n   </table>');";
        $result = $DB->query($query);
        $query = "INSERT INTO `glpi_notifications`\n                                   VALUES (NULL, 'Alert no validated typology', 0, 'PluginTypologyTypology', 'AlertNotValidatedTypology',\n                                          'mail'," . $itemtype . ",\n                                          '', 1, 1, '2010-02-17 22:36:46');";
        $result = $DB->query($query);
    }
    if (TableExists("glpi_plugin_typology_typologycriterias")) {
        $query = "UPDATE `glpi_plugin_typology_typologycriterias`\n                     SET `itemtype`='IPAddress'\n                     WHERE `itemtype`='NetworkPort'";
        $result = $DB->query($query);
        $query = "UPDATE `glpi_plugin_typology_typologycriteriadefinitions`\n                     SET `field`='name;glpi_ipaddresses;itemlink'\n                     WHERE `field` LIKE '%glpi_networkports%'";
        $result = $DB->query($query);
    }
    CronTask::Register('PluginTypologyTypology', 'UpdateTypology', DAY_TIMESTAMP);
    CronTask::Register('PluginTypologyTypology', 'NotValidated', DAY_TIMESTAMP);
    PluginTypologyProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    return true;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:26,代码来源:hook.php

示例2: uninstall

 static function uninstall()
 {
     global $DB;
     CronTask::Unregister('fusioninventory');
     PluginFusioninventoryProfile::uninstallProfile();
     $pfSetup = new PluginFusioninventorySetup();
     $user = new User();
     if (class_exists('PluginFusioninventoryConfig')) {
         $fusioninventory_config = new PluginFusioninventoryConfig();
         $users_id = $fusioninventory_config->getValue('users_id');
         $user->delete(array('id' => $users_id), 1);
     }
     if (file_exists(GLPI_PLUGIN_DOC_DIR . '/fusioninventory')) {
         $pfSetup->rrmdir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory');
     }
     $query = "SHOW TABLES;";
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         if (strstr($data[0], "glpi_plugin_fusioninventory_") or strstr($data[0], "glpi_plugin_fusinvsnmp_") or strstr($data[0], "glpi_plugin_fusinvinventory_") or strstr($data[0], "glpi_dropdown_plugin_fusioninventory") or strstr($data[0], "glpi_plugin_tracker") or strstr($data[0], "glpi_dropdown_plugin_tracker")) {
             $query_delete = "DROP TABLE `" . $data[0] . "`;";
             $DB->query($query_delete) or die($DB->error());
         }
     }
     $query = "DELETE FROM `glpi_displaypreferences`\n               WHERE `itemtype` LIKE 'PluginFusioninventory%';";
     $DB->query($query) or die($DB->error());
     // Delete rules
     $Rule = new Rule();
     $Rule->deleteByCriteria(array('sub_type' => 'PluginFusioninventoryInventoryRuleImport'));
     //Remove informations related to profiles from the session (to clean menu and breadcrumb)
     PluginFusioninventoryProfile::removeRightsFromSession();
     return TRUE;
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:32,代码来源:setup.class.php

示例3: getTaskInfo

 public function getTaskInfo($taskName)
 {
     Yii::import('site.common.components.cron.*');
     /** @var CActiveRecord $owner  */
     $owner = $this->getOwner();
     $modelName = get_class($owner);
     return CronTask::model()->findByAttributes(array('ownerModel' => $modelName, 'ownerId' => $owner->primaryKey, 'taskName' => $taskName));
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:8,代码来源:CronTaskBehavior.php

示例4: createByTask

 /**
  * Static method to create new instance and get information about last execution. Used in console daemon action.
  * @param CronTask $task configured task instance
  * @param CronService $service application service component
  * @return CronProcess
  */
 public static function createByTask(CronTask $task, CronService $service)
 {
     $process = new self($service, $task->getId());
     $process->readInfoFile();
     $process->unique = $task->isUnique();
     $process->name = $task->getName();
     $process->command = $task->getCommand();
     $process->action = $task->getCommandAction();
     $params = array();
     foreach ($task->getParams() as $param => $value) {
         $params[] = "--{$param}={$value}";
     }
     $process->params = $params;
     $app = Yii::app()->getBasePath() . DIRECTORY_SEPARATOR . 'yiic';
     $output = $task->getOutputFile() ? "> {$task->getOutputFile()}" : '>> /dev/null';
     $process->_wrapperCommand = "{$app} cron run --id={$task->getId()} {$output} 2>&1 & echo \$!";
     return $process;
 }
开发者ID:Stevad,项目名称:yii-cron-tasks,代码行数:24,代码来源:CronProcess.php

示例5: plugin_mreporting_install

function plugin_mreporting_install()
{
    global $DB;
    //get version
    $plugin = new Plugin();
    $found = $plugin->find("name = 'mreporting'");
    $plugin_mreporting = array_shift($found);
    //init migration
    $migration = new Migration($plugin_mreporting['version']);
    //create profiles table
    $queries = array();
    $queries[] = "CREATE TABLE IF NOT EXISTS `glpi_plugin_mreporting_profiles` (\n      `id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\n      `profiles_id` VARCHAR(45) NOT NULL,\n      `reports` CHAR(1),\n      `config` CHAR(1),\n   PRIMARY KEY (`id`)\n   )\n   ENGINE = MyISAM;";
    //create configuration table
    $queries[] = "CREATE TABLE IF NOT EXISTS `glpi_plugin_mreporting_configs` (\n   `id` int(11) NOT NULL auto_increment,\n   `name` varchar(255) collate utf8_unicode_ci default NULL,\n   `classname` varchar(255) collate utf8_unicode_ci default NULL,\n   `is_active` tinyint(1) NOT NULL default '0',\n   `is_notified` tinyint(1) NOT NULL default '1',\n   `show_graph` tinyint(1) NOT NULL default '0',\n   `show_area` tinyint(1) NOT NULL default '0',\n   `spline` tinyint(1) NOT NULL default '0',\n   `show_label` VARCHAR(10) default NULL,\n   `flip_data` tinyint(1) NOT NULL default '0',\n   `unit` VARCHAR(10) default NULL,\n   `default_delay` VARCHAR(10) default NULL,\n   `condition` VARCHAR(255) default NULL,\n   `graphtype` VARCHAR(255) default 'GLPI',\n   PRIMARY KEY  (`id`),\n   KEY `is_active` (`is_active`)\n   ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
    $queries[] = "CREATE TABLE  IF NOT EXISTS `glpi_plugin_mreporting_preferences` (\n   `id` int(11) NOT NULL auto_increment,\n   `users_id` int(11) NOT NULL default 0,\n   `template` varchar(255) collate utf8_unicode_ci default NULL,\n   PRIMARY KEY  (`id`),\n   KEY `users_id` (`users_id`)\n   ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
    // add display preferences
    $query_display_pref = "SELECT id \n      FROM glpi_displaypreferences\n      WHERE itemtype = 'PluginMreportingConfig'";
    $res_display_pref = $DB->query($query_display_pref);
    if ($DB->numrows($res_display_pref) == 0) {
        $queries[] = "INSERT INTO `glpi_displaypreferences` \n         VALUES (NULL,'PluginMreportingConfig','2','2','0');";
        $queries[] = "INSERT INTO `glpi_displaypreferences` \n         VALUES (NULL,'PluginMreportingConfig','3','3','0');";
        $queries[] = "INSERT INTO `glpi_displaypreferences` \n         VALUES (NULL,'PluginMreportingConfig','4','4','0');";
        $queries[] = "INSERT INTO `glpi_displaypreferences` \n         VALUES (NULL,'PluginMreportingConfig','5','5','0');";
        $queries[] = "INSERT INTO `glpi_displaypreferences` \n         VALUES (NULL,'PluginMreportingConfig','6','6','0');";
        $queries[] = "INSERT INTO `glpi_displaypreferences` \n         VALUES (NULL,'PluginMreportingConfig','8','8','0');";
    }
    $queries[] = "CREATE TABLE IF NOT EXISTS `glpi_plugin_mreporting_notifications` (\n      `id` int(11) NOT NULL auto_increment,\n      `entities_id` int(11) NOT NULL default '0',\n      `is_recursive` tinyint(1) NOT NULL default '0',\n      `name` varchar(255) collate utf8_unicode_ci default NULL,\n      `notepad` longtext collate utf8_unicode_ci,\n      `date_envoie` DATE DEFAULT NULL,\n      `notice`INT(11) NOT NULL DEFAULT 0,\n      `alert` INT(11) NOT NULL DEFAULT 0,\n      `comment` text collate utf8_unicode_ci,\n      `date_mod` datetime default NULL,\n      `is_deleted` tinyint(1) NOT NULL default '0',\n      PRIMARY KEY  (`id`)\n      ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
    foreach ($queries as $query) {
        $DB->query($query);
    }
    // == Update to 2.1 ==
    if (!FieldExists('glpi_plugin_mreporting_configs', 'is_notified')) {
        $migration->addField('glpi_plugin_mreporting_configs', 'is_notified', 'tinyint(1) NOT NULL default "1"', array('after' => 'is_active'));
        $migration->migrationOneTable('glpi_plugin_mreporting_configs');
    }
    require_once "inc/profile.class.php";
    PluginMreportingProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
    $rep_files_mreporting = GLPI_PLUGIN_DOC_DIR . "/mreporting";
    if (!is_dir($rep_files_mreporting)) {
        mkdir($rep_files_mreporting);
    }
    $notifications_folder = GLPI_PLUGIN_DOC_DIR . "/mreporting/notifications";
    if (!is_dir($notifications_folder)) {
        mkdir($notifications_folder);
    }
    require_once "inc/notification.class.php";
    PluginMreportingNotification::install();
    CronTask::Register('PluginMreportingNotification', 'SendNotifications', MONTH_TIMESTAMP);
    require_once "inc/baseclass.class.php";
    require_once "inc/common.class.php";
    require_once "inc/config.class.php";
    $config = new PluginMreportingConfig();
    $config->createFirstConfig();
    return true;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:55,代码来源:hook.php

示例6: plugin_reservation_install

function plugin_reservation_install()
{
    global $DB;
    $migration = new Migration(100);
    if (!TableExists("glpi_plugin_reservation_manageresa")) {
        //INSTALL
        $query = "CREATE TABLE `glpi_plugin_reservation_manageresa` (\n      `id` int(11) NOT NULL AUTO_INCREMENT,\n      `resaid` int(11) NOT NULL,\n      `matid` int(11) NOT NULL,\n      `date_return` datetime,\n      `date_theorique` datetime NOT NULL,\n      `itemtype` VARCHAR(100) NOT NULL,\n      `dernierMail` datetime,\n      PRIMARY KEY (`id`)\n\t) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, $DB->error());
    } else {
        // UPDATE
    }
    if (TableExists("glpi_plugin_reservation_config")) {
        $query = "RENAME TABLE `glpi_plugin_reservation_config` TO `glpi_plugin_reservation_configdayforauto`";
        $DB->query($query) or die($DB->error());
    }
    if (!TableExists("glpi_plugin_reservation_configdayforauto")) {
        // Création de la table config
        $query = "CREATE TABLE `glpi_plugin_reservation_configdayforauto` (\n        `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,\n        `jour` char(32) NOT NULL default '',\n        `actif` int(1) NOT NULL default '1'\n        )ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->query($query) or die($DB->error());
        $query = "INSERT INTO `glpi_plugin_reservation_configdayforauto` (`jour` , `actif`)\n                VALUES (\"lundi\",1),\n                       (\"mardi\",1),\n                       (\"mercredi\",1),\n                       (\"jeudi\",1),\n                       (\"vendredi\",1),\n                       (\"samedi\",0),\n                       (\"dimanche\",0)";
        $DB->queryOrDie($query) or die($DB->error());
    } else {
        // UPDATE
    }
    if (!TableExists("glpi_plugin_reservation_config")) {
        // Création de la table config
        $query = "CREATE TABLE `glpi_plugin_reservation_config` (\n        `name` VARCHAR(10) NOT NULL PRIMARY KEY,\n        `value` VARCHAR(10) NOT NULL\n        )ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->query($query) or die($DB->error());
        $query = "INSERT INTO `glpi_plugin_reservation_config` (`name` , `value`)\n                VALUES (\"methode\",\"manual\")";
        $DB->queryOrDie($query) or die($DB->error());
    } else {
        // UPDATE
    }
    $cron = new CronTask();
    if (!$cron->getFromDBbyName('PluginReservationTask', 'SurveilleResa')) {
        CronTask::Register('PluginReservationTask', 'SurveilleResa', 5 * MINUTE_TIMESTAMP, array('param' => 24, 'mode' => 2, 'logs_lifetime' => 10));
    }
    if (!$cron->getFromDBbyName('PluginReservationTask', 'MailUserDelayedResa')) {
        CronTask::Register('PluginReservationTask', 'MailUserDelayedResa', DAY_TIMESTAMP, array('hourmin' => 23, 'hourmax' => 24, 'mode' => 2, 'logs_lifetime' => 30, 'state' => 0));
    }
    return true;
}
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:42,代码来源:hook.php

示例7: cronSlaTicket

 /**
  * Cron for ticket's automatic close
  *
  * @param $task : CronTask object
  *
  * @return integer (0 : nothing done - 1 : done)
  **/
 static function cronSlaTicket(CronTask $task)
 {
     global $DB;
     $tot = 0;
     $query = "SELECT *\n                FROM `glpi_slalevels_tickets`\n                WHERE `glpi_slalevels_tickets`.`date` < NOW()";
     foreach ($DB->request($query) as $data) {
         $tot++;
         self::doLevelForTicket($data);
     }
     $task->setVolume($tot);
     return $tot > 0;
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:19,代码来源:slalevel_ticket.class.php

示例8: __shutdown

function __shutdown()
{
    $outStr = ob_get_contents();
    ob_end_clean();
    if (CronTask::$uniqKey) {
        $cronTask = CronTask::model()->findByAttributes(array('uniqKey' => CronTask::$uniqKey));
        if ($cronTask) {
            $cronTask->executeTimestamp = date('Y-m-d H:i:s', CronTask::$executeTimestamp);
            $cronTask->executeOut = $outStr;
            $cronTask->save();
        }
    }
    echo 'all out string:' . $outStr;
}
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:14,代码来源:yiic_cron.php

示例9: preExecute

 /**
  * Ensure there is a Cron worker running, before looping.
  *
  * @param type $arguments
  * @param type $options
  */
 protected function preExecute($arguments = array(), $options = array())
 {
     $this->createCloudControl();
     $found = false;
     foreach ($this->getCloudControl()->getWorkerList() as $eachWorker) {
         $details = $this->getCloudControl()->getWorkerDetails($eachWorker->wrk_id);
         if (strpos($details->params, CronTask::getWorkerParamsString()) === 0) {
             $found = true;
             break;
         }
     }
     if (!$found) {
         throw new RuntimeException(CronTask::EXCEPTION_NO_PROCESS, CloudControlBaseTask::RETURN_CODE_ERROR);
     }
 }
开发者ID:havvg,项目名称:sfCloudControlPlugin,代码行数:21,代码来源:ReloadCronTask.class.php

示例10: plugin_formcreator_install

function plugin_formcreator_install()
{
    global $DB;
    if (!TableExists("glpi_plugin_formcreator_forms")) {
        $query = "CREATE TABLE `glpi_plugin_formcreator_forms` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) NOT NULL collate utf8_unicode_ci,\n                  `content` longtext collate utf8_unicode_ci,\n                  `is_active` tinyint(1) NOT NULL default '0',\n                  `is_recursive` tinyint(1) NOT NULL default '0',\n                  `entities_id` int(11) NOT NULL default '0',\n\t\t\t\t  `language` varchar(5) NOT NULL collate utf8_unicode_ci,\n\t\t\t\t  `cat` INT( 3 ) NOT NULL,\n                PRIMARY KEY (`id`)\n               ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_forms " . $DB->error());
    }
    if (!TableExists("glpi_plugin_formcreator_targets")) {
        $query = "CREATE TABLE `glpi_plugin_formcreator_targets` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) NOT NULL collate utf8_unicode_ci,\n                  `content` longtext collate utf8_unicode_ci,\n                  `urgency` int(11) NOT NULL default '1',\n                  `priority` int(11) NOT NULL default '1',\n                  `type` tinyint(1) NOT NULL default '2',\n                  `itilcategories_id` int(11) NOT NULL default '0',\n                  `plugin_formcreator_forms_id` int(11) NOT NULL,\n                PRIMARY KEY (`id`)\n               ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_targets " . $DB->error());
    }
    if (!TableExists("glpi_plugin_formcreator_sections")) {
        $query = "CREATE TABLE `glpi_plugin_formcreator_sections` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) NOT NULL collate utf8_unicode_ci,\n                  `content` longtext collate utf8_unicode_ci,\n                  `position` int(11) NOT NULL default '0',\n                  `plugin_formcreator_targets_id` tinyint(1) NOT NULL,\n                  `plugin_formcreator_forms_id` int(11) NOT NULL,\n                PRIMARY KEY (`id`)\n               ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_sections " . $DB->error());
    } else {
        $query = "ALTER TABLE `glpi_plugin_formcreator_questions`\n\t\t\t\tCHANGE `plugin_formcreator_sections_id`\n\t\t\t\t`plugin_formcreator_sections_id` INT( 11 ) NOT NULL";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_sections " . $DB->error());
    }
    if (!TableExists("glpi_plugin_formcreator_questions")) {
        $query = "CREATE TABLE `glpi_plugin_formcreator_questions` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) NOT NULL collate utf8_unicode_ci,\n                  `type` int(11) NOT NULL default '0',\n                  `data` longtext collate utf8_unicode_ci,\n                  `content` longtext collate utf8_unicode_ci,\n                  `option` longtext collate utf8_unicode_ci,\n                  `position` int(11) NOT NULL default '0',\n                  `plugin_formcreator_sections_id` tinyint(1) NOT NULL,\n                  `plugin_formcreator_forms_id` int(11) NOT NULL,\n                PRIMARY KEY (`id`)\n               ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_questions " . $DB->error());
    }
    if (!TableExists("glpi_plugin_formcreator_cats")) {
        $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_cats` (\n\t\t\t  `id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t  `name` varchar(255) NOT NULL,\n\t\t\t  `position` int(3) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=14 ;";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_cats " . $DB->error());
    }
    if (!TableExists("glpi_plugin_formcreator_titles")) {
        $query = "CREATE TABLE IF NOT EXISTS `glpi_plugin_formcreator_titles` (\n\t\t\t  `id` int(2) NOT NULL AUTO_INCREMENT,\n\t\t\t  `name` longtext NOT NULL,\n\t\t\t  `language` varchar(5) NOT NULL,\n\t\t\t  PRIMARY KEY (`id`)\n\t\t\t) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;";
        $DB->query($query) or die("error creating glpi_plugin_formcreator_cats " . $DB->error());
    }
    $query = 'DELETE FROM `glpi_displaypreferences` WHERE `itemtype` = "PluginFormcreatorForm"';
    $DB->query($query) or die("error deleting glpi_displaypreferences " . $DB->error());
    $query_displayprefs = array();
    $query_displayprefs[] = "INSERT INTO `glpi_displaypreferences` \n                            VALUES (NULL,'PluginFormcreatorForm','0','0','0')";
    $query_displayprefs[] = "INSERT INTO `glpi_displaypreferences` \n                            VALUES (NULL,'PluginFormcreatorForm','1','1','0')";
    $query_displayprefs[] = "INSERT INTO `glpi_displaypreferences` \n                            VALUES (NULL,'PluginFormcreatorForm','2','2','0')";
    $query_displayprefs[] = "INSERT INTO `glpi_displaypreferences` \n                            VALUES (NULL,'PluginFormcreatorForm','3','3','0')";
    $query_displayprefs[] = "INSERT INTO `glpi_displaypreferences` \n                            VALUES (NULL,'PluginFormcreatorForm','4','4','0')";
    $query = "INSERT INTO `glpi_plugin_formcreator_cats` (`id`, `name`, `position`) VALUES (0, 'Default cat', 0);";
    foreach ($query_displayprefs as $query) {
        $DB->query($query) or die("error insert glpi_displaypreferences datas from  \n                                 glpi_plugin_formcreator_forms" . $DB->error());
    }
    //ajout d'une catégorie sinon pas d'affichage s'il n'y en pas
    $query = "INSERT INTO `glpi_plugin_formcreator_cats` (`name`, `position`) VALUES ('Default cat', 0);";
    $DB->query($query) or die("error inserting cat " . $DB->error());
    CronTask::Register('PluginFormcreator', 'Init', DAY_TIMESTAMP, array('param' => 50));
    return true;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:48,代码来源:hook.php

示例11: parse

 public static function parse($file)
 {
     /*{{{*/
     if (!file_exists($file) || filesize($file) === 0) {
         return false;
     }
     $data = json_decode(file_get_contents($file), true);
     self::$check_sum = md5(json_encode($data));
     if (empty($data)) {
         return array();
     }
     $execute_plan = array();
     foreach ($data as $task) {
         $task = CronTask::createTask($task['task'], $task['user'], $task['id'], $task['running_user']);
         if ($task) {
             $execute_plan[] = $task;
         }
     }
     return $execute_plan;
 }
开发者ID:sdgdsffdsfff,项目名称:xcron,代码行数:20,代码来源:parser.php

示例12: stats

 /**
  * Display Some statistics about Finished Jobs.
  *
  * @return void
  */
 public function stats()
 {
     $this->out('Jobs currenty in the Queue:');
     $types = $this->CronTask->getTypes();
     foreach ($types as $type) {
         $this->out("      " . str_pad($type, 20, ' ', STR_PAD_RIGHT) . ": " . $this->CronTask->getLength($type));
     }
     $this->hr();
     $this->out('Total unfinished Jobs      : ' . $this->CronTask->getLength());
     $this->hr();
     $this->out('Finished Job Statistics:');
     $data = $this->CronTask->getStats();
     foreach ($data as $item) {
         $this->out(" " . $item['CronTask']['jobtype'] . ": ");
         $this->out("   Finished Jobs in Database: " . $item[0]['num']);
         $this->out("   Average Job existence    : " . $item[0]['alltime'] . 's');
         $this->out("   Average Execution delay  : " . $item[0]['fetchdelay'] . 's');
         $this->out("   Average Execution time   : " . $item[0]['runtime'] . 's');
     }
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:25,代码来源:CronShell.php

示例13: plugin_certificates_install


//.........这里部分代码省略.........
      $DB->runFile(GLPI_ROOT ."/plugins/certificates/sql/update-1.8.0.sql");
   }
   
   if (TableExists("glpi_plugin_certificates_profiles")) {
   
      $notepad_tables = array('glpi_plugin_certificates_certificates');

      foreach ($notepad_tables as $t) {
         // Migrate data
         if (FieldExists($t, 'notepad')) {
            $query = "SELECT id, notepad
                      FROM `$t`
                      WHERE notepad IS NOT NULL
                            AND notepad <>'';";
            foreach ($DB->request($query) as $data) {
               $iq = "INSERT INTO `glpi_notepads`
                             (`itemtype`, `items_id`, `content`, `date`, `date_mod`)
                      VALUES ('".getItemTypeForTable($t)."', '".$data['id']."',
                              '".addslashes($data['notepad'])."', NOW(), NOW())";
               $DB->queryOrDie($iq, "0.85 migrate notepad data");
            }
            $query = "ALTER TABLE `glpi_plugin_certificates_certificates` DROP COLUMN `notepad`;";
            $DB->query($query);
         }
      }
   }
   
   if ($install || $update78) {

      //Do One time on 0.78
      $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginCertificatesCertificate' AND `name` = 'Alert Certificates'";
      $result = $DB->query($query_id) or die ($DB->error());
      $itemtype = $DB->result($result,0,'id');
      
      $query="INSERT INTO `glpi_notificationtemplatetranslations`
                                 VALUES(NULL, ".$itemtype.", '','##certificate.action## : ##certificate.entity##',
                        '##lang.certificate.entity## :##certificate.entity##
   ##FOREACHcertificates##
   ##lang.certificate.name## : ##certificate.name## - ##lang.certificate.dateexpiration## : ##certificate.dateexpiration##
   ##ENDFOREACHcertificates##',
                        '&lt;p&gt;##lang.certificate.entity## :##certificate.entity##&lt;br /&gt; &lt;br /&gt;
                        ##FOREACHcertificates##&lt;br /&gt;
                        ##lang.certificate.name##  : ##certificate.name## - ##lang.certificate.dateexpiration## :  ##certificate.dateexpiration##&lt;br /&gt; 
                        ##ENDFOREACHcertificates##&lt;/p&gt;');";
      $result=$DB->query($query);
      
      $query = "INSERT INTO `glpi_notifications`
                                   VALUES (NULL, 'Alert Expired Certificates', 0, 'PluginCertificatesCertificate', 'ExpiredCertificates',
                                          'mail',".$itemtype.",
                                          '', 1, 1, '2010-02-17 22:36:46');";
      
      $result=$DB->query($query);
      
      $query = "INSERT INTO `glpi_notifications`
                                   VALUES (NULL, 'Alert Certificates Which Expire', 0, 'PluginCertificatesCertificate', 'CertificatesWhichExpire',
                                          'mail',".$itemtype.",
                                          '', 1, 1, '2010-02-17 22:36:46');";
      
      $result=$DB->query($query);
   }
   
   if ($update78) {
      $query_="SELECT *
            FROM `glpi_plugin_certificates_profiles` ";
      $result_=$DB->query($query_);
      if ($DB->numrows($result_)>0) {

         while ($data=$DB->fetch_array($result_)) {
            $query="UPDATE `glpi_plugin_certificates_profiles`
                  SET `profiles_id` = '".$data["id"]."'
                  WHERE `id` = '".$data["id"]."';";
            $result=$DB->query($query);

         }
      }
      
      $query="ALTER TABLE `glpi_plugin_certificates_profiles`
               DROP `name` ;";
      $result=$DB->query($query);
   
      Plugin::migrateItemType(
         array(1700=>'PluginCertificatesCertificate'),
         array("glpi_bookmarks", "glpi_bookmarks_users", "glpi_displaypreferences",
               "glpi_documents_items", "glpi_infocoms", "glpi_logs", "glpi_tickets"),
         array("glpi_plugin_certificates_certificates_items"));
      
      Plugin::migrateItemType(
         array(1200 => "PluginAppliancesAppliance",1300 => "PluginWebapplicationsWebapplication"),
         array("glpi_plugin_certificates_certificates_items"));
   }
   
   CronTask::Register('PluginCertificatesCertificate', 'CertificatesAlert', DAY_TIMESTAMP);

   PluginCertificatesProfile::initProfile();
   PluginCertificatesProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']);
   $migration = new Migration("2.0.0");
   $migration->dropTable('glpi_plugin_certificates_profiles');
   
   return true;
}
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:101,代码来源:hook.php

示例14: header

    header("Cache-Control: no-cache,no-store");
    header("Pragma: no-cache");
    header("Connection: close");
    echo $image;
    flush();
    CronTask::launch(CronTask::MODE_INTERNAL);
} else {
    if (isset($_SERVER['argc']) && $_SERVER['argc'] > 1) {
        // Parse command line options
        $mode = CronTask::MODE_EXTERNAL;
        // when taskname given, will allow --force
        for ($i = 1; $i < $_SERVER['argc']; $i++) {
            if ($_SERVER['argv'][$i] == '--force') {
                $mode = -CronTask::MODE_EXTERNAL;
            } else {
                if (is_numeric($_SERVER['argv'][$i])) {
                    // Number of tasks
                    CronTask::launch(CronTask::MODE_EXTERNAL, intval($_SERVER['argv'][$i]));
                    // Only check first parameter when numeric is passed
                    break;
                } else {
                    // Task name
                    CronTask::launch($mode, $CFG_GLPI['cron_limit'], $_SERVER['argv'][$i]);
                }
            }
        }
    } else {
        // Default from configuration
        CronTask::launch(CronTask::MODE_EXTERNAL, $CFG_GLPI['cron_limit']);
    }
}
开发者ID:geldarr,项目名称:hack-space,代码行数:31,代码来源:cron.php

示例15: clean

 /**
  * clean a plugin
  *
  * @param $ID ID of the plugin
  **/
 function clean($ID)
 {
     if ($this->getFromDB($ID)) {
         // Clean crontask after "hard" remove
         CronTask::Unregister($this->fields['directory']);
         $this->delete(array('id' => $ID));
         $this->removeFromSession($this->fields['directory']);
     }
 }
开发者ID:pvasener,项目名称:glpi,代码行数:14,代码来源:plugin.class.php


注:本文中的CronTask类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。