mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 15:16:16 +02:00
[ticket/11366] Force the use of the cache on the list page
PHPBB3-11366
This commit is contained in:
parent
64467f50db
commit
521fe2b8e2
@ -26,7 +26,9 @@
|
||||
<td><strong>{enabled.META_DISPLAY_NAME}</strong></td>
|
||||
<td style="text-align: center;">
|
||||
<!-- IF enabled.S_VERSIONCHECK -->
|
||||
<strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong> [ <a href="{enabled.U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> ]
|
||||
<strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong>
|
||||
<!-- ELSE -->
|
||||
{enabled.META_VERSION}
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td>
|
||||
@ -49,7 +51,9 @@
|
||||
<td><strong>{disabled.META_DISPLAY_NAME}</strong></td>
|
||||
<td style="text-align: center;">
|
||||
<!-- IF disabled.S_VERSIONCHECK -->
|
||||
<strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong> [ <a href="{disabled.U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> ]
|
||||
<strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong>
|
||||
<!-- ELSE -->
|
||||
{disabled.META_VERSION}
|
||||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td style="text-align: center;">
|
||||
|
@ -29,6 +29,7 @@ class acp_extensions
|
||||
private $user;
|
||||
private $cache;
|
||||
private $log;
|
||||
private $request;
|
||||
|
||||
function main()
|
||||
{
|
||||
@ -40,6 +41,7 @@ class acp_extensions
|
||||
$this->template = $template;
|
||||
$this->user = $user;
|
||||
$this->cache = $cache;
|
||||
$this->request = $request;
|
||||
$this->log = $phpbb_log;
|
||||
|
||||
$user->add_lang(array('install', 'acp/extensions', 'migrator'));
|
||||
@ -304,7 +306,7 @@ class acp_extensions
|
||||
'META_VERSION' => $meta['version'],
|
||||
);
|
||||
|
||||
$updates = $this->version_check($md_manager);
|
||||
$updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false));
|
||||
|
||||
$enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
||||
$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
||||
@ -359,7 +361,7 @@ class acp_extensions
|
||||
'META_VERSION' => $meta['version'],
|
||||
);
|
||||
|
||||
$updates = $this->version_check($md_manager);
|
||||
$updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false));
|
||||
|
||||
$disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
||||
$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
||||
@ -417,7 +419,7 @@ class acp_extensions
|
||||
'META_VERSION' => $meta['version'],
|
||||
);
|
||||
|
||||
$updates = $this->version_check($md_manager);
|
||||
$updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false));
|
||||
|
||||
$available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
|
||||
$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
|
||||
@ -490,8 +492,9 @@ class acp_extensions
|
||||
$version_helper = new \phpbb\version_helper($this->cache, $this->config, $this->user);
|
||||
$version_helper->set_current_version($meta['version']);
|
||||
$version_helper->set_file_location($version_check ['host'], $version_check ['directory'], $version_check ['filename']);
|
||||
$version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null);
|
||||
|
||||
return $updates = $version_helper->get_suggested_updates($force);
|
||||
return $updates = $version_helper->get_suggested_updates($force, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user