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


PHP isIndex函数代码示例

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


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

示例1: update0712to0713

function update0712to0713()
{
    global $DB, $CFG_GLPI;
    if (!FieldExists("glpi_rule_cache_software", "ignore_ocs_import", false)) {
        $query = "ALTER TABLE `glpi_rule_cache_software`\n                ADD `ignore_ocs_import` VARCHAR( 255 ) NULL ";
        $DB->queryOrDie($query, "0.71.3 add ignore_ocs_import field in dictionnary cache");
    }
    // Update to longtext for fields which may be very long
    if (FieldExists("glpi_kbitems", "answer", false)) {
        if (isIndex("glpi_kbitems", "fulltext")) {
            // to avoid pb in altering column answer
            $query = "ALTER TABLE `glpi_kbitems`\n                   DROP INDEX `fulltext`";
            $DB->queryOrDie($query, "0.71.3 alter kbitem drop index Fulltext");
        }
        // field question : only to change latin1 to utf-8 if not done in update 0.68.3 to 0.71
        // before creating index fulltext based on 2 fields (perhaps both are not in same encoding)
        $query = "ALTER TABLE `glpi_kbitems`\n                CHANGE `question` `question` TEXT,\n                CHANGE `answer` `answer` LONGTEXT NULL DEFAULT NULL ";
        $DB->queryOrDie($query, "0.71.3 alter kbitem answer field to longtext");
        $query = "ALTER TABLE `glpi_kbitems`\n                ADD FULLTEXT `fulltext` (`question`,`answer`)";
        $DB->queryOrDie($query, "0.71.3 alter kbitem re-add index Fulltext");
    }
    if (FieldExists("glpi_tracking", "contents", false)) {
        $query = "ALTER TABLE `glpi_tracking`\n                CHANGE `contents` `contents` LONGTEXT NULL DEFAULT NULL ";
        $DB->queryOrDie($query, "0.71.3 alter tracking contents field to longtext");
    }
}
开发者ID:gaforeror,项目名称:glpi,代码行数:26,代码来源:update_0712_0713.php

示例2: update072to0721

function update072to0721()
{
    global $DB, $CFG_GLPI, $LANG;
    echo "<h3>" . $LANG['install'][4] . " -&gt; 0.72.1</h3>";
    displayMigrationMessage("0721");
    // Start
    if (!isIndex("glpi_groups", "ldap_group_dn")) {
        $query = "ALTER TABLE `glpi_groups` ADD INDEX `ldap_group_dn` ( `ldap_group_dn` );";
        $DB->query($query) or die("0.72.1 add index on ldap_group_dn in glpi_groups" . $LANG['update'][140] . $DB->error());
    }
    if (!isIndex("glpi_groups", "ldap_value")) {
        $query = "ALTER TABLE `glpi_groups` ADD INDEX `ldap_value`  ( `ldap_value` );";
        $DB->query($query) or die("0.72.1 add index on ldap_value in glpi_groups" . $LANG['update'][140] . $DB->error());
    }
    if (!isIndex('glpi_tracking', 'date_mod')) {
        $query = " ALTER TABLE `glpi_tracking` ADD INDEX `date_mod` (`date_mod`)  ";
        $DB->query($query) or die("0.72.1 add date_mod index in glpi_tracking " . $LANG['update'][90] . $DB->error());
    }
    // Display "Work ended." message - Keep this as the last action.
    displayMigrationMessage("0721");
    // End
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:22,代码来源:update_072_0721.php

示例3: update072to0721

function update072to0721()
{
    global $DB, $CFG_GLPI;
    //TRANS: %s is the number of new version
    echo "<h3>" . sprintf(__('Update to %s'), '0.72.1') . "</h3>";
    displayMigrationMessage("0721");
    // Start
    if (!isIndex("glpi_groups", "ldap_group_dn")) {
        $query = "ALTER TABLE `glpi_groups` ADD INDEX `ldap_group_dn` ( `ldap_group_dn` );";
        $DB->query($query, "0.72.1 add index on ldap_group_dn in glpi_groups");
    }
    if (!isIndex("glpi_groups", "ldap_value")) {
        $query = "ALTER TABLE `glpi_groups` ADD INDEX `ldap_value`  ( `ldap_value` );";
        $DB->query($query, "0.72.1 add index on ldap_value in glpi_groups");
    }
    if (!isIndex('glpi_tracking', 'date_mod')) {
        $query = " ALTER TABLE `glpi_tracking` ADD INDEX `date_mod` (`date_mod`)  ";
        $DB->query($query, "0.72.1 add date_mod index in glpi_tracking");
    }
    // Display "Work ended." message - Keep this as the last action.
    displayMigrationMessage("0721");
    // End
}
开发者ID:kipman,项目名称:glpi,代码行数:23,代码来源:update_072_0721.php

示例4: update0712to0713

function update0712to0713()
{
    global $DB, $CFG_GLPI, $LANG;
    if (!FieldExists("glpi_rule_cache_software", "ignore_ocs_import")) {
        $query = "ALTER TABLE `glpi_rule_cache_software` ADD `ignore_ocs_import` VARCHAR( 255 ) NULL ;";
        $DB->query($query) or die("0.71.3 add ignore_ocs_import field in dictionnary cache " . $LANG['update'][90] . $DB->error());
    }
    // Update to longtext for fields which may be very long
    if (FieldExists("glpi_kbitems", "answer")) {
        if (isIndex("glpi_kbitems", "fulltext")) {
            // to avoid pb in altering column answer
            $query = "ALTER TABLE `glpi_kbitems` DROP INDEX `fulltext`";
            $DB->query($query) or die("0.71.3 alter kbitem drop index Fulltext " . $LANG['update'][90] . $DB->error());
        }
        $query = "ALTER TABLE `glpi_kbitems` CHANGE `answer` `answer` LONGTEXT NULL DEFAULT NULL  ";
        $DB->query($query) or die("0.71.3 alter kbitem answer field to longtext " . $LANG['update'][90] . $DB->error());
        $query = "ALTER TABLE `glpi_kbitems` ADD FULLTEXT `fulltext` (`question`,`answer`)";
        $DB->query($query) or die("0.71.3 alter kbitem re-add index Fulltext " . $LANG['update'][90] . $DB->error());
    }
    if (FieldExists("glpi_tracking", "contents")) {
        $query = "ALTER TABLE `glpi_tracking` CHANGE `contents` `contents` LONGTEXT NULL DEFAULT NULL  ";
        $DB->query($query) or die("0.71.3 alter tracking contents field to longtext " . $LANG['update'][90] . $DB->error());
    }
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:24,代码来源:update_0712_0713.php

示例5: filterCatalog

                            </div>
                        <?php 
    }
    ?>
                        <div class="filter-block ">
                            <a class="show-hide-filters" href="javascript:void(0);">Показать/скрыть фильтры</a>
                            <?php 
    filterCatalog();
    ?>
                        </div>
                    </div>
                <?php 
}
?>
                <?php 
