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


PHP upgrade_started函数代码示例

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


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

示例1: install_core

/**
 * Install core moodle tables and initialize
 * @param float $version target version
 * @param bool $verbose
 * @return void, may throw exception
 */
function install_core($version, $verbose) {
    global $CFG, $DB;

    // We can not call purge_all_caches() yet, make sure the temp and cache dirs exist and are empty.
    remove_dir($CFG->cachedir.'', true);
    make_cache_directory('', true);

    remove_dir($CFG->localcachedir.'', true);
    make_localcache_directory('', true);

    remove_dir($CFG->tempdir.'', true);
    make_temp_directory('', true);

    remove_dir($CFG->dataroot.'/muc', true);
    make_writable_directory($CFG->dataroot.'/muc', true);

    try {
        core_php_time_limit::raise(600);
        print_upgrade_part_start('moodle', true, $verbose); // does not store upgrade running flag

        $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
        upgrade_started();     // we want the flag to be stored in config table ;-)

        // set all core default records and default settings
        require_once("$CFG->libdir/db/install.php");
        xmldb_main_install(); // installs the capabilities too

        // store version
        upgrade_main_savepoint(true, $version, false);

        // Continue with the installation
        log_update_descriptions('moodle');
        external_update_descriptions('moodle');
        events_update_definition('moodle');
        \core\task\manager::reset_scheduled_tasks_for_component('moodle');
        message_update_providers('moodle');
        \core\message\inbound\manager::update_handlers_for_component('moodle');

        // Write default settings unconditionally
        admin_apply_default_settings(NULL, true);

        print_upgrade_part_end(null, true, $verbose);

        // Purge all caches. They're disabled but this ensures that we don't have any persistent data just in case something
        // during installation didn't use APIs.
        cache_helper::purge_all();
    } catch (exception $ex) {
        upgrade_handle_exception($ex);
    }
}
开发者ID:jtibbetts,项目名称:moodle,代码行数:56,代码来源:upgradelib.php

示例2: install_core

/**
 * Install core moodle tables and initialize
 * @param float $version target version
 * @param bool $verbose
 * @return void, may throw exception
 */
function install_core($version, $verbose) {
    global $CFG, $DB;

    try {
        set_time_limit(600);
        print_upgrade_part_start('moodle', true, $verbose); // does not store upgrade running flag

        $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
        upgrade_started();     // we want the flag to be stored in config table ;-)

        // set all core default records and default settings
        require_once("$CFG->libdir/db/install.php");
        xmldb_main_install(); // installs the capabilities too

        // store version
        upgrade_main_savepoint(true, $version, false);

        // Continue with the installation
        log_update_descriptions('moodle');
        external_update_descriptions('moodle');
        events_update_definition('moodle');
        message_update_providers('moodle');

        // Write default settings unconditionally
        admin_apply_default_settings(NULL, true);

        print_upgrade_part_end(null, true, $verbose);
    } catch (exception $ex) {
        upgrade_handle_exception($ex);
    }
}
开发者ID:nicusX,项目名称:moodle,代码行数:37,代码来源:upgradelib.php

示例3: upgrade_language_pack

/**
 * Try to upgrade the given language pack (or current language)
 */
function upgrade_language_pack($lang = '')
{
    global $CFG;
    if (empty($lang)) {
        $lang = current_language();
    }
    if ($lang == 'en_utf8') {
        return true;
        // Nothing to do
    }
    upgrade_started(false);
    print_heading(get_string('langimport', 'admin') . ': ' . $lang);
    @mkdir($CFG->dataroot . '/temp/');
    //make it in case it's a fresh install, it might not be there
    @mkdir($CFG->dataroot . '/lang/');
    require_once $CFG->libdir . '/componentlib.class.php';
    if ($cd = new component_installer('http://download.moodle.org', 'lang16', $lang . '.zip', 'languages.md5', 'lang')) {
        $status = $cd->install();
        //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
        if ($status == COMPONENT_INSTALLED) {
            @unlink($CFG->dataroot . '/cache/languages');
            if ($parentlang = get_parent_language($lang)) {
                if ($cd = new component_installer('http://download.moodle.org', 'lang16', $parentlang . '.zip', 'languages.md5', 'lang')) {
                    $cd->install();
                }
            }
            notify(get_string('success'), 'notifysuccess');
        }
    }
    print_upgrade_separator();
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:34,代码来源:upgradelib.php

示例4: get_string

     die;
 }
 $strdatabasesetup = get_string("databasesetup");
 $navigation = build_navigation(array(array('name' => $strdatabasesetup, 'link' => null, 'type' => 'misc')));
 print_header($strinstallation . ' - Moodle ' . $CFG->target_release, $strinstallation, $navigation, "", upgrade_get_javascript(), false, " ", " ");
 if (!$DB->setup_is_unicodedb()) {
     if (!$DB->change_db_encoding()) {
         // If could not convert successfully, throw error, and prevent installation
         print_error('unicoderequired', 'admin');
     }
 }
 try {
     print_upgrade_part_start('moodle', true);
     // does not store upgrade running flag
     $DB->get_manager()->install_from_xmldb_file("{$CFG->libdir}/db/install.xml");
     upgrade_started();
     // we want the flag to be stored in config table ;-)
     /// set all core default records and default settings
     require_once "{$CFG->libdir}/db/install.php";
     xmldb_main_install();
     /// store version
     upgrade_main_savepoint(true, $version, false);
     /// Continue with the instalation
     events_update_definition('moodle');
     message_update_providers('moodle');
     message_update_providers('message');
     /// Write default settings unconditionlly
     admin_apply_default_settings(NULL, true);
     print_upgrade_part_end(null, true);
 } catch (exception $ex) {
     upgrade_handle_exception($ex);
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:index.php

示例5: install_core

/**
 * Install core moodle tables and initialize
 * @param float $version target version
 * @param bool $verbose
 * @return void, may throw exception
 */
function install_core($version, $verbose) {
    global $CFG, $DB;

    try {
        // Disable the use of cache stores here. We will reset the factory after we've performed the installation.
        // This ensures that we don't permanently cache anything during installation.
        cache_factory::disable_stores();

        set_time_limit(600);
        print_upgrade_part_start('moodle', true, $verbose); // does not store upgrade running flag

        $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
        upgrade_started();     // we want the flag to be stored in config table ;-)

        // set all core default records and default settings
        require_once("$CFG->libdir/db/install.php");
        xmldb_main_install(); // installs the capabilities too

        // store version
        upgrade_main_savepoint(true, $version, false);

        // Continue with the installation
        log_update_descriptions('moodle');
        external_update_descriptions('moodle');
        events_update_definition('moodle');
        message_update_providers('moodle');

        // Write default settings unconditionally
        admin_apply_default_settings(NULL, true);

        print_upgrade_part_end(null, true, $verbose);

        // Purge all caches. They're disabled but this ensures that we don't have any persistent data just in case something
        // during installation didn't use APIs.
        cache_helper::purge_all();
    } catch (exception $ex) {
        upgrade_handle_exception($ex);
    }
}
开发者ID:Burick,项目名称:moodle,代码行数:45,代码来源:upgradelib.php


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