diff options
author | Tristan Darricau <github@nicofuma.fr> | 2014-05-12 12:30:27 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2014-05-28 22:18:54 +0200 |
commit | 521fe2b8e29fdb61ab0c02ec40f20b652d66623a (patch) | |
tree | 4cd9c9e8b2946d5bda8b7ce2a27427c64743bdd1 /phpBB/phpbb/version_helper.php | |
parent | 64467f50db496d0cc388e437dd9d843d5faf6449 (diff) | |
download | forums-521fe2b8e29fdb61ab0c02ec40f20b652d66623a.tar forums-521fe2b8e29fdb61ab0c02ec40f20b652d66623a.tar.gz forums-521fe2b8e29fdb61ab0c02ec40f20b652d66623a.tar.bz2 forums-521fe2b8e29fdb61ab0c02ec40f20b652d66623a.tar.xz forums-521fe2b8e29fdb61ab0c02ec40f20b652d66623a.zip |
[ticket/11366] Force the use of the cache on the list page
PHPBB3-11366
Diffstat (limited to 'phpBB/phpbb/version_helper.php')
-rw-r--r-- | phpBB/phpbb/version_helper.php | 72 |
1 files changed, 40 insertions, 32 deletions
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); |