mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 16:05:00 +02:00
[ticket/9871] Option to force the stability when checking for updates
PHPBB3-9871
This commit is contained in:
parent
00d86a4af1
commit
feed1441ad
@ -29,6 +29,12 @@ class version_helper
|
|||||||
*/
|
*/
|
||||||
protected $file = 'versions.json';
|
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 */
|
/** @var \phpbb\cache\service */
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
@ -50,6 +56,11 @@ class version_helper
|
|||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
||||||
|
if (defined('PHPBB_QA'))
|
||||||
|
{
|
||||||
|
$this->force_stability = 'unstable';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,6 +80,20 @@ class version_helper
|
|||||||
return $this;
|
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
|
* Wrapper for version_compare() that allows using uppercase A and B
|
||||||
* for alpha and beta releases.
|
* for alpha and beta releases.
|
||||||
@ -169,7 +194,12 @@ class version_helper
|
|||||||
{
|
{
|
||||||
$info = $this->get_versions($force_update);
|
$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'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user