1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-17 22:11:26 +02:00

some fixes... most importantly the ability to update the board with the automatic files while having fsockopen disabled (instead, the update file information will be used, which may be inaccurate if the admin did a mistake).

git-svn-id: file:///svn/phpbb/trunk@7818 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-07-01 16:09:50 +00:00
parent 817a82a1af
commit 6ca11b2d2b
7 changed files with 83 additions and 8 deletions

View File

@@ -408,6 +408,60 @@ class install_update extends module
// Add database update to log
add_log('admin', 'LOG_UPDATE_PHPBB', $this->current_version, $this->latest_version);
// Refresh prosilver css data - this may cause some unhappy users, but
$sql = 'SELECT *
FROM ' . STYLES_THEME_TABLE . "
WHERE 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'];
foreach (glob("{$phpbb_root_path}styles/{$theme['theme_path']}/theme/*.css", GLOB_NOSORT) as $file)
{
if ($last_change < @filemtime($file))
{
$recache = true;
break;
}
}
}
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']
);
$sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE theme_id = ' . $theme['theme_id'];
$db->sql_query($sql);
$cache->destroy('sql', STYLES_THEME_TABLE);
}
}
$cache->purge();
$db->sql_return_on_error(true);
@@ -1192,6 +1246,19 @@ class install_update extends module
{
$info = $this->test_update;
}
// If info is false the fsockopen function may not be working. Instead get the latest version from our update file (and pray it is up-to-date)
if ($info === false)
{
$update_info = array();
include($phpbb_root_path . 'install/update/index.php');
$info = (empty($update_info) || !is_array($update_info)) ? false : $update_info;
if ($info !== false)
{
$info = (!empty($info['version']['to'])) ? trim($info['version']['to']) : false;
}
}
break;
case 'update_info':