mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-14 12:44:06 +02:00
Merge pull request #2309 from Nicofuma/ticket/11366
[ticket/11366] Extension's version's check * Nicofuma/ticket/11366: (29 commits) [ticket/11366] Fix headings css in list page [ticket/11366] Add config value in schema_data.sql [ticket/11366] Fix HTML [ticket/11366] Exchange links and settings' form [ticket/11366] Remove the extra {S_FORM_TOKEN} [ticket/11366] Move the links to the top of the page [ticket/11366] Hide the version check settings by default [ticket/11366] Versions, options and actions heading should be centered [ticket/11366] Better language string for "recheck all" [ticket/11366] Move "recheck all" link [ticket/11366] Add $config['extension_force_unstable'] [ticket/11366] Use force_cache on the list page [ticket/11366] Add recheck-all link [ticket/11366] Force the use of the cache on the list page [ticket/11366] Update FILE_NOT_FOUND language string [ticket/11366] Fix whitespaces [ticket/11366] Update FILE_NOT_FOUND language string [ticket/11366] Update var names [ticket/11366] Align language strings [ticket/11366] Fix detailed view ...
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package migration
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\db\migration\data\v310;
|
||||
|
||||
class extensions_version_check_force_unstable extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v310\dev');
|
||||
}
|
||||
|
||||
public function update_data()
|
||||
{
|
||||
return array(
|
||||
array('config.add', array('extension_force_unstable', false)),
|
||||
);
|
||||
}
|
||||
}
|
@@ -158,15 +158,16 @@ class version_helper
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the latest version for the current branch the user is on
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_latest_on_current_branch($force_update = false)
|
||||
* Gets the latest version for the current branch the user is on
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @param bool $force_cache Force the use of the cache. Override $force_update.
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_latest_on_current_branch($force_update = false, $force_cache = false)
|
||||
{
|
||||
$versions = $this->get_versions_matching_stability($force_update);
|
||||
$versions = $this->get_versions_matching_stability($force_update, $force_cache);
|
||||
|
||||
$self = $this;
|
||||
$current_version = $this->current_version;
|
||||
@@ -188,15 +189,16 @@ class version_helper
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the latest version information
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_suggested_updates($force_update = false)
|
||||
* Obtains the latest version information
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @param bool $force_cache Force the use of the cache. Override $force_update.
|
||||
* @return string
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_suggested_updates($force_update = false, $force_cache = false)
|
||||
{
|
||||
$versions = $this->get_versions_matching_stability($force_update);
|
||||
$versions = $this->get_versions_matching_stability($force_update, $force_cache);
|
||||
|
||||
$self = $this;
|
||||
$current_version = $this->current_version;
|
||||
@@ -208,15 +210,16 @@ class version_helper
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the latest version information matching the stability of the current install
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @return string Version info
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_versions_matching_stability($force_update = false)
|
||||
* Obtains the latest version information matching the stability of the current install
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @param bool $force_cache Force the use of the cache. Override $force_update.
|
||||
* @return string Version info
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_versions_matching_stability($force_update = false, $force_cache = false)
|
||||
{
|
||||
$info = $this->get_versions($force_update);
|
||||
$info = $this->get_versions($force_update, $force_cache);
|
||||
|
||||
if ($this->force_stability !== null)
|
||||
{
|
||||
@@ -227,19 +230,24 @@ class version_helper
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the latest version information
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @return string Version info, includes stable and unstable data
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_versions($force_update = false)
|
||||
* Obtains the latest version information
|
||||
*
|
||||
* @param bool $force_update Ignores cached data. Defaults to false.
|
||||
* @param bool $force_cache Force the use of the cache. Override $force_update.
|
||||
* @return string Version info, includes stable and unstable data
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function get_versions($force_update = false, $force_cache = false)
|
||||
{
|
||||
$cache_file = 'versioncheck_' . $this->host . $this->path . $this->file;
|
||||
|
||||
$info = $this->cache->get($cache_file);
|
||||
|
||||
if ($info === false || $force_update)
|
||||
if ($info === false && $force_cache)
|
||||
{
|
||||
throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL'));
|
||||
}
|
||||
else if ($info === false || $force_update)
|
||||
{
|
||||
$errstr = $errno = '';
|
||||
$info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno);
|
||||
|
Reference in New Issue
Block a user