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

PHP upgrade_mod_savepoint函数代码示例

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

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



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

示例1: xmldb_lti_upgrade

/**
 * xmldb_lti_upgrade is the function that upgrades
 * the lti module database when is needed
 *
 * This function is automaticly called when version number in
 * version.php changes.
 *
 * @param int $oldversion New old version number.
 *
 * @return boolean
 */
function xmldb_lti_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    if ($oldversion < 2014060201) {
        // Changing type of field grade on table lti to int.
        $table = new xmldb_table('lti');
        $field = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '100', 'instructorchoiceacceptgrades');
        // Launch change of type for field grade.
        $dbman->change_field_type($table, $field);
        // Lti savepoint reached.
        upgrade_mod_savepoint(true, 2014060201, 'lti');
    }
    return true;
}
开发者ID:abhilash1994,项目名称:moodle,代码行数:38,代码来源:upgrade.php


示例2: xmldb_scormcloud_upgrade

/**
 * xmldb_scormcloud_upgrade
 *
 * @param int $oldversion
 * @return bool
 */
function xmldb_scormcloud_upgrade($oldversion)
{
    global $DB;
    global $CFG;
    $dbman = $DB->get_manager();
    $module = new stdClass();
    require $CFG->dirroot . '/mod/scormcloud/version.php';
    $result = true;
    if ($result && $oldversion < 2011100700) {
        $table = new xmldb_table('scormcloud');
        $field = new xmldb_field('cloudid', XMLDB_TYPE_CHAR, '255', null, 'XMLDB_NULL', null, null, 'id');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        $rs = $DB->get_recordset('scormcloud');
        foreach ($rs as $record) {
            if (!isset($record->cloudid) || empty($record->cloudid)) {
                $record->cloudid = $record->id;
                $DB->update_record('scormcloud', $record, true);
            }
        }
        $rs->close();
        $field->setNotNull();
        $dbman->change_field_notnull($table, $field);
    }
    upgrade_mod_savepoint($result, $module->version, 'scormcloud');
    return $result;
}
开发者ID:mofet,项目名称:SCORMCloud_MoodleModule,代码行数:34,代码来源:upgrade.php


示例3: xmldb_trainingevent_upgrade

function xmldb_trainingevent_upgrade($oldversion)
{
    global $CFG, $DB;
    $result = true;
    $dbman = $DB->get_manager();
    if ($oldversion < 2011111701) {
        // Define table trainingevent_users to be created.
        $table = new xmldb_table('trainingevent_users');
        // Adding fields to table trainingevent_users.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('userid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
        $table->add_field('trainingeventid', XMLDB_TYPE_INTEGER, '20', XMLDB_UNSIGNED, null, null, null);
        // Adding keys to table trainingevent_users.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        // Conditionally launch create table for trainingevent_users.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        // Label savepoint reached.
        upgrade_mod_savepoint(true, 2011111701, 'trainingevent');
    }
    if ($oldversion < 2014012301) {
        // Define field approvaltype to be added to trainingevent.
        $table = new xmldb_table('trainingevent');
        $field = new xmldb_field('approvaltype', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'classroomid');
        // Conditionally launch add field approvaltype.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Trainingevent savepoint reached.
        upgrade_mod_savepoint(true, 2014012301, 'trainingevent');
    }
    return $result;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:34,代码来源:upgrade.php


示例4: xmldb_survey_upgrade

function xmldb_survey_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    //===== 1.9.0 upgrade line ======//
    if ($oldversion < 2009042002) {
        /// Define field introformat to be added to survey
        $table = new xmldb_table('survey');
        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
        /// Conditionally launch add field introformat
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // conditionally migrate to html format in intro
        if ($CFG->texteditors !== 'textarea') {
            $rs = $DB->get_recordset('survey', array('introformat' => FORMAT_MOODLE), '', 'id,intro,introformat');
            foreach ($rs as $s) {
                $s->intro = text_to_html($s->intro, false, false, true);
                $s->introformat = FORMAT_HTML;
                $DB->update_record('survey', $s);
                upgrade_set_timeout();
            }
            $rs->close();
        }
        /// survey savepoint reached
        upgrade_mod_savepoint(true, 2009042002, 'survey');
    }
    return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:29,代码来源:upgrade.php


示例5: xmldb_choice_upgrade

function xmldb_choice_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    if ($oldversion < 2014051201) {
        // Define field allowmultiple to be added to choice.
        $table = new xmldb_table('choice');
        $field = new xmldb_field('allowmultiple', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'allowupdate');
        // Conditionally launch add field allowmultiple.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Choice savepoint reached.
        upgrade_mod_savepoint(true, 2014051201, 'choice');
    }
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:upgrade.php


示例6: xmldb_workshop_upgrade

/**
 * Performs upgrade of the database structure and data
 *
 * Workshop supports upgrades from version 1.9.0 and higher only. During 1.9 > 2.0 upgrade,
 * there are significant database changes.
 *
 * @param int $oldversion the version we are upgrading from
 * @return bool result
 */
function xmldb_workshop_upgrade($oldversion)
{
    global $CFG, $DB;
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v3.0.0 release upgrade line.
    // Put any upgrade step following this.
    $dbman = $DB->get_manager();
    if ($oldversion < 2016022200) {
        // Add field submissionfiletypes to the table workshop.
        $table = new xmldb_table('workshop');
        $field = new xmldb_field('submissionfiletypes', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'nattachments');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Add field overallfeedbackfiletypes to the table workshop.
        $field = new xmldb_field('overallfeedbackfiletypes', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'overallfeedbackfiles');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        upgrade_mod_savepoint(true, 2016022200, 'workshop');
    }
    // Moodle v3.1.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:37,代码来源:upgrade.php


示例7: xmldb_choicegroup_upgrade

function xmldb_choicegroup_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2013070900) {
        if ($oldversion < 2012042500) {
            /// remove the no longer needed choicegroup_answers DB table
            $choicegroup_answers = new xmldb_table('choicegroup_answers');
            $dbman->drop_table($choicegroup_answers);
            /// change the choicegroup_options.text (text) field as choicegroup_options.groupid (int)
            $choicegroup_options = new xmldb_table('choicegroup_options');
            $field_text = new xmldb_field('text', XMLDB_TYPE_TEXT, 'small', null, null, null, null, 'choicegroupid');
            $field_groupid = new xmldb_field('groupid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0', 'choicegroupid');
            $dbman->rename_field($choicegroup_options, $field_text, 'groupid');
            $dbman->change_field_type($choicegroup_options, $field_groupid);
        }
        // Define table choicegroup to be created
        $table = new xmldb_table('choicegroup');
        // Adding fields to table choicegroup
        $newField = $table->add_field('multipleenrollmentspossible', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
        $dbman->add_field($table, $newField);
        upgrade_mod_savepoint(true, 2013070900, 'choicegroup');
    }
    if ($oldversion < 2015022301) {
        $table = new xmldb_table('choicegroup');
        // Adding field to table choicegroup
        $newField = $table->add_field('sortgroupsby', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
        if (!$dbman->field_exists($table, $newField)) {
            $dbman->add_field($table, $newField);
        }
        upgrade_mod_savepoint(true, 2015022301, 'choicegroup');
    }
    return true;
}
开发者ID:adamtppaw,项目名称:moodle-mod_choicegroup,代码行数:34,代码来源:upgrade.php


示例8: xmldb_survey_upgrade

function xmldb_survey_upgrade($oldversion)
{
    global $DB;
    $dbman = $DB->get_manager();
    // Loads ddl manager and xmldb classes.
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v3.0.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v3.1.0 release upgrade line.
    // Put any upgrade step following this.
    if ($oldversion < 2016061400) {
        // Define field completionsubmit to be added to survey.
        $table = new xmldb_table('survey');
        $field = new xmldb_field('completionsubmit', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'questions');
        // Conditionally launch add field completionsubmit.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Survey savepoint reached.
        upgrade_mod_savepoint(true, 2016061400, 'survey');
    }
    return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:26,代码来源:upgrade.php


示例9: xmldb_label_upgrade

function xmldb_label_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    $result = true;
    //===== 1.9.0 upgrade line ======//
    if ($oldversion < 2007101510) {
        $sql = "UPDATE {log_display} SET mtable = 'label' WHERE module = 'label'";
        $result = $DB->execute($sql);
        upgrade_mod_savepoint($result, 2007101510, 'label');
    }
    if ($result && $oldversion < 2009042200) {
        /// Rename field content on table label to intro
        $table = new xmldb_table('label');
        $field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
        /// Launch rename field content
        $dbman->rename_field($table, $field, 'intro');
        /// label savepoint reached
        upgrade_mod_savepoint($result, 2009042200, 'label');
    }
    if ($result && $oldversion < 2009042201) {
        /// Define field introformat to be added to label
        $table = new xmldb_table('label');
        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '4', 'intro');
        /// Launch add field introformat
        $dbman->add_field($table, $field);
        /// label savepoint reached
        upgrade_mod_savepoint($result, 2009042201, 'label');
    }
    return $result;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:upgrade.php


示例10: xmldb_label_upgrade

function xmldb_label_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    //===== 1.9.0 upgrade line ======//
    if ($oldversion < 2009042200) {
        /// Rename field content on table label to intro
        $table = new xmldb_table('label');
        $field = new xmldb_field('content', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
        /// Launch rename field content
        $dbman->rename_field($table, $field, 'intro');
        /// label savepoint reached
        upgrade_mod_savepoint(true, 2009042200, 'label');
    }
    if ($oldversion < 2009042201) {
        /// Define field introformat to be added to label
        $table = new xmldb_table('label');
        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0', 'intro');
        /// Launch add field introformat
        $dbman->add_field($table, $field);
        // all existing lables in 1.9 are in HTML format
        $DB->set_field('label', 'introformat', FORMAT_HTML, array());
        /// label savepoint reached
        upgrade_mod_savepoint(true, 2009042201, 'label');
    }
    // Moodle v2.1.0 release upgrade line
    // Put any upgrade step following this
    return true;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:29,代码来源:upgrade.php


示例11: xmldb_glossary_upgrade

function xmldb_glossary_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.
    if ($oldversion < 2015060200) {
        // Define field showtabs to be added to glossary_formats.
        $table = new xmldb_table('glossary_formats');
        $field = new xmldb_field('showtabs', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'showgroup');
        // Conditionally launch add field showtabs.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Glossary savepoint reached.
        upgrade_mod_savepoint(true, 2015060200, 'glossary');
    }
    // Moodle v3.0.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v3.1.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:25,代码来源:upgrade.php


示例12: xmldb_assignment_upgrade

function xmldb_assignment_upgrade($oldversion) {
    global $CFG, $DB, $OUTPUT;

    $dbman = $DB->get_manager();


    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this

    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this


    if ($oldversion < 2012061701) {
        // Fixed/updated numfiles field in assignment_submissions table to count the actual
        // number of files has been uploaded when sendformarking is disabled
        upgrade_set_timeout(600);  // increase excution time for in large sites
        $fs = get_file_storage();

        // Fetch the moduleid for use in the course_modules table
        $moduleid = $DB->get_field('modules', 'id', array('name' => 'assignment'), MUST_EXIST);

        $selectcount = 'SELECT COUNT(s.id) ';
        $select      = 'SELECT s.id, cm.id AS cmid ';
        $query       = 'FROM {assignment_submissions} s
                        JOIN {assignment} a ON a.id = s.assignment
                        JOIN {course_modules} cm ON a.id = cm.instance AND cm.module = :moduleid
                        WHERE assignmenttype = :assignmenttype';

        $params = array('moduleid' => $moduleid, 'assignmenttype' => 'upload');

        $countsubmissions = $DB->count_records_sql($selectcount.$query, $params);
        $submissions = $DB->get_recordset_sql($select.$query, $params);

        $pbar = new progress_bar('assignmentupgradenumfiles', 500, true);
        $i = 0;
        foreach ($submissions as $sub) {
            $i++;
            if ($context = context_module::instance($sub->cmid)) {
                $sub->numfiles = count($fs->get_area_files($context->id, 'mod_assignment', 'submission', $sub->id, 'sortorder', false));
                $DB->update_record('assignment_submissions', $sub);
            }
            $pbar->update($i, $countsubmissions, "Counting files of submissions ($i/$countsubmissions)");
        }
        $submissions->close();

        // assignment savepoint reached
        upgrade_mod_savepoint(true, 2012061701, 'assignment');
    }

    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this


    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.


    return true;
}
开发者ID:verbazend,项目名称:AWFA,代码行数:60,代码来源:upgrade.php


示例13: xmldb_mediaboard_upgrade

function xmldb_mediaboard_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $DB;
    $result = true;
    $dbman = $DB->get_manager();
    if ($oldversion < 2015030200) {
        // Define table assign_user_mapping to be created.
        $table = new xmldb_table('mediaboard_likes');
        // Adding fields to table assign_user_mapping.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('instance', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
        $table->add_field('fileid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
        $table->add_field('time', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
        // Adding keys to table assign_user_mapping.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->add_key('user', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
        // Conditionally launch create table for assign_user_mapping.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        // Assign savepoint reached.
        upgrade_mod_savepoint(true, 2015030200, 'mediaboard');
    }
    return $result;
}
开发者ID:e-rasvet,项目名称:mediaboard,代码行数:26,代码来源:upgrade.php


示例14: xmldb_recordingsbn_upgrade

/**
 * Execute recordingsbn upgrade from the given old version
 *
 * @param int $oldversion
 * @return bool
 */
function xmldb_recordingsbn_upgrade($oldversion)
{
    global $DB;
    $dbman = $DB->get_manager();
    // loads ddl manager and xmldb classes
    if ($oldversion < 2012040200) {
        // Define field intro to be droped from recordingsbn
        $table = new xmldb_table('recordingsbn');
        $field = new xmldb_field('intro', XMLDB_TYPE_TEXT, 'medium', null, null, null, null, 'name');
        // Drop field intro
        if ($dbman->field_exists($table, $field)) {
            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
        }
        // Define field introformat to be droped from recordingsbn
        $table = new xmldb_table('recordingsbn');
        $field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
        // Add field introformat
        if ($dbman->field_exists($table, $field)) {
            $dbman->drop_field($table, $field, $continue = true, $feedback = true);
        }
        // Once we reach this point, we can store the new version and consider the module
        // upgraded to the version 2012040200 so the next time this block is skipped
        upgrade_mod_savepoint(true, 2012040200, 'recordingsbn');
    }
    // Final return of upgrade result (true, all went good) to Moodle.
    return true;
}
开发者ID:rrusso,项目名称:moodle-mod_bigbluebutton,代码行数:33,代码来源:upgrade.php


示例15: xmldb_glossary_upgrade

function xmldb_glossary_upgrade($oldversion)
{
    global $CFG, $DB, $OUTPUT;
    $dbman = $DB->get_manager();
    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this
    if ($oldversion < 2012022000) {
        // Define field approvaldisplayformat to be added to glossary
        $table = new xmldb_table('glossary');
        $field = new xmldb_field('approvaldisplayformat', XMLDB_TYPE_CHAR, '50', null, XMLDB_NOTNULL, null, 'default', 'defaultapproval');
        // Conditionally launch add field approvaldisplayformat
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // glossary savepoint reached
        upgrade_mod_savepoint(true, 2012022000, 'glossary');
    }
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:27,代码来源:upgrade.php


示例16: xmldb_opencast_upgrade

function xmldb_opencast_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2013120100) {
        // Define fields to be added to table opencast
        $table = new xmldb_table('opencast');
        $field1 = new xmldb_field('userupload', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'inviting');
        $field2 = new xmldb_field('userupload_maxfilesize', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'userupload');
        // Conditionally launch add fields
        if (!$dbman->field_exists($table, $field1)) {
            $dbman->add_field($table, $field1);
        }
        if (!$dbman->field_exists($table, $field2)) {
            $dbman->add_field($table, $field2);
        }
        upgrade_mod_savepoint(true, 2013120100, 'mod', 'opencast');
    }
    if ($oldversion < 2013121600) {
        $table2 = new xmldb_table('opencast_uploadedclip');
        if (!$dbman->table_exists($table2)) {
            $dbman->install_one_table_from_xmldb_file($CFG->dirroot . '/mod/opencast/db/install.xml', 'opencast_uploadedclip');
        }
        upgrade_mod_savepoint(true, 2013121600, 'mod', 'opencast');
    }
    if ($oldversion < 2015070100) {
        // Define table matrix to be created
        $table = new xmldb_table('opencast');
        // Adding fields to table matrix
        $newField = $table->add_field('allow_annotations', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
        $dbman->add_field($table, $newField);
        upgrade_plugin_savepoint(true, 2015070100, 'mod', 'opencast');
    }
    return true;
}
开发者ID:ndunand,项目名称:moodle-mod_opencast,代码行数:35,代码来源:upgrade.php


示例17: xmldb_customlabel_upgrade

function xmldb_customlabel_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $DB;
    $result = true;
    $dbman = $DB->get_manager();
    //===== 1.9.0 upgrade line ======//
    if ($result && $oldversion < 2012062401) {
        // Define field fallbacktype to be added to customlabel.
        $table = new xmldb_table('customlabel');
        $field = new xmldb_field('fallbacktype');
        $field->set_attributes(XMLDB_TYPE_CHAR, '32', null, null, null, null, 'labelclass');
        // Launch add field parent.
        $result = $result || $dbman->add_field($table, $field);
        // customlabel savepoint reached.
        upgrade_mod_savepoint($result, 2012062401, 'customlabel');
    }
    if ($result && $oldversion < 2013041802) {
        // Regenerates all contents to match template changes.
        $sql = "\n            SELECT DISTINCT\n                c.id,\n                c.shortname,\n                c.fullname,\n                c.idnumber,\n                c.summary,\n                c.category,\n                c.summaryformat\n            FROM\n                {course} c,\n                {course_modules} cm,\n                {modules} m\n            WHERE\n                c.id = cm.course AND\n                cm.module = m.id AND\n                m.name = 'customlabel'\n        ";
        $courses = $DB->get_records_sql($sql);
        if ($courses) {
            echo '<pre>';
            foreach ($courses as $c) {
                customlabel_course_preprocess_filepickers($c);
                customlabel_course_regenerate($c, 'all');
            }
            echo '</pre>';
        }
        upgrade_mod_savepoint($result, 2013041802, 'customlabel');
    }
    return $result;
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:32,代码来源:upgrade.php


示例18: xmldb_openmeetings_upgrade

function xmldb_openmeetings_upgrade($oldversion)
{
    global $CFG, $DB, $OUTPUT;
    $dbman = $DB->get_manager();
    $result = true;
    if ($oldversion < 20111001) {
        // Define field allow_recording to be added to openmeetings
        $table = new xmldb_table('openmeetings');
        $field = new xmldb_field('allow_recording', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'room_recording_id');
        // Conditionally launch add field allow_recording
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // openmeetings savepoint reached
        upgrade_mod_savepoint(true, 20111001, 'openmeetings');
    }
    if ($oldversion < 20111002) {
        // Define field introformat to be dropped from openmeetings
        $table = new xmldb_table('openmeetings');
        $field = new xmldb_field('introformat');
        // Conditionally launch drop field introformat
        if ($dbman->field_exists($table, $field)) {
            $dbman->drop_field($table, $field);
        }
        // openmeetings savepoint reached
        upgrade_mod_savepoint(true, 20111002, 'openmeetings');
    }
    if ($oldversion == 20111002) {
        //$result = false;
        //nothing to upgrade here
    }
    return $result;
}
开发者ID:Neseek77,项目名称:openmeetings,代码行数:33,代码来源:upgrade.php


示例19: xmldb_label_upgrade

function xmldb_label_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // Moodle v2.2.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.3.0 release upgrade line
    // Put any upgrade step following this
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this
    if ($oldversion < 2013021400) {
        // find all courses that contain labels and reset their cache
        $modid = $DB->get_field_sql("SELECT id FROM {modules} WHERE name=?", array('label'));
        if ($modid) {
            $courses = $DB->get_fieldset_sql('SELECT DISTINCT course ' . 'FROM {course_modules} WHERE module=?', array($modid));
            foreach ($courses as $courseid) {
                rebuild_course_cache($courseid, true);
            }
        }
        // label savepoint reached
        upgrade_mod_savepoint(true, 2013021400, 'label');
    }
    // Moodle v2.5.0 release upgrade line.
    // Put any upgrade step following this.
    // Moodle v2.6.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:28,代码来源:upgrade.php


示例20: xmldb_local_enrolmentreminder_upgrade

function xmldb_local_enrolmentreminder_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2014051501) {
        // Define field leadtime to be added to enrolmentreminder.
        $table = new xmldb_table('enrolmentreminder');
        $field = new xmldb_field('leadtime', XMLDB_TYPE_INTEGER, '7', null, XMLDB_NOTNULL, null, '259200', 'tmpltext');
        // Conditionally launch add field leadtime.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Enrolmentreminder savepoint reached.
        upgrade_plugin_savepoint(true, '2014051501', 'local', 'enrolmentreminder');
    }
    if ($oldversion < 2014072200) {
        // Changing type of field tmpltext on table enrolmentreminder to text.
        $table = new xmldb_table('enrolmentreminder');
        $field = new xmldb_field('tmpltext', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'courseid');
        // Launch change of type for field tmpltext.
        $dbman->change_field_type($table, $field);
        // Enrolmentreminder savepoint reached.
        upgrade_mod_savepoint(true, 2014072200, 'enrolmentreminder');
    }
    return true;
}
开发者ID:advancingdesign,项目名称:moodle-local_enrolmentreminder,代码行数:26,代码来源:upgrade.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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