diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 0aed0243d9..e0d432ccd3 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -26,7 +26,9 @@ {enabled.META_DISPLAY_NAME} - style="color: #228822;"style="color: #BC2A4D;">{enabled.META_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;">{enabled.META_VERSION} + + {enabled.META_VERSION} {L_DETAILS} @@ -49,7 +51,9 @@ {disabled.META_DISPLAY_NAME} - style="color: #228822;"style="color: #BC2A4D;">{disabled.META_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;">{disabled.META_VERSION} + + {disabled.META_VERSION} diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index d2b3cb97f0..a91f6fba8b 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -29,6 +29,7 @@ class acp_extensions private $user; private $cache; private $log; + private $request; function main() { @@ -40,6 +41,7 @@ class acp_extensions $this->template = $template; $this->user = $user; $this->cache = $cache; + $this->request = $request; $this->log = $phpbb_log; $user->add_lang(array('install', 'acp/extensions', 'migrator')); @@ -304,7 +306,7 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $updates = $this->version_check($md_manager); + $updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); $enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; @@ -359,7 +361,7 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $updates = $this->version_check($md_manager); + $updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); $disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; @@ -417,7 +419,7 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $updates = $this->version_check($md_manager); + $updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); $available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; @@ -490,8 +492,9 @@ class acp_extensions $version_helper = new \phpbb\version_helper($this->cache, $this->config, $this->user); $version_helper->set_current_version($meta['version']); $version_helper->set_file_location($version_check ['host'], $version_check ['directory'], $version_check ['filename']); + $version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null); - return $updates = $version_helper->get_suggested_updates($force); + return $updates = $version_helper->get_suggested_updates($force, true); } /** diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index 5991744e76..968a57428f 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -158,15 +158,16 @@ class version_helper } /** - * Gets the latest version for the current branch the user is on - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @return string - * @throws \RuntimeException - */ - public function get_latest_on_current_branch($force_update = false) + * Gets the latest version for the current branch the user is on + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string + * @throws \RuntimeException + */ + public function get_latest_on_current_branch($force_update = false, $force_cache = false) { - $versions = $this->get_versions_matching_stability($force_update); + $versions = $this->get_versions_matching_stability($force_update, $force_cache); $self = $this; $current_version = $this->current_version; @@ -188,15 +189,16 @@ class version_helper } /** - * Obtains the latest version information - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @return string - * @throws \RuntimeException - */ - public function get_suggested_updates($force_update = false) + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string + * @throws \RuntimeException + */ + public function get_suggested_updates($force_update = false, $force_cache = false) { - $versions = $this->get_versions_matching_stability($force_update); + $versions = $this->get_versions_matching_stability($force_update, $force_cache); $self = $this; $current_version = $this->current_version; @@ -208,15 +210,16 @@ class version_helper } /** - * Obtains the latest version information matching the stability of the current install - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @return string Version info - * @throws \RuntimeException - */ - public function get_versions_matching_stability($force_update = false) + * Obtains the latest version information matching the stability of the current install + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string Version info + * @throws \RuntimeException + */ + public function get_versions_matching_stability($force_update = false, $force_cache = false) { - $info = $this->get_versions($force_update); + $info = $this->get_versions($force_update, $force_cache); if ($this->force_stability !== null) { @@ -227,19 +230,24 @@ class version_helper } /** - * Obtains the latest version information - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @return string Version info, includes stable and unstable data - * @throws \RuntimeException - */ - public function get_versions($force_update = false) + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return string Version info, includes stable and unstable data + * @throws \RuntimeException + */ + public function get_versions($force_update = false, $force_cache = false) { $cache_file = 'versioncheck_' . $this->host . $this->path . $this->file; $info = $this->cache->get($cache_file); - if ($info === false || $force_update) + if ($info === false && $force_cache) + { + throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + } + else if ($info === false || $force_update) { $errstr = $errno = ''; $info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno);