Merge branch 'MDL-56902-master-fix1' of http://github.com/damyon/moodle
This commit is contained in:
+20
-13
@@ -992,21 +992,23 @@ class block_manager {
|
||||
|
||||
// If there are any un-removable blocks that were not created - force them.
|
||||
$undeletable = $this->get_undeletable_block_types();
|
||||
foreach ($undeletable as $forced) {
|
||||
if (empty($forced)) {
|
||||
continue;
|
||||
}
|
||||
$found = false;
|
||||
foreach ($this->get_regions() as $region) {
|
||||
foreach($this->birecordsbyregion[$region] as $instance) {
|
||||
if ($instance->blockname == $forced) {
|
||||
$found = true;
|
||||
if (!$this->fakeblocksonly) {
|
||||
foreach ($undeletable as $forced) {
|
||||
if (empty($forced)) {
|
||||
continue;
|
||||
}
|
||||
$found = false;
|
||||
foreach ($this->get_regions() as $region) {
|
||||
foreach($this->birecordsbyregion[$region] as $instance) {
|
||||
if ($instance->blockname == $forced) {
|
||||
$found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
$this->add_block_required_by_theme($forced);
|
||||
$missing = true;
|
||||
if (!$found) {
|
||||
$this->add_block_required_by_theme($forced);
|
||||
$missing = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1036,6 +1038,11 @@ class block_manager {
|
||||
return;
|
||||
}
|
||||
|
||||
// Never auto create blocks when we are showing fake blocks only.
|
||||
if ($this->fakeblocksonly) {
|
||||
return;
|
||||
}
|
||||
|
||||
$systemcontext = context_system::instance();
|
||||
$defaultregion = $this->get_default_region();
|
||||
// Add a special system wide block instance only for themes that require it.
|
||||
|
||||
+1
-1
@@ -1391,7 +1391,7 @@ function disable_output_buffering() {
|
||||
*/
|
||||
function redirect_if_major_upgrade_required() {
|
||||
global $CFG;
|
||||
$lastmajordbchanges = 2016110600.00;
|
||||
$lastmajordbchanges = 2016112200.01;
|
||||
if (empty($CFG->version) or (float)$CFG->version < $lastmajordbchanges or
|
||||
during_initial_install() or !empty($CFG->adminsetuppending)) {
|
||||
try {
|
||||
|
||||
@@ -566,6 +566,18 @@ class core_blocklib_testcase extends advanced_testcase {
|
||||
|
||||
list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname),
|
||||
$context, 'page-type');
|
||||
|
||||
$blockmanager->show_only_fake_blocks(true);
|
||||
$blockmanager->load_blocks();
|
||||
$blockmanager->create_all_block_instances();
|
||||
$blocks = $blockmanager->get_blocks_for_region($regionname);
|
||||
$this->assertEmpty($blocks);
|
||||
|
||||
$PAGE->reset_theme_and_output();
|
||||
list($page, $blockmanager) = $this->get_a_page_and_block_manager(array($regionname),
|
||||
$context, 'page-type');
|
||||
|
||||
$blockmanager->show_only_fake_blocks(false);
|
||||
$blockmanager->load_blocks();
|
||||
$blockmanager->create_all_block_instances();
|
||||
$blocks = $blockmanager->get_blocks_for_region($regionname);
|
||||
|
||||
Reference in New Issue
Block a user