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

PHP isIndex函数代码示例

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

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



在下文中一共展示了isIndex函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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:paisde

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP isInstalled函数代码示例发布时间:2022-05-15
下一篇:
PHP isImageVideo函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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