本文整理汇总了PHP中upgrade_get_javascript函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_get_javascript函数的具体用法?PHP upgrade_get_javascript怎么用?PHP upgrade_get_javascript使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_get_javascript函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: str_replace
$releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink);
// extremely ugly validation hack
echo $OUTPUT->box($releasenoteslink, 'generalbox boxaligncenter boxwidthwide');
require_once $CFG->libdir . '/environmentlib.php';
if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
print_upgrade_reload("index.php?agreelicense=1&lang={$CFG->lang}");
} else {
echo $OUTPUT->notification(get_string('environmentok', 'admin'), 'notifysuccess');
echo $OUTPUT->continue_button("index.php?agreelicense=1&confirmrelease=1&lang={$CFG->lang}");
}
echo $OUTPUT->footer();
die;
}
$strdatabasesetup = get_string('databasesetup');
$navigation = build_navigation(array(array('name' => $strdatabasesetup, 'link' => null, 'type' => 'misc')));
upgrade_get_javascript();
print_header($strinstallation . ' - Moodle ' . $CFG->target_release, $strinstallation, $navigation, '', '', 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');
}
}
install_core($version, true);
}
// Check version of Moodle code on disk compared with database
// and upgrade if possible.
$stradministration = get_string('administration');
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
if (empty($CFG->version)) {
print_error('missingconfigversion', 'debug');
示例2: upgrade_local_dbs
/**
* This function checks to see whether local database customisations are up-to-date
* by comparing $CFG->local_version to the variable $local_version defined in
* local/version.php. If not, it looks for a function called 'xmldb_local_upgrade'
* in a file called 'local/db/upgrade.php', and if it's there calls it with the
* appropiate $oldversion parameter. Then it updates $CFG->local_version.
* On success it prints a continue link. On failure it prints an error.
*
* @uses $CFG
* @uses $db to do something really evil with the debug setting that should probably be eliminated. TODO!
* @param string $continueto a URL passed to print_continue() if the local upgrades succeed.
*/
function upgrade_local_dbs($continueto)
{
global $CFG, $db;
$path = '/local';
$pat = 'local';
$status = true;
$changed = false;
$firstloop = true;
while (is_dir($CFG->dirroot . $path)) {
// if we don't have code version or a db upgrade file, check lower
if (!file_exists($CFG->dirroot . "{$path}/version.php") || !file_exists($CFG->dirroot . "{$path}/db/upgrade.php")) {
$path .= '/local';
$pat .= 'local';
continue;
}
require_once $CFG->dirroot . "{$path}/version.php";
// Get code versions
$cfgvarname = "{$pat}_version";
if (empty($CFG->{$cfgvarname})) {
// normally we'd install, but just replay all the upgrades.
$CFG->{$cfgvarname} = 0;
}
$localversionvar = "{$pat}_version";
// echo "($localversionvar) ".$$localversionvar." > ($cfgvarname) ".$CFG->{$cfgvarname}."<br/>";
if (${$localversionvar} > $CFG->{$cfgvarname}) {
// something upgrades!
upgrade_log_start();
/// Capabilities
/// do this first *instead of* last , so that the installer has the chance to locally assign caps
if (!update_capabilities($pat)) {
error('Could not set up the capabilities for ' . $pat . '!');
}
if ($firstloop) {
$strdatabaseupgrades = get_string('databaseupgrades');
print_header($strdatabaseupgrades, $strdatabaseupgrades, build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript());
$firstloop = false;
}
$changed = true;
require_once $CFG->dirroot . "{$path}/db/upgrade.php";
$db->debug = true;
$upgradefunc = "xmldb_{$pat}_upgrade";
if ($upgradefunc($CFG->{$cfgvarname})) {
$db->debug = false;
if (set_config($localversionvar, ${$localversionvar})) {
notify(get_string('databasesuccess'), 'notifysuccess');
notify(get_string('databaseupgradelocal', '', $path . ' >> ' . ${$localversionvar}), 'notifysuccess');
} else {
$status = false;
error('Upgrade of local database customisations failed in $path! (Could not update version in config table)');
}
} else {
$db->debug = false;
error("Upgrade failed! See {$path}/version.php");
}
if (!events_update_definition($pat)) {
error('Could not set up the events definitions for ' . $pat . '!');
}
upgrade_log_finish();
} else {
if (${$localversionvar} < $CFG->{$cfgvarname}) {
notify("WARNING!!! The local version you are using in {$path} is OLDER than the version that made these databases!");
}
}
$path .= '/local';
$pat .= 'local';
}
if ($changed) {
print_continue($continueto);
print_footer('none');
exit;
}
}
示例3: upgrade_local_db
/**
* This function checks to see whether local database customisations are up-to-date
* by comparing $CFG->local_version to the variable $local_version defined in
* local/version.php. If not, it looks for a function called 'xmldb_local_upgrade'
* in a file called 'local/db/upgrade.php', and if it's there calls it with the
* appropiate $oldversion parameter. Then it updates $CFG->local_version.
* On success it prints a continue link. On failure it prints an error.
*
* @uses $CFG
* @uses $db to do something really evil with the debug setting that should probably be eliminated. TODO!
* @param string $continueto a URL passed to print_continue() if the local upgrades succeed.
*/
function upgrade_local_db($continueto)
{
global $CFG, $db;
// if we don't have code version or a db upgrade file, just return true, we're unneeded
if (!file_exists($CFG->dirroot . '/local/version.php') || !file_exists($CFG->dirroot . '/local/db/upgrade.php')) {
return true;
}
require_once $CFG->dirroot . '/local/version.php';
// Get code versions
if (empty($CFG->local_version)) {
// normally we'd install, but just replay all the upgrades.
$CFG->local_version = 0;
}
if ($local_version > $CFG->local_version) {
// upgrade!
$strdatabaseupgrades = get_string('databaseupgrades');
print_header($strdatabaseupgrades, $strdatabaseupgrades, build_navigation(array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript());
upgrade_log_start();
require_once $CFG->dirroot . '/local/db/upgrade.php';
$db->debug = true;
if (xmldb_local_upgrade($CFG->local_version)) {
$db->debug = false;
if (set_config('local_version', $local_version)) {
notify(get_string('databasesuccess'), 'notifysuccess');
notify(get_string('databaseupgradelocal', '', $local_version), 'notifysuccess');
print_continue($continueto);
print_footer('none');
exit;
} else {
error('Upgrade of local database customisations failed! (Could not update version in config table)');
}
} else {
$db->debug = false;
error('Upgrade failed! See local/version.php');
}
} else {
if ($local_version < $CFG->local_version) {
upgrade_log_start();
notify('WARNING!!! The local version you are using is OLDER than the version that made these databases!');
}
}
/// Capabilities
if (!update_capabilities('local')) {
error('Could not set up the capabilities for local!');
}
if (!events_update_definition('local')) {
error('Could not set up the events definitions for local!');
}
upgrade_log_finish();
}
示例4: upgrade_blocks_plugins
function upgrade_blocks_plugins($continueto)
{
global $CFG, $db;
$blocktitles = array();
$invalidblocks = array();
$validblocks = array();
$notices = array();
//Count the number of blocks in db
$blockcount = count_records('block');
//If there isn't records. This is the first install, so I remember it
if ($blockcount == 0) {
$first_install = true;
} else {
$first_install = false;
}
$site = get_site();
if (!($blocks = get_list_of_plugins('blocks', 'db'))) {
error('No blocks installed!');
}
include_once $CFG->dirroot . '/blocks/moodleblock.class.php';
if (!class_exists('block_base')) {
error('Class block_base is not defined or file not found for /blocks/moodleblock.class.php');
}
foreach ($blocks as $blockname) {
if ($blockname == 'NEWBLOCK') {
// Someone has unzipped the template, ignore it
continue;
}
if (!block_is_compatible($blockname)) {
// This is an old-style block
//$notices[] = 'Block '. $blockname .' is not compatible with the current version of Mooodle and needs to be updated by a programmer.';
$invalidblocks[] = $blockname;
continue;
}
$fullblock = $CFG->dirroot . '/blocks/' . $blockname;
if (is_readable($fullblock . '/block_' . $blockname . '.php')) {
include_once $fullblock . '/block_' . $blockname . '.php';
} else {
$notices[] = 'Block ' . $blockname . ': ' . $fullblock . '/block_' . $blockname . '.php was not readable';
continue;
}
$oldupgrade = false;
$newupgrade = false;
if (@is_dir($fullblock . '/db/')) {
if (@is_readable($fullblock . '/db/' . $CFG->dbtype . '.php')) {
include_once $fullblock . '/db/' . $CFG->dbtype . '.php';
// defines old upgrading function
$oldupgrade = true;
}
if (@is_readable($fullblock . '/db/upgrade.php')) {
include_once $fullblock . '/db/upgrade.php';
// defines new upgrading function
$newupgrade = true;
}
}
$classname = 'block_' . $blockname;
if (!class_exists($classname)) {
$notices[] = 'Block ' . $blockname . ': ' . $classname . ' not implemented';
continue;
}
// Here is the place to see if the block implements a constructor (old style),
// an init() function (new style) or nothing at all (error time).
$constructor = get_class_constructor($classname);
if (empty($constructor)) {
// No constructor
$notices[] = 'Block ' . $blockname . ': class does not have a constructor';
$invalidblocks[] = $blockname;
continue;
}
$block = new stdClass();
// This may be used to update the db below
$blockobj = new $classname();
// This is what we 'll be testing
// Inherits from block_base?
if (!is_subclass_of($blockobj, 'block_base')) {
$notices[] = 'Block ' . $blockname . ': class does not inherit from block_base';
continue;
}
// OK, it's as we all hoped. For further tests, the object will do them itself.
if (!$blockobj->_self_test()) {
$notices[] = 'Block ' . $blockname . ': self test failed';
continue;
}
$block->version = $blockobj->get_version();
if (!isset($block->version)) {
$notices[] = 'Block ' . $blockname . ': has no version support. It must be updated by a programmer.';
continue;
}
$block->name = $blockname;
// The name MUST match the directory
$blocktitle = $blockobj->get_title();
if ($currblock = get_record('block', 'name', $block->name)) {
if ($currblock->version == $block->version) {
// do nothing
} else {
if ($currblock->version < $block->version) {
if (empty($updated_blocks)) {
$strblocksetup = get_string('blocksetup');
print_header($strblocksetup, $strblocksetup, build_navigation(array(array('name' => $strblocksetup, 'link' => null, 'type' => 'misc'))), '', upgrade_get_javascript(), false, ' ', ' ');
}
//.........这里部分代码省略.........
示例5: get_string
echo '<a href="index.php?confirmupgrade=1&confirmrelease=1" title="' . get_string('reload') . '" ><img src="' . $CFG->pixpath . '/i/reload.gif" alt="" /> ' . get_string('reload') . '</a>';
echo '</div><br />';
echo '<form action="index.php"><div>';
echo '<input type="hidden" name="confirmupgrade" value="1" />';
echo '<input type="hidden" name="confirmrelease" value="1" />';
echo '<input type="hidden" name="confirmplugincheck" value="1" />';
echo '</div>';
echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">' . get_string('unattendedoperation', 'admin') . '</label>';
echo '<br /><br /><input type="submit" value="' . get_string('continue') . '" /></div>';
echo '</form>';
print_footer('none');
die;
} else {
$strdatabasesuccess = get_string("databasesuccess");
$navigation = build_navigation(array(array('name' => $strdatabasesuccess, 'link' => null, 'type' => 'misc')));
print_header($strdatabasechecking, $stradministration, $navigation, "", upgrade_get_javascript(), false, " ", " ");
/// return to original debugging level
$CFG->debug = $origdebug;
error_reporting($CFG->debug);
upgrade_log_start();
/// Upgrade current language pack if we can
if (empty($CFG->skiplangupgrade)) {
upgrade_language_pack();
}
print_heading($strdatabasechecking);
$db->debug = true;
/// Launch the old main upgrade (if exists)
$status = true;
if (function_exists('main_upgrade')) {
$status = main_upgrade($CFG->version);
}
示例6: upgrade_started
/**
* Marks start of upgrade, blocks any other access to site.
* The upgrade is finished at the end of script or after timeout.
*
* @global object
* @global object
* @global object
*/
function upgrade_started($preinstall = false)
{
global $CFG, $DB, $PAGE;
static $started = false;
if ($preinstall) {
ignore_user_abort(true);
upgrade_setup_debug(true);
} else {
if ($started) {
upgrade_set_timeout(120);
} else {
if (!CLI_SCRIPT and !$PAGE->headerprinted) {
$strupgrade = get_string('upgradingversion', 'admin');
$PAGE->set_generaltype('maintenance');
upgrade_get_javascript();
print_header($strupgrade . ' - Moodle ' . $CFG->target_release, $strupgrade, build_navigation(array(array('name' => $strupgrade, 'link' => null, 'type' => 'misc'))), '', '', false, ' ', ' ');
}
ignore_user_abort(true);
register_shutdown_function('upgrade_finished_handler');
upgrade_setup_debug(true);
set_config('upgraderunning', time() + 300);
$started = true;
}
}
}
示例7: str_replace
$releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink);
// extremely ugly validation hack
print_box($releasenoteslink, 'generalbox boxaligncenter boxwidthwide');
require_once $CFG->libdir . '/environmentlib.php';
if (!check_moodle_environment($release, $environment_results, true, ENV_SELECT_RELEASE)) {
print_upgrade_reload("index.php?agreelicense=1&lang={$CFG->lang}");
} else {
notify(get_string('environmentok', 'admin'), 'notifysuccess');
print_continue("index.php?agreelicense=1&confirmrelease=1&lang={$CFG->lang}");
}
print_footer('upgrade');
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();
示例8: is_dataroot_insecure
$insecuredataroot = is_dataroot_insecure(true);
$register_globals_enabled = ini_get_bool('register_globals');
$SESSION->admin_critical_warning = $register_globals_enabled || $insecuredataroot == INSECURE_DATAROOT_ERROR;
$adminroot =& admin_get_root();
/// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)) {
redirect('upgradesettings.php');
}
/// Everything should now be set up, and the user is an admin
if (array_key_exists('justinstalled', $_SESSION) && file_exists($CFG->dirroot . '/local/lib.php')) {
require_once $CFG->dirroot . '/local/lib.php';
if (function_exists('local_postinst')) {
admin_externalpage_setup('adminnotifications');
$strheader = get_string('performinglocalpostinst');
$navigation = build_navigation(array(array('name' => $strheader, 'link' => null, 'type' => 'misc')));
print_header($strheader, $strheader, $navigation, "", upgrade_get_javascript(), false, " ", " ");
//admin_externalpage_print_header();
print_heading($strheader);
if (!local_postinst()) {
print_error('localpostinstfailed', 'error');
}
unset($_SESSION['justinstalled']);
print_continue($CFG->wwwroot . '/index.php');
print_footer();
exit;
}
}
/// Print default admin page with notifications.
admin_externalpage_setup('adminnotifications');
admin_externalpage_print_header();
/// Deprecated database! Warning!!
示例9: upgrade_backup_db
function upgrade_backup_db($continueto)
{
/// This function upgrades the backup tables, if necessary
/// It's called from admin/index.php, also backup.php and restore.php
global $CFG, $db;
require_once "{$CFG->dirroot}/backup/version.php";
// Get code versions
if (empty($CFG->backup_version)) {
// Backup has never been installed.
$strdatabaseupgrades = get_string("databaseupgrades");
$navlinks = array();
$navlinks[] = array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($strdatabaseupgrades, $strdatabaseupgrades, $navigation, "", upgrade_get_javascript(), false, " ", " ");
upgrade_log_start();
print_heading('backup');
$db->debug = true;
/// Both old .sql files and new install.xml are supported
/// but we priorize install.xml (XMLDB) if present
$status = false;
if (file_exists($CFG->dirroot . '/backup/db/install.xml')) {
$status = install_from_xmldb_file($CFG->dirroot . '/backup/db/install.xml');
//New method
} else {
if (file_exists($CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.sql')) {
$status = modify_database($CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.sql');
//Old method
}
}
$db->debug = false;
if ($status) {
if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) {
//initialize default backup settings now
$adminroot = admin_get_root();
apply_default_settings($adminroot->locate('backups'));
notify(get_string("databasesuccess"), "green");
notify(get_string("databaseupgradebackups", "", $backup_version), "green");
print_continue($continueto);
print_footer('none');
exit;
} else {
error("Upgrade of backup system failed! (Could not update version in config table)");
}
} else {
error("Backup tables could NOT be set up successfully!");
}
}
/// Upgrading code starts here
$oldupgrade = false;
$newupgrade = false;
if (is_readable($CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.php')) {
include_once $CFG->dirroot . '/backup/db/' . $CFG->dbtype . '.php';
// defines old upgrading function
$oldupgrade = true;
}
if (is_readable($CFG->dirroot . '/backup/db/upgrade.php')) {
include_once $CFG->dirroot . '/backup/db/upgrade.php';
// defines new upgrading function
$newupgrade = true;
}
if ($backup_version > $CFG->backup_version) {
// Upgrade tables
$strdatabaseupgrades = get_string("databaseupgrades");
$navigation = array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'));
print_header($strdatabaseupgrades, $strdatabaseupgrades, build_navigation($navigation), '', upgrade_get_javascript());
upgrade_log_start();
print_heading('backup');
/// Run de old and new upgrade functions for the module
$oldupgrade_function = 'backup_upgrade';
$newupgrade_function = 'xmldb_backup_upgrade';
/// First, the old function if exists
$oldupgrade_status = true;
if ($oldupgrade && function_exists($oldupgrade_function)) {
$db->debug = true;
$oldupgrade_status = $oldupgrade_function($CFG->backup_version);
} else {
if ($oldupgrade) {
notify('Upgrade function ' . $oldupgrade_function . ' was not available in ' . '/backup/db/' . $CFG->dbtype . '.php');
}
}
/// Then, the new function if exists and the old one was ok
$newupgrade_status = true;
if ($newupgrade && function_exists($newupgrade_function) && $oldupgrade_status) {
$db->debug = true;
$newupgrade_status = $newupgrade_function($CFG->backup_version);
} else {
if ($newupgrade) {
notify('Upgrade function ' . $newupgrade_function . ' was not available in ' . '/backup/db/upgrade.php');
}
}
$db->debug = false;
/// Now analyze upgrade results
if ($oldupgrade_status && $newupgrade_status) {
// No upgrading failed
if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) {
notify(get_string("databasesuccess"), "green");
notify(get_string("databaseupgradebackups", "", $backup_version), "green");
print_continue($continueto);
print_footer('none');
exit;
//.........这里部分代码省略.........
示例10: upgrade_group_db
function upgrade_group_db($continueto)
{
/// This function upgrades the group tables, if necessary
/// It's called from admin/index.php.
global $CFG, $db;
$group_version = '';
// Get code versions
require "{$CFG->dirroot}/group/version.php";
if (empty($CFG->group_version)) {
// New 1.8 groups have never been installed...
$strdatabaseupgrades = get_string('databaseupgrades');
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript(), false, " ", " ");
upgrade_log_start();
//initialize default group settings now
install_group_db();
$adminroot = admin_get_root();
print_continue($continueto);
print_footer('none');
exit;
}
/// Upgrading code starts here
if ($group_version > $CFG->group_version) {
// Upgrade tables
$strdatabaseupgrades = get_string('databaseupgrades');
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades, '', upgrade_get_javascript());
upgrade_log_start();
print_heading('group');
$db->debug = true;
$status = xmldb_group_upgrade($CFG->group_version);
$db->debug = false;
/// Now analyze upgrade results
if ($status) {
// No upgrading failed
if (set_config('group_version', $group_version)) {
notify(get_string('databasesuccess'), 'green');
notify(get_string('databaseupgradegroups', '', $group_version), 'green');
print_continue($continueto);
print_footer('none');
exit;
} else {
error("Error: Upgrade of group system failed! (Could not update version in config table)");
}
} else {
error("Error: Upgrade failed! See group/upgrade.php");
}
} else {
if ($group_version < $CFG->group_version) {
error("Error: The code you are using is OLDER than the version that made these databases!");
}
}
}