? modules/devel.module Index: database/database.mysql =================================================================== RCS file: /cvs/drupal/drupal/database/database.mysql,v retrieving revision 1.195 diff -u -r1.195 database.mysql --- database/database.mysql 30 Aug 2005 15:19:20 -0000 1.195 +++ database/database.mysql 12 Sep 2005 17:30:54 -0000 @@ -128,7 +128,8 @@ custom tinyint(2) DEFAULT '0' NOT NULL, throttle tinyint(1) DEFAULT '0' NOT NULL, visibility tinyint(1) DEFAULT '0' NOT NULL, - pages text NOT NULL + pages text NOT NULL, + PRIMARY KEY (module,delta) ) TYPE=MyISAM; -- Index: database/database.pgsql =================================================================== RCS file: /cvs/drupal/drupal/database/database.pgsql,v retrieving revision 1.134 diff -u -r1.134 database.pgsql --- database/database.pgsql 30 Aug 2005 15:19:20 -0000 1.134 +++ database/database.pgsql 12 Sep 2005 17:31:32 -0000 @@ -123,7 +123,8 @@ custom smallint NOT NULL default '0', throttle smallint NOT NULL default '0', visibility smallint NOT NULL default '0', - pages text NOT NULL default '' + pages text NOT NULL default '', + PRIMARY KEY (module,detla) ); -- Index: database/updates.inc =================================================================== RCS file: /cvs/drupal/drupal/database/updates.inc,v retrieving revision 1.131 diff -u -r1.131 updates.inc --- database/updates.inc 8 Sep 2005 19:17:34 -0000 1.131 +++ database/updates.inc 12 Sep 2005 17:33:08 -0000 @@ -45,7 +45,8 @@ "2005-08-08" => "update_144", "2005-08-15" => "update_145", "2005-08-25" => "update_146", - "2005-09-07" => "update_147" + "2005-09-07" => "update_147", + "2005-09-12" => "update_148" ); function update_110() { @@ -790,6 +791,14 @@ return $ret; } +function update_148() { + $ret = array(); + + $ret[] = update_sql('ALTER TABLE {blocks} ADD PRIMARY KEY (module,delta)'); + + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); Index: modules/block.module =================================================================== RCS file: /cvs/drupal/drupal/modules/block.module,v retrieving revision 1.178 diff -u -r1.178 block.module --- modules/block.module 25 Aug 2005 21:14:16 -0000 1.178 +++ modules/block.module 12 Sep 2005 15:10:24 -0000 @@ -471,10 +471,12 @@ static $blocks = array(); - if (!isset($blocks[$region])) { - $blocks[$region] = array(); - $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 AND region = '%s' ORDER BY weight, module", $theme_key, $region); + if (!count($blocks)) { + $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s' AND status = 1 ORDER BY region, weight, module", $theme_key); while ($block = db_fetch_array($result)) { + if(!isset($blocks[$block->region])) { + $blocks[$block->region] = array(); + } // Use the user's block visibility setting, if necessary if ($block['custom'] != 0) { if ($user->uid && isset($user->block[$block['module']][$block['delta']])) { @@ -517,6 +519,10 @@ } } } + // Create an empty array if there were no entries + if(!isset($blocks[$region])) { + $blocks[$region] = Array(); + } return $blocks[$region]; }