1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[feature/merging-style-components] Updating database and acp modules

Removing theme and template tables, adding new columns to styles table, deleting acp modules, deleting code that updates theme in updater

PHPBB3-10632
This commit is contained in:
Vjacheslav Trushkin
2012-03-14 23:18:18 +02:00
parent b7d84a586c
commit ae3b0f736d
12 changed files with 81 additions and 455 deletions

View File

@@ -504,56 +504,6 @@ class install_update extends module
// Add database update to log
add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->update_to_version);
// Refresh prosilver css data - this may cause some unhappy users, but
$sql = 'SELECT *
FROM ' . STYLES_THEME_TABLE . "
WHERE LOWER(theme_name) = 'prosilver'";
$result = $db->sql_query($sql);
$theme = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($theme)
{
$recache = (empty($theme['theme_data'])) ? true : false;
$update_time = time();
// We test for stylesheet.css because it is faster and most likely the only file changed on common themes
if (!$recache && $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 if (!$recache)
{
$last_change = $theme['theme_mtime'];
$dir = @opendir("{$phpbb_root_path}styles/{$theme['theme_path']}/theme");
if ($dir)
{
while (($entry = readdir($dir)) !== false)
{
if (substr(strrchr($entry, '.'), 1) == 'css' && $last_change < @filemtime("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/{$entry}"))
{
$recache = true;
break;
}
}
closedir($dir);
}
}
if ($recache)
{
// Instead of re-caching here, we simply remove theme_data... HAR HAR HAR (think about a carribean pirate)
$sql = 'UPDATE ' . STYLES_THEME_TABLE . " SET theme_data = ''
WHERE theme_id = " . $theme['theme_id'];
$db->sql_query($sql);
$cache->destroy('sql', STYLES_THEME_TABLE);
$cache->destroy('sql', STYLES_TABLE);
}
}
$db->sql_return_on_error(true);
$db->sql_query('DELETE FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'");
$db->sql_return_on_error(false);
@@ -1694,9 +1644,9 @@ class install_update extends module
$info['custom'] = array();
/*
// Get custom installed styles...
$sql = 'SELECT template_name, template_path
FROM ' . STYLES_TEMPLATE_TABLE . "
WHERE LOWER(template_name) NOT IN ('subsilver2', 'prosilver')";
$sql = 'SELECT style_name, style_path
FROM ' . STYLES_TABLE . "
WHERE LOWER(style_name) NOT IN ('subsilver2', 'prosilver')";
$result = $db->sql_query($sql);
$templates = array();
@@ -1715,7 +1665,7 @@ class install_update extends module
{
foreach ($templates as $row)
{
$info['custom'][$filename][] = str_replace('/prosilver/', '/' . $row['template_path'] . '/', $filename);
$info['custom'][$filename][] = str_replace('/prosilver/', '/' . $row['style_path'] . '/', $filename);
}
}
}