diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2014-03-14 07:07:26 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2014-03-14 07:07:26 -0500 |
commit | 60d2c1f4006894f2bb4fa310372734d02565e9ca (patch) | |
tree | 64633a5e5379ad135b56f54ce20fc8e2dc3c50d3 | |
parent | 0c40cd5f137167d3a7a022ac951a238cbc885305 (diff) | |
download | forums-60d2c1f4006894f2bb4fa310372734d02565e9ca.tar forums-60d2c1f4006894f2bb4fa310372734d02565e9ca.tar.gz forums-60d2c1f4006894f2bb4fa310372734d02565e9ca.tar.bz2 forums-60d2c1f4006894f2bb4fa310372734d02565e9ca.tar.xz forums-60d2c1f4006894f2bb4fa310372734d02565e9ca.zip |
[ticket/9871] Can set current version to use instead of the phpBB version
PHPBB3-9871
-rw-r--r-- | phpBB/phpbb/version_helper.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index b8f305111f..e2fdf6ce63 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -30,6 +30,11 @@ class version_helper protected $file = 'versions.json'; /** + * @var string Current version installed + */ + protected $current_version; + + /** * @var null|string Null to not force stability, 'unstable' or 'stable' to * force the corresponding stability */ @@ -61,6 +66,8 @@ class version_helper { $this->force_stability = 'unstable'; } + + $this->current_version = $this->config['version']; } /** @@ -81,6 +88,19 @@ class version_helper } /** + * Set current version + * + * @param string $version The current version + * @return version_helper + */ + public function set_current_version($version) + { + $this->current_version = $version; + + 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 @@ -145,7 +165,7 @@ class version_helper $versions = $this->get_versions_matching_stability($force_update); $self = $this; - $current_version = $this->config['version']; + $current_version = $this->current_version; // Filter out any versions less than to the current version $versions = array_filter($versions, function($data) use ($self, $current_version) { @@ -175,7 +195,7 @@ class version_helper $versions = $this->get_versions_matching_stability($force_update); $self = $this; - $current_version = $this->config['version']; + $current_version = $this->current_version; // Filter out any versions less than or equal to the current version return array_filter($versions, function($data) use ($self, $current_version) { @@ -199,7 +219,7 @@ class version_helper return ($this->force_stability === 'unstable') ? $info['unstable'] : $info['stable']; } - return ($this->is_stable($this->config['version'])) ? $info['stable'] : $info['unstable']; + return ($this->is_stable($this->current_version)) ? $info['stable'] : $info['unstable']; } /** |