Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-28473 fix $instanceids troubles in blocks upgrade

Credit goes to Mateusz Wójcik.
  • Loading branch information...
commit e25df8c46494c2273c4063d8a69b6fc4addb3ae0 1 parent 80eb52c
@skodak skodak authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/db/upgrade.php
View
8 lib/db/upgrade.php
@@ -2121,7 +2121,7 @@ function xmldb_main_upgrade($oldversion) {
$instanceids[] = $blockinstance->id;
// If we have more than 1000 block instances now remove all block positions
// and empty the array
- if (count($contextids) > 1000) {
+ if (count($instanceids) > 1000) {
$instanceidstring = join(',',$instanceids);
$DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
$instanceids = array();
@@ -2131,8 +2131,10 @@ function xmldb_main_upgrade($oldversion) {
upgrade_cleanup_unwanted_block_contexts($contextids);
- $instanceidstring = join(',',$instanceids);
- $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
+ if ($instanceids) {
+ $instanceidstring = join(',',$instanceids);
+ $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
+ }
unset($allblockinstances);
unset($contextids);
Please sign in to comment.
Something went wrong with that request. Please try again.