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'; + } } /** @@ -69,6 +80,20 @@ class version_helper return $this; } + /** + * 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']; } /**