• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CronTask类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: install120

function install120()
{
    global $DB;
    //Do One time on 0.80
    $query = "INSERT INTO `glpi_notificationtemplates` VALUES(NULL, 'Projets', 'PluginProjetProjet', '2010-12-29 11:04:46','',NULL);";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notificationtemplates` VALUES(NULL, 'Alert Projets Tasks', 'PluginProjetProjet', '2010-12-29 11:04:46','',NULL);";
    $result = $DB->query($query);
    $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginProjetProjet' AND `name` = 'Projets'";
    $result = $DB->query($query_id) or die($DB->error());
    $itemtype = $DB->result($result, 0, 'id');
    $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                              VALUES(NULL, " . $itemtype . ", '','##lang.projet.title## - ##projet.name##',\n                     '##lang.projet.url## : ##projet.url##\n\n##lang.projet.entity## : ##projet.entity##\n##IFprojet.name####lang.projet.name## : ##projet.name####ENDIFprojet.name##\n##IFprojet.datebegin####lang.projet.datebegin## : ##projet.datebegin####ENDIFprojet.datebegin##\n##IFprojet.dateend####lang.projet.dateend## : ##projet.dateend####ENDIFprojet.dateend##\n##IFprojet.users####lang.projet.users## : ##projet.users####ENDIFprojet.users##\n##IFprojet.groups####lang.projet.groups## : ##projet.groups####ENDIFprojet.groups##\n##IFprojet.status####lang.projet.status## : ##projet.status####ENDIFprojet.status##\n##IFprojet.parent####lang.projet.parent## : ##projet.parent####ENDIFprojet.parent##\n##IFprojet.advance####lang.projet.advance## : ##projet.advance####ENDIFprojet.advance##\n##IFprojet.comment## ##lang.projet.comment## : ##projet.comment####ENDIFprojet.comment##\n##IFprojet.description####lang.projet.description## : ##projet.description####ENDIFprojet.description##\n##IFprojet.helpdesk####lang.projet.helpdesk## : ##projet.helpdesk####ENDIFprojet.helpdesk##\n##FOREACHupdates##----------\n##lang.update.title## : \n##IFupdate.name####lang.projet.name## : ##update.name####ENDIFupdate.name##\n##IFupdate.datebegin####lang.projet.datebegin## : ##update.datebegin####ENDIFupdate.datebegin##\n##IFupdate.dateend####lang.projet.dateend## : ##update.dateend####ENDIFupdate.dateend##\n##IFupdate.users####lang.projet.users## : ##update.users####ENDIFupdate.users##\n##IFupdate.groups####lang.projet.groups## : ##update.groups####ENDIFupdate.groups##\n##IFupdate.status####lang.projet.status## : ##update.status####ENDIFupdate.status##\n##IFupdate.parent####lang.projet.parent## : ##update.parent####ENDIFupdate.parent##\n##IFupdate.advance####lang.projet.advance## : ##update.advance####ENDIFupdate.advance##\n##IFupdate.comment## ##lang.projet.comment## : ##update.comment####ENDIFupdate.comment##\n##IFupdate.description####lang.projet.description## : ##update.description####ENDIFupdate.description##\n##IFupdate.helpdesk####lang.projet.helpdesk## : ##update.helpdesk####ENDIFupdate.helpdesk##\n##ENDFOREACHupdates##----------\n##IFtask.title## ##lang.task.title####ENDIFtask.title##\n##FOREACHtasks##----------\n##IFtask.name####lang.task.name## : ##task.name####ENDIFtask.name##\n##IFtask.users####lang.task.users## : ##task.users####ENDIFtask.users##\n##IFtask.groups####lang.task.groups## : ##task.groups####ENDIFtask.groups##\n##IFtask.contacts## ##lang.task.contacts## : ##task.contacts####ENDIFtask.contacts##\n##IFtask.type####lang.task.type## : ##task.type####ENDIFtask.type##\n##IFtask.status####lang.task.status## : ##task.status####ENDIFtask.status##\n##IFtask.location####lang.task.location## : ##task.location####ENDIFtask.location##\n##IFtask.advance####lang.task.advance## : ##task.advance####ENDIFtask.advance##\n##IFtask.priority####lang.task.priority## : ##task.priority####ENDIFtask.priority##\n##IFtask.comment####lang.task.comment## : ##task.comment####ENDIFtask.comment##\n##IFtask.sub####lang.task.sub## : ##task.sub####ENDIFtask.sub##\n##IFtask.others####lang.task.others## : ##task.others####ENDIFtask.others##\n##IFtask.affect####lang.task.affect## : ##task.affect####ENDIFtask.affect##\n##IFtask.depends####lang.task.depends## : ##task.depends####ENDIFtask.depends##\n##IFtask.parenttask####lang.task.parenttask## : ##task.parenttask####ENDIFtask.parenttask##\n##IFtask.realtime####lang.task.realtime## : ##task.realtime## ##ENDIFtask.realtime##\n----------##ENDFOREACHtasks##',\n                     '<p><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.url##</strong> : <a href=\"##projet.url##\">##projet.url##</a></span> <br /><br /> <span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.entity##</strong> : ##projet.entity##</span> <br /> ##IFprojet.name##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.name##</strong> : ##projet.name##<br /></span>##ENDIFprojet.name## ##IFprojet.datebegin##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.datebegin##</strong> :  ##projet.datebegin##<br /></span>##ENDIFprojet.datebegin## ##IFprojet.dateend##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.dateend##</strong> :  ##projet.dateend##<br /></span>##ENDIFprojet.dateend## ##IFprojet.users##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.users##</strong> :  ##projet.users##<br /></span>##ENDIFprojet.users## ##IFprojet.groups##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.groups##</strong> :  ##projet.groups##<br /></span>##ENDIFprojet.groups## ##IFprojet.status##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.status##</strong> :  ##projet.status##<br /></span>##ENDIFprojet.status## ##IFprojet.parent##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.parent##</strong> :  ##projet.parent##<br /></span>##ENDIFprojet.parent## ##IFprojet.advance##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.advance##</strong> :  ##projet.advance##<br /></span>##ENDIFprojet.advance## ##IFprojet.comment##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.comment##</strong> :  ##projet.comment##<br /></span>##ENDIFprojet.comment## ##IFprojet.description##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.description##</strong> :  ##projet.description##<br /></span>##ENDIFprojet.description## ##IFprojet.helpdesk##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.helpdesk##</strong> :  ##projet.helpdesk##<br /></span>##ENDIFprojet.helpdesk##  ##FOREACHupdates##----------<br /><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.update.title## :</strong></span> <br /> ##IFupdate.name##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.name##</strong> : ##update.name##<br /></span>##ENDIFupdate.name## ##IFupdate.datebegin##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.datebegin##</strong> : ##update.datebegin##<br /></span>##ENDIFupdate.datebegin## ##IFupdate.dateend##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.dateend##</strong> : ##update.dateend##<br /></span>##ENDIFupdate.dateend## ##IFupdate.users##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.users##</strong> : ##update.users##<br /></span>##ENDIFupdate.users## ##IFupdate.groups##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.groups##</strong> : ##update.groups##<br /></span>##ENDIFupdate.groups## ##IFupdate.status##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.status##</strong> : ##update.status##<br /></span>##ENDIFupdate.status## ##IFupdate.parent##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.parent##</strong> : ##update.parent##<br /></span>##ENDIFupdate.parent## ##IFupdate.advance##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.advance##</strong> : ##update.advance##<br /></span>##ENDIFupdate.advance## ##IFupdate.comment##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.comment##</strong> : ##update.comment##<br /></span>##ENDIFupdate.comment## ##IFupdate.description##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.description##</strong> : ##update.description##<br /></span>##ENDIFupdate.description## ##IFupdate.helpdesk##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.projet.helpdesk##</strong> : ##update.helpdesk##<br /></span>##ENDIFupdate.helpdesk##  ##ENDFOREACHupdates##----------<br /> ##IFtask.title##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.title##</strong></span><br />##ENDIFtask.title## ##FOREACHtasks##----------<br /> ##IFtask.name##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.name##</strong> : ##task.name##<br /></span>##ENDIFtask.name## ##IFtask.users##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.users##</strong> : ##task.users##<br /></span>##ENDIFtask.users## ##IFtask.groups##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.groups##</strong> : ##task.groups##<br /></span>##ENDIFtask.groups## ##IFtask.contacts##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.contacts##</strong> : ##task.contacts##<br /></span>##ENDIFtask.contacts## ##IFtask.type##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.type##</strong> : ##task.type##<br /></span>##ENDIFtask.type## ##IFtask.status##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.status##</strong> : ##task.status##<br /></span>##ENDIFtask.status## ##IFtask.location##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.location##</strong> : ##task.location##<br /></span>##ENDIFtask.location## ##IFtask.advance##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.advance##</strong> : ##task.advance##<br /></span>##ENDIFtask.advance## ##IFtask.priority##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.priority##</strong> : ##task.priority##<br /></span>##ENDIFtask.priority## ##IFtask.comment##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.comment##</strong> : ##task.comment##<br /></span>##ENDIFtask.comment## ##IFtask.sub##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.sub##</strong> : ##task.sub##<br /></span>##ENDIFtask.sub## ##IFtask.others##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.others##</strong> : ##task.others##<br /></span>##ENDIFtask.others## ##IFtask.affect##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.affect##</strong> : ##task.affect##<br /></span>##ENDIFtask.affect## ##IFtask.depends##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.depends##</strong> : ##task.depends##<br /></span>##ENDIFtask.depends## ##IFtask.parenttask##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.parenttask##</strong> : ##task.parenttask##<br /></span>##ENDIFtask.parenttask## ##IFtask.realtime##<span style=\"font-family: Verdana; font-size: 11px; text-align: left;\"><strong>##lang.task.realtime##</strong> : ##task.realtime##</span>##ENDIFtask.realtime## <br />----------##ENDFOREACHtasks##</p>');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'New Project', 0, 'PluginProjetProjet', 'new',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-05-16 22:36:46');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'Update Project', 0, 'PluginProjetProjet', 'update',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-05-16 22:36:46');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'Delete Project', 0, 'PluginProjetProjet', 'delete',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-05-16 22:36:46');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'New Project Task', 0, 'PluginProjetProjet', 'newtask',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-05-16 22:36:46');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'Update Project Task', 0, 'PluginProjetProjet', 'updatetask',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-05-16 22:36:46');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'Delete Project Task', 0, 'PluginProjetProjet', 'deletetask',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-05-16 22:36:46');";
    $result = $DB->query($query);
    $query_id = "SELECT `id` FROM `glpi_notificationtemplates` WHERE `itemtype`='PluginProjetProjet' AND `name` = 'Alert Projets Tasks'";
    $result = $DB->query($query_id) or die($DB->error());
    $itemtype = $DB->result($result, 0, 'id');
    $query = "INSERT INTO `glpi_notificationtemplatetranslations`\n                                 VALUES(NULL, " . $itemtype . ", '','##projet.action## : ##projet.entity##',\n                        '##FOREACHtasks## \n   ##lang.task.name## : ##task.name##\n   ##lang.task.type## : ##task.type##\n   ##lang.task.users## : ##task.users##\n   ##lang.task.groups## : ##task.groups##\n   ##lang.task.datebegin## : ##task.datebegin##\n   ##lang.task.dateend## : ##task.dateend##\n   ##lang.task.comment## : ##task.comment##\n   ##lang.task.projet## : ##task.projet##\n   ##ENDFOREACHtasks##',\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.task.name##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.type##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.users##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.groups##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.datebegin##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.dateend##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.comment##</span></td>\n   <td style=\"text-align: left;\" bgcolor=\"#cccccc\"><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##lang.task.projet##</span></td>\n   </tr>\n   ##FOREACHtasks##                 \n   <tr>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.name##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.type##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.users##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.groups##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.datebegin##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.dateend##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.comment##</span></td>\n   <td><span style=\"font-family: Verdana; font-size: 11px; text-align: left;\">##task.projet##</span></td>\n   </tr>\n   ##ENDFOREACHtasks##\n   </tbody>\n   </table>');";
    $result = $DB->query($query);
    $query = "INSERT INTO `glpi_notifications`\n                                VALUES (NULL, 'Alert Expired Projects Tasks', 0, 'PluginProjetProjet', 'AlertExpiredTasks',\n                                       'mail'," . $itemtype . ",\n                                       '', 1, 1, '2010-02-17 22:36:46');";
    $result = $DB->query($query);
    CronTask::Register('PluginProjetTask', 'ProjetTask', WEEK_TIMESTAMP);
}
开发者ID:geldarr,项目名称:hack-space,代码行数:34,代码来源:install_120.php


示例2: 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


示例3: 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


示例4: 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


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例9: __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


示例10: 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


示例11: 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('par 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Croogo类代码示例发布时间:2022-05-23
下一篇:
PHP Cron类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap