本文整理汇总了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();
}
示例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();
}
示例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();
}