Commit 4bdf24ea authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

#210219 by htalvitie, yched: initialize block caching properties properly on...

#210219 by htalvitie, yched: initialize block caching properties properly on install (and update bugos RC2 sites as well)
parent bf28630a
......@@ -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}'));
}
/**
......
......@@ -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);
......@@ -2479,6 +2479,17 @@ function system_update_6046() {
return $ret;
}
/**
* 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.
......
......@@ -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':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment