Permalink
Browse files

MDL-28473 fix $instanceids troubles in blocks upgrade

Credit goes to Mateusz Wójcik.
  • Loading branch information...
skodak committed Aug 5, 2011
1 parent 4b85dc1 commit fd526f38ce07c943dca100bbd718e5ab2c42cb9a
Showing with 5 additions and 3 deletions.
  1. +5 −3 lib/db/upgrade.php
View
@@ -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);

0 comments on commit fd526f3

Please sign in to comment.