if (!isIndex()) {
    ?>
                    <div class="main-block">
                        <?php 
    if (isCatalog() && !isSearch()) {
        ?>
                            <!--Вывод аякс поиска-->
                            <?php 
        layout('search');
        ?>
                            <!--/Вывод аякс поиска-->
                        <?php 
    }
    ?>
                        <?php 
    layout('content');
开发者ID:kostiukoleg,项目名称:all4web.loc,代码行数:31,代码来源:template.php

示例6: update042to05


//.........这里部分代码省略.........
    if (!FieldExists("glpi_computers", "deleted", false)) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD `deleted` ENUM('Y', 'N') DEFAULT 'N' NOT NULL ";
        $DB->queryOrDie($query, "0.5 add field deleted");
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`deleted`)";
        $DB->queryOrDie($query, "0.5 alter field deleted");
    }
    // Ajout template peripheral
    if (!FieldExists("glpi_peripherals", "is_template", false)) {
        $query = "ALTER TABLE `glpi_peripherals`\n                ADD `is_template` ENUM('0', '1') DEFAULT '0' NOT NULL ,\n                ADD `tplname` VARCHAR(255) ";
        $DB->queryOrDie($query, "0.5 add field deleted");
        $query = "INSERT INTO `glpi_peripherals`\n                       (`is_template`, `tplname`, `name`, `contact`, `contact_num`, `comments`,\n                        `serial`, `otherserial`, `brand`)\n                VALUES ('1', 'Blank Template', '', '', '', '', '', '', '')";
        $DB->queryOrDie($query, "0.5 add blank template");
        $query = "ALTER TABLE `glpi_peripherals`\n                ADD INDEX (`is_template`)";
        $DB->queryOrDie($query, "0.5 alter field is_template");
    }
    // Ajout template software
    if (!FieldExists("glpi_software", "is_template", false)) {
        $query = "ALTER TABLE `glpi_software`\n                ADD `is_template` ENUM('0', '1') DEFAULT '0' NOT NULL ,\n                ADD `tplname` VARCHAR(255) ";
        $DB->queryOrDie($query, "0.5 add field deleted");
        $query = "INSERT INTO `glpi_software`\n                       (`is_template`, `tplname`, `name`, `comments`, `version`)\n                VALUES ('1', 'Blank Template', '', '', '')";
        $DB->queryOrDie($query, "0.5 add blank template");
        $query = "ALTER TABLE `glpi_software`\n                ADD INDEX (`is_template`)";
        $DB->queryOrDie($query, "0.5 alter field is_template");
    }
    // Ajout template monitor
    if (!FieldExists("glpi_monitors", "is_template", false)) {
        $query = "ALTER TABLE `glpi_monitors`\n                ADD `is_template` ENUM('0', '1') DEFAULT '0' NOT NULL ,\n                ADD `tplname` VARCHAR(255) ";
        $DB->queryOrDie($query, "0.5 add field deleted");
        $query = "INSERT INTO `glpi_monitors`\n                       (`is_template`, `tplname`, `name`, `contact`, `contact_num`, `comments`,\n                        `serial`, `otherserial`)\n                VALUES ('1', 'Blank Template', '', '', '', '', '', '')";
        $DB->queryOrDie($query, "0.5 add blank template");
        $query = "ALTER TABLE `glpi_monitors`\n                ADD INDEX (`is_template`)";
        $DB->queryOrDie($query, "0.5 alter field is_template");
    }
    if (!isIndex("glpi_computers", "is_template")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`is_template`) ";
        $DB->queryOrDie($query, "5");
    }
    // Ajout template networking
    if (!FieldExists("glpi_networking", "is_template", false)) {
        $query = "ALTER TABLE `glpi_networking`\n                ADD `is_template` ENUM('0', '1') DEFAULT '0' NOT NULL ,\n                ADD `tplname` VARCHAR(255) ";
        $DB->queryOrDie($query, "0.5 add field deleted");
        $query = "INSERT INTO `glpi_networking`\n                       (`is_template`, `tplname`, `name`, `contact`, `contact_num`, `comments`,\n                        `ram`, `otherserial`, `serial`)\n                VALUES ('1', 'Blank Template', '', '', '', '', '', '', '')";
        $DB->queryOrDie($query, "0.5 add blank template");
        $query = "ALTER TABLE `glpi_networking`\n                ADD INDEX (`is_template`)";
        $DB->queryOrDie($query, "0.5 alter field is_template");
    }
    // Ajout template printer
    if (!FieldExists("glpi_printers", "is_template", false)) {
        $query = "ALTER TABLE `glpi_printers`\n                ADD `is_template` ENUM('0', '1') DEFAULT '0' NOT NULL ,\n                ADD `tplname` VARCHAR(255) ";
        $DB->queryOrDie($query, "0.5 add field deleted");
        $query = "INSERT INTO `glpi_printers`\n                       (`is_template`, `tplname`, `name`, `contact`, `contact_num`, `comments`,\n                        `serial`, `otherserial`, `ramSize`)\n                VALUES ('1', 'Blank Template', '', '', '', '', '', '', '')";
        $DB->queryOrDie($query, "0.5 add blank template");
        $query = "ALTER TABLE `glpi_printers`\n                ADD INDEX (`is_template`)";
        $DB->queryOrDie($query, "0.5 alter field is_template");
    }
    // Ajout date_mod
    if (!FieldExists("glpi_printers", "date_mod", false)) {
        $query = "ALTER TABLE `glpi_printers`\n                ADD `date_mod` DATETIME DEFAULT NULL";
        $DB->queryOrDie($query);
        $query = "ALTER TABLE `glpi_printers`\n                ADD INDEX (`date_mod`)";
        $DB->queryOrDie($query, "0.5 alter field date_mod");
    }
    if (!isIndex("glpi_computers", "date_mod")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`date_mod`) ";
        $DB->queryOrDie($query, "5");
    }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:67,代码来源:update_042_05.php

示例7: update0713to072


//.........这里部分代码省略.........
    if (!TableExists("glpi_dropdown_licensetypes")) {
        $query = "CREATE TABLE `glpi_dropdown_licensetypes` (\n                  `ID` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) NULL default NULL,\n                  `comments` text,\n                  PRIMARY KEY (`ID`),\n                  KEY `name` (`name`)\n                ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.72 create glpi_dropdown_licensetypes table");
        $input["tablename"] = "glpi_dropdown_licensetypes";
        $input["value"] = "OEM";
        $input['type'] = "first";
        $input["comment"] = "";
        $input["entities_id"] = -1;
        $query = "INSERT INTO `glpi_dropdown_licensetypes`\n                       (`name`)\n                VALUES ('OEM')";
        if ($result = $DB->query($query)) {
            $oemtype = $DB->insert_id();
            $query = "UPDATE `glpi_softwarelicenses`\n                      SET `type` = '{$oemtype}'\n                      WHERE `FK_computers` > '0'";
            $DB->queryOrDie($query, "0.72 affect OEM as licensetype");
        }
    }
    displayMigrationMessage("072", _n('User', 'Users', 2));
    if (!FieldExists("glpi_groups", "recursive", false)) {
        $query = "ALTER TABLE `glpi_groups`\n                ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`";
        $DB->queryOrDie($query, "0.72 add recursive in glpi_groups");
    }
    if (!FieldExists("glpi_auth_ldap", "ldap_field_title", false)) {
        $query = "ALTER TABLE `glpi_auth_ldap`\n                ADD `ldap_field_title` VARCHAR( 255 ) DEFAULT NULL ";
        $DB->queryOrDie($query, "0.72 add ldap_field_title in glpi_auth_ldap");
    }
    //Add user title retrieval from LDAP
    if (!TableExists("glpi_dropdown_user_titles")) {
        $query = "CREATE TABLE `glpi_dropdown_user_titles` (\n                  `ID` int( 11 ) NOT NULL AUTO_INCREMENT ,\n                  `name` varchar( 255 ) NULL default NULL ,\n                  `comments` text ,\n                  PRIMARY KEY ( `ID` ) ,\n                  KEY `name` (`name`)\n                ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci";
        $DB->queryOrDie($query, "0.72 create glpi_dropdown_user_titles table");
    }
    if (!FieldExists("glpi_users", "title", false)) {
        $query = "ALTER TABLE `glpi_users`\n                ADD `title` INT( 11 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.72 add title in glpi_users");
    }
    if (!isIndex("glpi_users", "title")) {
        $query = " ALTER TABLE `glpi_users`\n                ADD INDEX `title` (`title`)";
        $DB->queryOrDie($query, "0.72 add index on title in glpi_users");
    }
    if (!FieldExists("glpi_auth_ldap", "ldap_field_type", false)) {
        $query = "ALTER TABLE `glpi_auth_ldap`\n                ADD `ldap_field_type` VARCHAR( 255 ) DEFAULT NULL";
        $DB->queryOrDie($query, "0.72 add ldap_field_title in glpi_auth_ldap");
    }
    //Add user type retrieval from LDAP
    if (!TableExists("glpi_dropdown_user_types")) {
        $query = "CREATE TABLE `glpi_dropdown_user_types` (\n                  `ID` int( 11 ) NOT NULL AUTO_INCREMENT,\n                  `name` varchar( 255 ) NULL default NULL,\n                  `comments` text,\n                  PRIMARY KEY (`ID`),\n                  KEY `name` (`name`)\n                ) ENGINE = MYISAM DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci";
        $DB->queryOrDie($query, "0.72 create glpi_dropdown_user_types table");
    }
    if (!FieldExists("glpi_users", "type", false)) {
        $query = "ALTER TABLE `glpi_users`\n                ADD `type` INT( 11 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.72 add type in glpi_users");
    }
    if (!isIndex("glpi_users", "type")) {
        $query = " ALTER TABLE `glpi_users`\n                 ADD INDEX `type` (`type`)";
        $DB->queryOrDie($query, "0.72 add index on type in glpi_users");
    }
    if (!isIndex("glpi_users", "active")) {
        $query = " ALTER TABLE `glpi_users`\n                 ADD INDEX `active` (`active`)";
        $DB->queryOrDie($query, "0.72 add index on active in glpi_users");
    }
    if (!FieldExists("glpi_auth_ldap", "ldap_field_language", false)) {
        $query = "ALTER TABLE `glpi_auth_ldap`\n                ADD `ldap_field_language` VARCHAR( 255 ) NULL DEFAULT NULL ";
        $DB->queryOrDie($query, "0.72 add ldap_field_language in glpi_auth_ldap");
    }
    if (!FieldExists("glpi_ocs_config", "tag_exclude", false)) {
        $query = "ALTER TABLE `glpi_ocs_config`\n                ADD `tag_exclude` VARCHAR( 255 ) NULL AFTER `tag_limit`";
        $DB->queryOrDie($query, "0.72 add tag_exclude in glpi_ocs_config");
    }
开发者ID:gaforeror,项目名称:glpi,代码行数:67,代码来源:update_0713_072.php

示例8: update101to110

