Permalink
Browse files

Merge branch 'master' into install_master

  • Loading branch information...
2 parents 441972d + d45e65c commit 7800935d19b67dc307b38adac30605cc09f2fda3 AMOS bot committed Sep 28, 2013
Showing 3,836 changed files with 531,010 additions and 503,047 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
View
@@ -10,6 +10,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
+require_once($CFG->libdir.'/pluginlib.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
@@ -51,7 +52,8 @@
if ($auth == $CFG->registerauth) {
set_config('registerauth', '');
}
- session_gc(); // remove stale sessions
+ \core\session\manager::gc(); // Remove stale sessions.
+ plugin_manager::reset_caches();
break;
case 'enable':
@@ -61,7 +63,8 @@
$authsenabled = array_unique($authsenabled);
set_config('auth', implode(',', $authsenabled));
}
- session_gc(); // remove stale sessions
+ \core\session\manager::gc(); // Remove stale sessions.
+ plugin_manager::reset_caches();
break;
case 'down':
View
@@ -1,76 +0,0 @@
-<?php
-
-// block.php - allows admin to edit all local configuration variables for a block
-
- require_once('../config.php');
- require_once($CFG->libdir.'/adminlib.php');
-
- $blockid = required_param('block', PARAM_INT);
-
- if(!$blockrecord = blocks_get_record($blockid)) {
- print_error('blockdoesnotexist', 'error');
- }
-
- admin_externalpage_setup('blocksetting'.$blockrecord->name);
-
- $block = block_instance($blockrecord->name);
- if($block === false) {
- print_error('blockcannotinistantiate', 'error');
- }
-
- // Define the data we're going to silently include in the instance config form here,
- // so we can strip them from the submitted data BEFORE handling it.
- $hiddendata = array(
- 'block' => $blockid,
- 'sesskey' => sesskey()
- );
-
- /// If data submitted, then process and store.
-
- if ($config = data_submitted()) {
-
- if (!confirm_sesskey()) {
- print_error('confirmsesskeybad', 'error');
- }
- if(!$block->has_config()) {
- print_error('blockcannotconfig', 'error');
- }
- $remove = array_keys($hiddendata);
- foreach($remove as $item) {
- unset($config->$item);
- }
- $block->config_save($config);
- redirect("$CFG->wwwroot/$CFG->admin/blocks.php", get_string("changessaved"), 1);
- exit;
- }
-
- /// Otherwise print the form.
-
- $strmanageblocks = get_string('manageblocks');
- $strblockname = $block->get_title();
-
- echo $OUTPUT->header();
-
- echo $OUTPUT->heading($strblockname);
-
- echo $OUTPUT->notification('This block still uses an old-style config_global.html file. ' .
- 'It must be updated by a developer to use a settings.php file.');
-
- echo $OUTPUT->box(get_string('configwarning', 'admin'), 'generalbox boxwidthnormal boxaligncenter');
- echo '<br />';
-
- echo '<form method="post" action="block.php">';
- echo '<p>';
- foreach($hiddendata as $name => $val) {
- echo '<input type="hidden" name="'. $name .'" value="'. $val .'" />';
- }
- echo '</p>';
-
- echo $OUTPUT->box_start();
- include($CFG->dirroot.'/blocks/'. $block->name() .'/config_global.html');
- echo $OUTPUT->box_end();
-
- echo '</form>';
- echo $OUTPUT->footer();
-
-
View
@@ -5,6 +5,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
+ require_once($CFG->libdir.'/pluginlib.php');
admin_externalpage_setup('manageblocks');
@@ -29,16 +30,14 @@
$strprotect = get_string('blockprotect', 'admin');
$strunprotect = get_string('blockunprotect', 'admin');
- // Purge all caches related to blocks administration.
- cache::make('core', 'plugininfo_block')->purge();
-
/// If data submitted, then process and store.
if (!empty($hide) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$hide))) {
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '0', array('id'=>$block->id)); // Hide block
+ plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
}
@@ -47,6 +46,7 @@
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '1', array('id'=>$block->id)); // Show block
+ plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
}
@@ -120,12 +120,13 @@
foreach ($blocknames as $blockid=>$strblockname) {
$block = $blocks[$blockid];
$blockname = $block->name;
+ $dbversion = get_config('block_'.$block->name, 'version');
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$strblockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new stdClass();
- $plugin->version = $block->version;
+ $plugin->version = $dbversion;
} else {
$plugin = new stdClass();
@@ -186,10 +187,10 @@
$class = ' class="dimmed_text"'; // Leading space required!
}
- if ($block->version == $plugin->version) {
- $version = $block->version;
+ if ($dbversion == $plugin->version) {
+ $version = $dbversion;
} else {
- $version = "$block->version ($plugin->version)";
+ $version = "$dbversion ($plugin->version)";
}
if (!$blockobject) {
View
@@ -151,6 +151,7 @@
}
// set up configuration
+global $CFG;
$CFG = new stdClass();
$CFG->lang = 'en';
$CFG->dirroot = dirname(dirname(dirname(__FILE__)));
@@ -189,9 +190,37 @@
require_once($CFG->libdir.'/componentlib.class.php');
require_once($CFG->dirroot.'/cache/lib.php');
+// Register our classloader, in theory somebody might want to replace it to load other hacked core classes.
+// Required because the database checks below lead to session interaction which is going to lead us to requiring autoloaded classes.
+if (defined('COMPONENT_CLASSLOADER')) {
+ spl_autoload_register(COMPONENT_CLASSLOADER);
+} else {
+ spl_autoload_register('core_component::classloader');
+}
+
require($CFG->dirroot.'/version.php');
$CFG->target_release = $release;
+$_SESSION = array();
+$_SESSION['SESSION'] = new stdClass();
+$_SESSION['SESSION']->lang = $CFG->lang;
+$_SESSION['USER'] = new stdClass();
+$_SESSION['USER']->id = 0;
+$_SESSION['USER']->mnethostid = 1;
+
+global $SESSION;
+global $USER;
+$SESSION = &$_SESSION['SESSION'];
+$USER = &$_SESSION['USER'];
+
+global $COURSE;
+$COURSE = new stdClass();
+$COURSE->id = 1;
+
+global $SITE;
+$SITE = $COURSE;
+define('SITEID', 1);
+
//Database types
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'),
View
@@ -172,7 +172,7 @@
upgrade_noncore(true);
// log in as admin - we need doanything permission when applying defaults
-session_set_user(get_admin());
+\core\session\manager::set_user(get_admin());
// apply all default settings, just in case do it twice to fill all defaults
admin_apply_default_settings(NULL, false);
View
@@ -53,11 +53,13 @@
print_error('cannotdisableformat', 'error', $return);
}
set_config('disabled', 1, 'format_'. $formatname);
+ plugin_manager::reset_caches();
}
break;
case 'enable':
if (!$formatplugins[$formatname]->is_enabled()) {
unset_config('disabled', 'format_'. $formatname);
+ plugin_manager::reset_caches();
}
break;
case 'up':
View
@@ -53,7 +53,7 @@
require_once($CFG->libdir.'/cronlib.php');
// extra safety
-session_get_instance()->write_close();
+\core\session\manager::write_close();
// check if execution allowed
if (!empty($CFG->cronclionly)) {
View
@@ -7,6 +7,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
+require_once($CFG->libdir.'/pluginlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$editor = required_param('editor', PARAM_PLUGIN);
@@ -93,6 +94,7 @@
}
set_config('texteditors', implode(',', $active_editors));
+plugin_manager::reset_caches();
if ($return) {
redirect ($returnurl);
View
@@ -27,6 +27,7 @@
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
+require_once($CFG->libdir.'/pluginlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$enrol = required_param('enrol', PARAM_PLUGIN);
@@ -50,6 +51,7 @@
case 'disable':
unset($enabled[$enrol]);
set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
+ plugin_manager::reset_caches();
$syscontext->mark_dirty(); // resets all enrol caches
break;
@@ -60,6 +62,7 @@
$enabled = array_keys($enabled);
$enabled[] = $enrol;
set_config('enrol_plugins_enabled', implode(',', $enabled));
+ plugin_manager::reset_caches();
$syscontext->mark_dirty(); // resets all enrol caches
break;
View
@@ -33,6 +33,7 @@
require_once(dirname(__FILE__) . '/../config.php');
require_once($CFG->libdir . '/adminlib.php');
+ require_once($CFG->libdir . '/pluginlib.php');
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$filterpath = optional_param('filterpath', '', PARAM_SAFEDIR);
@@ -44,9 +45,6 @@
$returnurl = "$CFG->wwwroot/$CFG->admin/filters.php";
admin_externalpage_setup('managefilters');
- // Purge all caches related to filter administration.
- cache::make('core', 'plugininfo_filter')->purge();
-
$filters = filter_get_global_states();
// In case any new filters have been installed, but not put in the table yet.
@@ -59,7 +57,7 @@
/// Process actions ============================================================
if ($action) {
- if (!isset($filters[$filterpath]) && !isset($newfilters[$filterpath])) {
+ if ($action !== 'delete' and !isset($filters[$filterpath]) and !isset($newfilters[$filterpath])) {
throw new moodle_exception('filternotinstalled', 'error', $returnurl, $filterpath);
}
@@ -97,38 +95,6 @@
filter_set_global_state($filterpath, $filters[$filterpath]->active, -1);
}
break;
-
- case 'delete':
- // If not yet confirmed, display a confirmation message.
- if (!optional_param('confirm', '', PARAM_BOOL)) {
- $filtername = filter_get_name($filterpath);
-
- $title = get_string('deletefilterareyousure', 'admin', $filtername);
- echo $OUTPUT->header();
- echo $OUTPUT->heading($title);
-
- $linkcontinue = new moodle_url($returnurl, array('action' => 'delete', 'filterpath' => $filterpath, 'confirm' => 1));
- $formcancel = new single_button(new moodle_url($returnurl), get_string('no'), 'get');
- echo $OUTPUT->confirm(get_string('deletefilterareyousuremessage', 'admin', $filtername), $linkcontinue, $formcancel);
- echo $OUTPUT->footer();
- exit;
- }
-
- // Do the deletion.
- $title = get_string('deletingfilter', 'admin', $filterpath);
- echo $OUTPUT->header();
- echo $OUTPUT->heading($title);
-
- // Delete all data for this plugin.
- filter_delete_all_for_filter($filterpath);
-
- $a = new stdClass;
- $a->filter = $filterpath;
- $a->directory = "$CFG->dirroot/filter/$filterpath";
- echo $OUTPUT->box(get_string('deletefilterfiles', 'admin', $a), 'generalbox', 'notice');
- echo $OUTPUT->continue_button($returnurl);
- echo $OUTPUT->footer();
- exit;
}
// Add any missing filters to the DB table.
@@ -138,6 +104,7 @@
// Reset caches and return
if ($action) {
+ plugin_manager::reset_caches();
reset_text_filters_cache();
redirect($returnurl);
}
@@ -212,6 +179,9 @@
/// Display helper functions ===================================================
function filters_action_url($filterpath, $action) {
+ if ($action === 'delete') {
+ return new moodle_url('/admin/plugins.php', array('sesskey'=>sesskey(), 'uninstall'=>'filter_'.$filterpath));
+ }
return new moodle_url('/admin/filters.php', array('sesskey'=>sesskey(), 'filterpath'=>$filterpath, 'action'=>$action));
}
Oops, something went wrong.

0 comments on commit 7800935

Please sign in to comment.