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


PHP Rule::delete方法代码示例

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


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

示例1: plugin_typology_uninstall

function plugin_typology_uninstall()
{
    global $DB;
    // Plugin tables deletion
    $tables = array("glpi_plugin_typology_profiles", "glpi_plugin_typology_typologies", "glpi_plugin_typology_typologycriterias", "glpi_plugin_typology_typologycriteriadefinitions", "glpi_plugin_typology_typologies_items");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    // Plugin adding information on general table deletion
    $tables_glpi = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs");
    foreach ($tables_glpi as $table_glpi) {
        $DB->query("DELETE FROM `{$table_glpi}` WHERE `itemtype` = 'PluginTypologyTypology';");
    }
    //drop rules
    $Rule = new Rule();
    $a_rules = $Rule->find("`sub_type`='PluginTypologyRuleTypology'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginTypologyTypology', 'event' => 'AlertNotValidatedTypology', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    return true;
}
开发者ID:geldarr,项目名称:hack-space,代码行数:26,代码来源:hook.php

示例2: RegexpRuleResultAssignTest

 /**
  * @test
  */
 public function RegexpRuleResultAssignTest()
 {
     global $DB, $PF_CONFIG;
     $DB->connect();
     $rule = new Rule();
     $location = new Location();
     $input = array('name' => 'Monsols04', 'entities_id' => 0);
     $location->add($input);
     $input = array('is_active' => 1, 'name' => 'Location regexp', 'match' => 'AND', 'sub_type' => 'PluginFusioninventoryInventoryRuleLocation', 'ranking' => 1);
     $rules_id = $rule->add($input);
     // Add criteria
     $rulecriteria = new RuleCriteria();
     $input = array('rules_id' => $rules_id, 'criteria' => "name", 'pattern' => "/computer (.*)/", 'condition' => PluginFusioninventoryInventoryRuleLocation::REGEX_MATCH);
     $rulecriteria->add($input);
     // Add action
     $ruleaction = new RuleAction();
     $input = array('rules_id' => $rules_id, 'action_type' => 'assign', 'field' => 'locations_id', 'value' => 1);
     $ruleaction->add($input);
     $input = array('name' => 'computer Monsols04');
     $_SESSION["plugin_fusioninventory_entity"] = 0;
     $ruleLocation = new PluginFusioninventoryInventoryRuleLocationCollection();
     $ruleLocation->getCollectionPart();
     $loc = $ruleLocation->processAllRules($input, array());
     $a_references = array('locations_id' => 1, '_ruleid' => 50);
     $this->assertEquals($a_references, $loc, 'Location result assign_result');
     $rule->delete(array('id' => $rules_id), True);
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:30,代码来源:RuleLocationTest.php

示例3: pluginFusioninventoryInstall

function pluginFusioninventoryInstall($version, $migrationname = 'Migration')
{
    global $DB;
    ini_set("memory_limit", "-1");
    ini_set("max_execution_time", "0");
    $migration = new $migrationname($version);
    /*
     * Load classes
     */
    foreach (glob(GLPI_ROOT . '/plugins/fusioninventory/inc/*.php') as $file) {
        require_once $file;
    }
    $migration->displayMessage("Installation of plugin FusionInventory");
    // Get informations of plugin
    /*
     * Clean if Fusion / Tracker has been installed and uninstalled (not clean correctly)
     */
    $migration->displayMessage("Clean data from old installation of the plugin");
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5150'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5151'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5152'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5153'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5156'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5157'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5158'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5159'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5161'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5165'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5166'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5167'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype`='5168'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype` LIKE 'PluginFusioninventory%'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype` LIKE 'PluginFusinvinventory%'";
    $DB->query($sql);
    $sql = "DELETE FROM `glpi_displaypreferences`\n         WHERE `itemtype` LIKE 'PluginFusinvsnmp%'";
    $DB->query($sql);
    // Purge network ports have itemtype tp 5153
    $networkPort = new NetworkPort();
    $sql = "SELECT * FROM `glpi_networkports`\n            WHERE `itemtype`='5153'";
    $result = $DB->query($sql);
    while ($data = $DB->fetch_array($result)) {
        $networkPort->delete(array('id' => $data['id']), 1);
    }
    /*
     * Remove old rules
     */
    $migration->displayMessage("Clean rules from old installation of the plugin");
    $Rule = new Rule();
    $a_rules = $Rule->find("`sub_type`='PluginFusioninventoryInventoryRuleImport'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    $a_rules = $Rule->find("`sub_type`='PluginFusinvinventoryRuleEntity'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    $a_rules = $Rule->find("`sub_type`='PluginFusinvinventoryRuleLocation'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    /*
     * Create DB structure
     */
    $migration->displayMessage("Creation tables in database");
    $DB_file = GLPI_ROOT . "/plugins/fusioninventory/install/mysql/plugin_fusioninventory-empty.sql";
    if (!$DB->runFile($DB_file)) {
        $migration->displayMessage("Error on creation tables in database");
    }
    if (!$DB->runFile(GLPI_ROOT . "/plugins/fusioninventory/install/mysql/usbid.sql")) {
        $migration->displayMessage("Error on creation table usbid in database");
    }
    if (!$DB->runFile(GLPI_ROOT . "/plugins/fusioninventory/install/mysql/pciid.sql")) {
        $migration->displayMessage("Error on creation table pciid in database");
    }
    if (!$DB->runFile(GLPI_ROOT . "/plugins/fusioninventory/install/mysql/oui.sql")) {
        $migration->displayMessage("Error on creation table oui in database");
    }
    /*
     * Creation of folders
     */
    $migration->displayMessage("Creation of folders");
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory');
    }
    if (!is_dir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory/tmp')) {
        mkdir(GLPI_PLUGIN_DOC_DIR . '/fusioninventory/tmp');
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:101,代码来源:install.php

示例4: initRules

 /**
  * Create rules (initialisation)
  */
 function initRules($reset = 0)
 {
     if ($reset == 1) {
         $grule = new Rule();
         $a_rules = $grule->find("`sub_type`='PluginFusioninventoryInventoryRuleImport'");
         foreach ($a_rules as $data) {
             $grule->delete($data);
         }
     }
     $rules = array();
     $rules[] = array('name' => 'Computer constraint (name)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'name', 'condition' => 9, 'pattern' => 1)), 'action' => '_fusion2');
     $rules[] = array('name' => 'Computer update (by serial + uuid)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1), array('criteria' => 'uuid', 'condition' => 10, 'pattern' => 1), array('criteria' => 'uuid', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer update (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer update (by uuid)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'uuid', 'condition' => 10, 'pattern' => 1), array('criteria' => 'uuid', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer update (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'mac', 'condition' => 10, 'pattern' => 1), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer update (by name)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'name', 'condition' => 10, 'pattern' => 1), array('criteria' => 'name', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer import (by serial + uuid)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'uuid', 'condition' => 8, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer import (by uuid)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'uuid', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer import (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer import (by name)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer'), array('criteria' => 'name', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Computer import denied', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Computer')), 'action' => '_fusion2');
     $rules[] = array('name' => 'Printer constraint (name)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Printer'), array('criteria' => 'name', 'condition' => 9, 'pattern' => 1)), 'action' => '_fusion2');
     $rules[] = array('name' => 'Printer update (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Printer'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Printer update (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Printer'), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1), array('criteria' => 'mac', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Printer import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Printer'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Printer import (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Printer'), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Printer import denied', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Printer')), 'action' => '_fusion2');
     $rules[] = array('name' => 'NetworkEquipment constraint (name)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'NetworkEquipment'), array('criteria' => 'name', 'condition' => 9, 'pattern' => 1)), 'action' => '_fusion2');
     $rules[] = array('name' => 'NetworkEquipment import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'NetworkEquipment'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'NetworkEquipment update (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'NetworkEquipment'), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1), array('criteria' => 'mac', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'NetworkEquipment import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'NetworkEquipment'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'NetworkEquipment import (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'NetworkEquipment'), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'NetworkEquipment import denied', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'NetworkEquipment')), 'action' => '_fusion2');
     $rules[] = array('name' => 'Peripheral update (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Peripheral'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Peripheral import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Peripheral'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Peripheral import denied', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Peripheral')), 'action' => '_fusion2');
     $rules[] = array('name' => 'Monitor update (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Monitor'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Monitor import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Monitor'), array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Monitor import denied', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Monitor')), 'action' => '_fusion2');
     $rules[] = array('name' => 'Phone constraint (name)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Phone'), array('criteria' => 'name', 'condition' => 9, 'pattern' => 1)), 'action' => '_fusion2');
     $rules[] = array('name' => 'Phone update (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Phone'), array('criteria' => 'mac', 'condition' => 10, 'pattern' => 1), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Phone import (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Phone'), array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Phone import denied', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => 'Phone')), 'action' => '_fusion2');
     $rules[] = array('name' => 'Global constraint (name)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'name', 'condition' => 9, 'pattern' => 1)), 'action' => '_fusion2');
     $rules[] = array('name' => 'Global update (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1), array('criteria' => 'serial', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Global update (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1), array('criteria' => 'mac', 'condition' => 10, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Global import (by serial)', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'serial', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Global import (by mac)', 'match' => 'AND', 'is_active' => 0, 'criteria' => array(array('criteria' => 'mac', 'condition' => 8, 'pattern' => 1)), 'action' => '_fusion1');
     $rules[] = array('name' => 'Global import denied', 'match' => 'AND', 'is_active' => 1, 'criteria' => array(array('criteria' => 'itemtype', 'condition' => 0, 'pattern' => '')), 'action' => '_fusion2');
     $ranking = 0;
     foreach ($rules as $rule) {
         $rulecollection = new PluginFusioninventoryInventoryRuleImportCollection();
         $input = array();
         $input['is_active'] = $rule['is_active'];
         $input['name'] = $rule['name'];
         $input['match'] = $rule['match'];
         $input['sub_type'] = 'PluginFusioninventoryInventoryRuleImport';
         $input['ranking'] = $ranking;
         $rule_id = $rulecollection->add($input);
         // Add criteria
         $rulefi = $rulecollection->getRuleClass();
         foreach ($rule['criteria'] as $criteria) {
             $rulecriteria = new RuleCriteria(get_class($rulefi));
             $criteria['rules_id'] = $rule_id;
             $rulecriteria->add($criteria);
         }
         // Add action
         $ruleaction = new RuleAction(get_class($rulefi));
         $input = array();
         $input['rules_id'] = $rule_id;
         $input['action_type'] = 'assign';
         if ($rule['action'] == '_fusion1') {
             $input['field'] = '_fusion';
             $input['value'] = '1';
         } else {
             if ($rule['action'] == '_fusion2') {
                 $input['field'] = '_fusion';
                 $input['value'] = '2';
             } else {
                 if ($rule['action'] == '_ignore_import') {
                     $input['field'] = '_ignore_import';
                     $input['value'] = '1';
                 }
             }
         }
         $ruleaction->add($input);
         $ranking++;
     }
     return true;
     // Old rules
     $ranking = 0;
     // Create rule for : Peripheral + serial
     $rulecollection = new PluginFusioninventoryInventoryRuleImportCollection();
     $input = array();
     $input['is_active'] = 1;
     $input['name'] = 'Peripheral serial';
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:101,代码来源:setup.class.php

示例5: plugin_resources_uninstall

function plugin_resources_uninstall()
{
    global $DB;
    $tables = array("glpi_plugin_resources_resources", "glpi_plugin_resources_resources_items", "glpi_plugin_resources_employees", "glpi_plugin_resources_employers", "glpi_plugin_resources_clients", "glpi_plugin_resources_choices", "glpi_plugin_resources_choiceitems", "glpi_plugin_resources_departments", "glpi_plugin_resources_contracttypes", "glpi_plugin_resources_resourcestates", "glpi_plugin_resources_tasktypes", "glpi_plugin_resources_profiles", "glpi_plugin_resources_tasks", "glpi_plugin_resources_taskplannings", "glpi_plugin_resources_tasks_items", "glpi_plugin_resources_checklists", "glpi_plugin_resources_checklistconfigs", "glpi_plugin_resources_reportconfigs", "glpi_plugin_resources_resourcerestings", "glpi_plugin_resources_resourceholidays", "glpi_plugin_resources_ticketcategories", "glpi_plugin_resources_resourcesituations", "glpi_plugin_resources_contractnatures", "glpi_plugin_resources_ranks", "glpi_plugin_resources_resourcespecialities", "glpi_plugin_resources_leavingreasons", "glpi_plugin_resources_professions", "glpi_plugin_resources_professionlines", "glpi_plugin_resources_professioncategories", "glpi_plugin_resources_employments", "glpi_plugin_resources_employmentstates", "glpi_plugin_resources_budgets", "glpi_plugin_resources_costs", "glpi_plugin_resources_budgettypes", "glpi_plugin_resources_budgetvolumes");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    //old versions
    $tables = array("glpi_plugin_resources", "glpi_plugin_resources_device", "glpi_plugin_resources_needs", "glpi_plugin_resources_employee", "glpi_dropdown_plugin_resources_employer", "glpi_dropdown_plugin_resources_client", "glpi_dropdown_plugin_resources_type", "glpi_dropdown_plugin_resources_department", "glpi_dropdown_plugin_resources_tasks_type", "glpi_plugin_resources_mailingsettings", "glpi_plugin_resources_mailing");
    foreach ($tables as $table) {
        $DB->query("DROP TABLE IF EXISTS `{$table}`;");
    }
    $in = "IN (" . implode(',', array("'PluginResourcesResource'", "'PluginResourcesTask'", "'PluginResourcesHelpdesk'", "'PluginResourcesDirectory'", "'PluginResourcesChecklistconfig'", "'PluginResourcesResourceResting'", "'PluginResourcesResourceHoliday'", "'PluginResourcesBudget'", "'PluginResourcesEmployment'", "'PluginResourcesRecap'")) . ")";
    $tables = array("glpi_displaypreferences", "glpi_documents_items", "glpi_bookmarks", "glpi_logs", "glpi_tickets");
    foreach ($tables as $table) {
        $query = "DELETE FROM `{$table}` WHERE (`itemtype` " . $in . " ) ";
        $DB->query($query);
    }
    //drop rules
    $Rule = new Rule();
    $a_rules = $Rule->find("`sub_type`='PluginResourcesRuleChecklist'\n                              OR `sub_type`='PluginResourcesRuleContracttype'");
    foreach ($a_rules as $data) {
        $Rule->delete($data);
    }
    $notif = new Notification();
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'new', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'update', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'delete', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newtask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updatetask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deletetask', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertExpiredTasks', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertLeavingResources', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertArrivalChecklists', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'AlertLeavingChecklists', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'LeavingResource', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'report', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newresting', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updateresting', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deleteresting', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'newholiday', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'updateholiday', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    $options = array('itemtype' => 'PluginResourcesResource', 'event' => 'deleteholiday', 'FIELDS' => 'id');
    foreach ($DB->request('glpi_notifications', $options) as $data) {
        $notif->delete($data);
    }
    //templates
    $template = new NotificationTemplate();
    $translation = new NotificationTemplateTranslation();
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:hook.php


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