diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-09-12 18:26:59 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-09-12 18:26:59 +0000 |
commit | 6ea4bc6caa1fe80081324f5d49e9990e57b5ce7d (patch) | |
tree | 59377a177d7437c36e82e099724e9d029bff8b94 /modules/block.module | |
parent | d995621f2e885e710523e4cc689155d5d12e874d (diff) | |
download | brdo-6ea4bc6caa1fe80081324f5d49e9990e57b5ce7d.tar.gz brdo-6ea4bc6caa1fe80081324f5d49e9990e57b5ce7d.tar.bz2 |
- Patch #30801 by Allie Micka and m3avrck: performance improvements: improved the database scheme and queries of the block.module.
Diffstat (limited to 'modules/block.module')
-rw-r--r-- | modules/block.module | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/block.module b/modules/block.module index f507a53d5..9dfaec3ac 100644 --- a/modules/block.module +++ b/modules/block.module @@ -471,10 +471,12 @@ function block_list($region) { 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 @@ function block_list($region) { } } } + // Create an empty array if there were no entries + if(!isset($blocks[$region])) { + $blocks[$region] = array(); + } return $blocks[$region]; } |