當前位置: 首頁>>代碼示例>>PHP>>正文


PHP print_upgrade_separator函數代碼示例

本文整理匯總了PHP中print_upgrade_separator函數的典型用法代碼示例。如果您正苦於以下問題:PHP print_upgrade_separator函數的具體用法?PHP print_upgrade_separator怎麽用?PHP print_upgrade_separator使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了print_upgrade_separator函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: upgrade_language_pack

/**
 * Try to upgrade the given language pack (or current language)
 * @global object
 */
function upgrade_language_pack($lang = '')
{
    global $CFG, $OUTPUT;
    if (empty($lang)) {
        $lang = current_language();
    }
    if ($lang == 'en_utf8') {
        return true;
        // Nothing to do
    }
    upgrade_started(false);
    echo $OUTPUT->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();
                }
            }
            echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
        }
    }
    print_upgrade_separator();
}
開發者ID:ajv,項目名稱:Offline-Caching,代碼行數:35,代碼來源:upgradelib.php

示例2: upgrade_language_pack

/**
 * Try to upgrade the given language pack (or current language)
 *
 * @param string $lang the code of the language to update, defaults to the current language
 */
function upgrade_language_pack($lang = null) {
    global $CFG;

    if (!empty($CFG->skiplangupgrade)) {
        return;
    }

    if (!file_exists("$CFG->dirroot/$CFG->admin/tool/langimport/lib.php")) {
        // weird, somebody uninstalled the import utility
        return;
    }

    if (!$lang) {
        $lang = current_language();
    }

    if (!get_string_manager()->translation_exists($lang)) {
        return;
    }

    get_string_manager()->reset_caches();

    if ($lang === 'en') {
        return;  // Nothing to do
    }

    upgrade_started(false);

    require_once("$CFG->dirroot/$CFG->admin/tool/langimport/lib.php");
    tool_langimport_preupgrade_update($lang);

    get_string_manager()->reset_caches();

    print_upgrade_separator();
}
開發者ID:jtibbetts,項目名稱:moodle,代碼行數:40,代碼來源:upgradelib.php

示例3: upgrade_language_pack

/**
 * Try to upgrade the given language pack (or current language)
 *
 * @param string $lang the code of the language to update, defaults to the current language
 */
function upgrade_language_pack($lang = '')
{
    global $CFG, $OUTPUT;
    get_string_manager()->reset_caches();
    if (empty($lang)) {
        $lang = current_language();
    }
    if ($lang == 'en') {
        return true;
        // Nothing to do
    }
    upgrade_started(false);
    echo $OUTPUT->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';
    $installer = new lang_installer($lang);
    $results = $installer->run();
    foreach ($results as $langcode => $langstatus) {
        switch ($langstatus) {
            case lang_installer::RESULT_DOWNLOADERROR:
                echo $OUTPUT->notification($langcode . '.zip');
                break;
            case lang_installer::RESULT_INSTALLED:
                echo $OUTPUT->notification(get_string('langpackinstalled', 'admin', $langcode), 'notifysuccess');
                break;
            case lang_installer::RESULT_UPTODATE:
                echo $OUTPUT->notification(get_string('langpackuptodate', 'admin', $langcode), 'notifysuccess');
                break;
        }
    }
    get_string_manager()->reset_caches();
    print_upgrade_separator();
}
開發者ID:hatone,項目名稱:moodle,代碼行數:40,代碼來源:upgradelib.php


注:本文中的print_upgrade_separator函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。