diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2014-03-11 19:15:50 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2014-03-11 19:15:50 -0500 |
commit | feed1441add9582d987c7480b92cc38946eedf15 (patch) | |
tree | 4569196ded4654b27979bb91e410cc01f14252c4 /phpBB/phpbb | |
parent | 00d86a4af1adc4d34955d0432ef514d8c25942c9 (diff) | |
download | forums-feed1441add9582d987c7480b92cc38946eedf15.tar forums-feed1441add9582d987c7480b92cc38946eedf15.tar.gz forums-feed1441add9582d987c7480b92cc38946eedf15.tar.bz2 forums-feed1441add9582d987c7480b92cc38946eedf15.tar.xz forums-feed1441add9582d987c7480b92cc38946eedf15.zip |
[ticket/9871] Option to force the stability when checking for updates
PHPBB3-9871
Diffstat (limited to 'phpBB/phpbb')
-rw-r--r-- | phpBB/phpbb/version_helper.php | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index d7bc09182e..b8f305111f 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -29,6 +29,12 @@ class version_helper */ protected $file = 'versions.json'; + /** + * @var null|string Null to not force stability, 'unstable' or 'stable' to + * force the corresponding stability + */ + protected $force_stability; + /** @var \phpbb\cache\service */ protected $cache; @@ -50,6 +56,11 @@ class version_helper $this->cache = $cache; $this->config = $config; $this->user = $user; + + if (defined('PHPBB_QA')) + { + $this->force_stability = 'unstable'; + } } /** @@ -70,6 +81,20 @@ class version_helper } /** + * Over-ride the stability to force check to include unstable versions + * + * @param null|string Null to not force stability, 'unstable' or 'stable' to + * force the corresponding stability + * @return version_helper + */ + public function force_stability($stability) + { + $this->force_stability = $stability; + + return $this; + } + + /** * Wrapper for version_compare() that allows using uppercase A and B * for alpha and beta releases. * @@ -169,7 +194,12 @@ class version_helper { $info = $this->get_versions($force_update); - return ($this->is_stable($this->config['version']) && !defined('PHPBB_QA')) ? $info['stable'] : $info['unstable']; + if ($this->force_stability !== null) + { + return ($this->force_stability === 'unstable') ? $info['unstable'] : $info['stable']; + } + + return ($this->is_stable($this->config['version'])) ? $info['stable'] : $info['unstable']; } /** |