Merge branch 'w27_MDL-39088_m26_uninstall' of https://github.com/skodak/moodle
This commit is contained in:
+18
-39
@@ -1,6 +1,6 @@
|
||||
<?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');
|
||||
@@ -11,14 +11,13 @@
|
||||
$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');
|
||||
@@ -81,35 +80,6 @@
|
||||
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);
|
||||
|
||||
@@ -127,8 +97,8 @@
|
||||
|
||||
$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');
|
||||
@@ -170,7 +140,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
$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()) {
|
||||
@@ -235,7 +209,7 @@
|
||||
'<span'.$class.'>'.$version.'</span>',
|
||||
$visible,
|
||||
$undeletable,
|
||||
$delete,
|
||||
$uninstall,
|
||||
$settings
|
||||
);
|
||||
$table->add_data($row);
|
||||
@@ -248,8 +222,8 @@
|
||||
|
||||
$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');
|
||||
@@ -257,9 +231,14 @@
|
||||
$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();
|
||||
|
||||
@@ -28,7 +28,6 @@ require_once($CFG->libdir.'/pluginlib.php');
|
||||
|
||||
$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');
|
||||
@@ -79,52 +78,5 @@ switch ($action) {
|
||||
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);
|
||||
|
||||
@@ -83,47 +83,6 @@ switch ($action) {
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
+15
-48
@@ -31,7 +31,6 @@ require_once($CFG->libdir.'/adminlib.php');
|
||||
$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());
|
||||
@@ -96,7 +95,7 @@ switch ($action) {
|
||||
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 {
|
||||
@@ -106,58 +105,26 @@ switch ($action) {
|
||||
$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));
|
||||
// Disable plugin to prevent concurrent cron execution.
|
||||
unset($enabled[$enrol]);
|
||||
set_config('enrol_plugins_enabled', implode(',', array_keys($enabled)));
|
||||
|
||||
$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');
|
||||
echo $OUTPUT->heading(get_string('uninstallmigrating', 'enrol', 'enrol_'.$enrol));
|
||||
|
||||
$buttons = $OUTPUT->render($delete) . $OUTPUT->render($cancel);
|
||||
if ($enrol !== 'manual') {
|
||||
$buttons = $OUTPUT->render($migrate) . $buttons;
|
||||
}
|
||||
require_once("$CFG->dirroot/enrol/manual/locallib.php");
|
||||
enrol_manual_migrate_plugin_enrolments($enrol);
|
||||
|
||||
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->notification(get_string('success'), 'notifysuccess');
|
||||
|
||||
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));
|
||||
|
||||
require_once("$CFG->dirroot/enrol/manual/locallib.php");
|
||||
enrol_manual_migrate_plugin_enrolments($enrol);
|
||||
|
||||
echo $OUTPUT->notification(get_string('success'), 'notifysuccess');
|
||||
}
|
||||
|
||||
// Delete everything!!
|
||||
uninstall_plugin('enrol', $enrol);
|
||||
$syscontext->mark_dirty(); // Resets all enrol caches.
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+7
-39
@@ -33,48 +33,14 @@ require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
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');
|
||||
@@ -92,8 +58,10 @@ foreach (get_plugin_list('local') as $plugin => $plugindir) {
|
||||
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($uninstall, get_string('uninstallplugin', 'core_admin'));
|
||||
}
|
||||
|
||||
$version = get_config('local_' . $plugin);
|
||||
if (!empty($version->version)) {
|
||||
@@ -102,7 +70,7 @@ foreach ($plugins as $plugin => $name) {
|
||||
$version = '?';
|
||||
}
|
||||
|
||||
$table->add_data(array($name, $version, $delete));
|
||||
$table->add_data(array($name, $version, $uninstall));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
+10
-41
@@ -13,14 +13,12 @@
|
||||
|
||||
$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");
|
||||
@@ -46,7 +44,7 @@
|
||||
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
|
||||
@@ -73,38 +71,6 @@
|
||||
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);
|
||||
|
||||
@@ -117,8 +83,8 @@
|
||||
/// 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');
|
||||
@@ -136,7 +102,10 @@
|
||||
$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")) {
|
||||
@@ -172,7 +141,7 @@
|
||||
$class = ' class="dimmed_text"';
|
||||
}
|
||||
if ($module->name == "forum") {
|
||||
$delete = "";
|
||||
$uninstall = "";
|
||||
$visible = "";
|
||||
$class = "";
|
||||
}
|
||||
@@ -183,7 +152,7 @@
|
||||
$countlink,
|
||||
'<span'.$class.'>'.$module->version.'</span>',
|
||||
$visible,
|
||||
$delete,
|
||||
$uninstall,
|
||||
$settings
|
||||
));
|
||||
}
|
||||
|
||||
+10
-39
@@ -18,7 +18,7 @@
|
||||
* 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
|
||||
@@ -32,43 +32,12 @@ require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
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');
|
||||
if (empty($plagiarismplugins)) {
|
||||
@@ -81,7 +50,7 @@ echo $OUTPUT->heading(get_string('availableplugins', 'plagiarism'), 3, 'main');
|
||||
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';
|
||||
@@ -101,10 +70,12 @@ foreach ($plagiarismplugins as $plugin => $dir) {
|
||||
} 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);
|
||||
|
||||
+9
-5
@@ -375,7 +375,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* 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
|
||||
*/
|
||||
@@ -384,10 +384,14 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$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;
|
||||
@@ -397,7 +401,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* 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
|
||||
@@ -431,7 +435,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* 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
|
||||
*/
|
||||
|
||||
+10
-40
@@ -18,7 +18,7 @@
|
||||
* 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.
|
||||
*
|
||||
@@ -33,48 +33,16 @@ require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
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');
|
||||
@@ -104,8 +72,10 @@ foreach ($installed as $config) {
|
||||
}
|
||||
|
||||
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")) {
|
||||
@@ -126,7 +96,7 @@ foreach ($plugins as $plugin => $name) {
|
||||
}
|
||||
}
|
||||
|
||||
$table->add_data(array($name, $version, $delete));
|
||||
$table->add_data(array($name, $version, $uninstall));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
+10
-40
@@ -18,7 +18,7 @@
|
||||
* Provides an overview of installed admin tools
|
||||
*
|
||||
* Displays the list of found admin tools, their version (if found) and
|
||||
* a link to delete the admin tool.
|
||||
* a link to uninstall the admin tool.
|
||||
*
|
||||
* The code is based on admin/localplugins.php by David Mudrak.
|
||||
*
|
||||
@@ -33,48 +33,16 @@ require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
admin_externalpage_setup('managetools');
|
||||
|
||||
$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('tools', 'admin'));
|
||||
|
||||
if (!$confirm) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'tool_' . $delete)) {
|
||||
$strpluginname = get_string('pluginname', 'tool_' . $delete);
|
||||
} else {
|
||||
$strpluginname = $delete;
|
||||
}
|
||||
echo $OUTPUT->confirm(get_string('toolsdeleteconfirm', 'admin', $strpluginname),
|
||||
new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1)),
|
||||
$PAGE->url);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
uninstall_plugin('tool', $delete);
|
||||
$a = new stdclass();
|
||||
$a->name = $delete;
|
||||
$pluginlocation = get_plugin_types();
|
||||
$a->directory = $pluginlocation['tool'] . '/' . $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('tools', 'admin'));
|
||||
|
||||
/// Print the table of all installed tool plugins
|
||||
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
|
||||
$table = new flexible_table('toolplugins_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', 'toolplugins');
|
||||
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthwide');
|
||||
@@ -104,8 +72,10 @@ foreach ($installed as $config) {
|
||||
}
|
||||
|
||||
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('tool_'.$plugin)) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
if (!isset($versions[$plugin])) {
|
||||
if (file_exists("$CFG->dirroot/$CFG->admin/tool/$plugin/version.php")) {
|
||||
@@ -126,7 +96,7 @@ foreach ($plugins as $plugin => $name) {
|
||||
}
|
||||
}
|
||||
|
||||
$table->add_data(array($name, $version, $delete));
|
||||
$table->add_data(array($name, $version, $uninstall));
|
||||
}
|
||||
|
||||
$table->print_html();
|
||||
|
||||
@@ -537,8 +537,6 @@ $string['forceloginforprofileimage_help'] = 'If enabled, users must login in ord
|
||||
$string['forceloginforprofiles'] = 'Force users to login for profiles';
|
||||
$string['forcetimezone'] = 'Force default timezone';
|
||||
$string['formatuninstallwithcourses'] = 'There are {$a->count} courses using {$a->format}. Their format will be changed to {$a->defaultformat} (default format for this site). Some format-specific data may be lost. Are you sure you want to proceed?';
|
||||
$string['formatuninstallconfirm'] = '{$a} will be uninstalled. No courses currently use it. Continue?';
|
||||
$string['formatuninstalled'] = 'All data associated with the format plugin \'{$a->plugin}\' has been deleted from the database. To complete the deletion (and prevent the plugin re-installing itself), you should now delete this directory from your server: {$a->directory}';
|
||||
$string['frontpage'] = 'Front page';
|
||||
$string['frontpagebackup'] = 'Front page backup';
|
||||
$string['frontpagedefaultrole'] = 'Default frontpage role';
|
||||
@@ -911,7 +909,6 @@ $string['releasenoteslink'] = 'For information about this version of Moodle, ple
|
||||
$string['rememberusername'] = 'Remember username';
|
||||
$string['rememberusername_desc'] = 'Enable if you want to store permanent cookies with usernames during user login. Permanent cookies may be considered a privacy issue if used without consent.';
|
||||
$string['reportsmanage'] = 'Manage reports';
|
||||
$string['reportsdeleteconfirm'] = 'You are about to completely delete the report \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
$string['requiredentrieschanged'] = '<strong>IMPORTANT - PLEASE READ<br/>(This warning message will only be displayed during this upgrade)</strong><br/>Due to a bug fix, the behaviour of database activities using the \'Required entries\' and \'Required entries before viewing settings\' settings will change. A more detailed explanation of the changes can be read on <a href="http://moodle.org/mod/forum/discuss.php?d=110928" target="_blank">the database module forum</a>. The expected behavior of these settings can also be read on <a href="http://docs.moodle.org/en/Adding/editing_a_database#Required_entries" target="_blank">Moodle Docs</a>.
|
||||
<br/><br/>This change affects the following databases in your system: (Please save this list now, and after the upgrade, check that these activities still work the way that the teacher intends.)<br/><strong>{$a->text}</strong><br/>';
|
||||
$string['requiremodintro'] = 'Require activity description';
|
||||
@@ -1027,7 +1024,6 @@ $string['timezoneisforcedto'] = 'Force all users to use';
|
||||
$string['timezonenotforced'] = 'Users can choose their own timezone';
|
||||
$string['tokenizerrecommended'] = 'Installing the optional PHP Tokenizer extension is recommended -- it improves Moodle Networking functionality.';
|
||||
$string['tools'] = 'Admin tools';
|
||||
$string['toolsdeleteconfirm'] = 'You are about to completely delete the admin tool \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
$string['toolsmanage'] = 'Manage admin tools';
|
||||
$string['unattendedoperation'] = 'Unattended operation';
|
||||
$string['unbookmarkthispage'] = 'Unbookmark this page';
|
||||
|
||||
@@ -52,7 +52,6 @@ $string['createlink'] = 'Insert Web Link';
|
||||
$string['cut'] = 'Cut selection';
|
||||
$string['cutpastemozilla'] = 'Unfortunately, you cannot currently use normal keyboard shortcuts (or even the Paste button) for pasting text into this online editor. This is because of a security feature that is built into some versions of Mozilla and Firefox browsers.<br /><br />There are three known workarounds you can try: <br /> (1) Instead of CTRL-v, use SHIFT-Insert <br /> (2) Use the Edit->Paste menu in your browser <br /> (3) Change the preferences in your browser by editing the user.js file. <br /><br />Click the OK button below for more help, or Cancel to return to the editor';
|
||||
$string['delete'] = 'Delete';
|
||||
$string['editordeleteconfirm'] = 'You are about to completely delete the editor plugin \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
$string['editors'] = 'Text editors';
|
||||
$string['editorsettings'] = 'Manage editors';
|
||||
$string['enterurlfirst'] = 'You have to enter an URL first';
|
||||
|
||||
+1
-6
@@ -81,6 +81,7 @@ $string['invalidenrolinstance'] = 'Invalid enrolment instance';
|
||||
$string['invalidrole'] = 'Invalid role';
|
||||
$string['manageenrols'] = 'Manage enrol plugins';
|
||||
$string['manageinstance'] = 'Manage';
|
||||
$string['migratetomanual'] = 'Migrate to manual enrolments';
|
||||
$string['nochange'] = 'No change';
|
||||
$string['noexistingparticipants'] = 'No existing participants';
|
||||
$string['noguestaccess'] = 'Guests can not access this course, please try to log in.';
|
||||
@@ -110,12 +111,6 @@ $string['unenrolconfirm'] = 'Do you really want to unenrol user "{$a->user}" fro
|
||||
$string['unenrolme'] = 'Unenrol me from {$a}';
|
||||
$string['unenrolnotpermitted'] = 'You do not have permission or can not unenrol this user from this course.';
|
||||
$string['unenrolroleusers'] = 'Unenrol users';
|
||||
$string['uninstallconfirm'] = 'You are about to uninstall the enrolment plugin \'{$a}\'. This will result in the deletion of all data associated with this enrolment type, including users\' grades, group membership, forum subscriptions and any other course-related data.
|
||||
|
||||
Are you SURE you want to continue?';
|
||||
$string['uninstalldelete'] = 'Delete all enrolments and uninstall';
|
||||
$string['uninstalldeletefiles'] = 'All data associated with the enrol plugin \'{$a->plugin}\' has been deleted from the database. To complete the deletion (and prevent the plugin re-installing itself), you should now delete this directory from your server: {$a->directory}';
|
||||
$string['uninstallmigrate'] = 'Uninstall but keep all enrolments';
|
||||
$string['uninstallmigrating'] = 'Migrating "{$a}" enrolments';
|
||||
$string['unknowajaxaction'] = 'Unknown action requested';
|
||||
$string['unlimitedduration'] = 'Unlimited';
|
||||
|
||||
@@ -197,8 +197,6 @@ $string['badges'] = 'Badges';
|
||||
$string['block'] = 'Block';
|
||||
$string['blockconfiga'] = 'Configuring a {$a} block';
|
||||
$string['blockconfigbad'] = 'This block has not been implemented correctly and thus cannot provide a configuration interface.';
|
||||
$string['blockdeleteconfirm'] = 'You are about to completely delete the block \'{$a}\'. This will completely delete everything in the database associated with this block. Are you SURE you want to continue?';
|
||||
$string['blockdeletefiles'] = 'All data associated with the block \'{$a->block}\' has been deleted from the database. To complete the deletion (and prevent the block re-installing itself), you should now delete this directory from your server: {$a->directory}';
|
||||
$string['blocks'] = 'Blocks';
|
||||
$string['blocksaddedit'] = 'Add/Edit blocks';
|
||||
$string['blockseditoff'] = 'Blocks editing off';
|
||||
@@ -926,7 +924,6 @@ $string['listofallpeople'] = 'List of all people';
|
||||
$string['listofcourses'] = 'List of courses';
|
||||
$string['loadinghelp'] = 'Loading...';
|
||||
$string['local'] = 'Local';
|
||||
$string['localplugindeleteconfirm'] = 'You are about to completely delete the local plugin \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
$string['localplugins'] = 'Local plugins';
|
||||
$string['localpluginsmanage'] = 'Manage local plugins';
|
||||
$string['location'] = 'Location';
|
||||
@@ -1059,8 +1056,6 @@ $string['months'] = 'Months';
|
||||
$string['modified'] = 'Modified';
|
||||
$string['modchooserenable'] = 'Activity chooser on';
|
||||
$string['modchooserdisable'] = 'Activity chooser off';
|
||||
$string['moduledeleteconfirm'] = 'You are about to completely delete the module \'{$a}\'. This will completely delete everything in the database associated with this activity module. Are you SURE you want to continue?';
|
||||
$string['moduledeletefiles'] = 'All data associated with the module \'{$a->module}\' has been deleted from the database. To complete the deletion (and prevent the module re-installing itself), you should now delete this directory from your server: {$a->directory}';
|
||||
$string['moduleintro'] = 'Description';
|
||||
$string['modulesetup'] = 'Setting up module tables';
|
||||
$string['modulesuccess'] = '{$a} tables have been set up correctly';
|
||||
|
||||
@@ -6,4 +6,3 @@ $string['configenableplagiarism'] = 'This will allow administrators to configure
|
||||
$string['manageplagiarism'] = 'Manage plagiarism plugins';
|
||||
$string['nopluginsinstalled'] = 'No plagiarism plugins are installed.';
|
||||
$string['plagiarism'] = 'Plagiarism prevention';
|
||||
$string['plagiarismplugindeleteconfirm'] = 'You are about to completely delete the plagiarism plugin \'{$a}\'. This will completely delete everything in the database associated with this plugin. Are you SURE you want to continue?';
|
||||
|
||||
@@ -151,6 +151,9 @@ $string['uninstallconfirm'] = 'You are about to uninstall the plugin <em>{$a->na
|
||||
$string['uninstalldelete'] = 'All data associated with the plugin <em>{$a->name}</em> has been deleted from the database. To prevent the plugin re-installing itself, its folder <em>{$a->rootdir}</em> must be manually removed from your server now. Moodle itself cannot remove the folder due to write permissions.';
|
||||
$string['uninstalldeleteconfirm'] = 'All data associated with the plugin <em>{$a->name}</em> has been deleted from the database. To prevent the plugin re-installing itself, its folder <em>{$a->rootdir}</em> must be removed from your server. Do you want to remove the plugin folder now?';
|
||||
$string['uninstalldeleteconfirmexternal'] = 'It appears that the current version of the plugin has been obtained via source code management system ({$a}) checkout. If you remove the plugin folder, you may loose important local modifications of the code. Please ensure that you definitely want to remove the plugin folder before continuing.';
|
||||
$string['uninstallextraconfirmblock'] = 'There are {$a->instances} instances of this block.';
|
||||
$string['uninstallextraconfirmenrol'] = 'There are {$a->enrolments} user enrolments.';
|
||||
$string['uninstallextraconfirmmod'] = 'There are {$a->instances} instances of this module in {$a->courses} courses.';
|
||||
$string['uninstalling'] = 'Uninstalling {$a->name}';
|
||||
$string['version'] = 'Version';
|
||||
$string['versiondb'] = 'Current version';
|
||||
|
||||
+17
-18
@@ -115,6 +115,8 @@ define('INSECURE_DATAROOT_ERROR', 2);
|
||||
/**
|
||||
* Automatically clean-up all plugin data and remove the plugin DB tables
|
||||
*
|
||||
* NOTE: do not call directly, use new /admin/plugins.php?uninstall=component instead!
|
||||
*
|
||||
* @param string $type The plugin type, eg. 'mod', 'qtype', 'workshopgrading' etc.
|
||||
* @param string $name The plugin name, eg. 'forum', 'multichoice', 'accumulative' etc.
|
||||
* @uses global $OUTPUT to produce notices and other messages
|
||||
@@ -5127,7 +5129,7 @@ class admin_setting_manageenrols extends admin_setting {
|
||||
$strsettings = get_string('settings');
|
||||
$strenable = get_string('enable');
|
||||
$strdisable = get_string('disable');
|
||||
$struninstall = get_string('uninstallplugin', 'admin');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
$strusage = get_string('enrolusage', 'enrol');
|
||||
$strversion = get_string('version');
|
||||
|
||||
@@ -5230,18 +5232,16 @@ class admin_setting_manageenrols extends admin_setting {
|
||||
// Add settings link.
|
||||
if (!$version) {
|
||||
$settings = '';
|
||||
} else if ($url = $plugininfo->get_settings_url()) {
|
||||
$settings = html_writer::link($url, $strsettings);
|
||||
} else if ($surl = $plugininfo->get_settings_url()) {
|
||||
$settings = html_writer::link($surl, $strsettings);
|
||||
} else {
|
||||
$settings = '';
|
||||
}
|
||||
|
||||
// Add uninstall info.
|
||||
if ($version) {
|
||||
$url = new moodle_url($plugininfo->get_uninstall_url(), array('return'=>'settings'));
|
||||
$uninstall = html_writer::link($url, $struninstall);
|
||||
} else {
|
||||
$uninstall = '';
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('enrol_'.$enrol)) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
// Add a row to the table.
|
||||
@@ -5861,7 +5861,7 @@ class admin_setting_manageeditors extends admin_setting {
|
||||
// display strings
|
||||
$txt = get_strings(array('administration', 'settings', 'edit', 'name', 'enable', 'disable',
|
||||
'up', 'down', 'none'));
|
||||
$struninstall = get_string('uninstallplugin', 'admin');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
|
||||
@@ -5941,11 +5941,9 @@ class admin_setting_manageeditors extends admin_setting {
|
||||
$settings = '';
|
||||
}
|
||||
|
||||
if ($editor === 'textarea') {
|
||||
$uninstall = '';
|
||||
} else {
|
||||
$uurl = new moodle_url('/admin/editors.php', array('action'=>'uninstall', 'editor'=>$editor, 'sesskey'=>sesskey()));
|
||||
$uninstall = html_writer::link($uurl, $struninstall);
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('editor_'.$editor)) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
// add a row to the table
|
||||
@@ -6132,11 +6130,12 @@ class admin_setting_manageformats extends admin_setting {
|
||||
$formats = plugin_manager::instance()->get_plugins_of_type('format');
|
||||
|
||||
// display strings
|
||||
$txt = get_strings(array('settings', 'name', 'enable', 'disable', 'up', 'down', 'default', 'delete'));
|
||||
$txt = get_strings(array('settings', 'name', 'enable', 'disable', 'up', 'down', 'default'));
|
||||
$txt->uninstall = get_string('uninstallplugin', 'core_admin');
|
||||
$txt->updown = "$txt->up/$txt->down";
|
||||
|
||||
$table = new html_table();
|
||||
$table->head = array($txt->name, $txt->enable, $txt->updown, $txt->delete, $txt->settings);
|
||||
$table->head = array($txt->name, $txt->enable, $txt->updown, $txt->uninstall, $txt->settings);
|
||||
$table->align = array('left', 'center', 'center', 'center', 'center');
|
||||
$table->width = '90%';
|
||||
$table->attributes['class'] = 'manageformattable generaltable';
|
||||
@@ -6181,8 +6180,8 @@ class admin_setting_manageformats extends admin_setting {
|
||||
$settings = html_writer::link($format->get_settings_url(), $txt->settings);
|
||||
}
|
||||
$uninstall = '';
|
||||
if ($defaultformat !== $format->name) {
|
||||
$uninstall = html_writer::link($format->get_uninstall_url(), $txt->delete);
|
||||
if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('format_'.$format->name)) {
|
||||
$uninstall = html_writer::link($uninstallurl, $txt->uninstall);
|
||||
}
|
||||
$table->data[] =array($strformatname, $hideshow, $updown, $uninstall, $settings);
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ class plugininfo_tinymce extends plugininfo_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/lib/editor/tinymce/subplugins.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
}
|
||||
|
||||
public function get_settings_section_name() {
|
||||
return 'tinymce'.$this->name.'settings';
|
||||
}
|
||||
@@ -174,7 +170,7 @@ class tiynce_subplugins_settings extends admin_setting {
|
||||
$strenable = get_string('enable');
|
||||
$strname = get_string('name');
|
||||
$strsettings = get_string('settings');
|
||||
$struninstall = get_string('uninstallplugin', 'admin');
|
||||
$struninstall = get_string('uninstallplugin', 'core_admin');
|
||||
$strversion = get_string('version');
|
||||
|
||||
$subplugins = get_plugin_list('tinymce');
|
||||
@@ -235,11 +231,9 @@ class tiynce_subplugins_settings extends admin_setting {
|
||||
}
|
||||
|
||||
// Add uninstall info.
|
||||
if ($version) {
|
||||
$url = new moodle_url($plugininfo->get_uninstall_url(), array('return'=>'settings'));
|
||||
$uninstall = html_writer::link($url, $struninstall);
|
||||
} else {
|
||||
$uninstall = '';
|
||||
$uninstall = '';
|
||||
if ($uninstallurl = plugin_manager::instance()->get_uninstall_url('tinymce_' . $name)) {
|
||||
$uninstall = html_writer::link($uninstallurl, $struninstall);
|
||||
}
|
||||
|
||||
// Add a row to the table.
|
||||
|
||||
@@ -34,7 +34,6 @@ $string['customtoolbar_desc'] = 'Each line contains a list of comma separated bu
|
||||
$string['fontselectlist'] = 'Available fonts list';
|
||||
$string['pluginname'] = 'TinyMCE HTML editor';
|
||||
$string['settings'] = 'General settings';
|
||||
$string['subplugindeleteconfirm'] = 'You are about to completely delete TinyMCE subplugin \'{$a}\'. This will completely delete everything in the database associated with this subplugin. Are you SURE you want to continue?';
|
||||
$string['subplugintype_tinymce_plural'] = 'Plugins';
|
||||
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$delete = optional_param('delete', '', PARAM_PLUGIN);
|
||||
$confirm = optional_param('confirm', '', PARAM_BOOL);
|
||||
$disable = optional_param('disable', '', PARAM_PLUGIN);
|
||||
$enable = optional_param('enable', '', PARAM_PLUGIN);
|
||||
$return = optional_param('return', 'overview', PARAM_ALPHA);
|
||||
@@ -44,54 +42,24 @@ if ($return === 'settings') {
|
||||
$returnurl = new moodle_url('/admin/plugins.php');
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('pluginname', 'editor_tinymce'));
|
||||
|
||||
if (!$confirm) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'tinymce_' . $delete)) {
|
||||
$strpluginname = get_string('pluginname', 'tinymce_' . $delete);
|
||||
} else {
|
||||
$strpluginname = $delete;
|
||||
}
|
||||
echo $OUTPUT->confirm(get_string('subplugindeleteconfirm', 'editor_tinymce', $strpluginname),
|
||||
new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1, 'return'=>$return)),
|
||||
$returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
uninstall_plugin('tinymce', $delete);
|
||||
$a = new stdclass();
|
||||
$a->name = $delete;
|
||||
$pluginlocation = get_plugin_types();
|
||||
$a->directory = $pluginlocation['tinymce'] . '/' . $delete;
|
||||
echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
|
||||
echo $OUTPUT->continue_button($returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
|
||||
} else {
|
||||
$disabled = array();
|
||||
$disabledsubplugins = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($disabledsubplugins) {
|
||||
$disabledsubplugins = explode(',', $disabledsubplugins);
|
||||
foreach ($disabledsubplugins as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabled[$sp] = $sp;
|
||||
}
|
||||
$disabled = array();
|
||||
$disabledsubplugins = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($disabledsubplugins) {
|
||||
$disabledsubplugins = explode(',', $disabledsubplugins);
|
||||
foreach ($disabledsubplugins as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabled[$sp] = $sp;
|
||||
}
|
||||
}
|
||||
|
||||
if ($disable) {
|
||||
$disabled[$disable] = $disable;
|
||||
} else if ($enable) {
|
||||
unset($disabled[$enable]);
|
||||
}
|
||||
|
||||
set_config('disabledsubplugins', implode(',', $disabled), 'editor_tinymce');
|
||||
}
|
||||
|
||||
if ($disable) {
|
||||
$disabled[$disable] = $disable;
|
||||
} else if ($enable) {
|
||||
unset($disabled[$enable]);
|
||||
}
|
||||
|
||||
set_config('disabledsubplugins', implode(',', $disabled), 'editor_tinymce');
|
||||
|
||||
redirect($returnurl);
|
||||
|
||||
+127
-20
@@ -520,6 +520,26 @@ class plugin_manager {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns uninstall URL if exists.
|
||||
*
|
||||
* @param string $component
|
||||
* @return moodle_url uninstall URL, null if uninstall not supported
|
||||
*/
|
||||
public function get_uninstall_url($component) {
|
||||
if (!$this->can_uninstall_plugin($component)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$pluginfo = $this->get_plugin_info($component);
|
||||
|
||||
if (is_null($pluginfo)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $pluginfo->get_uninstall_url();
|
||||
}
|
||||
|
||||
/**
|
||||
* Uninstall the given plugin.
|
||||
*
|
||||
@@ -2825,6 +2845,15 @@ abstract class plugininfo_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional extra warning before uninstallation, for example number of uses in courses.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_uninstall_extra_warning() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL of the screen where this plugin can be uninstalled
|
||||
*
|
||||
@@ -3048,9 +3077,19 @@ class plugininfo_block extends plugininfo_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
$blocksinfo = self::get_blocks_info();
|
||||
return new moodle_url('/admin/blocks.php', array('delete' => $blocksinfo[$this->name]->id, 'sesskey' => sesskey()));
|
||||
/**
|
||||
* Warnign with number of block instances.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_uninstall_extra_warning() {
|
||||
global $DB;
|
||||
|
||||
if (!$count = $DB->count_records('block_instances', array('blockname'=>$this->name))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return '<p>'.get_string('uninstallextraconfirmblock', 'core_plugin', array('instances'=>$count)).'</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3384,8 +3423,29 @@ class plugininfo_mod extends plugininfo_base {
|
||||
}
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/modules.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
/**
|
||||
* Return warning with number of activities and number of affected courses.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_uninstall_extra_warning() {
|
||||
global $DB;
|
||||
|
||||
if (!$module = $DB->get_record('modules', array('name'=>$this->name))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$count = $DB->count_records('course_modules', array('module'=>$module->id))) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$sql = "SELECT COUNT(course)
|
||||
FROM {course_modules}
|
||||
WHERE module = :mid
|
||||
GROUP BY course";
|
||||
$courses = $DB->count_records_sql($sql, array('mid'=>$module->id));
|
||||
|
||||
return '<p>'.get_string('uninstallextraconfirmmod', 'core_plugin', array('instances'=>$count, 'courses'=>$courses)).'</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3566,11 +3626,38 @@ class plugininfo_enrol extends plugininfo_base {
|
||||
}
|
||||
|
||||
public function is_uninstall_allowed() {
|
||||
if ($this->name === 'manual') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/enrol.php', array('action' => 'uninstall', 'enrol' => $this->name, 'sesskey' => sesskey()));
|
||||
/**
|
||||
* Return warning with number of activities and number of affected courses.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_uninstall_extra_warning() {
|
||||
global $DB, $OUTPUT;
|
||||
|
||||
$sql = "SELECT COUNT('x')
|
||||
FROM {user_enrolments} ue
|
||||
JOIN {enrol} e ON e.id = ue.enrolid
|
||||
WHERE e.enrol = :plugin";
|
||||
$count = $DB->count_records_sql($sql, array('plugin'=>$this->name));
|
||||
|
||||
if (!$count) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$migrateurl = new moodle_url('/admin/enrol.php', array('action'=>'migrate', 'enrol'=>$this->name, 'sesskey'=>sesskey()));
|
||||
$migrate = new single_button($migrateurl, get_string('migratetomanual', 'core_enrol'));
|
||||
$button = $OUTPUT->render($migrate);
|
||||
|
||||
$result = '<p>'.get_string('uninstallextraconfirmenrol', 'core_plugin', array('enrolments'=>$count)).'</p>';
|
||||
$result .= $button;
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3781,10 +3868,6 @@ class plugininfo_tool extends plugininfo_base {
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/tools.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3796,10 +3879,6 @@ class plugininfo_report extends plugininfo_base {
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/reports.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3808,8 +3887,8 @@ class plugininfo_report extends plugininfo_base {
|
||||
*/
|
||||
class plugininfo_local extends plugininfo_base {
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/localplugins.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3839,6 +3918,17 @@ class plugininfo_editor extends plugininfo_base {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic textarea editor can not be uninstalled.
|
||||
*/
|
||||
public function is_uninstall_allowed() {
|
||||
if ($this->name === 'textarea') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the information about plugin availability
|
||||
*
|
||||
@@ -3880,6 +3970,10 @@ class plugininfo_plagiarism extends plugininfo_base {
|
||||
$adminroot->add($parentnodename, $settings);
|
||||
}
|
||||
}
|
||||
|
||||
public function is_uninstall_allowed() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3982,8 +4076,21 @@ class plugininfo_format extends plugininfo_base {
|
||||
}
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/admin/courseformats.php',
|
||||
array('sesskey' => sesskey(), 'action' => 'uninstall', 'format' => $this->name));
|
||||
public function get_uninstall_extra_warning() {
|
||||
global $DB;
|
||||
|
||||
$coursecount = $DB->count_records('course', array('format' => $this->name));
|
||||
|
||||
if (!$coursecount) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$defaultformat = $this->get_plugin_manager()->plugin_name('format_'.get_config('moodlecourse', 'format'));
|
||||
$message = get_string(
|
||||
'formatuninstallwithcourses', 'core_admin',
|
||||
(object)array('count' => $coursecount, 'format' => $this->displayname,
|
||||
'defaultformat' => $defaultformat));
|
||||
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ $string['cannotaddsubscriber'] = 'Could not add subscriber with id {$a} to this
|
||||
$string['cannotaddteacherforumto'] = 'Could not add converted teacher forum instance to section 0 in the course';
|
||||
$string['cannotcreatediscussion'] = 'Could not create new discussion';
|
||||
$string['cannotcreateinstanceforteacher'] = 'Could not create new course module instance for the teacher forum';
|
||||
$string['cannotdeleteforummodule'] = 'You can not delete the forum module.';
|
||||
$string['cannotdeletepost'] = 'You can\'t delete this post!';
|
||||
$string['cannoteditposts'] = 'You can\'t edit other people\'s posts!';
|
||||
$string['cannotfinddiscussion'] = 'Could not find the discussion in this forum';
|
||||
|
||||
Reference in New Issue
Block a user