Commit 34402867 authored by Aaron Wells's avatar Aaron Wells
Browse files

Bug 1455122: Missing block plugin causes upgrade to crash

Change-Id: I607830471cd4ffe2555421b05a2e99eabf74bb06
parent 19f5a685
...@@ -4011,10 +4011,6 @@ function xmldb_core_upgrade($oldversion=0) { ...@@ -4011,10 +4011,6 @@ function xmldb_core_upgrade($oldversion=0) {
log_debug("Update block categories for plugins"); log_debug("Update block categories for plugins");
if ($blocktypes = plugins_installed('blocktype', true)) { if ($blocktypes = plugins_installed('blocktype', true)) {
foreach ($blocktypes as $bt) { foreach ($blocktypes as $bt) {
// Hack to deal with contactinfo block deletion
if ($bt->name == 'contactinfo') {
continue;
}
install_blocktype_categories_for_plugin(blocktype_single_to_namespaced($bt->name, $bt->artefactplugin)); install_blocktype_categories_for_plugin(blocktype_single_to_namespaced($bt->name, $bt->artefactplugin));
} }
} }
......
...@@ -1125,7 +1125,10 @@ function get_blocktype_categories() { ...@@ -1125,7 +1125,10 @@ function get_blocktype_categories() {
} }
function install_blocktype_categories_for_plugin($blocktype) { function install_blocktype_categories_for_plugin($blocktype) {
safe_require('blocktype', $blocktype); if (!safe_require('blocktype', $blocktype, 'lib.php', 'require_once', true)) {
// Block has been uninstalled or is missing, so no category data to enter.
return;
}
$blocktype = blocktype_namespaced_to_single($blocktype); $blocktype = blocktype_namespaced_to_single($blocktype);
$catsinstalled = get_column('blocktype_category', 'name'); $catsinstalled = get_column('blocktype_category', 'name');
db_begin(); db_begin();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment