Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Blocks upgrade - reduce memory consumption by a few GB and (postgres …

…only) halve database traffic.
  • Loading branch information...
commit e2d7747f101062dd54fc651c7564062e79eb34a8 1 parent 05746e6
martinlanghoff authored
Showing with 8 additions and 8 deletions.
  1. +4 −4 blocks/db/mysql.php
  2. +4 −4 blocks/db/postgres7.php
View
8 blocks/db/mysql.php
@@ -58,7 +58,7 @@ function blocks_upgrade($oldversion=0) {
if(!empty($records)) {
foreach($records as $block) {
$block->multiple = 0;
- insert_record('block', $block);
+ insert_record('block', $block, false);
}
}
@@ -82,7 +82,7 @@ function blocks_upgrade($oldversion=0) {
return false;
}
- $records = get_records('course');
+ $records = get_records('course', '','','', 'id, shortname, blockinfo');
if(!empty($records)) {
foreach($records as $thiscourse) {
// The @ suppresses a notice emitted if there is no : in the string
@@ -98,7 +98,7 @@ function blocks_upgrade($oldversion=0) {
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
- insert_record('block_instance', $instance);
+ insert_record('block_instance', $instance, false);
}
}
if(!empty($right)) {
@@ -112,7 +112,7 @@ function blocks_upgrade($oldversion=0) {
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
- insert_record('block_instance', $instance);
+ insert_record('block_instance', $instance, false);
}
}
}
View
8 blocks/db/postgres7.php
@@ -59,7 +59,7 @@ function blocks_upgrade($oldversion=0) {
if(!empty($records)) {
foreach($records as $block) {
$block->multiple = 0;
- insert_record('block', $block);
+ insert_record('block', $block, false);
}
execute_sql("SELECT setval('{$CFG->prefix}block_id_seq', (SELECT MAX(id) FROM {$CFG->prefix}block), true)");
}
@@ -81,7 +81,7 @@ function blocks_upgrade($oldversion=0) {
return false;
}
- $records = get_records('course');
+ $records = get_records('course', '','','', 'id, shortname, blockinfo');
if(!empty($records)) {
foreach($records as $thiscourse) {
// The @ suppresses a notice emitted if there is no : in the string
@@ -97,7 +97,7 @@ function blocks_upgrade($oldversion=0) {
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
- insert_record('block_instance', $instance);
+ insert_record('block_instance', $instance, false);
}
}
if(!empty($right)) {
@@ -111,7 +111,7 @@ function blocks_upgrade($oldversion=0) {
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance->configdata = '';
- insert_record('block_instance', $instance);
+ insert_record('block_instance', $instance, false);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.