function update101to110()
{
    global $DB, $CFG_GLPI;
    echo "<strong>Update 1.0.1 to 1.1.0</strong><br/>";
    // ** Update glpi_plugin_projet_projets
    if (TableExists("glpi_plugin_projet")) {
        $query = "RENAME TABLE `glpi_plugin_projet` TO `glpi_plugin_projet_projets` ";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "ID")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `ID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "FK_entities")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `FK_entities` `entities_id` INT( 11 ) NOT NULL DEFAULT '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "recursive")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `recursive` `is_recursive` tinyint(1) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "FK_users")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `FK_users` `users_id` int(11) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "FK_groups")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `FK_groups` `groups_id` int(11) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "status")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `status` `plugin_projet_projetstates_id` INT( 4 ) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "parentID")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `parentID` `plugin_projet_projets_id` int(11) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "comments")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `comments` `comment` TEXT CHARACTER \n                     SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "tplname")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `tplname` `template_name` varchar(255) collate utf8_unicode_ci NOT NULL default ''";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projets", "deleted")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projets` \n                  CHANGE `deleted` `is_deleted` smallint(6) NOT NULL default '0'";
        $DB->query($query);
    }
    // ** Update glpi_plugin_projet_projetitems
    if (TableExists("glpi_plugin_projet_items")) {
        $query = "RENAME TABLE `glpi_plugin_projet_items` TO `glpi_plugin_projet_projetitems` ";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projetitems", "ID")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  CHANGE `ID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projetitems", "FK_projet")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  CHANGE `FK_projet` `plugin_projet_projets_id` int(11) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projetitems", "FK_device")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  CHANGE `FK_device` `items_id` int(11) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_projetitems", "device_type")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  CHANGE `device_type` `itemtype` varchar(100) NOT NULL default '0'";
        $DB->query($query);
    }
    if (isIndex("glpi_plugin_projet_projetitems", "FK_device")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  DROP INDEX `FK_device` ,\n                  ADD INDEX `items_id` (`items_id`,`plugin_projet_projets_id`) ";
        $DB->query($query);
    }
    if (isIndex("glpi_plugin_projet_projetitems", "FK_projet")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  DROP INDEX `FK_projet` ,\n                  ADD INDEX `plugin_projet_projets_id` (`plugin_projet_projets_id`) ";
        $DB->query($query);
    }
    if (isIndex("glpi_plugin_projet_projetitems", "FK_device_2")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  DROP INDEX `FK_device_2` ,\n                  ADD INDEX `items_id_2` (`items_id`) ";
        $DB->query($query);
    }
    if (isIndex("glpi_plugin_projet_projetitems", "device_type")) {
        $query = "ALTER TABLE `glpi_plugin_projet_projetitems` \n                  DROP INDEX `device_type` ,\n                  ADD INDEX itemtype (`itemtype`) ";
        $DB->query($query);
    }
    // ** Update glpi_plugin_projet_tasks
    if (FieldExists("glpi_plugin_projet_tasks", "ID")) {
        $query = "ALTER TABLE `glpi_plugin_projet_tasks` \n                  CHANGE `ID` `id` INT( 11 ) NOT NULL AUTO_INCREMENT";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_tasks", "FK_projet")) {
        $query = "ALTER TABLE `glpi_plugin_projet_tasks` \n                  CHANGE `FK_projet` `plugin_projet_projets_id` int(4) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_tasks", "FK_users")) {
        $query = "ALTER TABLE `glpi_plugin_projet_tasks` \n                  CHANGE `FK_users` `users_id` int(11) NOT NULL default '0'";
        $DB->query($query);
    }
    if (FieldExists("glpi_plugin_projet_tasks", "FK_groups")) {
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:update_101_110.php

示例9: update0681to07

function update0681to07()
{
    global $DB, $CFG_GLPI;
    $DB->query("SET NAMES 'latin1'");
    // Improve user table :
    if (!isIndex("glpi_users", "firstname")) {
        $query = "ALTER TABLE `glpi_users`\n                ADD INDEX (`firstname`)";
        $DB->queryOrDie($query, "0.7 alter users add index on firstname");
    }
    if (!isIndex("glpi_users", "realname")) {
        $query = "ALTER TABLE `glpi_users`\n                ADD INDEX (`realname`)";
        $DB->queryOrDie($query, "0.7 alter users add index on realname");
    }
    // Decimal problem
    if (FieldExists("glpi_infocoms", "value", false)) {
        $query = "ALTER TABLE `glpi_infocoms`\n                CHANGE `value` `value` DECIMAL( 20, 4 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.7 alter value in glpi_infocoms");
    }
    if (FieldExists("glpi_infocoms", "warranty_value", false)) {
        $query = "ALTER TABLE `glpi_infocoms`\n                CHANGE warranty_value warranty_value DECIMAL( 20, 4 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.7 alter warranty_value in glpi_infocoms");
    }
    if (FieldExists("glpi_tracking", "cost_time", false)) {
        $query = "ALTER TABLE `glpi_tracking`\n                CHANGE cost_time cost_time DECIMAL( 20, 4 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.7 alter cost_time in glpi_tracking");
    }
    if (FieldExists("glpi_tracking", "cost_fixed", false)) {
        $query = "ALTER TABLE `glpi_tracking`\n                CHANGE cost_fixed cost_fixed DECIMAL( 20, 4 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.7 alter cost_fixed in glpi_tracking");
    }
    if (FieldExists("glpi_tracking", "cost_material", false)) {
        $query = "ALTER TABLE `glpi_tracking`\n                CHANGE cost_material cost_material DECIMAL( 20, 4 ) NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.7 alter cost_material in glpi_tracking");
    }
    if (!FieldExists("glpi_config", "decimal_number", false)) {
        $query = "ALTER TABLE `glpi_config`\n                ADD `decimal_number` INT DEFAULT '2'";
        $DB->queryOrDie($query, "0.7 add decimal_number in glpi_config");
    }
    $CFG_GLPI["decimal_number"] = 2;
    if (!FieldExists("glpi_config", "cas_logout", false)) {
        $query = "ALTER TABLE `glpi_config`\n                ADD `cas_logout` VARCHAR( 255 ) NULL AFTER `cas_uri`";
        $DB->queryOrDie($query, "0.7 add cas_logout in glpi_config");
    }
    if (!isIndex("glpi_computer_device", "specificity")) {
        $query = "ALTER TABLE `glpi_computer_device`\n                ADD INDEX (`specificity`)";
        $DB->queryOrDie($query, "0.7 add index specificity in glpi_computer_device");
    }
    if (!FieldExists("glpi_docs", "comments", false)) {
        $query = "ALTER TABLE `glpi_docs`\n                CHANGE `comment` `comments` TEXT DEFAULT NULL ";
        $DB->queryOrDie($query, "0.7 alter docs.comment to be comments");
    }
    // Update polish langage file
    $query = "UPDATE `glpi_users`\n             SET `language` = 'pl_PL'\n             WHERE `language` = 'po_PO'";
    $DB->queryOrDie($query, "0.7 update polish lang file");
    // Add show_group_hardware
    if (!FieldExists("glpi_profiles", "show_group_hardware", false)) {
        $query = "ALTER TABLE `glpi_profiles`\n                ADD `show_group_hardware` CHAR(1) NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.7 alter glpi_profiles add show_group_hardware");
        $query = "UPDATE `glpi_profiles`\n                SET `show_group_hardware` = `show_group_ticket`";
        $DB->queryOrDie($query, "0.7 alter glpi_profiles add show_group_hardware");
    }
    // Clean doc association
    if (FieldExists("glpi_doc_device", "is_template", false)) {
        $query = "ALTER TABLE `glpi_doc_device`\n                DROP `is_template`";
        $DB->queryOrDie($query, "0.7 delete is_template from glpi_doc_device");
    }
    // Clean contract association
    if (FieldExists("glpi_contract_device", "is_template", false)) {
        $query = "ALTER TABLE `glpi_contract_device`\n                DROP `is_template`";
        $DB->queryOrDie($query, "0.7 delete is_template from glpi_contract_device");
    }
    //// ENTITY MANAGEMENT
    if (!TableExists("glpi_entities")) {
        $query = "CREATE TABLE `glpi_entities` (\n                  `ID` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) NOT NULL,\n                  `parentID` int(11) NOT NULL default '0',\n                  `completename` text NOT NULL,\n                  `comments` text,\n                  `level` int(11) default NULL,\n                  PRIMARY KEY (`ID`),\n                  UNIQUE KEY `name` (`name`,`parentID`),\n                  KEY `parentID` (`parentID`)\n                ) ENGINE=MyISAM";
        $DB->queryOrDie($query, "0.7 create glpi_entities");
    }
    if (!TableExists("glpi_entities_data")) {
        $query = "CREATE TABLE `glpi_entities_data` (\n                  `ID` int(11) NOT NULL auto_increment,\n                  `FK_entities` int(11) NOT NULL default '0',\n                  `address` text,\n                  `postcode` varchar(255) default NULL,\n                  `town` varchar(255) default NULL,\n                  `state` varchar(255) default NULL,\n                  `country` varchar(255) default NULL,\n                  `website` varchar(200) default NULL,\n                  `phonenumber` varchar(200) default NULL,\n                  `fax` varchar(255) default NULL,\n                  `email` varchar(255) default NULL,\n                  `notes` longtext,\n                  PRIMARY KEY (`ID`),\n                  UNIQUE KEY `FK_entities` (`FK_entities`)\n                ) ENGINE=MyISAM";
        $DB->queryOrDie($query, "0.7 create glpi_entities_data");
    }
    // Add default profile to all users without any profile
    $query = "SELECT `ID`\n             FROM `glpi_profiles`\n             WHERE `is_default` = '1'";
    if ($result = $DB->query($query)) {
        if ($DB->numrows($result) > 0) {
            $IDprof = $DB->result($result, 0, 0);
            $query = "SELECT `glpi_users`.`ID`\n                   FROM `glpi_users`\n                   LEFT JOIN `glpi_users_profiles`\n                        ON (`glpi_users_profiles`.`FK_users` = `glpi_users`.`ID`)\n                   WHERE `glpi_users_profiles`.`ID` IS NULL";
            if ($result = $DB->query($query)) {
                if ($DB->numrows($result) > 0) {
                    while ($data = $DB->fetch_assoc($result)) {
                        $query = "INSERT INTO `glpi_users_profiles`\n                                   (`FK_users`, `FK_profiles`)\n                            VALUES ('" . $data['ID'] . "', '{$IDprof}') ";
                        $DB->query($query);
                    }
                }
            }
        }
    }
    if (!FieldExists("glpi_users_profiles", "FK_entities", false)) {
        // Clean Datas
        $query = "DELETE\n                FROM `glpi_users_profiles`\n                WHERE `FK_users` = '0'";
        $DB->queryOrDie($query, "0.7 clean datas of glpi_users_profiles");
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:update_0681_07.php

示例10: update068to0681

function update068to0681()
{
    global $DB, $CFG_GLPI;
    if (TableExists("glpi_repair_item")) {
        $query = "DROP TABLE `glpi_repair_item`";
        $DB->queryOrDie($query, "0.68.1 drop glpi_repair_item");
    }
    $tables = array("computers", "monitors", "networking", "peripherals", "phones", "printers");
    foreach ($tables as $tbl) {
        if (isIndex("glpi_" . $tbl, "type")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   DROP INDEX `type`";
            $DB->queryOrDie($query, "0.68.1 drop index type glpi_{$tbl}");
        }
        if (isIndex("glpi_" . $tbl, "type_2")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   DROP INDEX `type_2`";
            $DB->queryOrDie($query, "0.68.1 drop index type_2 glpi_{$tbl}");
        }
        if (isIndex("glpi_" . $tbl, "model")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   DROP INDEX `model`";
            $DB->queryOrDie($query, "0.68.1 drop index model glpi_{$tbl}");
        }
        if (!isIndex("glpi_" . $tbl, "type")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   ADD INDEX (`type`)";
            $DB->queryOrDie($query, "0.68.1 add index type glpi_{$tbl}");
        }
        if (!isIndex("glpi_" . $tbl, "model")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   ADD INDEX (`model`)";
            $DB->queryOrDie($query, "0.68.1 add index model glpi_{$tbl}");
        }
        if (!isIndex("glpi_" . $tbl, "FK_groups")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   ADD INDEX (`FK_groups`)";
            $DB->queryOrDie($query, "0.68.1 add index on glpi_{$tbl}.FK_groups");
        }
        if (!isIndex("glpi_" . $tbl, "FK_users")) {
            $query = "ALTER TABLE `glpi_{$tbl}`\n                   ADD INDEX ( `FK_users` )";
            $DB->queryOrDie($query, "0.68.1 add index on glpi_{$tbl}.FK_users");
        }
    }
    if (!isIndex("glpi_software", "FK_groups")) {
        $query = "ALTER TABLE `glpi_software`\n                ADD INDEX (`FK_groups`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_software.FK_groups");
    }
    if (!isIndex("glpi_software", "FK_users")) {
        $query = "ALTER TABLE `glpi_software`\n                ADD INDEX ( `FK_users` )";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_software.FK_users");
    }
    if (!isIndex("glpi_cartridges_type", "location")) {
        $query = "ALTER TABLE `glpi_cartridges_type`\n                ADD INDEX (`location`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_cartridges_type.location");
    }
    if (FieldExists("glpi_cartridges_type", "type", false)) {
        $query = "ALTER TABLE `glpi_cartridges_type`\n                CHANGE `type` `type` INT NOT NULL DEFAULT '0'";
        $DB->queryOrDie($query, "0.68.1 alter glpi_cartridges_type.type");
    }
    if (!isIndex("glpi_cartridges_type", "type")) {
        $query = "ALTER TABLE `glpi_cartridges_type`\n               ADD INDEX (`type`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_cartridges_type.type");
    }
    if (!isIndex("glpi_cartridges_type", "alarm")) {
        $query = "ALTER TABLE `glpi_cartridges_type`\n                ADD INDEX (`alarm`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_cartridges_type.alarm");
    }
    if (!isIndex("glpi_computers", "os_sp")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`os_sp`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_computers.os_sp");
    }
    if (!isIndex("glpi_computers", "os_version")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`os_version`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_computers.os_version");
    }
    if (!isIndex("glpi_computers", "network")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`network`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_computers.network");
    }
    if (!isIndex("glpi_computers", "domain")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`domain`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_computers.domain");
    }
    if (!isIndex("glpi_computers", "auto_update")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`auto_update`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_computers.auto_update");
    }
    if (!isIndex("glpi_computers", "ocs_import")) {
        $query = "ALTER TABLE `glpi_computers`\n                ADD INDEX (`ocs_import`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_computers.ocs_import");
    }
    if (!isIndex("glpi_consumables", "id_user")) {
        $query = "ALTER TABLE `glpi_consumables`\n                ADD INDEX (`id_user`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_consumables.id_user");
    }
    if (!isIndex("glpi_consumables_type", "location")) {
        $query = "ALTER TABLE `glpi_consumables_type`\n                ADD INDEX (`location`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_consumables_type.location");
    }
    if (!isIndex("glpi_consumables_type", "type")) {
        $query = "ALTER TABLE `glpi_consumables_type`\n                ADD INDEX (`type`)";
        $DB->queryOrDie($query, "0.68.1 add index on glpi_consumables_type.type");
    }
    if (!isIndex("glpi_consumables_type", "alarm")) {
        $query = "ALTER TABLE `glpi_consumables_type`\n                ADD INDEX (`alarm`)";
//.........这里部分代码省略.........
开发者ID:btry,项目名称:glpi,代码行数:101,代码来源:update_068_0681.php

示例11: testIsIndex

 /**
  * @covers ::isIndex
  **/
 public function testIsIndex()
 {
     $this->assertFalse(isIndex('glpi_configs', 'fakeField'));
     $this->assertFalse(isIndex('fakeTable', 'id'));
     $this->assertFalse(isIndex('glpi_configs', 'name'));
     $this->assertTrue(isIndex('glpi_users', 'locations_id'));
     $this->assertTrue(isIndex('glpi_users', 'unicity'));
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:11,代码来源:DbFunctionTest.php

示例12: update0782to080


//.........这里部分代码省略.........
                    $firstactiontime = max(0, $firstactiontime);
                    $query2 = "UPDATE `glpi_tickets`\n                          SET `takeintoaccount_delay_stat` = '{$firstactiontime}'\n                          WHERE `id` = '" . $data['ID'] . "'";
                    $DB->queryOrDie($query2, "0.80 update takeintoaccount_delay_stat values for #" . $data['ID']);
                }
            }
        }
        // Not solved tickets
        $query = "SELECT `glpi_tickets`.`id` AS ID,\n                       MIN(UNIX_TIMESTAMP(`glpi_ticketfollowups`.`date`)\n                            - UNIX_TIMESTAMP(`glpi_tickets`.`date`)) AS FIRST,\n                       MIN(UNIX_TIMESTAMP(`glpi_tickettasks`.`date`)\n                            - UNIX_TIMESTAMP(`glpi_tickets`.`date`)) AS FIRST2\n                FROM `glpi_tickets`\n                LEFT JOIN `glpi_ticketfollowups`\n                     ON (`glpi_ticketfollowups`.`tickets_id` = `glpi_tickets`.`id`)\n                LEFT JOIN `glpi_tickettasks`\n                     ON (`glpi_tickettasks`.`tickets_id` = `glpi_tickets`.`id`)\n                WHERE (`glpi_tickets`.`status` <> 'closed'\n                       AND `glpi_tickets`.`status` <> 'solved')\n                      OR `glpi_tickets`.`solvedate` IS NULL\n                GROUP BY `glpi_tickets`.`id`";
        if ($result = $DB->query($query)) {
            if ($DB->numrows($result) > 0) {
                while ($data = $DB->fetch_assoc($result)) {
                    $firstactiontime = min($data['FIRST'], $data['FIRST2']);
                    $firstactiontime = max(0, $firstactiontime);
                    $query2 = "UPDATE `glpi_tickets`\n                          SET `takeintoaccount_delay_stat` = '{$firstactiontime}'\n                          WHERE `id` = '" . $data['ID'] . "'";
                    $DB->queryOrDie($query2, "0.80 update takeintoaccount_delay_stat values for #" . $data['ID']);
                }
            }
        }
    }
    // Put realtime in seconds
    $migration->addField("glpi_tickets", "actiontime", "INT( 11 ) NOT NULL DEFAULT 0", array('update' => "ROUND(realtime * 3600)"));
    $migration->dropField("glpi_tickets", "realtime");
    $migration->addField("glpi_tickettasks", "actiontime", "INT( 11 ) NOT NULL DEFAULT 0", array('update' => "ROUND(realtime * 3600)"));
    $migration->dropField("glpi_tickettasks", "realtime");
    $migration->displayMessage(sprintf(__('Change of the database layout - %s'), 'Software'));
    // Updating schema
    if ($migration->addField("glpi_softwareversions", "operatingsystems_id", "INT( 11 ) NOT NULL DEFAULT '0'")) {
        $migration->addKey("glpi_softwareversions", "operatingsystems_id");
        $migration->migrationOneTable('glpi_softwareversions');
        $query = "UPDATE `glpi_softwareversions`,\n                        (SELECT `id`, `operatingsystems_id`\n                         FROM `glpi_softwares`) AS SOFT\n                SET `glpi_softwareversions`.`operatingsystems_id` = `SOFT`.`operatingsystems_id`\n                WHERE `glpi_softwareversions`.`softwares_id` = `SOFT`.`id` ";
        $DB->queryOrDie($query, "0.80 transfer operatingsystems_id from glpi_softwares to glpi_softwareversions");
        $migration->dropField("glpi_softwares", "operatingsystems_id");
    }
    if (!isIndex("glpi_computers_softwareversions", "unicity")) {
        // clean datas
        $query = "SELECT `computers_id`,\n                       `softwareversions_id`,\n                       COUNT(*) AS CPT\n               FROM `glpi_computers_softwareversions`\n               GROUP BY `computers_id`, `softwareversions_id`\n               HAVING CPT > 1";
        if ($result = $DB->query($query)) {
            if ($DB->numrows($result)) {
                while ($data = $DB->fetch_assoc($result)) {
                    $query2 = "SELECT `id`\n                          FROM `glpi_computers_softwareversions`\n                          WHERE `computers_id` = '" . $data['computers_id'] . "'\n                                AND `softwareversions_id` = '" . $data['softwareversions_id'] . "'\n                          LIMIT 1";
                    if ($result2 = $DB->query($query2)) {
                        if ($DB->numrows($result2)) {
                            $keep_id = $DB->result($result2, 0, 0);
                            $query3 = "DELETE\n                                FROM `glpi_computers_softwareversions`\n                                WHERE `computers_id` = '" . $data['computers_id'] . "'\n                                      AND `softwareversions_id` = '" . $data['softwareversions_id'] . "'\n                                      AND `id` <> {$keep_id}";
                            $DB->queryOrDie($query3, "0.80 clean glpi_computers_softwareversions");
                        }
                    }
                }
            }
        }
        $migration->addKey("glpi_computers_softwareversions", array('computers_id', 'softwareversions_id'), 'unicity', "UNIQUE");
    }
    $migration->dropKey("glpi_computers_softwareversions", "computers_id");
    // For real count : copy template and deleted information
    $migration->addField("glpi_computers_softwareversions", "is_deleted", "tinyint(1) NOT NULL DEFAULT 0");
    // Gain de temps pour les beta-testeurs
    if ($migration->addField("glpi_computers_softwareversions", "is_template", "tinyint(1) NOT NULL DEFAULT 0")) {
        $migration->migrationOneTable('glpi_computers_softwareversions');
        // Update datas
        $query = "SELECT DISTINCT `computers_id`\n                FROM `glpi_computers_softwareversions`";
        if ($result = $DB->query($query)) {
            if ($DB->numrows($result)) {
                while ($data = $DB->fetch_assoc($result)) {
                    $comp = new Computer();
                    if ($comp->getFromDB($data['computers_id'])) {
                        $query = "UPDATE `glpi_computers_softwareversions`\n                            SET `is_template` = '" . $comp->getField('is_template') . "',\n                                `is_deleted` = '" . $comp->getField('is_deleted') . "'\n                            WHERE `computers_id` = '" . $data['computers_id'] . "';";
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:67,代码来源:update_0782_080.php

示例13: update07to071

function update07to071()
{
    global $DB, $CFG_GLPI, $LANG;
    if (!FieldExists("glpi_profiles", "rule_dictionnary_software")) {
        $query = "ALTER TABLE `glpi_profiles` ADD `rule_dictionnary_software` VARCHAR( 1 ) NULL DEFAULT NULL;";
        $DB->query($query) or die("0.71 add rule_dictionnary_software in glpi_profiles if not present for compatibility " . $LANG['update'][90] . $DB->error());
        $query = "UPDATE glpi_profiles SET rule_dictionnary_software=rule_softwarecategories";
        $DB->query($query) or die("0.71 update value of rule_dictionnary_software right " . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_profiles", "rule_dictionnary_dropdown")) {
        $query = "ALTER TABLE `glpi_profiles` ADD `rule_dictionnary_dropdown` VARCHAR( 1 ) NULL DEFAULT NULL;";
        $DB->query($query) or die("0.71 add rule_dictionnary_dropdown in glpi_profiles " . $LANG['update'][90] . $DB->error());
        $query = "UPDATE glpi_profiles SET rule_dictionnary_dropdown=rule_dictionnary_software";
        $DB->query($query) or die("0.71 update value of rule_dictionnary_dropdown" . $LANG['update'][90] . $DB->error());
    }
    $cache_tables = array("glpi_rule_cache_manufacturer", "glpi_rule_cache_model_computer", "glpi_rule_cache_model_monitor", "glpi_rule_cache_model_printer", "glpi_rule_cache_model_peripheral", "glpi_rule_cache_model_phone", "glpi_rule_cache_model_networking", "glpi_rule_cache_type_computer", "glpi_rule_cache_type_monitor", "glpi_rule_cache_type_printer", "glpi_rule_cache_type_peripheral", "glpi_rule_cache_type_phone", "glpi_rule_cache_type_networking", "glpi_rule_cache_software", "glpi_rule_cache_os", "glpi_rule_cache_os_sp", "glpi_rule_cache_os_version");
    foreach ($cache_tables as $cache_table) {
        if (!TableExists($cache_table)) {
            $query = "CREATE TABLE `" . $cache_table . "` (\n\t\t\t`ID` INT( 11 ) NOT NULL auto_increment ,\n\t\t\t`old_value` VARCHAR( 255 ) NULL default NULL ,\n\t\t\t`rule_id` INT( 11 ) NOT NULL DEFAULT '0',\n\t\t\t`new_value` VARCHAR( 255 ) NULL default NULL ,\n\t\t\tPRIMARY KEY ( `ID` ),\n\t\t\tKEY `rule_id` (`rule_id`),\n\t\t\tKEY `old_value` (`old_value`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
            $DB->query($query) or die("0.71 add table " . $cache_table . " " . $LANG['update'][90] . $DB->error());
        }
    }
    //Add the field version espacially for the software's cache
    if (!FieldExists("glpi_rule_cache_software", "version")) {
        $query = "ALTER TABLE `glpi_rule_cache_software` ADD `version` VARCHAR( 255 ) DEFAULT NULL ;";
        $DB->query($query) or die("0.71 add version in glpi_rule_cache_software if not present " . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_rule_cache_software", "manufacturer")) {
        $query = "ALTER TABLE `glpi_rule_cache_software` ADD `manufacturer` VARCHAR( 255 ) NOT NULL AFTER `old_value` ;";
        $DB->query($query) or die("0.71 add manufacturer in glpi_rule_cache_software if not present " . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_rule_cache_software", "new_manufacturer")) {
        $query = "ALTER TABLE `glpi_rule_cache_software` ADD `new_manufacturer` VARCHAR( 255 ) NOT NULL AFTER `version` ;";
        $DB->query($query) or die("0.71 add new_manufacturer in glpi_rule_cache_software if not present " . $LANG['update'][90] . $DB->error());
    }
    $model_cache_tables = array("glpi_rule_cache_model_computer", "glpi_rule_cache_model_monitor", "glpi_rule_cache_model_printer", "glpi_rule_cache_model_peripheral", "glpi_rule_cache_model_phone", "glpi_rule_cache_model_networking");
    foreach ($model_cache_tables as $model_cache_table) {
        if (!FieldExists($model_cache_table, "manufacturer")) {
            $query = "ALTER TABLE `" . $model_cache_table . "` ADD `manufacturer` VARCHAR( 255 ) DEFAULT NULL ;";
            $DB->query($query) or die("0.71 add manufacturer in " . $model_cache_table . " if not present " . $LANG['update'][90] . $DB->error());
        }
    }
    if (!FieldExists("glpi_rules_descriptions", "active")) {
        $query = "ALTER TABLE `glpi_rules_descriptions` ADD `active` INT( 1 ) NOT NULL DEFAULT '1';";
        $DB->query($query) or die("0.71 add active in glpi_rules_descriptions if not present " . $LANG['update'][90] . $DB->error());
    }
    if (!TableExists("glpi_auth_ldap_replicate")) {
        $query = "CREATE TABLE IF NOT EXISTS `glpi_auth_ldap_replicate` (\n\t  `ID` int(11) NOT NULL auto_increment,\n\t  `server_id` int(11) NOT NULL default '0',\n\t  `ldap_host` varchar(255) NULL default NULL,\n\t  `ldap_port` int(11) NOT NULL default '389',\n\t  `name` varchar(255) NULL default NULL,\n\t  PRIMARY KEY  (`ID`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
        $DB->query($query) or die("0.71 add table glpi_auth_ldap_replicate " . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_config", "dbreplicate_notify_desynchronization")) {
        $query = "ALTER TABLE `glpi_config` ADD `dbreplicate_notify_desynchronization` SMALLINT NOT NULL DEFAULT '0',\n\t\t\t\tADD `dbreplicate_email` VARCHAR( 255 ) NULL ,\n\t\t\t\tADD `dbreplicate_maxdelay` INT NOT NULL DEFAULT '3600';";
        $DB->query($query) or die("0.71 alter config add config for dbreplicate notif " . $LANG['update'][90] . $DB->error());
    }
    if (FieldExists("glpi_reminder", "author")) {
        $query = "ALTER TABLE `glpi_reminder` CHANGE `author` `FK_users` INT( 11 ) NOT NULL DEFAULT '0';";
        $DB->query($query) or die("0.71 rename author in glpi_reminder" . $LANG['update'][90] . $DB->error());
        if (isIndex("glpi_reminder", "author")) {
            $query = "ALTER TABLE `glpi_reminder` DROP INDEX `author`";
            $DB->query($query) or die("0.7 drop index author on glpi_reminder " . $LANG['update'][90] . $DB->error());
        }
        $query = " ALTER TABLE `glpi_reminder` ADD INDEX `FK_users` ( `FK_users` ) ";
        $DB->query($query) or die("0.71 ad index FK_users in glpi_reminder" . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_reminder", "recursive")) {
        $query = "ALTER TABLE `glpi_reminder` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `type`;";
        $DB->query($query) or die("0.71 add recursive in glpi_reminder" . $LANG['update'][90] . $DB->error());
        $query = "ALTER TABLE `glpi_reminder` ADD INDEX `recursive` ( `recursive` ); ";
        $DB->query($query) or die("0.71 add recursive index in glpi_reminder" . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_reminder", "private")) {
        $query = "ALTER TABLE `glpi_reminder` ADD `private` TINYINT( 1 ) NOT NULL DEFAULT '1' AFTER `type`;";
        $DB->query($query) or die("0.71 add private in glpi_reminder" . $LANG['update'][90] . $DB->error());
        $query = "UPDATE `glpi_reminder` SET private = '0' WHERE type='public' ";
        $DB->query($query) or die("0.71 update private field in glpi_reminder" . $LANG['update'][90] . $DB->error());
        $query = "ALTER TABLE `glpi_reminder` ADD INDEX `private` ( `private` ); ";
        $DB->query($query) or die("0.71 add private index in glpi_reminder" . $LANG['update'][90] . $DB->error());
        // Drop type
        $query = "ALTER TABLE `glpi_reminder` DROP `type`;";
        $DB->query($query) or die("0.71 drop type in glpi_reminder" . $LANG['update'][90] . $DB->error());
    }
    if (FieldExists("glpi_reminder", "title")) {
        $query = "ALTER TABLE `glpi_reminder` CHANGE `title` `name` VARCHAR( 255 ) NULL DEFAULT NULL  ";
        $DB->query($query) or die("0.71 alter title to namein glpi_reminder" . $LANG['update'][90] . $DB->error());
    }
    if (!isIndex("glpi_ocs_link", "last_ocs_update")) {
        $query = "ALTER TABLE `glpi_ocs_link` ADD INDEX `last_ocs_update` ( `ocs_server_id` , `last_ocs_update` )";
        $DB->query($query) or die("0.7 alter ocs_link add index on last_ocs_update " . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_contacts", "recursive")) {
        $query = "ALTER TABLE `glpi_contacts` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
        $DB->query($query) or die("0.71 add recursive in glpi_contacts" . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_contracts", "recursive")) {
        $query = "ALTER TABLE `glpi_contracts` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
        $DB->query($query) or die("0.71 add recursive in glpi_contracts" . $LANG['update'][90] . $DB->error());
    }
    if (!FieldExists("glpi_enterprises", "recursive")) {
        $query = "ALTER TABLE `glpi_enterprises` ADD `recursive` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `FK_entities`;";
        $DB->query($query) or die("0.71 add recursive in glpi_enterprises" . $LANG['update'][90] . $DB->error());
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:update_07_071.php

示例14: plugin_escalade_install

function plugin_escalade_install()
{
    global $DB;
    //get version
    $plugin = new Plugin();
    $found = $plugin->find("name = 'escalade'");
    $plugin_escalade = array_shift($found);
    //init migration
    $migration = new Migration($plugin_escalade['version']);
    // == Tables creation (initial installation) ==
    if (!TableExists('glpi_plugin_escalade_histories')) {
        $query = "CREATE TABLE `glpi_plugin_escalade_histories` (\n         `id`              INT(11) NOT NULL AUTO_INCREMENT,\n         `tickets_id`      INT(11) NOT NULL,\n         `groups_id`       INT(11) NOT NULL,\n         `date_mod`        DATETIME NOT NULL,\n         PRIMARY KEY (`id`),\n         KEY `tickets_id` (`tickets_id`),\n         KEY `groups_id` (`groups_id`)\n      ) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
        $DB->query($query);
    }
    if (!TableExists('glpi_plugin_escalade_configs')) {
        $query = "CREATE TABLE `glpi_plugin_escalade_configs` (\n         `id`                                      INT(11) NOT NULL AUTO_INCREMENT,\n         `remove_group`                            INT(11) NOT NULL,\n         `remove_delete_group_btn`                 INT(11) NOT NULL,\n         `remove_delete_user_btn`                  INT(11) NOT NULL,\n         `show_history`                            INT(11) NOT NULL,\n         `task_history`                            INT(11) NOT NULL,\n         `remove_tech`                             INT(11) NOT NULL,\n         `solve_return_group`                      INT(11) NOT NULL,\n         `reassign_group_from_cat`                 INT(11) NOT NULL,\n         `reassign_tech_from_cat`                  INT(11) NOT NULL,\n         `cloneandlink_ticket`                     INT(11) NOT NULL,\n         `close_linkedtickets`                     INT(11) NOT NULL,\n         `use_assign_user_group`                   INT(11) NOT NULL,\n         `use_assign_user_group_creation`          INT(11) NOT NULL,\n         `use_assign_user_group_modification`      INT(11) NOT NULL,\n         `assign_me_ticket`                        INT(11) NOT NULL,\n         `use_filter_assign_group`                 INT(11) NOT NULL,\n         `ticket_last_status`                      INT(11) NOT NULL,\n         PRIMARY KEY (`id`)\n      ) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
        $DB->query($query);
        $query = "INSERT INTO glpi_plugin_escalade_configs \n      VALUES (NULL, 1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, '" . Ticket::WAITING . "')";
        $DB->query($query);
    }
    // == Update to 1.2 ==
    if (!FieldExists('glpi_plugin_escalade_configs', 'cloneandlink_ticket')) {
        $migration->addField('glpi_plugin_escalade_configs', 'cloneandlink_ticket', 'INT(11) NOT NULL', array('after' => 'reassign_tech_from_cat'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'close_linkedtickets')) {
        $migration->addField('glpi_plugin_escalade_configs', 'close_linkedtickets', 'INT(11) NOT NULL', array('after' => 'cloneandlink_ticket'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'use_assign_user_group')) {
        $migration->addField('glpi_plugin_escalade_configs', 'use_assign_user_group', 'INT(11) NOT NULL', array('after' => 'close_linkedtickets'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'use_assign_user_group_creation')) {
        $migration->addField('glpi_plugin_escalade_configs', 'use_assign_user_group_creation', 'INT(11) NOT NULL', array('after' => 'use_assign_user_group'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'use_assign_user_group_modification')) {
        $migration->addField('glpi_plugin_escalade_configs', 'use_assign_user_group_modification', 'INT(11) NOT NULL', array('after' => 'use_assign_user_group_creation'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'remove_delete_group_btn')) {
        $migration->addField('glpi_plugin_escalade_configs', 'remove_delete_group_btn', 'INT(11) NOT NULL', array('after' => 'remove_group'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'assign_me_ticket')) {
        $migration->addField('glpi_plugin_escalade_configs', 'assign_me_ticket', 'INT(11) NOT NULL', array('after' => 'use_assign_user_group_modification'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!isIndex("glpi_plugin_escalade_histories", 'tickets_id') || !isIndex("glpi_plugin_escalade_histories", 'groups_id')) {
        $migration->addKey("glpi_plugin_escalade_histories", 'tickets_id', 'tickets_id');
        $migration->addKey("glpi_plugin_escalade_histories", 'groups_id', 'groups_id');
        $migration->migrationOneTable('glpi_plugin_escalade_histories');
    }
    // == Update to 1.3 ==
    if (!FieldExists('glpi_plugin_escalade_configs', 'remove_delete_user_btn')) {
        $migration->addField('glpi_plugin_escalade_configs', 'remove_delete_user_btn', 'INT(11) NOT NULL DEFAULT 1', array('after' => 'remove_delete_group_btn'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!FieldExists('glpi_plugin_escalade_configs', 'use_filter_assign_group')) {
        $migration->addField('glpi_plugin_escalade_configs', 'use_filter_assign_group', 'INT(11) NOT NULL', array('after' => 'use_assign_user_group_modification'));
        $migration->migrationOneTable('glpi_plugin_escalade_configs');
    }
    if (!TableExists('glpi_plugin_escalade_groups_groups')) {
        $query = "CREATE TABLE `glpi_plugin_escalade_groups_groups` (\n         `id`                                      INT(11) NOT NULL AUTO_INCREMENT,\n         `groups_id_source` int(11) NOT NULL DEFAULT '0',\n         `groups_id_destination` int(11) NOT NULL DEFAULT '0',\n         PRIMARY KEY (`id`)\n      ) ENGINE = MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
        $DB->query($query);
    }
    // Update for 0.84 status
    if (TableExists('glpi_plugin_escalade_configs')) {
        foreach ($DB->request("glpi_plugin_escalade_configs") as $data) {
            switch ($data['ticket_last_status']) {
                case 'solved':
                    $status = Ticket::SOLVED;
                    break;
                case 'waiting':
                    $status = Ticket::WAITING;
                    break;
                case 'closed':
                    $status = Ticket::CLOSED;
                    break;
                case 'assign':
                    $status = Ticket::ASSIGNED;
                    break;
                case 'new':
                    $status = Ticket::INCOMING;
                    break;
                case 'plan':
                    $status = Ticket::PLANNED;
                    break;
                default:
                    $status = -1;
                    break;
            }
            $query = "UPDATE `glpi_plugin_escalade_configs`\n                   SET `ticket_last_status` = '" . $status . "'\n                   WHERE `id` = '" . $data['id'] . "'";
            $DB->query($query);
        }
        $query = "ALTER TABLE `glpi_plugin_escalade_configs` MODIFY `ticket_last_status` INT(11);";
        $DB->query($query);
    }
    return true;
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:hook.php

示例15: if

                    'ROOT_MENU_TYPE' => 'top',
                    'CHILD_MENU_TYPE' => 'sub',
                    'USE_EXT' => 'Y',
                    'MAX_LEVEL' => 1,
                    'MENU_CACHE_TYPE' => 'A',
                    'MENU_CACHE_TIME' => COMPONENTS_CACHE_TTL,
                )
            ); ?>

            <div class="clear"></div>
        </div>
    </div>
    <div class="logo"
        <? if (isIndex()) { ?>
            style="padding-bottom: 30px;"
        <?}?>
        >
        <div class="domino-logo">
            <a href="/index.php"><span class="domino-span"><img src="/web/images/logo.png" alt="Мебельный Центр Домино"></a>

     <? $APPLICATION->IncludeComponent('sitedevelopment:contacts', 'top')?>
        </div>
    </div>
    <div class="header_bottom">
        <div class="wrap">
            <? if (isIndex()) { ?>
                <? $APPLICATION->IncludeComponent('sitedevelopment:slider') ?>
            <? } ?>
        </div>
    </div>
</div>
开发者ID:AlexSmerw,项目名称:domino,代码行数:31,代码来源:header.php


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