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

PHP upgrade_block_savepoint函数代码示例

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

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



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

示例1: xmldb_block_recent_activity_upgrade

/**
 * Upgrade code for the recent activity block.
 *
 * @global moodle_database $DB
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_recent_activity_upgrade($oldversion, $block)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    // loads ddl manager and xmldb classes
    if ($oldversion < 2014012000) {
        // Define table block_recent_activity to be created.
        $table = new xmldb_table('block_recent_activity');
        // Adding fields to table block_recent_activity.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('courseid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('cmid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('action', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null);
        $table->add_field('modname', XMLDB_TYPE_CHAR, '20', null, null, null, null);
        // Adding keys to table block_recent_activity.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        // Adding indexes to table block_recent_activity.
        $table->add_index('coursetime', XMLDB_INDEX_NOTUNIQUE, array('courseid', 'timecreated'));
        // Conditionally launch create table for block_recent_activity.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
            // Insert dummy log record for each existing course to notify that their logs need to be migrated.
            $DB->execute('INSERT INTO {block_recent_activity} (timecreated, userid, courseid, cmid, action) ' . 'SELECT ?, 0, id, 0, 3 FROM {course}', array(time()));
        }
        // Recent_activity savepoint reached.
        upgrade_block_savepoint(true, 2014012000, 'recent_activity');
    }
    // Moodle v2.7.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:40,代码来源:upgrade.php


示例2: xmldb_block_rss_client_upgrade

/**
 * Upgrade the block_rss_client database.
 *
 * @param int $oldversion The version number of the plugin that was installed.
 * @return boolean
 */
function xmldb_block_rss_client_upgrade($oldversion)
{
    global $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2015071700) {
        // Support for skipping RSS feeds for a while when they fail.
        $table = new xmldb_table('block_rss_client');
        // How many seconds we are currently ignoring this RSS feed for (due to an error).
        $field = new xmldb_field('skiptime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'url');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // When to next update this RSS feed.
        $field = new xmldb_field('skipuntil', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'skiptime');
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        upgrade_block_savepoint(true, 2015071700, 'rss_client');
    }
    // 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,代码行数:31,代码来源:upgrade.php


示例3: xmldb_block_rcommon_upgrade

function xmldb_block_rcommon_upgrade($oldversion)
{
    global $DB, $OUTPUT;
    if ($oldversion < 2014070300) {
        $local_version = $DB->get_field('config_plugins', 'value', array('name' => 'version', 'plugin' => 'local_rcommon'));
        if (!$local_version) {
            //Local not installed
            try {
                $version = $DB->get_field('block', 'version', array('name' => 'rcommon'));
            } catch (Exception $e) {
                $version = false;
            }
            if (!$version) {
                $version = $DB->get_field('config_plugins', 'value', array('name' => 'version', 'plugin' => 'block_rcommon'));
            }
            if ($version) {
                $new_version = new StdClass();
                $new_version->name = 'version';
                $new_version->plugin = 'local_rcommon';
                $new_version->value = $version;
                $DB->insert_record('config_plugins', $new_version);
            }
        }
        // Savepoint reached.
        upgrade_block_savepoint(true, 2014070300, 'rcommon');
    }
    echo $OUTPUT->notification('Now you can uninstall block/rcommon by erasing the directory', 'notifysuccess');
    return true;
}
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:29,代码来源:upgrade.php


示例4: xmldb_block_tts_upgrade

/**
 * This function is run when the plugin have to be updated
 * @global stdClass $CFG
 * @global moodle_database $DB
 * @param int $oldversion The older version of the plugin installed on the moodle
 * @return boolean True if the update passed successfully
 */
function xmldb_block_tts_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2012101800) {
        // Define table block_tts to be renamed to NEWNAMEGOESHERE
        $table = new xmldb_table('tts');
        $table2 = new xmldb_table('tts_lexicon');
        // Launch rename table for block_tts
        $dbman->rename_table($table, 'block_tts');
        $dbman->rename_table($table2, 'block_tts_lexicon');
        // tts savepoint reached
        upgrade_block_savepoint(true, 2012101800, 'tts');
    }
    if ($oldversion < 2012102900) {
        // Correction on the wrong table name
        upgrade_block_savepoint(true, 2012102900, 'tts');
    }
    if ($oldversion < 2012110500) {
        // Fixed language string issue
        upgrade_block_savepoint(true, 2012110500, 'tts');
    }
    if ($oldversion < 2012121000) {
        //Update logo for Moodle 2.4
        upgrade_block_savepoint(true, 2012121000, 'tts');
    }
    if ($oldversion < 2012121400) {
        //Update capabilities for Moodle 2.4
        upgrade_block_savepoint(true, 2012121400, 'tts');
    }
    return true;
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:39,代码来源:upgrade.php


示例5: xmldb_block_roomscheduler_upgrade

/**
 *
 * @since 2.0
 * @package blocks
 * @copyright 2011 Dustin Durand
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
function xmldb_block_roomscheduler_upgrade($oldversion)
{
    global $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2011150301) {
        $timenow = time();
        $sysctx = get_context_instance(CONTEXT_SYSTEM);
        /// Fully setup the Elluminate Moderator role.
        if (!($mrole = $DB->get_record('role', array('shortname' => 'roomschedulermanager')))) {
            if ($rid = create_role(get_string('roomschedulermanager', 'block_roomscheduler'), 'roomschedulemanager', get_string('roomschedulermanagerdescription', 'block_roomscheduler'))) {
                $mrole = $DB->get_record('role', array('id' => $rid));
                assign_capability('block/roomscheduler:manage', CAP_ALLOW, $mrole->id, $sysctx->id);
                set_role_contextlevels($mrole->id, array(CONTEXT_SYSTEM));
            } else {
                $mrole = $DB->get_record('role', array('shortname' => 'roomschedulermanager'));
                set_role_contextlevels($mrole->id, array(CONTEXT_SYSTEM));
            }
        }
        upgrade_block_savepoint(true, 2011150301, 'roomscheduler');
    }
    if ($oldversion < 2011140315) {
        // Define field reservable to be added to roomscheduler_rooms
        $table = new xmldb_table('roomscheduler_rooms');
        $field = new xmldb_field('reservable', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'active');
        // Conditionally launch add field reservable
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        upgrade_block_savepoint(true, 2011140315, 'roomscheduler');
    }
    return true;
}
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:39,代码来源:upgrade.php


示例6: xmldb_block_iomad_approve_access_upgrade

/**
 *
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_iomad_approve_access_upgrade($oldversion)
{
    global $CFG, $DB;
    $result = true;
    $dbman = $DB->get_manager();
    if ($oldversion < 2013061100) {
        // Define field companyid to be added to block_iomad_approve_access.
        $table = new xmldb_table('block_iomad_approve_access');
        $field = new xmldb_field('companyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null, 'userid');
        // Conditionally launch add field companyid.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Iomad_approve_access savepoint reached.
        upgrade_block_savepoint(true, 2013061100, 'iomad_approve_access');
    }
    if ($oldversion < 2013071000) {
        // Define field activityid to be added to block_iomad_approve_access.
        $table = new xmldb_table('block_iomad_approve_access');
        $field = new xmldb_field('activityid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'courseid');
        // Conditionally launch add field activityid.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Iomad_approve_access savepoint reached.
        upgrade_block_savepoint(true, 2013071000, 'iomad_approve_access');
    }
    return true;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:34,代码来源:upgrade.php


示例7: xmldb_block_community_upgrade

/**
 *
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_community_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2010042701) {
        /// Define table block_community to be created
        $table = new xmldb_table('block_community');
        /// Adding fields to table block_community
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null);
        $table->add_field('coursename', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
        $table->add_field('coursedescription', XMLDB_TYPE_TEXT, 'big', null, null, null, null);
        $table->add_field('courseurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
        $table->add_field('imageurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
        /// Adding keys to table block_community
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        /// Conditionally launch create table for block_community
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        /// community savepoint reached
        upgrade_block_savepoint(true, 2010042701, 'community');
    }
    return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:30,代码来源:upgrade.php


示例8: xmldb_block_section_links_upgrade

/**
 * Upgrade code for the section links block.
 *
 * @global moodle_database $DB
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_section_links_upgrade($oldversion, $block)
{
    global $DB;
    // 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 < 2013012200.0) {
        // The section links block used to use its own crazy plugin name.
        // Here we are converting it to the proper component name.
        $oldplugin = 'blocks/section_links';
        $newplugin = 'block_section_links';
        // Use the proper API here... thats what we should be doing as it ensures any caches etc are cleared
        // along the way!
        // It may be quicker to just write an SQL statement but that would be reckless.
        $config = get_config($oldplugin);
        if (!empty($config)) {
            foreach ($config as $name => $value) {
                set_config($name, $value, $newplugin);
                unset_config($name, $oldplugin);
            }
        }
        // Main savepoint reached.
        upgrade_block_savepoint(true, 2013012200.0, 'section_links');
    }
    // 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.
    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.
    return true;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:42,代码来源:upgrade.php


示例9: xmldb_block_html_upgrade

/**
 *
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_html_upgrade($oldversion)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2010071900) {
        $params = array();
        $sql = "SELECT * FROM {block_instances} b WHERE b.blockname = :blockname";
        $params['blockname'] = 'html';
        $rs = $DB->get_recordset_sql($sql, $params);
        foreach ($rs as $record) {
            $config = unserialize(base64_decode($record->configdata));
            if (!empty($config) && is_object($config)) {
                if (!empty($config->text) && is_array($config->text)) {
                    // fix bad data
                    $data = clone $config;
                    $config->text = $data->text['text'];
                    $config->format = $data->text['format'];
                    $record->configdata = base64_encode(serialize($config));
                    $DB->update_record('block_instances', $record);
                } else {
                    if (empty($config->format)) {
                        // add format parameter to 1.9
                        $config->format = FORMAT_HTML;
                        $record->configdata = base64_encode(serialize($config));
                        $DB->update_record('block_instances', $record);
                    }
                }
            }
        }
        $rs->close();
        /// html block savepoint reached
        upgrade_block_savepoint(true, 2010071900, 'html');
    }
    return true;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:40,代码来源:upgrade.php


示例10: xmldb_block_completionstatus_upgrade

/**
 * Handles upgrading instances of this block.
 *
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_completionstatus_upgrade($oldversion, $block)
{
    global $DB;
    // Moodle v2.4.0 release upgrade line
    // Put any upgrade step following this.
    if ($oldversion < 2012112901) {
        // Get the instances of this block.
        if ($blocks = $DB->get_records('block_instances', array('blockname' => 'completionstatus', 'pagetypepattern' => 'my-index'))) {
            // Loop through and remove them from the My Moodle page.
            foreach ($blocks as $block) {
                blocks_delete_instance($block);
            }
        }
        // Savepoint reached.
        upgrade_block_savepoint(true, 2012112901, 'completionstatus');
    }
    // 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.
    // 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.
    return true;
}
开发者ID:alanaipe2015,项目名称:moodle,代码行数:36,代码来源:upgrade.php


示例11: xmldb_block_calendar_month_upgrade

/**
 * Upgrade the calendar_month block
 * @param int $oldversion
 * @param object $block
 */
