mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
implement change style check suggested by code reader.
git-svn-id: file:///svn/phpbb/trunk@7500 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
1ad49ecb91
commit
b7939ba801
1 changed files with 40 additions and 14 deletions
|
@ -115,26 +115,52 @@ if ($id && $sid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-cache stylesheet data if necessary
|
// 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);
|
// We test for stylesheet.css because it is faster and most likely the only file changed on common themes
|
||||||
$theme['theme_mtime'] = @filemtime("{$phpbb_root_path}styles/" . $theme['theme_path'] . '/theme/stylesheet.css');
|
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
|
foreach (glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT) as $file)
|
||||||
$sql_ary = array(
|
{
|
||||||
'theme_mtime' => $theme['theme_mtime'],
|
if ($last_change < @filemtime($file))
|
||||||
'theme_data' => $theme['theme_data']
|
{
|
||||||
);
|
$recache = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
if ($recache)
|
||||||
WHERE theme_id = $id";
|
{
|
||||||
$db->sql_query($sql);
|
include_once($phpbb_root_path . 'includes/acp/acp_styles.' . $phpEx);
|
||||||
|
|
||||||
$cache->destroy('sql', STYLES_THEME_TABLE);
|
$theme['theme_data'] = acp_styles::db_theme_data($theme);
|
||||||
|
$theme['theme_mtime'] = $update_time;
|
||||||
|
|
||||||
header('Expires: 0');
|
// Save CSS contents
|
||||||
|
$sql_ary = array(
|
||||||
|
'theme_mtime' => $theme['theme_mtime'],
|
||||||
|
'theme_data' => $theme['theme_data']
|
||||||
|
);
|
||||||
|
|
||||||
|
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
|
||||||
|
WHERE theme_id = $id";
|
||||||
|
$db->sql_query($sql);
|
||||||
|
|
||||||
|
$cache->destroy('sql', STYLES_THEME_TABLE);
|
||||||
|
|
||||||
|
header('Expires: 0');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue