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


PHP modify_database函数代码示例

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


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

示例1: slideshow_upgrade

function slideshow_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2006112100) {
        table_column('slideshow', '', 'layout', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006092600) {
        table_column('slideshow', '', 'location', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006012600) {
        table_column('slideshow', '', 'filename', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006112700) {
        modify_database('', "CREATE TABLE " . $CFG->prefix . "slideshow_captions (\r\n              id SERIAL PRIMARY KEY,\r\n              slideshow integer NOT NULL default '0',\r\n              image text NOT NULL,\r\n              title text NOT NULL,\r\n              caption text NOT NULL\r\n            )\r\n        ");
    }
    if ($oldversion < 2007070702) {
        table_column('slideshow', '', 'delaytime', 'int', '2', 'unsigned', '7', 'not null', '');
    }
    if ($oldversion < 2007070703) {
        table_column('slideshow', '', 'centred', 'int', '2', 'unsigned', '0', 'not null', '');
        table_column('slideshow', '', 'autobgcolor', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    return true;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:26,代码来源:postgres7.php

示例2: generic_comments_init

function generic_comments_init()
{
    global $CFG, $db, $function, $metatags, $template;
    $metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/generic_comments/generic_comments.js\"><!-- generic_comments js --></script>";
    // create the generic_comments and generic watchlist table
    $tables = $db->Metatables();
    if (!in_array($CFG->prefix . "comments", $tables) || !in_array($CFG->prefix . "watchlist", $tables)) {
        if (file_exists($CFG->dirroot . "mod/generic_comments/{$CFG->dbtype}.sql")) {
            modify_database($CFG->dirroot . "mod/generic_comments/{$CFG->dbtype}.sql");
            //reload system
            header_redirect($CFG->wwwroot);
        } else {
            error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg generic comments.  See the mod/generic_comments directory.");
        }
        print_continue("index.php");
        exit;
    }
    $function['comments:init'][] = $CFG->dirroot . "mod/generic_comments/comments_actions.php";
    $function['permissions:check'][] = $CFG->dirroot . "mod/generic_comments/permissions_check.php";
    // Add annotation support
    display_set_display_annotation_function("file::file", "generic_comments_displayobjectannotations");
    display_set_display_annotation_function("mediastream::media", "generic_comments_displayobjectannotations");
    // Register file river hook (if there)
    if (function_exists('river_save_event')) {
        river_register_friendlyname_hook('file::file', 'generic_comments_get_friendly_name');
    }
    templates_add_context('embeddedcomments', 'mod/generic_comments/comments');
    templates_add_context('embeddedcomment', 'mod/generic_comments/comment');
    templates_add_context('css', 'mod/generic_comments/css', true, false);
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:30,代码来源:lib.php

示例3: messages_init

function messages_init()
{
    global $CFG, $function, $db, $METATABLES;
    if (in_array($CFG->prefix . "messages", $METATABLES)) {
        $messagesTable = $db->MetaColumnNames($CFG->prefix . "messages", true);
        // If dosn't exists adding the colummns 'hidden_from' and 'hidden_to'
        if (!in_array("hidden_from", $messagesTable) || !in_array("hidden_to", $messagesTable)) {
            if (file_exists($CFG->dirroot . "mod/messages/{$CFG->dbtype}.sql")) {
                modify_database($CFG->dirroot . "mod/messages/{$CFG->dbtype}.sql");
            } else {
                error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg messages plug-in.  See the mod/messages directory.");
            }
        }
    }
    // Functions to perform initializacion
    $function['messages:init'][] = $CFG->dirroot . "mod/messages/lib/messages_init.php";
    // Compose / Delete messages
    $function['messages:new'][] = $CFG->dirroot . "mod/messages/lib/messages_new.php";
    $function['messages:new:body'][] = $CFG->dirroot . "mod/tinymce/tinymce_js.php";
    // View a message
    $function['messages:view'][] = $CFG->dirroot . "mod/messages/lib/messages_view.php";
    $function['messages:message:view'][] = $CFG->dirroot . "mod/messages/lib/messages_message_view.php";
    $function['messages:detailedview'][] = $CFG->dirroot . "mod/messages/lib/messages_message_detailedview.php";
    // Sidebar display function
    $function['messages:contact:link'][] = $CFG->dirroot . "/mod/messages/lib/messages_sidebar_link.php";
    $function['users:infobox:menu:text'][] = $CFG->dirroot . "/mod/messages/lib/messages_sidebar_link.php";
    // Inits the display field module param for the 'select' input field
    // I know, I know this is a big cannon to kill a fly, but I want to use the display_input_field function :P
    if (!isset($CFG->display_field_module)) {
        $CFG->display_field_module = array();
    }
    if (!array_key_exists("as_select", $CFG->display_field_module)) {
        $CFG->display_field_module["as_select"] = "messages";
    }
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:35,代码来源:lib.php

示例4: slideshow_upgrade

function slideshow_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2006112100) {
        table_column('slideshow', '', 'layout', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006092600) {
        table_column('slideshow', '', 'location', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006012600) {
        table_column('slideshow', '', 'filename', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    if ($oldversion < 2006120500) {
        modify_database('', "CREATE TABLE `" . $CFG->prefix . "slideshow_captions` (\r\n                    `id` int(10) unsigned NOT NULL auto_increment,\r\n                    `slideshow` int(10) unsigned NOT NULL default '0',\r\n                    `image` text NOT NULL,\r\n                    `title` text NOT NULL,\r\n                    `caption` text NOT NULL,\r\n                    PRIMARY KEY  (`id`),\r\n                    KEY slideshow (slideshow)\r\n                    );\r\n        ");
    }
    if ($oldversion < 2007070702) {
        table_column('slideshow', '', 'delaytime', 'int', '2', 'unsigned', '7', 'not null', '');
    }
    if ($oldversion < 2007070703) {
        table_column('slideshow', '', 'centred', 'int', '2', 'unsigned', '0', 'not null', '');
        table_column('slideshow', '', 'autobgcolor', 'int', '2', 'unsigned', '0', 'not null', '');
    }
    return true;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:26,代码来源:mysql.php

示例5: commentwall_init

/**
 * Comment wall initialisation.
 */
function commentwall_init()
{
    global $CFG, $db, $function, $metatags, $template;
    // Add meta tags
    $metatags .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}mod/commentwall/commentwall.js\"><!-- commentwall js --></script>";
    // Define some templates
    templates_add_context('commentwallobject', 'mod/commentwall/template');
    templates_add_context('commentwallfooter', 'mod/commentwall/footer');
    templates_add_context('css', 'mod/commentwall/css');
    // Set up the database
    $tables = $db->Metatables();
    if (!in_array($CFG->prefix . "commentwall", $tables)) {
        if (file_exists($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql")) {
            modify_database($CFG->dirroot . "mod/commentwall/{$CFG->dbtype}.sql");
            //reload system
            header_redirect($CFG->wwwroot);
        } else {
            error("Error: Your database ({$CFG->dbtype}) is not yet fully supported by the Elgg commentwall. See the mod/commentwall directory.");
        }
        print_continue($CFG->wwwroot);
        exit;
    }
    // Add configuration options
    $function['userdetails:edit:details'][] = $CFG->dirroot . "mod/commentwall/lib/commentwall_settings.php";
}
开发者ID:BackupTheBerlios,项目名称:tulipan-svn,代码行数:28,代码来源:lib.php

示例6: groups_create_database_tables

/**
 * Creates the database tables required
 */
function groups_create_database_tables()
{
    global $CFG;
    if ('mysql' == $CFG->dbfamily) {
        $createcoursegrouptablesql = "CREATE TABLE IF NOT EXISTS `{$CFG->prefix}groups_courses_groups` (\n                            `id` int(10) unsigned NOT NULL auto_increment,\n                            `courseid` int(10) unsigned NOT NULL default '0',\n                            `groupid` int(11) NOT NULL,\n                            PRIMARY KEY  (`id`),\n                            UNIQUE KEY `id` (`id`),\n                            KEY `courseid` (`courseid`)\n                          ) ";
        $creategroupstablesql = "CREATE TABLE IF NOT EXISTS `{$CFG->prefix}groups_groups` (\n                            `id` int(10) unsigned NOT NULL auto_increment,\n                            `name` varchar(254) collate latin1_general_ci NOT NULL default '',\n                            `description` text collate latin1_general_ci NOT NULL,\n                            `enrolmentkey` varchar(50) collate latin1_general_ci NOT NULL default '',\n                            `lang` varchar(10) collate latin1_general_ci NOT NULL default 'en',\n                            `theme` varchar(50) collate latin1_general_ci NOT NULL default '',\n                            `picture` int(10) unsigned NOT NULL default '0',\n                            `hidepicture` int(2) unsigned NOT NULL default '0',\n                            `timecreated` int(10) unsigned NOT NULL default '0',\n                            `timemodified` int(10) unsigned NOT NULL default '0',\n                            PRIMARY KEY  (`id`),\n                            UNIQUE KEY `id` (`id`)\n                          ) ";
        $creategroupsuserstablesql = "CREATE TABLE IF NOT EXISTS `{$CFG->prefix}groups_groups_users` (\n                            `id` int(10) unsigned NOT NULL auto_increment,\n                            `groupid` int(10) unsigned NOT NULL default '0',\n                            `userid` int(10) unsigned NOT NULL default '0',\n                            `timeadded` int(10) unsigned NOT NULL default '0',\n                            PRIMARY KEY  (`id`),\n                            UNIQUE KEY `id` (`id`),\n                            KEY `groupid` (`groupid`),\n                            KEY `userid` (`userid`)\n                          ) ";
        $createcoursesgroupingtablesql = "CREATE TABLE IF NOT EXISTS `{$CFG->prefix}groups_courses_groupings` (\n                            `id` int(10) unsigned NOT NULL auto_increment,\n                            `courseid` int(10) unsigned NOT NULL default '0',\n                            `groupingid` mediumint(9) NOT NULL,\n                            PRIMARY KEY  (`id`),\n                            UNIQUE KEY `id` (`id`),\n                            KEY `courseid` (`courseid`)\n                          ) ";
        $creategroupingstablesql = "CREATE TABLE `{$CFG->prefix}groups_groupings` (\n                            `id` int(10) unsigned NOT NULL auto_increment,\n                            `name` varchar(254) collate latin1_general_ci NOT NULL,\n                            `description` text collate latin1_general_ci NOT NULL default '',\n                            `timecreated` int(10) unsigned NOT NULL default 0,\n                            `viewowngroup` binary(1) NOT NULL default 1,\n                            `viewallgroupsmembers` binary(1) NOT NULL default 0,\n                            `viewallgroupsactivities` binary(1) NOT NULL default 0,\n                            `teachersgroupmark` binary(1) NOT NULL default 0,\n                            `teachersgroupview` binary(1) NOT NULL default 0,\n                            `teachersoverride` binary(1) NOT NULL default 0,\n                            PRIMARY KEY  (`id`),\n                            UNIQUE KEY `id` (`id`)\n                          ) ";
        $creategroupingsgroupstablesql = "CREATE TABLE IF NOT EXISTS `{$CFG->prefix}groups_groupings_groups` (\n                            `id` int(10) unsigned NOT NULL auto_increment,\n                            `groupingid` int(10) unsigned default '0',\n                            `groupid` int(10) NOT NULL,\n                            `timeadded` int(10) unsigned NOT NULL default '0',\n                            PRIMARY KEY  (`id`),\n                            UNIQUE KEY `id` (`id`),\n                            KEY `courseid` (`groupingid`)\n                          ) ";
    } else {
        //postgres7
        $createcoursegrouptablesql = "CREATE TABLE {$CFG->prefix}groups_courses_groups (\n                            id SERIAL PRIMARY KEY,\n                            courseid integer NOT NULL default '0',\n                            groupid integer NOT NULL default '0'\n                          );\n                          CREATE INDEX {$CFG->prefix}groups_courses_groups_courseid_idx ON {$CFG->prefix}groups_courses_groups (courseid);\n                          ";
        //?? CONSTRAINT {$CFG->prefix}groups_courses_groups_id_courseid_uk UNIQUE (id, courseid)
        $creategroupstablesql = "CREATE TABLE {$CFG->prefix}groups_groups (\n                            id SERIAL PRIMARY KEY,\n                            name varchar(255) NOT NULL,\n                            description text NOT NULL default '',\n                            enrolmentkey varchar(50) NOT NULL default '',\n                            lang varchar(10) NOT NULL default 'en',\n                            theme varchar(50) NOT NULL default '',\n                            picture integer NOT NULL default '0',\n                            hidepicture integer NOT NULL default '0',\n                            timecreated integer NOT NULL default '0',\n                            timemodified integer NOT NULL default '0'\n                          ) ";
        $creategroupsuserstablesql = "CREATE TABLE {$CFG->prefix}groups_groups_users (\n                            id SERIAL PRIMARY KEY,\n                            groupid integer NOT NULL default '0',\n                            userid integer NOT NULL default '0',\n                            timeadded integer NOT NULL default '0'\n                          );\n                          CREATE INDEX {$CFG->prefix}groups_groups_users_groupid_idx ON {$CFG->prefix}groups_groups_users (groupid);\n                          CREATE INDEX {$CFG->prefix}groups_groups_users_userid_idx ON {$CFG->prefix}groups_groups_users (userid);\n                          COMMENT ON TABLE {$CFG->prefix}groups_groups_users IS 'New groupings (OU).';\n                          ";
        $createcoursesgroupingtablesql = "CREATE TABLE {$CFG->prefix}groups_courses_groupings (\n                            id SERIAL PRIMARY KEY,\n                            courseid integer NOT NULL default '0',\n                            groupingid integer NOT NULL\n                          );\n                          CREATE INDEX {$CFG->prefix}groups_courses_groupings_courseid_idx ON {$CFG->prefix}groups_courses_groupings (courseid);\n                          COMMENT ON TABLE {$CFG->prefix}groups_courses_groupings IS 'New groupings (OU).';\n                          ";
        $creategroupingstablesql = "CREATE TABLE {$CFG->prefix}groups_groupings (\n                            id SERIAL PRIMARY KEY,\n                            name varchar(254) NOT NULL default,\n                            description text NOT NULL default '',\n                            timecreated integer NOT NULL default 0,\n                            viewowngroup integer NOT NULL default 1,\n                            viewallgroupsmembers integer NOT NULL default 0,\n                            viewallgroupsactivities integer NOT NULL default 0,\n                            teachersgroupmark integer NOT NULL default 0,\n                            teachersgroupview integer NOT NULL default 0,\n                            teachersoverride integer NOT NULL default 0\n                          ) ";
        $creategroupingsgroupstablesql = "CREATE TABLE {$CFG->prefix}groups_groupings_groups (\n                            id SERIAL PRIMARY KEY,\n                            groupingid integer default '0',\n                            groupid integer NOT NULL,\n                            timeadded integer NOT NULL default '0'\n                          );\n                          CREATE INDEX {$CFG->prefix}groups_groupings_groups_groupingid_idx ON {$CFG->prefix}groups_groupings_groups (groupingid);\n                          ";
    }
    modify_database('', $createcoursegrouptablesql);
    modify_database('', $creategroupstablesql);
    modify_database('', $creategroupsuserstablesql);
    modify_database('', $createcoursesgroupingtablesql);
    modify_database('', $creategroupingstablesql);
    modify_database('', $creategroupingsgroupstablesql);
}
开发者ID:veritech,项目名称:pare-project,代码行数:30,代码来源:dbsetup.php

示例7: skype_upgrade

function skype_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    ///no upgrades yet :)
    modify_database('', 'ALTER TABLE prefix_skype ADD `description` TEXT NOT NULL');
    return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:8,代码来源:mysql.php

示例8: resource_upgrade

function resource_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004013101) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'update', 'resource', 'name');");
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('resource', 'add', 'resource', 'name');");
    }
    if ($oldversion < 2004071000) {
        table_column("resource", "", "popup", "text", "", "", "", "", "alltext");
        if ($resources = get_records_select("resource", "type='3' OR type='5'", "", "id, alltext")) {
            foreach ($resources as $resource) {
                $resource->popup = addslashes($resource->alltext);
                $resource->alltext = "";
                if (!update_record("resource", $resource)) {
                    notify("Error updating popup field for resource id = {$resource->id}");
                }
            }
        }
        require_once "{$CFG->dirroot}/course/lib.php";
        rebuild_course_cache();
    }
    if ($oldversion < 2004071300) {
        table_column("resource", "", "options", "varchar", "255", "", "", "", "popup");
    }
    if ($oldversion < 2004071303) {
        table_column("resource", "type", "type", "varchar", "30", "", "", "", "");
        modify_database("", "UPDATE prefix_resource SET type='reference' WHERE type='1';");
        modify_database("", "UPDATE prefix_resource SET type='file', options='frame' WHERE type='2';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='3';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='0' WHERE type='4';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='5';");
        modify_database("", "UPDATE prefix_resource SET type='html' WHERE type='6';");
        modify_database("", "UPDATE prefix_resource SET type='file' WHERE type='7';");
        modify_database("", "UPDATE prefix_resource SET type='text', options='3' WHERE type='8';");
        modify_database("", "UPDATE prefix_resource SET type='directory' WHERE type='9';");
    }
    if ($oldversion < 2004080801) {
        modify_database("", "UPDATE prefix_resource SET alltext=reference,type='html' WHERE type='reference';");
        rebuild_course_cache();
    }
    if ($oldversion < 2004111200) {
        //drop first to avoid conflicts when upgrading
        execute_sql("DROP INDEX {$CFG->prefix}resource_course_idx;", false);
        modify_database('', 'CREATE INDEX prefix_resource_course_idx ON prefix_resource (course);');
    }
    if ($oldversion < 2005041100) {
        // replace wiki-like with markdown
        include_once "{$CFG->dirroot}/lib/wiki_to_markdown.php";
        $wtm = new WikiToMarkdown();
        $wtm->update('resource', 'alltext', 'options');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:56,代码来源:postgres7.php

示例9: qtype_randomsamatch_upgrade

function qtype_randomsamatch_upgrade($oldversion = 0)
{
    global $CFG;
    if ($oldversion < 2006042800) {
        // This is a random questiontype and therefore answers are always shuffled, no need for this field
        modify_database('', 'ALTER TABLE prefix_question_randomsamatch DROP shuffleanswers');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:10,代码来源:mysql.php

示例10: questionnaire_upgrade

function questionnaire_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004021300) {
        # Do something ...
    }
    if ($oldversion < 2004081300) {
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire` ADD `respondenttype` ENUM( \'fullname\', \'anonymous\' ) DEFAULT \'fullname\' NOT NULL AFTER `qtype`');
    }
    if ($oldversion < 2004090700) {
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire` ADD `resp_eligible` ENUM( \'all\', \'students\', \'teachers\' ) DEFAULT \'all\' NOT NULL AFTER `respondenttype`');
    }
    if ($oldversion < 2004090900) {
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire` ADD `opendate` INT( 10 ) NOT NULL AFTER `resp_eligible` , ' . 'ADD `closedate` INT( 10 ) NOT NULL AFTER `opendate`');
    }
    if ($oldversion < 2005021100) {
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire` ADD INDEX ( `sid` )');
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire_survey` ADD INDEX ( `owner` )');
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire_survey` DROP INDEX `name` , ' . 'ADD INDEX `name` ( `name` )');
        questionnaire_upgrade_2005021100();
    }
    if ($oldversion < 2005030100) {
        execute_sql('ALTER TABLE `' . $CFG->prefix . 'questionnaire_attempts` ADD `rid` INT( 10 ) UNSIGNED ' . 'DEFAULT \'0\' NOT NULL AFTER `userid`');
    }
    if ($oldversion < 2005062700) {
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_bool` DROP PRIMARY KEY ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_bool` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_bool` ADD INDEX `response_question` ( `response_id` , `question_id` ) ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_single` DROP PRIMARY KEY ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_single` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_single` ADD INDEX `response_question` ( `response_id` , `question_id` ) ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_rank` DROP PRIMARY KEY ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_rank` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_rank` ADD INDEX `response_question_choice` ( `response_id` , `question_id`, `choice_id` ) ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_text` DROP PRIMARY KEY ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_text` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_text` ADD INDEX `response_question` ( `response_id` , `question_id` ) ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_other` DROP PRIMARY KEY ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_other` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_other` ADD INDEX `response_question_choice` ( `response_id` , `question_id`, `choice_id` ) ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_date` DROP PRIMARY KEY ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_date` ADD `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST ;');
        modify_database('', 'ALTER TABLE `prefix_questionnaire_response_date` ADD INDEX `response_question` ( `response_id` , `question_id` ) ;');
    }
    if ($oldversion < 2006012700) {
        questionnaire_upgrade_2006012700();
    }
    if ($oldversion < 2006031702) {
        questionnaire_upgrade_2006031700();
    }
    return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:54,代码来源:mysql.php

示例11: chat_upgrade

function chat_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2003072100) {
        modify_database("", " INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'report', 'chat', 'name'); ");
    }
    if ($oldversion < 2003072101) {
        table_column("chat", "messages", "keepdays", "integer", "10", "unsigned", "0", "not null");
    }
    if ($oldversion < 2003072102) {
        table_column("chat", "", "studentlogs", "integer", "4", "unsigned", "0", "not null", "keepdays");
    }
    if ($oldversion < 2003072500) {
        table_column("chat", "", "chattime", "integer", "10", "unsigned", "0", "not null", "studentlogs");
        table_column("chat", "", "schedule", "integer", "4", "", "0", "not null", "studentlogs");
    }
    if ($oldversion < 2004022300) {
        table_column("chat_messages", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
        table_column("chat_users", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
    }
    if ($oldversion < 2004042500) {
        include_once "{$CFG->dirroot}/mod/chat/lib.php";
        chat_refresh_events();
    }
    if ($oldversion < 2004043000) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name');");
    }
    if ($oldversion < 2004111200) {
        execute_sql("ALTER TABLE {$CFG->prefix}chat DROP INDEX `course`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX  `chatid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `userid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_messages DROP INDEX `groupid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_users DROP INDEX  `chatid`;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}chat_users DROP INDEX  `groupid`;", false);
        modify_database('', 'ALTER TABLE prefix_chat ADD INDEX `course` (`course`);');
        modify_database('', 'ALTER TABLE prefix_chat_messages ADD INDEX  `chatid` (`chatid`);');
        modify_database('', 'ALTER TABLE prefix_chat_messages ADD INDEX `userid` (`userid`);');
        modify_database('', 'ALTER TABLE prefix_chat_messages ADD INDEX `groupid` (`groupid`);');
        modify_database('', 'ALTER TABLE prefix_chat_users ADD INDEX  `chatid` (`chatid`);');
        modify_database('', 'ALTER TABLE prefix_chat_users ADD INDEX  `groupid` (`groupid`);');
    }
    if ($oldversion < 2005020300) {
        table_column('chat_users', '', 'course', 'integer', '10', 'unsigned', '0', 'not null', '');
        table_column('chat_users', '', 'lang', 'varchar', '10', '', '', 'not null', '');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:50,代码来源:mysql.php

示例12: exercise_upgrade

function exercise_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2003111400) {
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD INDEX (`userid`)");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` DROP INDEX `title`");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`submissionid`)");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_assessments` ADD INDEX (`userid`)");
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_grades` ADD INDEX (`assessmentid`)");
    }
    if ($oldversion < 2003121000) {
        execute_sql(" ALTER TABLE `{$CFG->prefix}exercise_submissions` ADD `late` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0'");
    }
    if ($oldversion < 2004062300) {
        table_column("exercise", "", "gradinggrade", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL", "grade");
        table_column("exercise", "", "assessmentcomps", "INTEGER", "4", "UNSIGNED", "2", "NOT NULL", "usemaximum");
        execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `teacherweight`");
        execute_sql("ALTER TABLE `{$CFG->prefix}exercise` DROP COLUMN `gradingweight`");
    }
    if ($oldversion < 2004090200) {
        table_column("exercise", "", "usepassword", "INTEGER", "4", "UNSIGNED", "0", "NOT NULL");
        table_column("exercise", "", "password", "VARCHAR", "32", "", "", "NOT NULL");
    }
    if ($oldversion < 2004091000) {
        table_column("exercise_assessments", "generalcomment", "generalcomment", "text", "", "", "", "NOT NULL");
        table_column("exercise_assessments", "teachercomment", "teachercomment", "text", "", "", "", "NOT NULL");
    }
    if ($oldversion < 2004100800) {
        include_once "{$CFG->dirroot}/mod/exercise/lib.php";
        exercise_refresh_events();
    }
    if ($oldversion < 2004111200) {
        execute_sql("ALTER TABLE {$CFG->prefix}exercise DROP INDEX course;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_submissions DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_assessments DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_elements DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_rubrics DROP INDEX exerciseid;", false);
        execute_sql("ALTER TABLE {$CFG->prefix}exercise_grades DROP INDEX exerciseid;", false);
        modify_database('', 'ALTER TABLE prefix_exercise ADD INDEX course (course);');
        modify_database('', 'ALTER TABLE prefix_exercise_submissions ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_assessments ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_elements ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_rubrics ADD INDEX exerciseid (exerciseid);');
        modify_database('', 'ALTER TABLE prefix_exercise_grades ADD INDEX exerciseid (exerciseid);');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:50,代码来源:mysql.php

示例13: journal_upgrade

function journal_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    $result = true;
    if ($oldversion < 2003081705) {
        $defaultscale = NULL;
        $defaultscale->courseid = 0;
        $defaultscale->userid = 0;
        $defaultscale->timemodified = time();
        $defaultscale->name = get_string("journalrating2", "journal");
        $defaultscale->scale = get_string("journalrating1", "journal") . "," . get_string("journalrating2", "journal") . "," . get_string("journalrating3", "journal");
        if ($defaultscale->id = insert_record("scale", $defaultscale)) {
            execute_sql("UPDATE {$CFG->prefix}journal SET assessed = '-{$defaultscale->id}'", false);
        } else {
            notify("An error occurred while inserting the default journal scale");
            $result = false;
        }
    }
    if ($oldversion < 2004011400) {
        table_column("journal", "", "introformat", "integer", "2", "", "1", "not null", "intro");
    }
    if ($oldversion < 2004111200) {
        execute_sql("DROP INDEX {$CFG->prefix}journal_course_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}journal_entries_journal_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}journal_entries_userid_idx;", false);
        modify_database('', 'CREATE INDEX prefix_journal_course_idx ON prefix_journal (course);');
        modify_database('', 'CREATE INDEX prefix_journal_entries_journal_idx ON prefix_journal_entries (journal);');
        modify_database('', 'CREATE INDEX prefix_journal_entries_userid_idx ON prefix_journal_entries (userid);');
    }
    if ($oldversion < 2005041100) {
        // replace wiki-like with markdown
        include_once "{$CFG->dirroot}/lib/wiki_to_markdown.php";
        $wtm = new WikiToMarkdown();
        // journal intro
        $wtm->update('journal', 'intro', 'introformat');
        // journal entries
        $sql = "select course from {$CFG->prefix}journal, {$CFG->prefix}journal_entries ";
        $sql .= "where {$CFG->prefix}journal.id = {$CFG->prefix}journal_entries.journal ";
        $sql .= "and {$CFG->prefix}journal_entries.id = ";
        $wtm->update('journal_entries', 'text', 'format', $sql);
    }
    if ($oldversion < 2006092100) {
        table_column('journal_entries', 'comment', 'entrycomment', 'text', '', '', '', 'null');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return $result;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:49,代码来源:postgres7.php

示例14: chat_upgrade

function chat_upgrade($oldversion)
{
    // This function does anything necessary to upgrade
    // older versions to match current functionality
    global $CFG;
    if ($oldversion < 2004022300) {
        table_column("chat_messages", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
        table_column("chat_users", "", "groupid", "integer", "10", "unsigned", "0", "not null", "userid");
    }
    if ($oldversion < 2004042500) {
        include_once "{$CFG->dirroot}/mod/chat/lib.php";
        chat_refresh_events();
    }
    if ($oldversion < 2004043000) {
        modify_database("", "INSERT INTO prefix_log_display (module, action, mtable, field) VALUES ('chat', 'talk', 'chat', 'name');");
    }
    if ($oldversion < 2004111200) {
        //drop them first to avoid collisions with upgrades from 1.4.2+
        execute_sql("DROP INDEX {$CFG->prefix}chat_course_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_chatid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_userid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_groupid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_messages_timemodifiedchatid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_chatid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_userid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_groupid_idx;", false);
        execute_sql("DROP INDEX {$CFG->prefix}chat_users_lastping_idx;", false);
        modify_database('', 'CREATE INDEX prefix_chat_course_idx ON prefix_chat(course);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_chatid_idx ON prefix_chat_messages (chatid);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_userid_idx ON prefix_chat_messages (userid);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_groupid_idx ON prefix_chat_messages (groupid);');
        modify_database('', 'CREATE INDEX prefix_chat_messages_timemodifiedchatid_idx ON prefix_chat_messages(timestamp,chatid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_chatid_idx ON prefix_chat_users (chatid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_userid_idx ON prefix_chat_users (userid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_groupid_idx ON prefix_chat_users (groupid);');
        modify_database('', 'CREATE INDEX prefix_chat_users_lastping_idx ON prefix_chat_users (lastping);');
    }
    if ($oldversion < 2005020300) {
        table_column('chat_users', '', 'course', 'integer', '10', 'unsigned', '0', 'not null', '');
        table_column('chat_users', '', 'lang', 'varchar', '10', '', '', 'not null', '');
    }
    if ($oldversion < 2005031001) {
        // Mass cleanup of bad upgrade scripts
        modify_database('', 'ALTER TABLE prefix_chat_users ALTER course SET NOT NULL');
        modify_database('', 'ALTER TABLE prefix_chat_users ALTER lang SET NOT NULL');
    }
    //////  DO NOT ADD NEW THINGS HERE!!  USE upgrade.php and the lib/ddllib.php functions.
    return true;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:49,代码来源:postgres7.php

示例15: main_upgrade

function main_upgrade($oldversion = 0)
{
    global $CFG, $db, $METATABLES;
    $result = true;
    if ($oldversion < 2007062601) {
        modify_database("", "\n            CREATE TABLE `{$CFG->prefix}extauth_hash` (\n              `id` int(11) NOT NULL auto_increment,\n              `login` varchar(15) NOT NULL default '',\n              `hash` varchar(32) NOT NULL default '',\n              `time` timestamp NOT NULL default CURRENT_TIMESTAMP,\n              PRIMARY KEY (`id`));");
        $METATABLES = $db->Metatables();
        // table added/removed without using modify_database()
        // set initial value for auth config
        set_config('auth', '');
    }
    if ($oldversion < 2007062602) {
        table_column('ponente', 'domicilio', 'domicilio', 'varchar', '255', '', '');
    }
    return $result;
}
开发者ID:BackupTheBerlios,项目名称:yupana,代码行数:16,代码来源:mysql.php


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