Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-28473 fix $instanceids troubles in blocks upgrade

Credit goes to Mateusz Wójcik.
  • Loading branch information...
commit e25df8c46494c2273c4063d8a69b6fc4addb3ae0 1 parent 80eb52c
Petr Skoda skodak authored

Showing 1 changed file with 5 additions and 3 deletions. Show diff stats Hide diff stats

  1. +5 3 lib/db/upgrade.php
8 lib/db/upgrade.php
@@ -2121,7 +2121,7 @@ function xmldb_main_upgrade($oldversion) {
2121 2121 $instanceids[] = $blockinstance->id;
2122 2122 // If we have more than 1000 block instances now remove all block positions
2123 2123 // and empty the array
2124   - if (count($contextids) > 1000) {
  2124 + if (count($instanceids) > 1000) {
2125 2125 $instanceidstring = join(',',$instanceids);
2126 2126 $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
2127 2127 $instanceids = array();
@@ -2131,8 +2131,10 @@ function xmldb_main_upgrade($oldversion) {
2131 2131
2132 2132 upgrade_cleanup_unwanted_block_contexts($contextids);
2133 2133
2134   - $instanceidstring = join(',',$instanceids);
2135   - $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
  2134 + if ($instanceids) {
  2135 + $instanceidstring = join(',',$instanceids);
  2136 + $DB->delete_records_select('block_positions', 'blockinstanceid IN ('.$instanceidstring.')');
  2137 + }
2136 2138
2137 2139 unset($allblockinstances);
2138 2140 unset($contextids);

0 comments on commit e25df8c

Please sign in to comment.
Something went wrong with that request. Please try again.