本文整理汇总了PHP中upgrade_plugins函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_plugins函数的具体用法?PHP upgrade_plugins怎么用?PHP upgrade_plugins使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_plugins函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose) {
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type=>$location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例2: upgrade_local_db
upgrade_local_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check for changes to RPC functions
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Upgrade all plugins for gradebook
upgrade_plugins('gradeexport', 'grade/export', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
upgrade_plugins('gradeimport', 'grade/import', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
upgrade_plugins('gradereport', 'grade/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all message output plugins and upgrade if necessary
upgrade_plugins('message', 'message/output', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all course report plugins and upgrade if necessary
upgrade_plugins('coursereport', 'course/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all admin report plugins and upgrade if necessary
upgrade_plugins('report', $CFG->admin . '/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
unset($_SESSION['installautopilot']);
/// Set up the blank site - to be customized later at the end of install.
if (!($site = get_site())) {
// We are about to create the site "course"
require_once $CFG->libdir . '/blocklib.php';
$newsite = new object();
$newsite->fullname = "";
$newsite->shortname = "";
$newsite->summary = NULL;
$newsite->newsitems = 3;
$newsite->numsections = 0;
$newsite->category = 0;
$newsite->format = 'site';
示例3: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose)
{
global $CFG;
// upgrade all plugins types
try {
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
try {
// this needs a full rewrite, sorry to mention that :-(
// we have to make it part of standard WS framework
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions();
// Return here afterwards
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
}
示例4: upgrade_blocks_db
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/blocklib.php";
upgrade_blocks_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check all blocks and load (or upgrade them if necessary)
/// first old *.php update and then the new upgrade.php script
upgrade_blocks_plugins("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check all enrolment plugins and upgrade if necessary
/// first old *.php update and then the new upgrade.php script
upgrade_plugins('enrol', 'enrol', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check all auth plugins and upgrade if necessary
upgrade_plugins('auth', 'auth', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check all course formats and upgrade if necessary
upgrade_plugins('format', 'course/format', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
/// Check for local database customisations
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/locallib.php";
upgrade_local_db("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// Check for changes to RPC functions
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions("{$CFG->wwwroot}/{$CFG->admin}/index.php");
// Return here afterwards
/// just make sure upgrade logging is properly terminated
upgrade_log_finish();
unset($_SESSION['installautopilot']);
/// Set up the blank site - to be customized later at the end of install.
if (!($site = get_site())) {
// We are about to create the site "course"
示例5: notify
}
} else {
if ($version < $CFG->version) {
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
}
}
/// Updated human-readable release version if necessary
if ($release != $CFG->release) {
// Update the release version
set_config("release", $release);
}
/// upgrade all plugins types
try {
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
upgrade_plugins($type, $location, 'print_upgrade_part_start', 'print_upgrade_part_end');
}
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
/// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
try {
// this needs a full rewrite, sorry to mention that :-(
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions();
// Return here afterwards
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例6: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose)
{
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
// Reset caches before any output.
cache_helper::purge_all(true);
purge_all_caches();
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type => $location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Upgrade services.
// This function gives plugins and subsystems a chance to add functions to existing built-in services.
external_update_services();
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
// Mark the site as upgraded.
set_config('allversionshash', core_component::get_all_versions_hash());
// Purge caches again, just to be sure we arn't holding onto old stuff now.
cache_helper::purge_all(true);
purge_all_caches();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
} catch (Throwable $ex) {
// Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5).
upgrade_handle_exception($ex);
}
}
示例7: deploy_ingredients
/**
* Adds and upgrades the selected plugins
*
* @param array $ingredients
* @param string $path Path to the ingredient type file system
* @param SimpleXMLElement $xml
* @return array Problems during the ingredients deployment
*/
public function deploy_ingredients($ingredients, $path, SimpleXMLElement $xml)
{
// Using the $ingredients array keys to maintain coherence with the main deployment method
$problems = array();
$pluginman = plugin_manager::instance();
$plugintypespaths = get_plugin_types();
$this->get_flavour_info($xml);
foreach ($ingredients as $selection) {
// [0] => ingredienttype, [1] => ingredientname
$ingredientdata = explode('/', $selection);
$type = $ingredientdata[0];
$ingredient = $ingredientdata[1];
if (empty($this->branches[$type]->branches[$ingredient])) {
$problems[$selection]['pluginnotfound'] = $selection;
continue;
}
$ingredientdata = $this->branches[$type]->branches[$ingredient];
// Adapter to the restrictions array
if (!empty($ingredientdata->restrictions)) {
$problems[$selection] = $ingredientdata->restrictions;
continue;
}
if (empty($xml->{$type}) || empty($xml->{$type}->{$ingredient})) {
$problems[$selection]['pluginnotfound'] = $selection;
continue;
}
// Deploy then
$ingredientpath = $plugintypespaths[$type] . '/' . $ingredient;
// Remove old dir if present
if (file_exists($ingredientpath)) {
// Report if the old plugin directory can't be removed
if (!$this->unlink($ingredientpath)) {
$problems[$selection]['plugincantremove'] = $selection;
continue;
}
}
// Copy the new contents where the flavour says
$tmppath = $path . '/' . $xml->{$type}->{$ingredient}->path;
if (!$this->copy($tmppath, $ingredientpath)) {
debugging('From : ' . $tmppath . ' To: ' . $ingredientpath);
$problems[$selection]['plugincopyerror'] = $selection;
}
}
// Execute the moodle upgrade process
try {
foreach ($plugintypespaths as $type => $location) {
upgrade_plugins($type, 'flavours_print_upgrade_void', 'flavours_print_upgrade_void', false);
}
} catch (Exception $ex) {
abort_all_db_transactions();
$info = get_exception_info($ex);
upgrade_log(UPGRADE_LOG_ERROR, $ex->module, 'Exception: ' . get_class($ex), $info->message, $info->backtrace);
}
return $problems;
}
示例8: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose)
{
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
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();
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
// Reset the cache system to a normal state.
cache_factory::reset();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例9: xmldb_main_install
xmldb_main_install($version);
/// Continue with the instalation
// Install the roles system.
moodle_install_roles();
// Install core event handlers
events_update_definition();
// Install core message providers
message_update_providers();
message_update_providers('message');
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
admin_apply_default_settings(NULL, true);
/// upgrade all plugins types
$upgradedplugins = false;
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
$upgradedplugins = upgrade_plugins($type, $location) || $upgradedplugins;
}
/// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions($return_url);
// Return here afterwards
}
/// Check for local database customisations
/// first old *.php update and then the new upgrade.php script
require_once "{$CFG->dirroot}/lib/locallib.php";
upgrade_local_db($return_url);
// Return here afterwards
/// just make sure upgrade logging is properly terminated
upgrade_finished();
/// make sure admin user is created - this is the last step because we need
示例10: xmldb_main_install
$DB->get_manager()->install_from_xmldb_file("{$CFG->libdir}/db/install.xml");
/// set all core default records and default settings
require_once "{$CFG->libdir}/db/install.php";
xmldb_main_install($version);
/// Continue with the instalation
// Install the roles system.
moodle_install_roles();
// Install core event handlers
events_update_definition();
// Install core message providers
message_update_providers();
message_update_providers('message');
// Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
admin_apply_default_settings(NULL, true);
/// upgrade all plugins types
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
upgrade_plugins($type);
}
/// Check for changes to RPC functions
if ($CFG->mnet_dispatcher_mode != 'off') {
require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php";
upgrade_RPC_functions($return_url);
// Return here afterwards
}
/// just make sure upgrade logging is properly terminated
upgrade_finished();
/// make sure admin user is created - this is the last step because we need
/// session to be working properly in order to edit admin account
create_admin_user();
redirect('index.php');
示例11: setcookie
setcookie("hotaru_key", "", time() - 3600, "/");
// remove cookies from whole domain just in case of 1.4.2 cookies issue
$parsed = parse_url(BASEURL);
setcookie("hotaru_user", "", time() - 3600, "/", "." . $parsed['host']);
setcookie("hotaru_key", "", time() - 3600, "/", "." . $parsed['host']);
if ($action == 'upgrade') {
upgrade_step_3($h);
} else {
//$db = init_database();
register_admin($h);
// Username and password for Admin user...
}
break;
case 4:
if ($action == 'upgrade') {
upgrade_plugins($h);
} else {
installation_complete($h);
// Delete "install" folder. Visit your site"
}
break;
case 90:
template($h, 'help.php');
break;
case 99:
$dbuser_name = $h->cage->get->testAlnumLines('dbuser_name');
$dbpassword_name = $h->cage->get->KeyExists('dbpassword_name');
$dbname_name = $h->cage->get->testAlnumLines('dbname_name');
$dbhost_name = $h->cage->get->testAlnumLines('dbhost_name');
if (!$settings_file_exists) {
$db = new ezSQL_mysql($dbuser_name, $dbpassword_name, $dbname_name, $dbhost_name);
示例12: print_heading
// Don't return anywhere
if ($verbose > CLI_NO) {
print_heading(get_string('upgradinggradeimportplugin', 'install'), '', 1);
}
upgrade_plugins('gradeimport', 'grade/import', '');
// Don't return anywhere
if ($verbose > CLI_NO) {
print_heading(get_string('upgradinggradereportplugin', 'install'), '', 1);
}
upgrade_plugins('gradereport', 'grade/report', '');
// Don't return anywhere
/// Check all message output plugins and upgrade if necessary
if ($verbose > CLI_NO) {
print_heading(get_string('upgradingmessageoutputpluggin', 'install'), '', 1);
}
upgrade_plugins('message', 'message/output', '');
// Don't return anywhere
/// just make sure upgrade logging is properly terminated
upgrade_finished();
/// Set up the site
if (!($site = get_site())) {
// We are about to create the site "course"
if ($interactive == CLI_FULL || $interactive == CLI_SEMI && (!isset($INSTALL['sitefullname']) || !isset($INSTALL['siteshortname']) || !isset($INSTALL['sitesummary']) || !isset($INSTALL['sitenewsitems']))) {
console_write('siteinfo');
print_newline();
}
if ($interactive == CLI_FULL || $interactive == CLI_SEMI && !isset($INSTALL['sitefullname'])) {
console_write('sitefullname');
$sitefullname = read();
} else {
if (isset($INSTALL['sitefullname'])) {
示例13: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose) {
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
// Disable the use of cache stores here.
// We don't reset this, the site can live without proper caching for life of this request.
cache_factory::disable_stores();
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type=>$location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例14: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose) {
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
// Reset caches before any output.
cache_helper::purge_all(true);
purge_all_caches();
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type=>$location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
// Mark the site as upgraded.
set_config('allversionshash', core_component::get_all_versions_hash());
// Purge caches again, just to be sure we arn't holding onto old stuff now.
cache_helper::purge_all(true);
purge_all_caches();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例15: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose) {
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type=>$location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}