Skip to content

Commit

Permalink
Merge branch 'MDL-32324' of git://github.com/timhunt/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed Aug 21, 2013
2 parents 2968602 + aed2918 commit ac6fb0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
15 changes: 5 additions & 10 deletions admin/qbehaviours.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
print_error('cannotdeletemissingbehaviour', 'question', $thispageurl);
}

if (!isset($behaviours[$delete])) {
if (!isset($behaviours[$delete]) && !get_config('qbehaviour_' . $delete, 'version')) {
print_error('unknownbehaviour', 'question', $thispageurl, $delete);
}

Expand Down Expand Up @@ -171,10 +171,7 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deletingbehaviour', 'question', $behaviourname));

// Delete any configuration records.
if (!unset_all_config_for_plugin('qbehaviour_' . $delete)) {
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qbehaviour_' . $delete));
}
// Remove this behaviour from configurations where it might appear.
if (($key = array_search($delete, $disabledbehaviours)) !== false) {
unset($disabledbehaviours[$key]);
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
Expand All @@ -185,12 +182,10 @@
set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
}

// Then the tables themselves
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);
// Then uninstall the plugin.
uninstall_plugin('qbehaviour', $delete);

// Display a message.
$a = new stdClass();
$a->behaviour = $behaviourname;
$a->directory = core_component::get_plugin_directory('qbehaviour', $delete);
Expand Down
14 changes: 4 additions & 10 deletions admin/qtypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
print_error('cannotdeletemissingqtype', 'question', $thispageurl);
}

if (!isset($qtypes[$delete])) {
if (!isset($qtypes[$delete]) && !get_config('qtype_' . $delete, 'version')) {
print_error('unknownquestiontype', 'question', $thispageurl, $delete);
}

Expand Down Expand Up @@ -158,18 +158,12 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('deletingqtype', 'question', $qtypename));

// Delete any configuration records.
if (!unset_all_config_for_plugin('qtype_' . $delete)) {
echo $OUTPUT->notification(get_string('errordeletingconfig', 'admin', 'qtype_' . $delete));
}
// Delete any questoin configuration records mentioning this plugin.
unset_config($delete . '_disabled', 'question');
unset_config($delete . '_sortorder', 'question');

// Then the tables themselves
drop_plugin_tables($delete, $qtypes[$delete]->plugin_dir() . '/db/install.xml', false);

// Remove event handlers and dequeue pending events
events_uninstall('qtype_' . $delete);
// Then uninstall the plugin.
uninstall_plugin('qtype', $delete);

$a = new stdClass();
$a->qtype = $qtypename;
Expand Down

0 comments on commit ac6fb0a

Please sign in to comment.