aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/style.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/style.php')
-rw-r--r--phpBB/style.php54
1 files changed, 40 insertions, 14 deletions
diff --git a/phpBB/style.php b/phpBB/style.php
index 150261aba6..f224df9f30 100644
--- a/phpBB/style.php
+++ b/phpBB/style.php
@@ -115,26 +115,52 @@ if ($id && $sid)
}
// Re-cache stylesheet data if necessary
- if ($config['load_tplcompile'] && $theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
+ if ($config['load_tplcompile'])
{
- include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
+ $recache = false;
+ $update_time = time();
- $theme['theme_data'] = acp_styles::db_theme_data($theme);
- $theme['theme_mtime'] = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
+ // We test for stylesheet.css because it is faster and most likely the only file changed on common themes
+ if ($theme['theme_mtime'] < @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css'))
+ {
+ $recache = true;
+ $update_time = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
+ }
+ else
+ {
+ $last_change = $theme['theme_mtime'];
- // Save CSS contents
- $sql_ary = array(
- 'theme_mtime' => $theme['theme_mtime'],
- 'theme_data' => $theme['theme_data']
- );
+ foreach (glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT) as $file)
+ {
+ if ($last_change < @filemtime($file))
+ {
+ $recache = true;
+ break;
+ }
+ }
+ }
- $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE theme_id = $id";
- $db->sql_query($sql);
+ if ($recache)
+ {
+ include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
+
+ $theme['theme_data'] = acp_styles::db_theme_data($theme);
+ $theme['theme_mtime'] = $update_time;
+
+ // Save CSS contents
+ $sql_ary = array(
+ 'theme_mtime' => $theme['theme_mtime'],
+ 'theme_data' => $theme['theme_data']
+ );
- $cache->destroy('sql', STYLES_THEME_TABLE);
+ $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
+ WHERE theme_id = $id";
+ $db->sql_query($sql);
- header('Expires: 0');
+ $cache->destroy('sql', STYLES_THEME_TABLE);
+
+ header('Expires: 0');
+ }
}
else
{