diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-28 19:56:27 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2008-01-28 19:56:27 +0000 |
commit | 4bdf24ea52a0e661d84a13ec78a868cb50c46cc5 (patch) | |
tree | a7c9a3c02f7fe02481e6cffe5459afdc9f6a91ea | |
parent | bf28630a5e46d28d66d604ceea80f53c060e647b (diff) | |
download | brdo-4bdf24ea52a0e661d84a13ec78a868cb50c46cc5.tar.gz brdo-4bdf24ea52a0e661d84a13ec78a868cb50c46cc5.tar.bz2 |
#210219 by htalvitie, yched: initialize block caching properties properly on install (and update bugos RC2 sites as well)
-rw-r--r-- | includes/file.inc | 12 | ||||
-rw-r--r-- | modules/system/system.install | 19 | ||||
-rw-r--r-- | modules/system/system.module | 2 |
3 files changed, 23 insertions, 10 deletions
diff --git a/includes/file.inc b/includes/file.inc index 1fd40a017..907a7200a 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -437,17 +437,17 @@ function file_delete($path) { } /** - * Determine the total amount of disk space used by a single user's files, or - * the filesystem as a whole. + * Determine total disk space used by a single user or the whole filesystem. * - * @param $uid An optional, user id. A NULL value returns the total space used + * @param $uid + * An optional user id. A NULL value returns the total space used * by all files. */ function file_space_used($uid = NULL) { - if (is_null($uid)) { - return db_result(db_query('SELECT SUM(filesize) FROM {files} WHERE uid = %d', $uid)); + if (isset($uid)) { + return (int) db_result(db_query('SELECT SUM(filesize) FROM {files} WHERE uid = %d', $uid)); } - return db_result(db_query('SELECT SUM(filesize) FROM {files}')); + return (int) db_result(db_query('SELECT SUM(filesize) FROM {files}')); } /** diff --git a/modules/system/system.install b/modules/system/system.install index 30d0a5aaa..1de6f7401 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -68,7 +68,7 @@ function system_requirements($phase) { 'title' => $t('PHP register globals'), ); $register_globals = trim(ini_get('register_globals')); - // Unfortunately, ini_get() may return many different values, and we can't + // Unfortunately, ini_get() may return many different values, and we can't // be certain which values mean 'on', so we instead check for 'not off' // since we never want to tell the user that their site is secure // (register_globals off), when it is in fact on. We can only guarantee @@ -393,9 +393,9 @@ function system_install() { db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", 'theme_default', 's:7:"garland";'); db_query("UPDATE {system} SET status = %d WHERE type = '%s' AND name = '%s'", 1, 'theme', 'garland'); - db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s')", 'user', '0', 'garland', 1, 0, 'left', ''); - db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s')", 'user', '1', 'garland', 1, 0, 'left', ''); - db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s')", 'system', '0', 'garland', 1, 10, 'footer', ''); + db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', '0', 'garland', 1, 0, 'left', '', -1); + db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'user', '1', 'garland', 1, 0, 'left', '', -1); + db_query("INSERT INTO {blocks} (module, delta, theme, status, weight, region, pages, cache) VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s', %d)", 'system', '0', 'garland', 1, 10, 'footer', '', -1); db_query("INSERT INTO {node_access} (nid, gid, realm, grant_view, grant_update, grant_delete) VALUES (%d, %d, '%s', %d, %d, %d)", 0, 0, 'all', 1, 0, 0); @@ -2480,6 +2480,17 @@ function system_update_6046() { } /** + * Fix cache mode for blocks inserted in system_install() in fresh installs of previous RC. + */ +function system_update_6047() { + $ret = array(); + $ret[] = update_sql("UPDATE {blocks} SET cache = %d WHERE module = '%s' AND delta = '%s'", -1, 'user', '0'); + $ret[] = update_sql("UPDATE {blocks} SET cache = %d WHERE module = '%s' AND delta = '%s'", -1, 'user', '1'); + $ret[] = update_sql("UPDATE {blocks} SET cache = %d WHERE module = '%s' AND delta = '%s'", -1, 'system', '0'); + return $ret; +} + +/** * @} End of "defgroup updates-5.x-to-6.x" * The next series of updates should start at 7000. */ diff --git a/modules/system/system.module b/modules/system/system.module index 1f1cac291..a982f2e87 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -580,6 +580,8 @@ function system_block($op = 'list', $delta = 0, $edit = NULL) { $blocks[0] = array( 'info' => t('Powered by Drupal'), 'weight' => '10', + // Not worth caching. + 'cache' => BLOCK_NO_CACHE, ); return $blocks; case 'configure': |