From 6ca11b2d2b7a9e6420eec3b21e1531c1586c15c2 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sun, 1 Jul 2007 16:09:50 +0000 Subject: 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 --- phpBB/install/install_update.php | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'phpBB/install/install_update.php') diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 5c83ac2c67..e6fdddf0a2 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -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': -- cgit v1.2.1