function xmldb_block_calendar_month_upgrade($oldversion, $block)
{
    global $DB;
    if ($oldversion < 2014062600) {
        // Add this block the default blocks on /my.
        $blockname = 'calendar_month';
        // Do not try to add the block if we cannot find the default my_pages entry.
        // Private => 1 refers to MY_PAGE_PRIVATE.
        if ($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => 1))) {
            $page = new moodle_page();
            $page->set_context(context_system::instance());
            // Check to see if this block is already on the default /my page.
            $criteria = array('blockname' => $blockname, 'parentcontextid' => $page->context->id, 'pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id);
            if (!$DB->record_exists('block_instances', $criteria)) {
                // Add the block to the default /my.
                $page->blocks->add_region(BLOCK_POS_RIGHT);
                $page->blocks->add_block($blockname, BLOCK_POS_RIGHT, 0, false, 'my-index', $systempage->id);
            }
        }
        upgrade_block_savepoint(true, 2014062600, $blockname);
    }
    // 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.
    return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:36,代码来源:upgrade.php


示例12: xmldb_block_search_upgrade

function xmldb_block_search_upgrade($oldversion)
{
    global $CFG, $DB;
    require 'upgradelib.php';
    $result = TRUE;
    $dbman = $DB->get_manager();
    if ($oldversion < 2010101800) {
        // See MDL-24374
        // Changing type of field docdate on table block_search_documents to int
        // Changing type of field updated on table block_search_documents to int
        $table = new xmldb_table('block_search_documents');
        $field_docdate_new = new xmldb_field('docdate_new', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'docdate');
        $field_updated_new = new xmldb_field('updated_new', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'updated');
        $field_docdate_old = new xmldb_field('docdate');
        $field_updated_old = new xmldb_field('updated');
        // Conditionally launch add temporary fields
        if (!$dbman->field_exists($table, $field_docdate_new)) {
            $dbman->add_field($table, $field_docdate_new);
        }
        if (!$dbman->field_exists($table, $field_updated_new)) {
            $dbman->add_field($table, $field_updated_new);
        }
        $sql = "SELECT id, docdate, updated FROM {block_search_documents}";
        $search_documents = $DB->get_records_sql($sql);
        if ($search_documents) {
            foreach ($search_documents as $sd) {
                $sd->docdate_new = convert_datetime_upgrade($sd->docdate);
                $sd->updated_new = convert_datetime_upgrade($sd->updated);
                $DB->update_record('block_search_documents', $sd);
            }
        }
        // Conditionally launch drop the old fields
        if ($dbman->field_exists($table, $field_docdate_old)) {
            $dbman->drop_field($table, $field_docdate_old);
        }
        if ($dbman->field_exists($table, $field_updated_old)) {
            $dbman->drop_field($table, $field_updated_old);
        }
        //rename the new fields to the original field names.
        $dbman->rename_field($table, $field_docdate_new, 'docdate');
        $dbman->rename_field($table, $field_updated_new, 'updated');
        // search savepoint reached
        upgrade_block_savepoint(true, 2010101800, 'search');
    }
    if ($oldversion < 2010110900) {
        unset_config('block_search_text');
        unset_config('block_search_button');
        upgrade_block_savepoint(true, 2010110900, 'search');
    }
    if ($oldversion < 2010111100) {
        // set block to hidden if global search is disabled.
        if ($CFG->enableglobalsearch != 1) {
            $DB->set_field('block', 'visible', 0, array('name' => 'search'));
            // Hide block
        }
        upgrade_block_savepoint(true, 2010111100, 'search');
    }
    return $result;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:59,代码来源:upgrade.php


示例13: xmldb_block_oppia_mobile_export_upgrade

function xmldb_block_oppia_mobile_export_upgrade($oldversion)
{
    global $CFG, $DB, $OUTPUT;
    $dbman = $DB->get_manager();
    if ($oldversion < 2013111402) {
        // block savepoint reached
        upgrade_block_savepoint(true, 2013111402, 'oppia_mobile_export');
    }
    if ($oldversion < 2014032100) {
        // Define table block_oppia_mobile_server to be created.
        $table = new xmldb_table('block_oppia_mobile_server');
        // Adding fields to table block_oppia_mobile_server.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('servername', XMLDB_TYPE_CHAR, '50', null, null, null, '');
        $table->add_field('url', XMLDB_TYPE_CHAR, '50', null, null, null, '');
        $table->add_field('moodleuserid', XMLDB_TYPE_INTEGER, '10', null, null, null, '0');
        $table->add_field('username', XMLDB_TYPE_CHAR, '50', null, null, null, '');
        $table->add_field('apikey', XMLDB_TYPE_CHAR, '50', null, null, null, '');
        $table->add_field('defaultserver', XMLDB_TYPE_INTEGER, '10', null, null, null, '0');
        // Adding keys to table block_oppia_mobile_server.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        // Conditionally launch create table for block_oppia_mobile_server.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        // Blocks savepoint reached.
        upgrade_plugin_savepoint(true, 2014032100, 'error', 'blocks');
    }
    if ($oldversion < 2015021802) {
        // Changing type of field value on table block_oppia_mobile_config to text.
        $table = new xmldb_table('block_oppia_mobile_config');
        $field = new xmldb_field('value', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
        // Launch change of type for field value.
        $dbman->change_field_type($table, $field);
        // Blocks savepoint reached.
        upgrade_plugin_savepoint(true, 2015021802, 'error', 'blocks');
    }
    if ($oldversion < 2016021500) {
        // Add the field serverid to table block_oppia_mobile_config
        $table = new xmldb_table('block_oppia_mobile_config');
        if (!$dbman->field_exists($table, 'serverid')) {
            $field = new xmldb_field('serverid', XMLDB_TYPE_TEXT, null, null, null, null, null, 'value');
            $dbman->add_field($table, $field);
        }
        // Blocks savepoint reached.
        upgrade_plugin_savepoint(true, 2016021500, 'error', 'blocks');
    }
    if ($oldversion < 2016041301) {
        //Update the size for field value to support longer tag values
        $table = new xmldb_table('block_oppia_mobile_config');
        $field = new xmldb_field('value', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
        // Launch change of type for field value.
        $dbman->change_field_type($table, $field);
        // Blocks savepoint reached.
        upgrade_plugin_savepoint(true, 2016041301, 'error', 'blocks');
    }
    return true;
}
开发者ID:chaotic-kingdoms,项目名称:moodle-block_oppia_mobile_export,代码行数:58,代码来源:upgrade.php


示例14: xmldb_block_nurs_navigation_upgrade

/**
 * This is the upgrade script for the project.
 *
 * @package    block_nurs_navigation
 * @category   block
 * @copyright  2012 Craig Jamieson
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
function xmldb_block_nurs_navigation_upgrade($oldversion = 0)
{
    global $DB;
    $dbman = $DB->get_manager();
    $result = true;
    // June 17, 2013 version changed the way that contexts are stored in the files table.
    if ($oldversion < 2013061706) {
        $query = "SELECT * FROM {nurs_navigation} WHERE courseid <> 1";
        $records = $DB->get_records_sql($query);
        $fs = get_file_storage();
        foreach ($records as $record) {
            $coursecontext = context_course::instance($record->courseid);
            // Explicit check here since sometimes there are old nurs_navigation records that point to deleted courses.
            if (isset($coursecontext->id)) {
                $params = array($coursecontext->id, 'nurs_navigation');
                $query = "SELECT * FROM {block_instances} WHERE parentcontextid = ? AND blockname = ?";
                $block = $DB->get_record_sql($query, $params, IGNORE_MULTIPLE);
                $blockcontext = context_block::instance($block->id);
                // This can return multiple records because of how the multiple file terminator works.
                $filerecords = $DB->get_records('files', array('contextid' => $coursecontext->id, 'itemid' => $record->fileid));
                foreach ($filerecords as $filerecord) {
                    $filerecord->contextid = $blockcontext->id;
                    // Path hash must be updated as well with a context change.
                    $filerecord->pathnamehash = $fs->get_pathname_hash($filerecord->contextid, BNN_BLOCK_SAVE_COMPONENT, BNN_BLOCK_SAVE_AREA, $filerecord->itemid, $filerecord->filepath, $filerecord->filename);
                    $DB->update_record('files', $filerecord);
                }
            }
        }
    }
    // Create the second table.
    if ($oldversion < 2012110200) {
        // Define table nurs_navigation_settings to be created.
        $table = new xmldb_table('nurs_navigation_settings');
        // Adding fields to table nurs_navigation_settings.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('courseid', XMLDB_TYPE_INTEGER, '20', null, XMLDB_NOTNULL, null, null);
        $table->add_field('sectionname', XMLDB_TYPE_TEXT, 'big', null, null, null, null, null);
        $table->add_field('disableicon', XMLDB_TYPE_INTEGER, '20', null, XMLDB_NOTNULL, null, null);
        $table->add_field('customlabel', XMLDB_TYPE_TEXT, 'big', null, null, null, null);
        // Adding keys to table nurs_navigation_settings.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        // Conditionally launch create table for nurs_navigation_settings.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }
        // Define field disableicon to be dropped from nurs_navigation.
        $table = new xmldb_table('nurs_navigation');
        $field = new xmldb_field('disableicon');
        // Conditionally launch drop field courseid.
        if ($dbman->field_exists($table, $field)) {
            $dbman->drop_field($table, $field);
        }
        // Update savepoint.
        upgrade_block_savepoint(true, 2012110200, 'nurs_navigation');
    }
    return $result;
}
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:65,代码来源:upgrade.php


示例15: xmldb_block_panopto_upgrade

function xmldb_block_panopto_upgrade($oldversion = 0)
{
    global $CFG, $DB;
    $dbman = $DB->get_manager();
    if ($oldversion < 2014121502) {
        // Add db fields for servername and application key per course.
        if (isset($CFG->block_panopto_server_name)) {
            $oldservername = $CFG->block_panopto_server_name;
        }
        if (isset($CFG->block_panopto_application_key)) {
            $oldappkey = $CFG->block_panopto_application_key;
        }
        // Define field panopto_server to be added to block_panopto_foldermap.
        $table = new xmldb_table('block_panopto_foldermap');
        $field = new xmldb_field('panopto_server', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null, 'panopto_id');
        // Conditionally launch add field panopto_server.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
            if (isset($oldservername)) {
                $DB->set_field('block_panopto_foldermap', 'panopto_server', $oldservername, null);
            }
        }
        // Define field panopto_app_key to be added to block_panopto_foldermap.
        $table = new xmldb_table('block_panopto_foldermap');
        $field = new xmldb_field('panopto_app_key', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null, 'panopto_server');
        // Conditionally launch add field panopto_app_key.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
            if (isset($oldappkey)) {
                $DB->set_field('block_panopto_foldermap', 'panopto_app_key', $oldappkey, null);
            }
        }
        // Panopto savepoint reached.
        upgrade_block_savepoint(true, 2014121502, 'panopto');
    }
    if ($oldversion < 2015012901) {
        // Define field publisher_mapping to be added to block_panopto_foldermap.
        $table = new xmldb_table('block_panopto_foldermap');
        $field = new xmldb_field('publisher_mapping', XMLDB_TYPE_CHAR, '20', null, null, null, '1', 'panopto_app_key');
        // Conditionally launch add field publisher_mapping.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Define field creator_mapping to be added to block_panopto_foldermap.
        $table = new xmldb_table('block_panopto_foldermap');
        $field = new xmldb_field('creator_mapping', XMLDB_TYPE_CHAR, '20', null, null, null, '3,4', 'publisher_mapping');
        // Conditionally launch add field creator_mapping.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // Panopto savepoint reached.
        upgrade_block_savepoint(true, 2015012901, 'panopto');
    }
    return true;
}
开发者ID:hitteshahuja,项目名称:Moodle-2.0-plugin-for-Panopto,代码行数:55,代码来源:upgrade.php


示例16: xmldb_block_courserequest_upgrade

function xmldb_block_courserequest_upgrade($oldversion = 0)
{
    $result = true;
    // Migrate language strings
    if ($result && $oldversion < 2014030701) {
        $migrator = new \local_eliscore\install\migration\migrator('block_course_request', 'block_courserequest');
        $result = $migrator->migrate_language_strings();
        upgrade_block_savepoint($result, 2014030701, 'courserequest');
    }
    return $result;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:11,代码来源:upgrade.php


示例17: xmldb_block_taskchain_navigation_upgrade

function xmldb_block_taskchain_navigation_upgrade($oldversion = 0)
{
    global $CFG, $DB;
    $result = true;
    $newversion = 2014051601;
    if ($oldversion < $newversion) {
        update_capabilities('block/taskchain_navigation');
        upgrade_block_savepoint($result, "{$newversion}", 'taskchain_navigation');
    }
    return $result;
}
开发者ID:gbateson,项目名称:moodle-block_taskchain_navigation,代码行数:11,代码来源:upgrade.php


示例18: xmldb_block_accessibility_upgrade

function xmldb_block_accessibility_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $DB;
    $dbman = $DB->get_manager();
    $result = true;
    // And upgrade begins here. For each one, you'll need one
    // block of code similar to the next one. Please, delete
    // this comment lines once this file start handling proper
    // upgrade code.
    if ($result && $oldversion < 2009071000) {
        // Changing type of field fontsize on table accessibility to number
        $table = new XMLDBTable('accessibility');
        $field = new XMLDBField('fontsize');
        $field->setAttributes(XMLDB_TYPE_NUMBER, '4, 1', XMLDB_UNSIGNED, null, null, null, null, null, 'userid');
        // Launch change of type for field fontsize
        $result = $result && $dbman->change_field_type($table, $field);
        upgrade_block_savepoint(true, 2009071000, 'accessibility');
    }
    if ($result && $oldversion < 2009082500) {
        // Define field colourscheme to be added to accessibility
        $table = new xmldb_table('accessibility');
        $field = new xmldb_field('colourscheme', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'fontsize');
        // Launch add field colourschemea
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        upgrade_block_savepoint(true, 2009082500, 'accessibility');
    }
    if ($oldversion < 2010121500) {
        // Define field autoload_atbar to be added to accessibility
        $table = new xmldb_table('accessibility');
        $cs = new xmldb_field('colourscheme', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'fontsize');
        $field = new xmldb_field('autoload_atbar', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'colourscheme');
        if (!$dbman->field_exists($table, $cs)) {
            $dbman->add_field($table, $cs);
        }
        // Conditionally launch add field autoload_atbar
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        // accessibility savepoint reached
        upgrade_block_savepoint(true, 2010121500, 'accessibility');
    }
    if ($oldversion < 2011122000) {
        // Define table accessibility to be renamed to block_accessibility
        $table = new xmldb_table('accessibility');
        // Launch rename table for accessibility
        $dbman->rename_table($table, 'block_accessibility');
        // accessibility savepoint reached
        upgrade_block_savepoint(true, 2011122000, 'accessibility');
    }
    return $result;
}
开发者ID:bystrikondica,项目名称:actnow,代码行数:53,代码来源:upgrade.php


示例19: xmldb_block_openveo_videos_upgrade

/**
 * Upgrades openveo block depending on actual version.
 *
 * For version older than 2016021500 :
 * Media ids generated by OpenVeo can contains characters, not only digits, thus the table field "videoid" needs to
 * store Strings and not Integers.
 *
 * @package block_openveo_videos
 * @copyright 2015, veo-labs <[email protected]>
 * @license TODO
 */
function xmldb_block_openveo_videos_upgrade($oldversion)
{
    global $DB;
    $dbman = $DB->get_manager();
    /// Change the type of the field "videoid" from Integer to String
    if ($oldversion < 2016021500) {
        $table = new xmldb_table('block_openveo_videos');
        $field = new xmldb_field('videoid', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, null, null);
        $dbman->change_field_type($table, $field);
        upgrade_block_savepoint(true, 2016021500, 'openveo_videos');
    }
    return true;
}
开发者ID:veo-labs,项目名称:openveo-moodle-block,代码行数:24,代码来源:upgrade.php


示例20: xmldb_block_my_books_upgrade

function xmldb_block_my_books_upgrade($oldversion = 0)
{
    global $CFG, $DB;
    if ($oldversion < 2014111100) {
        set_config('viewer_opening', $CFG->mybooks_viewer_opening, 'mybooks');
        unset_config('mybooks_viewer_opening');
        set_config('width', $CFG->mybooks_width, 'mybooks');
        unset_config('mybooks_width');
        set_config('height', $CFG->mybooks_height, 'mybooks');
        unset_config('mybooks_height');
        set_config('activity_opening', $CFG->mybooks_activity_opening, 'mybooks');
        unset_config('mybooks_activity_opening');
        set_config('scrollbars', $CFG->mybooks_scrollbars, 'mybooks');
        unset_config('mybooks_scrollbars');
        set_config('menubar', $CFG->mybooks_menubar, 'mybooks');
        unset_config('mybooks_menubar');
        set_config('toolbar', $CFG->mybooks_toolbar, 'mybooks');
        unset_config('mybooks_toolbar');
        set_config('status', $CFG->mybooks_status, 'mybooks');
        unset_config('mybooks_status');
        set_config('addkey', $CFG->mybooks_addkey, 'mybooks');
        unset_config('mybooks_addkey');
        unset_config('mybooks_directories');
        unset_config('mybooks_resizable');
        unset_config('mybooks_location');
        upgrade_block_savepoint(true, 2014111100, 'my_books');
    }
    if ($oldversion < 2015051900) {
        unset_config('resizable', 'mybooks');
        unset_config('directories', 'mybooks');
        unset_config('location', 'mybooks');
        $DB->set_field('rcontent', 'frame', 0, array('course' => SITEID));
        upgrade_block_savepoint(true, 2015051900, 'my_books');
    }
    if ($oldversion < 2015111700) {
        unset_config('status', 'mybooks');
        unset_config('toolbar', 'mybooks');
        unset_config('menubar', 'mybooks');
        unset_config('scrollbars', 'mybooks');
        unset_config('activity_opening', 'mybooks');
        unset_config('height', 'mybooks');
        unset_config('width', 'mybooks');
        $popupoptions = "scrollbars=1,menubar=0,toolbar=1,status=1,height=800,width=600";
        $DB->set_field('rcontent', 'popup', 0, array('course' => SITEID));
        $DB->set_field('rcontent', 'popup_options', $popupoptions, array('course' => SITEID));
        $DB->set_field('rcontent', 'width', 800, array('course' => SITEID));
        $DB->set_field('rcontent', 'height', 600, array('course' => SITEID));
        upgrade_block_savepoint(true, 2015111700, 'm 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP upgrade_calculated_grade_items函数代码示例发布时间:2022-05-23
下一篇:
PHP upgrade_availability_item函数代码示例发布时间: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