mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-04 15:57:45 +02:00
[ticket/9871] Can set current version to use instead of the phpBB version
PHPBB3-9871
This commit is contained in:
@@ -29,6 +29,11 @@ class version_helper
|
|||||||
*/
|
*/
|
||||||
protected $file = 'versions.json';
|
protected $file = 'versions.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Current version installed
|
||||||
|
*/
|
||||||
|
protected $current_version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var null|string Null to not force stability, 'unstable' or 'stable' to
|
* @var null|string Null to not force stability, 'unstable' or 'stable' to
|
||||||
* force the corresponding stability
|
* force the corresponding stability
|
||||||
@@ -61,6 +66,8 @@ class version_helper
|
|||||||
{
|
{
|
||||||
$this->force_stability = 'unstable';
|
$this->force_stability = 'unstable';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->current_version = $this->config['version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,6 +87,19 @@ class version_helper
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
* Over-ride the stability to force check to include unstable versions
|
||||||
*
|
*
|
||||||
@@ -145,7 +165,7 @@ class version_helper
|
|||||||
$versions = $this->get_versions_matching_stability($force_update);
|
$versions = $this->get_versions_matching_stability($force_update);
|
||||||
|
|
||||||
$self = $this;
|
$self = $this;
|
||||||
$current_version = $this->config['version'];
|
$current_version = $this->current_version;
|
||||||
|
|
||||||
// Filter out any versions less than to the current version
|
// Filter out any versions less than to the current version
|
||||||
$versions = array_filter($versions, function($data) use ($self, $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);
|
$versions = $this->get_versions_matching_stability($force_update);
|
||||||
|
|
||||||
$self = $this;
|
$self = $this;
|
||||||
$current_version = $this->config['version'];
|
$current_version = $this->current_version;
|
||||||
|
|
||||||
// Filter out any versions less than or equal to the current version
|
// Filter out any versions less than or equal to the current version
|
||||||
return array_filter($versions, function($data) use ($self, $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->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'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user