Skip to content
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 80eb52c commit e25df8c46494c2273c4063d8a69b6fc4addb3ae0
Showing with 5 additions and 3 deletions.
  1. +5 −3 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);

0 comments on commit e25df8c

Please sign in to comment.
You can’t perform that action at this time.