<?php
- // Allows the admin to configure blocks (hide/show, delete and configure)
+ // Allows the admin to configure blocks (hide/show, uninstall and configure)
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
- $delete = optional_param('delete', 0, PARAM_INT);
$unprotect = optional_param('unprotect', 0, PARAM_INT);
$protect = optional_param('protect', 0, PARAM_INT);
/// Print headings
$strmanageblocks = get_string('manageblocks');
- $strdelete = get_string('delete');
+ $struninstall = get_string('uninstallplugin', 'core_admin');
$strversion = get_string('version');
$strhide = get_string('hide');
$strshow = get_string('show');
admin_get_root(true, false); // settings not required - only pages
}
- if (!empty($delete) && confirm_sesskey()) {
- echo $OUTPUT->header();
- echo $OUTPUT->heading($strmanageblocks);
-
- if (!$block = blocks_get_record($delete)) {
- print_error('blockdoesnotexist', 'error');
- }
-
- if (get_string_manager()->string_exists('pluginname', "block_$block->name")) {
- $strblockname = get_string('pluginname', "block_$block->name");
- } else {
- $strblockname = $block->name;
- }
-
- if (!$confirm) {
- echo $OUTPUT->confirm(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete='.$block->id.'&confirm=1', 'blocks.php');
- echo $OUTPUT->footer();
- exit;
-
- } else {
- uninstall_plugin('block', $block->name);
-
- $a = new stdClass();
- $a->block = $strblockname;
- $a->directory = $CFG->dirroot.'/blocks/'.$block->name;
- notice(get_string('blockdeletefiles', '', $a), 'blocks.php');
- }
- }
-
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
$table = new flexible_table('admin-blocks-compatible');
- $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'delete', 'settings'));
- $table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strdelete, $strsettings));
+ $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'uninstall', 'settings'));
+ $table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $struninstall, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'admintable blockstable generaltable');
$table->set_attribute('id', 'compatibleblockstable');
}
}
- $delete = '<a href="blocks.php?delete='.$blockid.'&sesskey='.sesskey().'">'.$strdelete.'</a>';
+ if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('block_'.$blockname)) {
+ $uninstall = html_writer::link($uninstallurl, $struninstall);
+ } else {
+ $uninstall = '';
+ }
$settings = ''; // By default, no configuration
if ($blockobject and $blockobject->has_config()) {
'<span'.$class.'>'.$version.'</span>',
$visible,
$undeletable,
- $delete,
+ $uninstall,
$settings
);
$table->add_data($row);
$table = new flexible_table('admin-blocks-incompatible');
- $table->define_columns(array('block', 'delete'));
- $table->define_headers(array($strname, $strdelete));
+ $table->define_columns(array('block', 'uninstall'));
+ $table->define_headers(array($strname, $struninstall));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
$table->setup();
foreach ($incompatible as $block) {
+ if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('block_'.$block->name)) {
+ $uninstall = html_writer::link($uninstallurl, $struninstall);
+ } else {
+ $uninstall = '';
+ }
$table->add_data(array(
$block->name,
- '<a href="blocks.php?delete='.$block->id.'&sesskey='.sesskey().'">'.$strdelete.'</a>',
+ $uninstall,
));
}
$table->print_html();
--- /dev/null
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This hack is intended for clustered sites that do not want
+ * to use shared cachedir for component cache.
+ *
+ * This file needs to be called after any change in PHP files in dataroot,
+ * that is before upgrade and install.
+ *
+ * @package core
+ * @copyright 2013 Petr Skoda (skodak) {@link http://skodak.org}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+
+define('CLI_SCRIPT', true);
+define('ABORT_AFTER_CONFIG', true); // We need just the values from config.php.
+define('CACHE_DISABLE_ALL', true); // This prevents reading of existing caches.
+define('IGNORE_COMPONENT_CACHE', true);
+
+require(__DIR__.'/../../config.php');
+require_once($CFG->libdir.'/clilib.php');
+
+// Now get cli options.
+list($options, $unrecognized) = cli_get_params(
+ array(
+ 'file' => false,
+ 'rebuild' => false,
+ 'print' => false,
+ 'help' => false
+ ),
+ array(
+ 'h' => 'help'
+ )
+);
+
+if ($unrecognized) {
+ $unrecognized = implode("\n ", $unrecognized);
+ cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
+}
+
+if (!$options['rebuild'] and !$options['file'] and !$options['print']) {
+ $help =
+"Create alternative component cache file
+
+Options:
+-h, --help Print out this help
+--rebuild Rebuild \$CFG->alternative_component_cache file
+--file=filepath Save component cache to file
+--print Print component cache file content
+
+Example:
+\$ php admin/cli/rebuild_alternative_component_cache.php --rebuild
+";
+
+ echo $help;
+ exit(0);
+}
+
+error_reporting(E_ALL | E_STRICT);
+ini_set('display_errors', 1);
+
+$content = core_component::get_cache_content();
+
+if ($options['print']) {
+ echo $content;
+ exit(0);
+}
+
+if ($options['rebuild']) {
+ if (empty($CFG->alternative_component_cache)) {
+ fwrite(STDERR, 'config.php does not contain $CFG->alternative_component_cache setting');
+ fwrite(STDERR, "\n");
+ exit(2);
+ }
+ $target = $CFG->alternative_component_cache;
+} else {
+ $target = $options['file'];
+}
+
+if (!$target) {
+ fwrite(STDERR, "Invalid target file $target");
+ fwrite(STDERR, "\n");
+ exit(1);
+}
+
+$bytes = file_put_contents($target, $content);
+
+if (!$bytes) {
+ fwrite(STDERR, "Error writing to $target");
+ fwrite(STDERR, "\n");
+ exit(1);
+}
+
+// Success.
+echo "File $target was updated\n";
+exit(0);
exit(1);
}
+// Force OPcache reset if used, we do not want any stale caches
+// when preparing test environment.
+if (function_exists('opcache_reset')) {
+ opcache_reset();
+}
+
$help =
"Command line Moodle installer, creates config.php and initializes database.
Please note you must execute this script with the same uid as apache
define('PHPUNIT_TEST', false);
+define('IGNORE_COMPONENT_CACHE', true);
+
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.3.3") < 0) {
$phpversion = phpversion();
ini_set('include_path', $CFG->libdir.'/pear' . PATH_SEPARATOR . ini_get('include_path'));
require_once($CFG->libdir.'/classes/component.php');
+require_once($CFG->libdir.'/classes/text.php');
require_once($CFG->libdir.'/installlib.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/setuplib.php');
-require_once($CFG->libdir.'/textlib.class.php');
require_once($CFG->libdir.'/weblib.php');
require_once($CFG->libdir.'/dmllib.php');
require_once($CFG->libdir.'/moodlelib.php');
//Database types
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
+ 'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'),
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
'oci' => moodle_database::get_driver_instance('oci', 'native'),
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
cli_error(get_string('pathserrcreatedataroot', 'install', $a));
}
}
-$CFG->tempdir = $CFG->dataroot.'/temp';
-$CFG->cachedir = $CFG->dataroot.'/cache';
+$CFG->tempdir = $CFG->dataroot.'/temp';
+$CFG->cachedir = $CFG->dataroot.'/cache';
+$CFG->localcachedir = $CFG->dataroot.'/localcache';
// download required lang packs
if ($CFG->lang !== 'en') {
exit(1);
}
+// Force OPcache reset if used, we do not want any stale caches
+// when preparing test environment.
+if (function_exists('opcache_reset')) {
+ opcache_reset();
+}
+
$help =
"Advanced command line Moodle database installer.
Please note you must execute this script with the same uid as apache.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+// Force OPcache reset if used, we do not want any stale caches
+// when detecting if upgrade necessary or when running upgrade.
+if (function_exists('opcache_reset') and !isset($_SERVER['REMOTE_ADDR'])) {
+ opcache_reset();
+}
+
define('CLI_SCRIPT', true);
define('CACHE_DISABLE_ALL', true);
$action = required_param('action', PARAM_ALPHANUMEXT);
$formatname = required_param('format', PARAM_PLUGIN);
-$confirm = optional_param('confirm', 0, PARAM_BOOL);
$syscontext = context_system::instance();
$PAGE->set_url('/admin/courseformats.php');
set_config('format_plugins_sortorder', implode(',', $seq));
}
break;
- case 'uninstall':
- echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('courseformats', 'moodle'));
-
- $coursecount = $DB->count_records('course', array('format' => $formatname));
- if ($coursecount) {
- // Check that default format is set. It will be used to convert courses
- // using this format
- $defaultformat = get_config('moodlecourse', 'format');
- $defaultformat = $formatplugins[get_config('moodlecourse', 'format')];
- if (!$defaultformat) {
- echo $OUTPUT->error_text(get_string('defaultformatnotset', 'admin'));
- echo $OUTPUT->footer();
- exit;
- }
- }
-
- $format = $formatplugins[$formatname];
- $deleteurl = $format->get_uninstall_url();
- if (!$deleteurl) {
- // somebody was trying to cheat and type non-existing link
- echo $OUTPUT->error_text(get_string('cannotuninstall', 'admin', $format->displayname));
- echo $OUTPUT->footer();
- exit;
- }
-
- if (!$confirm) {
- if ($coursecount) {
- $message = get_string('formatuninstallwithcourses', 'admin',
- (object)array('count' => $coursecount, 'format' => $format->displayname,
- 'defaultformat' => $defaultformat->displayname));
- } else {
- $message = get_string('formatuninstallconfirm', 'admin', $format->displayname);
- }
- $deleteurl->param('confirm', 1);
- echo $OUTPUT->confirm($message, $deleteurl, $return);
- } else {
- $a = new stdClass();
- $a->plugin = $format->displayname;
- $a->directory = $format->rootdir;
- uninstall_plugin('format', $formatname);
- echo $OUTPUT->notification(get_string('formatuninstalled', 'admin', $a), 'notifysuccess');
- echo $OUTPUT->continue_button($return);
- }
-
- echo $OUTPUT->footer();
- exit;
}
redirect($return);
}
break;
- case 'uninstall':
- if ($editor === 'textarea') {
- redirect($returnurl);
- }
- if (get_string_manager()->string_exists('pluginname', 'editor_'.$editor)) {
- $strplugin = get_string('pluginname', 'editor_'.$editor);
- } else {
- $strplugin = $editor;
- }
-
- $PAGE->set_title($strplugin);
- echo $OUTPUT->header();
-
- if (!$confirm) {
- echo $OUTPUT->heading(get_string('editors', 'core_editor'));
-
- $deleteurl = new moodle_url('/admin/editors.php', array('action'=>'uninstall', 'editor'=>$editor, 'sesskey'=>sesskey(), 'confirm'=>1));
-
- echo $OUTPUT->confirm(get_string('editordeleteconfirm', 'core_editor', $strplugin),
- $deleteurl, $returnurl);
- echo $OUTPUT->footer();
- die();
-
- } else {
- // Remove from enabled list.
- $key = array_search($editor, $active_editors);
- unset($active_editors[$key]);
- set_config('texteditors', implode(',', $active_editors));
-
- // Delete everything!!
- uninstall_plugin('editor', $editor);
-
- $a = new stdClass();
- $a->name = $strplugin;
- $a->directory = "$CFG->dirroot/lib/editor/$editor";
- echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
- echo $OUTPUT->continue_button($returnurl);
- echo $OUTPUT->footer();
- die();
- }
-
default:
break;
}
$action = required_param('action', PARAM_ALPHANUMEXT);
$enrol = required_param('enrol', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
-$migrate = optional_param('migrate', 0, PARAM_BOOL);
$PAGE->set_url('/admin/enrol.php');
$PAGE->set_context(context_system::instance());
set_config('enrol_plugins_enabled', implode(',', $enabled));
break;
- case 'uninstall':
+ case 'migrate':
if (get_string_manager()->string_exists('pluginname', 'enrol_'.$enrol)) {
$strplugin = get_string('pluginname', 'enrol_'.$enrol);
} else {
$PAGE->set_title($strplugin);
echo $OUTPUT->header();
- if (!$confirm) {
- echo $OUTPUT->heading(get_string('enrolments', 'enrol'));
+ // This may take a long time.
+ set_time_limit(0);
- $deleteurl = new moodle_url('/admin/enrol.php', array('action'=>'uninstall', 'enrol'=>$enrol, 'sesskey'=>sesskey(), 'confirm'=>1, 'migrate'=>0));
- $migrateurl = new moodle_url('/admin/enrol.php', array('action'=>'uninstall', 'enrol'=>$enrol, 'sesskey'=>sesskey(), 'confirm'=>1, 'migrate'=>1));
-
- $migrate = new single_button($migrateurl, get_string('uninstallmigrate', 'enrol'));
- $delete = new single_button($deleteurl, get_string('uninstalldelete', 'enrol'));
- $cancel = new single_button($return, get_string('cancel'), 'get');
-
- $buttons = $OUTPUT->render($delete) . $OUTPUT->render($cancel);
- if ($enrol !== 'manual') {
- $buttons = $OUTPUT->render($migrate) . $buttons;
- }
-
- echo $OUTPUT->box_start('generalbox', 'notice');
- echo html_writer::tag('p', markdown_to_html(get_string('uninstallconfirm', 'enrol', $strplugin)));
- echo html_writer::tag('div', $buttons, array('class' => 'buttons'));
- echo $OUTPUT->box_end();
-
- echo $OUTPUT->footer();
- exit;
-
- } else {
- // This may take a long time.
- set_time_limit(0);
-
- // Disable plugin to prevent concurrent cron execution.
- unset($enabled[$enrol]);
- set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
-
- if ($migrate) {
- echo $OUTPUT->heading(get_string('uninstallmigrating', 'enrol', 'enrol_'.$enrol));
+ // Disable plugin to prevent concurrent cron execution.
+ unset($enabled[$enrol]);
+ set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
- require_once("$CFG->dirroot/enrol/manual/locallib.php");
- enrol_manual_migrate_plugin_enrolments($enrol);
+ echo $OUTPUT->heading(get_string('uninstallmigrating', 'enrol', 'enrol_'.$enrol));
- echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
- }
+ require_once("$CFG->dirroot/enrol/manual/locallib.php");
+ enrol_manual_migrate_plugin_enrolments($enrol);
- // Delete everything!!
- uninstall_plugin('enrol', $enrol);
- $syscontext->mark_dirty(); // Resets all enrol caches.
+ echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
- $a = new stdClass();
- $a->plugin = $strplugin;
- $a->directory = "$CFG->dirroot/enrol/$enrol";
- echo $OUTPUT->notification(get_string('uninstalldeletefiles', 'enrol', $a), 'notifysuccess');
- echo $OUTPUT->continue_button($return);
- echo $OUTPUT->footer();
- exit;
+ if (!$return = plugin_manager::instance()->get_uninstall_url('enrol_'.$enrol)) {
+ $return = new moodle_url('/admin/plugins.php');
}
+ echo $OUTPUT->continue_button($return);
+ echo $OUTPUT->footer();
+ exit;
}
</PHP_SETTING>
</PHP_SETTINGS>
</MOODLE>
+ <MOODLE version="2.6" requires="2.2">
+ <UNICODE level="required">
+ <FEEDBACK>
+ <ON_ERROR message="unicoderequired" />
+ </FEEDBACK>
+ </UNICODE>
+ <DATABASE level="required">
+ <VENDOR name="mariadb" version="5.3.5" />
+ <VENDOR name="mysql" version="5.1.33" />
+ <VENDOR name="postgres" version="8.3" />
+ <VENDOR name="mssql" version="9.0" />
+ <VENDOR name="oracle" version="10.2" />
+ </DATABASE>
+ <PHP version="5.3.3" level="required">
+ </PHP>
+ <PCREUNICODE level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="pcreunicodewarning" />
+ </FEEDBACK>
+ </PCREUNICODE>
+ <PHP_EXTENSIONS>
+ <PHP_EXTENSION name="iconv" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="iconvrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="mbstring" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="mbstringrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="curl" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="curlrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="openssl" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="opensslrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="tokenizer" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="tokenizerrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="xmlrpc" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="xmlrpcrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="soap" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="soaprecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="ctype" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="ctyperequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="zip" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="ziprequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="zlib" level="optional">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="gd" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="gdrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="simplexml" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="simplexmlrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="spl" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="splrequired" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="pcre" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="dom" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="xml" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="intl" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="intlrecommended" />
+ </FEEDBACK>
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="json" level="required">
+ </PHP_EXTENSION>
+ <PHP_EXTENSION name="hash" level="required"/>
+ </PHP_EXTENSIONS>
+ <PHP_SETTINGS>
+ <PHP_SETTING name="memory_limit" value="64M" level="required">
+ <FEEDBACK>
+ <ON_ERROR message="settingmemorylimit" />
+ </FEEDBACK>
+ </PHP_SETTING>
+ <PHP_SETTING name="safe_mode" value="0" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="settingsafemode" />
+ </FEEDBACK>
+ </PHP_SETTING>
+ <PHP_SETTING name="file_uploads" value="1" level="optional">
+ <FEEDBACK>
+ <ON_CHECK message="settingfileuploads" />
+ </FEEDBACK>
+ </PHP_SETTING>
+ </PHP_SETTINGS>
+ </MOODLE>
</COMPATIBILITY_MATRIX>
$action = clam_handle_infected_file($file,$log->userid,true);
clam_replace_infected_file($file);
- list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
+ $ctxselect = ', ' . context_helper::get_preload_record_columns_sql('ctx');
+ $ctxjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = :contextlevel)";
$sql = "SELECT c.id, c.fullname $ctxselect FROM {course} c $ctxjoin WHERE c.id = :courseid";
- $course = $DB->get_record_sql($sql, array('courseid' => $log->course));
- context_instance_preload($course);
+ $course = $DB->get_record_sql($sql, array('courseid' => $log->course, 'contextlevel' => CONTEXT_COURSE));
+ context_helper::preload_from_record($course);
$user = $DB->get_record("user", array("id"=>$log->userid));
$subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
define('NO_OUTPUT_BUFFERING', true);
-if (empty($_GET['cache']) and empty($_POST['cache'])) {
+if (empty($_GET['cache']) and empty($_POST['cache']) and empty($_GET['sesskey']) and empty($_POST['sesskey'])) {
// Prevent caching at all cost when visiting this page directly,
// we redirect to self once we known no upgrades are necessary.
// Note: $_GET and $_POST are used here intentionally because our param cleaning is not loaded yet.
+ // Note2: the sesskey is present in all block editing hacks, we can not redirect there, so enable caching.
define('CACHE_DISABLE_ALL', true);
+
+ // Force OPcache reset if used, we do not want any stale caches
+ // when detecting if upgrade necessary or when running upgrade.
+ if (function_exists('opcache_reset')) {
+ opcache_reset();
+ }
}
require('../config.php');
// Now we can be sure everything was upgraded and caches work fine,
// redirect if necessary to make sure caching is enabled.
-if (!$cache) {
+if (!$cache and !optional_param('sesskey', '', PARAM_RAW)) {
redirect(new moodle_url($PAGE->url, array('cache' => 1)));
}
admin_externalpage_setup('managelocalplugins');
-$delete = optional_param('delete', '', PARAM_PLUGIN);
-$confirm = optional_param('confirm', '', PARAM_BOOL);
-
-/// If data submitted, then process and store.
-
-if (!empty($delete) and confirm_sesskey()) {
- echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('localplugins'));
-
- if (!$confirm) {
- if (get_string_manager()->string_exists('pluginname', 'local_' . $delete)) {
- $strpluginname = get_string('pluginname', 'local_' . $delete);
- } else {
- $strpluginname = $delete;
- }
- echo $OUTPUT->confirm(get_string('localplugindeleteconfirm', '', $strpluginname),
- new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
- $PAGE->url);
- echo $OUTPUT->footer();
- die();
-
- } else {
- uninstall_plugin('local', $delete);
- $a = new stdclass();
- $a->name = $delete;
- $pluginlocation = get_plugin_types();
- $a->directory = $pluginlocation['local'] . '/' . $delete;
- echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
- echo $OUTPUT->continue_button($PAGE->url);
- echo $OUTPUT->footer();
- die();
- }
-}
-
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('localplugins'));
/// Print the table of all installed local plugins
$table = new flexible_table('localplugins_administration_table');
-$table->define_columns(array('name', 'version', 'delete'));
-$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('delete')));
+$table->define_columns(array('name', 'version', 'uninstall'));
+$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('uninstallplugin', 'core_admin')));
$table->define_baseurl($PAGE->url);
$table->set_attribute('id', 'localplugins');
$table->set_attribute('class', 'admintable generaltable');
$table->setup();
$plugins = array();
-foreach (get_plugin_list('local') as $plugin => $plugindir) {
+foreach (core_component::get_plugin_list('local') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'local_' . $plugin)) {
$strpluginname = get_string('pluginname', 'local_' . $plugin);
} else {
collatorlib::asort($plugins);
foreach ($plugins as $plugin => $name) {
- $delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
- $delete = html_writer::link($delete, get_string('delete'));
+ $uninstall = '';
+ if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('local_'.$plugin)) {
+ $uninstall = html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'));
+ }
$version = get_config('local_' . $plugin);
if (!empty($version->version)) {
$version = '?';
}
- $table->add_data(array($name, $version, $delete));
+ $table->add_data(array($name, $version, $uninstall));
}
$table->print_html();
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$themes = array('' => get_string('forceno'));
- foreach (array_keys(get_plugin_list('theme')) as $themename) {
+ foreach (array_keys(core_component::get_plugin_list('theme')) as $themename) {
$themes[$themename] = get_string('pluginname', 'theme_'.$themename);
}
$mform->addElement('select', 'theme', get_string('forcetheme'), $themes);
$show = optional_param('show', '', PARAM_PLUGIN);
$hide = optional_param('hide', '', PARAM_PLUGIN);
- $delete = optional_param('delete', '', PARAM_PLUGIN);
- $confirm = optional_param('confirm', '', PARAM_BOOL);
/// Print headings
$stractivities = get_string("activities");
- $strdelete = get_string("delete");
+ $struninstall = get_string('uninstallplugin', 'core_admin');
$strversion = get_string("version");
$strhide = get_string("hide");
$strshow = get_string("show");
WHERE module=?";
$DB->execute($sql, array($module->id));
// clear the course modinfo cache for courses
- // where we just deleted something
+ // where we just uninstalld something
$sql = "UPDATE {course}
SET modinfo=''
WHERE id IN (SELECT DISTINCT course
admin_get_root(true, false); // settings not required - only pages
}
- if (!empty($delete) and confirm_sesskey()) {
- echo $OUTPUT->header();
- echo $OUTPUT->heading($stractivities);
-
- if (get_string_manager()->string_exists('modulename', $delete)) {
- $strmodulename = get_string('modulename', $delete);
- } else {
- $strmodulename = $delete;
- }
-
- if (!$confirm) {
- echo $OUTPUT->confirm(get_string("moduledeleteconfirm", "", $strmodulename), "modules.php?delete=$delete&confirm=1", "modules.php");
- echo $OUTPUT->footer();
- exit;
-
- } else { // Delete everything!!
-
- if ($delete == "forum") {
- print_error("cannotdeleteforummodule", 'forum');
- }
-
- uninstall_plugin('mod', $delete);
- $a = new stdClass();
- $a->module = $strmodulename;
- $a->directory = "$CFG->dirroot/mod/$delete";
- echo $OUTPUT->notification(get_string("moduledeletefiles", "", $a), 'notifysuccess');
- echo $OUTPUT->continue_button("modules.php");
- echo $OUTPUT->footer();
- exit;
- }
- }
-
echo $OUTPUT->header();
echo $OUTPUT->heading($stractivities);
/// Print the table of all modules
// construct the flexible table ready to display
$table = new flexible_table(MODULE_TABLE);
- $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'delete', 'settings'));
- $table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $strdelete, $strsettings));
+ $table->define_columns(array('name', 'instances', 'version', 'hideshow', 'uninstall', 'settings'));
+ $table->define_headers(array($stractivitymodule, $stractivities, $strversion, "$strhide/$strshow", $struninstall, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/modules.php');
$table->set_attribute('id', 'modules');
$table->set_attribute('class', 'generaltable');
$missing = false;
}
- $delete = "<a href=\"modules.php?delete=$module->name&sesskey=".sesskey()."\">$strdelete</a>";
+ $uninstall = '';
+ if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('mod_'.$module->name)) {
+ $uninstall = html_writer::link($uninstallurl, $struninstall);
+ }
if (file_exists("$CFG->dirroot/mod/$module->name/settings.php") ||
file_exists("$CFG->dirroot/mod/$module->name/settingstree.php")) {
$class = ' class="dimmed_text"';
}
if ($module->name == "forum") {
- $delete = "";
+ $uninstall = "";
$visible = "";
$class = "";
}
$countlink,
'<span'.$class.'>'.$module->version.'</span>',
$visible,
- $delete,
+ $uninstall,
$settings
));
}
+++ /dev/null
-<?php
-
-if (!isset($CFG)) {
-
- require('../config.php');
- require_once($CFG->libdir.'/adminlib.php');
-
- admin_externalpage_setup('oacleanup');
-
- echo $OUTPUT->header();
- online_assignment_cleanup(true);
- echo $OUTPUT->footer();
-
-}
-
-
-
-function online_assignment_cleanup($output=false) {
- global $CFG, $DB, $OUTPUT;
-
- if ($output) {
- echo $OUTPUT->heading('Online Assignment Cleanup');
- echo '<center>';
- }
-
-
- /// We don't want to run this code if we are doing an upgrade from an assignment
- /// version earlier than 2005041400
- /// because the assignment type field will not exist
- $amv = $DB->get_field('modules', 'version', array('name'=>'assignment'));
- if ((int)$amv < 2005041400) {
- if ($output) {
- echo '</center>';
- }
- return;
- }
-
-
- /// get the module id for assignments from db
- $arecord = $DB->get_record('modules', array('name', 'assignment'));
- $aid = $arecord->id;
-
-
- /// get a list of all courses on this site
- list($ctxselect, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
- $sql = "SELECT c.* $ctxselect FROM {course} c $ctxjoin";
- $courses = $DB->get_records_sql($sql);
-
- /// cycle through each course
- foreach ($courses as $course) {
- context_instance_preload($course);
- $context = context_course::instance($course->id);
-
- if (empty($course->fullname)) {
- $fullname = get_string('course').': '.$course->id;
- } else {
- $fullname = format_string($course->fullname, true, array('context' => $context));
- }
- if ($output) echo $OUTPUT->heading($fullname);
-
- /// retrieve a list of sections beyond what is currently being shown
- $courseformatoptions = course_get_format($course)->get_format_options();
- if (!isset($courseformatoptions['numsections'])) {
- // Course format does not use numsections
- if ($output) {
- echo 'No extra sections<br />';
- }
- continue;
- }
- $sql = "SELECT *
- FROM {course_sections}
- WHERE course=? AND section>?
- ORDER BY section ASC";
- $params = array($course->id, $courseformatoptions['numsections']);
- if (!($xsections = $DB->get_records_sql($sql, $params))) {
- if ($output) echo 'No extra sections<br />';
- continue;
- }
-
- /// cycle through each of the xtra sections
- foreach ($xsections as $xsection) {
-
- if ($output) echo 'Checking Section: '.$xsection->section.'<br />';
-
- /// grab any module instances from the sequence field
- if (!empty($xsection->sequence)) {
- $instances = explode(',', $xsection->sequence);
-
- /// cycle through the instances
- foreach ($instances as $instance) {
- /// is this an instance of an online assignment
- $sql = "SELECT a.id
- FROM {course_modules} cm, {assignment} a
- WHERE cm.id = ? AND cm.module = ? AND
- cm.instance = a.id AND a.assignmenttype = 'online'";
- $params = array($instance, $aid);
-
- /// if record exists then we need to move instance to it's correct section
- if ($DB->record_exists_sql($sql, $params)) {
-
- /// check the new section id
- /// the journal update erroneously stored it in course_sections->section
- $newsection = $xsection->section;
- /// double check the new section
- if ($newsection > $courseformatoptions['numsections']) {
- /// get the record for section 0 for this course
- if (!($zerosection = $DB->get_record('course_sections', array('course'=>$course->id, 'section'=>'0')))) {
- continue;
- }
- $newsection = $zerosection->id;
- }
-
- /// grab the section record
- if (!($section = $DB->get_record('course_sections', array('id'=>$newsection)))) {
- if ($output) {
- echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. $fullname .'<br />';
- }
- continue;
- }
-
- /// explode the sequence
- if (($sequence = explode(',', $section->sequence)) === false) {
- $sequence = array();
- }
-
- /// add instance to correct section
- array_push($sequence, $instance);
-
- /// implode the sequence
- $section->sequence = implode(',', $sequence);
-
- $DB->set_field('course_sections', 'sequence', $section->sequence, array('id'=>$section->id));
-
- /// now we need to remove the instance from the old sequence
-
- /// grab the old section record
- if (!($section = $DB->get_record('course_sections', array('id'=>$xsection->id)))) {
- if ($output) echo 'Serious error: Cannot retrieve old section: '.$xsection->id.' for course: '.$fullname.'<br />';
- continue;
- }
-
- /// explode the sequence
- if (($sequence = explode(',', $section->sequence)) === false) {
- $sequence = array();
- }
-
- /// remove the old value from the array
- $key = array_search($instance, $sequence);
- unset($sequence[$key]);
-
- /// implode the sequence
- $section->sequence = implode(',', $sequence);
-
- $DB->set_field('course_sections', 'sequence', $section->sequence, array('id'=>$section->id));
-
-
- if ($output) echo 'Online Assignment (instance '.$instance.') moved from section '.$section->id.': to section '.$newsection.'<br />';
-
- }
- }
- }
-
- /// if the summary and sequence are empty then remove this section
- if (empty($xsection->summary) and empty($xsection->sequence)) {
- $DB->delete_records('course_sections', array('id'=>$xsection->id));
- if ($output) echo 'Deleting empty section '.$xsection->section.'<br />';
- }
- }
- }
-
- echo '</center>';
-}
-
-
* Provides an overview of installed plagiarism plugins
*
* Displays the list of found plagiarism plugins, their version (if found) and
- * a link to delete the plagiarism plugin.
+ * a link to uninstall the plagiarism plugin.
*
* @see http://docs.moodle.org/dev/Plagiarism_API
* @package admin
admin_externalpage_setup('manageplagiarismplugins');
-$delete = optional_param('delete', '', PARAM_PLUGIN);
-$confirm = optional_param('confirm', false, PARAM_BOOL);
-
-if (!empty($delete) and confirm_sesskey()) { // If data submitted, then process and store.
- echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('manageplagiarism', 'plagiarism'));
-
- if (!$confirm) {
- if (get_string_manager()->string_exists('pluginname', 'plagiarism_' . $delete)) {
- $strpluginname = get_string('pluginname', 'plagiarism_' . $delete);
- } else {
- $strpluginname = $delete;
- }
- echo $OUTPUT->confirm(get_string('plagiarismplugindeleteconfirm', 'plagiarism', $strpluginname),
- new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
- $PAGE->url);
- echo $OUTPUT->footer();
- die();
-
- } else {
- uninstall_plugin('plagiarism', $delete);
- $a = new stdclass();
- $a->name = $delete;
- $pluginlocation = get_plugin_types();
- $a->directory = $pluginlocation['plagiarism'] . '/' . $delete;
- echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
- echo $OUTPUT->continue_button($PAGE->url);
- echo $OUTPUT->footer();
- die();
- }
-}
-
echo $OUTPUT->header();
// Print the table of all installed plagiarism plugins.
-$txt = get_strings(array('settings', 'name', 'version', 'delete'));
+$txt = get_strings(array('settings', 'name', 'version'));
+$txt->uninstall = get_string('uninstallplugin', 'core_admin');
-$plagiarismplugins = get_plugin_list('plagiarism');
+$plagiarismplugins = core_component::get_plugin_list('plagiarism');
if (empty($plagiarismplugins)) {
echo $OUTPUT->notification(get_string('nopluginsinstalled', 'plagiarism'));
echo $OUTPUT->footer();
echo $OUTPUT->box_start('generalbox authsui');
$table = new html_table();
-$table->head = array($txt->name, $txt->version, $txt->delete, $txt->settings);
+$table->head = array($txt->name, $txt->version, $txt->uninstall, $txt->settings);
$table->colclasses = array('mdl-left', 'mdl-align', 'mdl-align', 'mdl-align');
$table->data = array();
$table->attributes['class'] = 'manageplagiarismtable generaltable';
} else {
$version = '?';
}
- // Delete link.
- $delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
- $delete = html_writer::link($delete, get_string('delete'));
- $table->data[] = array($displayname, $version, $delete, $settings);
+ // uninstall link.
+ $uninstall = '';
+ if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('plagiarism_'.$plugin)) {
+ $uninstall = html_writer::link($uninstallurl, $txt->uninstall);
+ }
+ $table->data[] = array($displayname, $version, $uninstall, $settings);
}
}
echo html_writer::table($table);
if ($pluginman->is_plugin_folder_removable($pluginfo->component)) {
$continueurl = new moodle_url($PAGE->url, array('delete' => $pluginfo->component, 'sesskey' => sesskey(), 'confirm' => 1));
echo $output->plugin_uninstall_results_removable_page($pluginman, $pluginfo, $progress, $continueurl);
+ // Reset op code caches.
+ if (function_exists('opcache_reset')) {
+ opcache_reset();
+ }
exit();
} else {
echo $output->plugin_uninstall_results_page($pluginman, $pluginfo, $progress);
+ // Reset op code caches.
+ if (function_exists('opcache_reset')) {
+ opcache_reset();
+ }
exit();
}
}
// So long, and thanks for all the bugs.
fulldelete($pluginfo->rootdir);
- cache::make('core', 'pluginlist')->purge();
+ // Reset op code caches.
+ if (function_exists('opcache_reset')) {
+ opcache_reset();
+ }
redirect($PAGE->url);
}
$output = $OUTPUT->box_start('generalbox');
- $plugins = get_plugin_list('portfolio');
+ $plugins = core_component::get_plugin_list('portfolio');
$plugins = array_keys($plugins);
$instances = portfolio_instances(false, false);
$usedplugins = array();
admin_externalpage_setup('manageqbehaviours');
$thispageurl = new moodle_url('/admin/qbehaviours.php');
-$behaviours = get_plugin_list('qbehaviour');
+$behaviours = core_component::get_plugin_list('qbehaviour');
$pluginmanager = plugin_manager::instance();
// Get some data we will need - question counts and which types are needed.
}
// Then the tables themselves
- drop_plugin_tables($delete, get_plugin_directory('qbehaviour', $delete) . '/db/install.xml', false);
+ drop_plugin_tables($delete, core_component::get_plugin_directory('qbehaviour', $delete) . '/db/install.xml', false);
// Remove event handlers and dequeue pending events
events_uninstall('qbehaviour_' . $delete);
$a = new stdClass();
$a->behaviour = $behaviourname;
- $a->directory = get_plugin_directory('qbehaviour', $delete);
+ $a->directory = core_component::get_plugin_directory('qbehaviour', $delete);
echo $OUTPUT->box(get_string('qbehaviourdeletefiles', 'question', $a), 'generalbox', 'notice');
echo $OUTPUT->continue_button($thispageurl);
echo $OUTPUT->footer();
* Display a page to confirm the plugin uninstallation.
*
* @param plugin_manager $pluginman
- * @param plugin_info $pluginfo
+ * @param plugininfo_base $pluginfo
* @param moodle_url $continueurl URL to continue after confirmation
* @return string
*/
$pluginname = $pluginman->plugin_name($pluginfo->component);
+ $confirm = '<p>' . get_string('uninstallconfirm', 'core_plugin', array('name' => $pluginname)) . '</p>';
+ if ($extraconfirm = $pluginfo->get_uninstall_extra_warning()) {
+ $confirm .= $extraconfirm;
+ }
+
$output .= $this->output->header();
$output .= $this->output->heading(get_string('uninstalling', 'core_plugin', array('name' => $pluginname)));
- $output .= $this->output->confirm(get_string('uninstallconfirm', 'core_plugin', array('name' => $pluginname)),
- $continueurl, $this->page->url);
+ $output .= $this->output->confirm($confirm, $continueurl, $this->page->url);
$output .= $this->output->footer();
return $output;
* Display a page with results of plugin uninstallation and offer removal of plugin files.
*
* @param plugin_manager $pluginman
- * @param plugin_info $pluginfo
+ * @param plugininfo_base $pluginfo
* @param progress_trace_buffer $progress
* @param moodle_url $continueurl URL to continue to remove the plugin folder
* @return string
* Display a page with results of plugin uninstallation and inform about the need to remove plugin files manually.
*
* @param plugin_manager $pluginman
- * @param plugin_info $pluginfo
+ * @param plugininfo_base $pluginfo
* @param progress_trace_buffer $progress
* @return string
*/
* Provides an overview of installed reports
*
* Displays the list of found reports, their version (if found) and
- * a link to delete the report.
+ * a link to uninstall the report.
*
* The code is based on admin/localplugins.php by David Mudrak.
*
admin_externalpage_setup('managereports');
-$delete = optional_param('delete', '', PARAM_PLUGIN);
-$confirm = optional_param('confirm', '', PARAM_BOOL);
-
-/// If data submitted, then process and store.
-
-if (!empty($delete) and confirm_sesskey()) {
- echo $OUTPUT->header();
- echo $OUTPUT->heading(get_string('reports'));
-
- if (!$confirm) {
- if (get_string_manager()->string_exists('pluginname', 'report_' . $delete)) {
- $strpluginname = get_string('pluginname', 'report_' . $delete);
- } else {
- $strpluginname = $delete;
- }
- echo $OUTPUT->confirm(get_string('reportsdeleteconfirm', 'admin', $strpluginname),
- new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
- $PAGE->url);
- echo $OUTPUT->footer();
- die();
-
- } else {
- uninstall_plugin('report', $delete);
- $a = new stdclass();
- $a->name = $delete;
- $pluginlocation = get_plugin_types();
- $a->directory = $pluginlocation['report'] . '/' . $delete;
- echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
- echo $OUTPUT->continue_button($PAGE->url);
- echo $OUTPUT->footer();
- die();
- }
-}
-
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('reports'));
/// Print the table of all installed report plugins
+$struninstall = get_string('uninstallplugin', 'core_admin');
+
$table = new flexible_table('reportplugins_administration_table');
-$table->define_columns(array('name', 'version', 'delete'));
-$table->define_headers(array(get_string('plugin'), get_string('version'), get_string('delete')));
+$table->define_columns(array('name', 'version', 'uninstall'));
+$table->define_headers(array(get_string('plugin'), get_string('version'), $struninstall));
$table->define_baseurl($PAGE->url);
$table->set_attribute('id', 'reportplugins');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
$table->setup();
$plugins = array();
-foreach (get_plugin_list('report') as $plugin => $plugindir) {
+foreach (core_component::get_plugin_list('report') as $plugin => $plugindir) {
if (get_string_manager()->string_exists('pluginname', 'report_' . $plugin)) {
$strpluginname = get_string('pluginname', 'report_' . $plugin);
} else {
}
foreach ($plugins as $plugin => $name) {
- $delete = new moodle_url($PAGE->url, array('delete' => $plugin, 'sesskey' => sesskey()));
- $delete = html_writer::link($delete, get_string('delete'));
+ $uninstall = '';
+ if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('report_'.$plugin)) {
+ $uninstall = html_writer::link($uninstallurl, $struninstall);
+ }
if (!isset($versions[$plugin])) {
if (file_exists("$CFG->dirroot/report/$plugin/version.php")) {
}
}
- $table->add_data(array($name, $version, $delete));
+ $table->add_data(array($name, $version, $uninstall));
}
$table->print_html();
}
// Get all the plugins that exist on disk
- $plugins = get_plugin_list('repository');
+ $plugins = core_component::get_plugin_list('repository');
if (!empty($plugins)) {
foreach ($plugins as $plugin => $dir) {
// Check that it has not already been listed
<?php
-
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
- * Lets you site administrators
+ * Select site administrators.
*
- * @package core
- * @subpackage role
- * @copyright 2010 Petr Skoda (skodak) http://skodak.org
+ * @package core_role
+ * @copyright 2010 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-require_once(dirname(__FILE__) . '/../../config.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/roles/lib.php');
+require_once(__DIR__ . '/../../config.php');
+require_once($CFG->libdir.'/adminlib.php');
$confirmadd = optional_param('confirmadd', 0, PARAM_INT);
$confirmdel = optional_param('confirmdel', 0, PARAM_INT);
die;
}
-$admisselector = new admins_existing_selector();
+$admisselector = new core_role_admins_existing_selector();
$admisselector->set_extra_fields(array('username', 'email'));
-$potentialadmisselector = new admins_potential_selector();
+$potentialadmisselector = new core_role_admins_potential_selector();
$potentialadmisselector->set_extra_fields(array('username', 'email'));
if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) {
$user = reset($userstoadd);
$username = fullname($user) . " ($user->username, $user->email)";
echo $OUTPUT->header();
- echo $OUTPUT->confirm(get_string('confirmaddadmin', 'role', $username), new moodle_url('/admin/roles/admins.php', array('confirmadd'=>$user->id, 'sesskey'=>sesskey())), $PAGE->url);
+ $yesurl = new moodle_url('/admin/roles/admins.php', array('confirmadd'=>$user->id, 'sesskey'=>sesskey()));
+ echo $OUTPUT->confirm(get_string('confirmaddadmin', 'core_role', $username), $yesurl, $PAGE->url);
echo $OUTPUT->footer();
die;
}
if ($userstoremove = $admisselector->get_selected_users()) {
$user = reset($userstoremove);
if ($USER->id == $user->id) {
- //can not remove self
+ // Can not remove self.
} else {
$username = fullname($user) . " ($user->username, $user->email)";
echo $OUTPUT->header();
- echo $OUTPUT->confirm(get_string('confirmdeladmin', 'role', $username), new moodle_url('/admin/roles/admins.php', array('confirmdel'=>$user->id, 'sesskey'=>sesskey())), $PAGE->url);
+ $yesurl = new moodle_url('/admin/roles/admins.php', array('confirmdel'=>$user->id, 'sesskey'=>sesskey()));
+ echo $OUTPUT->confirm(get_string('confirmdeladmin', 'core_role', $username), $yesurl, $PAGE->url);
echo $OUTPUT->footer();
die;
}
$newmain = reset($newmain);
&nb