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:
Joas Schilling 2014-05-28 23:46:03 +02:00
commit 305be2ae64
10 changed files with 345 additions and 79 deletions

View file

@ -6,6 +6,22 @@
<h1>{L_EXTENSIONS_ADMIN}</h1> <h1>{L_EXTENSIONS_ADMIN}</h1>
<!-- IF S_VERSIONCHECK -->
<div class="<!-- IF S_UP_TO_DATE -->successbox<!-- ELSE -->errorbox<!-- ENDIF -->">
<p>{UP_TO_DATE_MSG} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
</div>
<!-- ELSE IF S_VERSIONCHECK_STATUS == 0 -->
<div class="errorbox notice">
<p>{L_VERSIONCHECK_FAIL}</p>
<p>{VERSIONCHECK_FAIL_REASON}</p>
<p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p>
</div>
<!-- ELSE IF S_VERSIONCHECK_STATUS == 1 -->
<div class="errorbox notice">
<p>{VERSIONCHECK_FAIL_REASON}</p>
</div>
<!-- ENDIF -->
<fieldset> <fieldset>
<legend>{L_EXT_DETAILS}</legend> <legend>{L_EXT_DETAILS}</legend>
<!-- IF META_DISPLAY_NAME --> <!-- IF META_DISPLAY_NAME -->
@ -46,6 +62,32 @@
</dl> </dl>
</fieldset> </fieldset>
<!-- IF S_VERSIONCHECK && not S_UP_TO_DATE -->
<fieldset>
<legend>{L_LATEST_VERSION}</legend>
<!-- BEGIN updates_available -->
<fieldset>
<dl>
<dt><label>{L_VERSION}{L_COLON}</label></dt>
<dd><strong>{updates_available.current}</strong></dd>
</dl>
<!-- IF updates_available.download-->
<dl>
<dt><label>{L_DOWNLOAD_LATEST}</label></dt>
<dd><strong><a href="{updates_available.download}">{L_DOWNLOAD} {META_NAME} {LATEST_VERSION}</a></strong></dd>
</dl>
<!-- ENDIF -->
<!-- IF updates_available.announcement -->
<dl>
<dt><label>{L_ANNOUNCEMENT_TOPIC}</label></dt>
<dd><strong><a href="{updates_available.announcement}">{L_RELEASE_ANNOUNCEMENT}</a></strong></dd>
</dl>
<!-- ENDIF -->
</fieldset>
<!-- END updates_available -->
</fieldset>
<!-- ENDIF -->
<!-- IF META_REQUIRE_PHPBB || META_REQUIRE_PHP --> <!-- IF META_REQUIRE_PHPBB || META_REQUIRE_PHP -->
<fieldset> <fieldset>
<legend>{L_REQUIREMENTS}</legend> <legend>{L_REQUIREMENTS}</legend>

View file

@ -6,23 +6,56 @@
<p>{L_EXTENSIONS_EXPLAIN}</p> <p>{L_EXTENSIONS_EXPLAIN}</p>
<fieldset class="quick">
<span class="small"><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE_ALL}</a> &bull; <a href="javascript:phpbb.toggleDisplay('version_check_settings');">{L_SETTINGS}</a></span>
</fieldset>
<form id="version_check_settings" method="post" action="{U_ACTION}" style="display:none">
<fieldset>
<legend>{L_EXTENSIONS_VERSION_CHECK_SETTINGS}</legend>
<dl>
<dt><label for="force_unstable">{L_FORCE_UNSTABLE}{L_COLON}</label></dt>
<dd>
<label><input type="radio" id="force_unstable" name="force_unstable" class="radio" value="1"<!-- IF FORCE_UNSTABLE --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" name="force_unstable" class="radio" value="0"<!-- IF not FORCE_UNSTABLE --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
<p class="submit-buttons">
<input class="button1" type="submit" name="update" value="{L_SUBMIT}" />&nbsp;
<input class="button2" type="reset" name="reset" value="{L_RESET}" />
<input type="hidden" name="action" value="set_config_version_check_force_unstable" />
{S_FORM_TOKEN}
</p>
</fieldset>
</form>
<table class="table1"> <table class="table1">
<col class="row1" ><col class="row2" ><col class="row2" > <col class="row1" ><col class="row1" ><col class="row2" ><col class="row2" >
<thead> <thead>
<tr> <tr>
<th>{L_EXTENSION_NAME}</th> <th>{L_EXTENSION_NAME}</th>
<th>{L_EXTENSION_OPTIONS}</th> <th style="text-align: center; width: 20%;">{L_CURRENT_VERSION}</th>
<th>{L_EXTENSION_ACTIONS}</th> <th style="text-align: center; width: 10%;">{L_EXTENSION_OPTIONS}</th>
<th style="text-align: center; width: 25%;">{L_EXTENSION_ACTIONS}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<!-- IF .enabled --> <!-- IF .enabled -->
<tr> <tr>
<td class="row3" colspan="3"><strong>{L_EXTENSIONS_ENABLED}</strong></td> <td class="row3" colspan="4"><strong>{L_EXTENSIONS_ENABLED}</strong></td>
</tr> </tr>
<!-- BEGIN enabled --> <!-- BEGIN enabled -->
<tr class="ext_enabled"> <tr class="ext_enabled">
<td><strong>{enabled.META_DISPLAY_NAME}</strong></td> <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>
<!-- ELSE -->
{enabled.META_VERSION}
<!-- ENDIF -->
</td>
<td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td> <td style="text-align: center;"><a href="{enabled.U_DETAILS}">{L_DETAILS}</a></td>
<td style="text-align: center;"> <td style="text-align: center;">
<!-- BEGIN actions --> <!-- BEGIN actions -->
@ -36,11 +69,18 @@
<!-- IF .disabled --> <!-- IF .disabled -->
<tr> <tr>
<td class="row3" colspan="3"><strong>{L_EXTENSIONS_DISABLED}</strong></td> <td class="row3" colspan="4"><strong>{L_EXTENSIONS_DISABLED}</strong></td>
</tr> </tr>
<!-- BEGIN disabled --> <!-- BEGIN disabled -->
<tr class="ext_disabled"> <tr class="ext_disabled">
<td><strong>{disabled.META_DISPLAY_NAME}</strong></td> <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>
<!-- ELSE -->
{disabled.META_VERSION}
<!-- ENDIF -->
</td>
<td style="text-align: center;"> <td style="text-align: center;">
<!-- IF disabled.U_DETAILS --><a href="{disabled.U_DETAILS}">{L_DETAILS}</a><!-- ENDIF --> <!-- IF disabled.U_DETAILS --><a href="{disabled.U_DETAILS}">{L_DETAILS}</a><!-- ENDIF -->
</td> </td>
@ -55,7 +95,6 @@
<!-- ENDIF --> <!-- ENDIF -->
</tbody> </tbody>
</table> </table>
<br />
<table class="table1"> <table class="table1">
<tr> <tr>

View file

@ -27,17 +27,21 @@ class acp_extensions
private $config; private $config;
private $template; private $template;
private $user; private $user;
private $cache;
private $log; private $log;
private $request;
function main() function main()
{ {
// Start the page // Start the page
global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log; global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log, $cache;
$this->db = $db; $this->db = $db;
$this->config = $config; $this->config = $config;
$this->template = $template; $this->template = $template;
$this->user = $user; $this->user = $user;
$this->cache = $cache;
$this->request = $request;
$this->log = $phpbb_log; $this->log = $phpbb_log;
$user->add_lang(array('install', 'acp/extensions', 'migrator')); $user->add_lang(array('install', 'acp/extensions', 'migrator'));
@ -81,12 +85,44 @@ class acp_extensions
// What are we doing? // What are we doing?
switch ($action) switch ($action)
{ {
case 'set_config_version_check_force_unstable':
$force_unstable = $this->request->variable('force_unstable', false);
if ($force_unstable)
{
$s_hidden_fields = build_hidden_fields(array(
'force_unstable' => $force_unstable,
));
confirm_box(false, $user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields);
}
else
{
$config->set('extension_force_unstable', false);
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
break;
case 'list': case 'list':
default: default:
if (confirm_box(true))
{
$config->set('extension_force_unstable', true);
trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
}
$this->list_enabled_exts($phpbb_extension_manager); $this->list_enabled_exts($phpbb_extension_manager);
$this->list_disabled_exts($phpbb_extension_manager); $this->list_disabled_exts($phpbb_extension_manager);
$this->list_available_exts($phpbb_extension_manager); $this->list_available_exts($phpbb_extension_manager);
$this->template->assign_vars(array(
'U_VERSIONCHECK_FORCE' => $this->u_action . '&amp;action=list&amp;versioncheck_force=1',
'FORCE_UNSTABLE' => $config['extension_force_unstable'],
'U_ACTION' => $this->u_action,
));
add_form_key('version_check_settings');
$this->tpl_name = 'acp_ext_list'; $this->tpl_name = 'acp_ext_list';
break; break;
@ -247,7 +283,33 @@ class acp_extensions
// Output it to the template // Output it to the template
$md_manager->output_template_data(); $md_manager->output_template_data();
$template->assign_var('U_BACK', $this->u_action . '&amp;action=list'); try
{
$updates_available = $this->version_check($md_manager, $request->variable('versioncheck_force', false));
$template->assign_vars(array(
'S_UP_TO_DATE' => empty($updates_available),
'S_VERSIONCHECK' => true,
'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
));
foreach ($updates_available as $branch => $version_data)
{
$template->assign_block_vars('updates_available', $version_data);
}
}
catch (\RuntimeException $e)
{
$template->assign_vars(array(
'S_VERSIONCHECK_STATUS' => $e->getCode(),
'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '',
));
}
$template->assign_vars(array(
'U_BACK' => $this->u_action . '&amp;action=list',
'U_VERSIONCHECK_FORCE' => $this->u_action . '&amp;action=details&amp;versioncheck_force=1&amp;ext_name=' . urlencode($md_manager->get_metadata('name')),
));
$this->tpl_name = 'acp_ext_details'; $this->tpl_name = 'acp_ext_details';
break; break;
@ -255,11 +317,11 @@ class acp_extensions
} }
/** /**
* Lists all the enabled extensions and dumps to the template * Lists all the enabled extensions and dumps to the template
* *
* @param $phpbb_extension_manager An instance of the extension manager * @param $phpbb_extension_manager An instance of the extension manager
* @return null * @return null
*/ */
public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager) public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager)
{ {
$enabled_extension_meta_data = array(); $enabled_extension_meta_data = array();
@ -270,25 +332,39 @@ class acp_extensions
try try
{ {
$enabled_extension_meta_data[$name] = $md_manager->get_metadata('display-name'); $meta = $md_manager->get_metadata('all');
$enabled_extension_meta_data[$name] = array(
'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'),
'META_VERSION' => $meta['version'],
);
$force_update = $this->request->variable('versioncheck_force', false);
$updates = $this->version_check($md_manager, $force_update, !$force_update);
$enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
$enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&amp;action=details&amp;versioncheck_force=1&amp;ext_name=' . urlencode($md_manager->get_metadata('name'));
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->template->assign_block_vars('disabled', array( $this->template->assign_block_vars('disabled', array(
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
'S_VERSIONCHECK' => false,
)); ));
} }
catch (\RuntimeException $e)
{
$enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
}
} }
natcasesort($enabled_extension_meta_data); uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
foreach ($enabled_extension_meta_data as $name => $display_name) foreach ($enabled_extension_meta_data as $name => $block_vars)
{ {
$this->template->assign_block_vars('enabled', array( $block_vars['U_DETAILS'] = $this->u_action . '&amp;action=details&amp;ext_name=' . urlencode($name);
'META_DISPLAY_NAME' => $display_name,
'U_DETAILS' => $this->u_action . '&amp;action=details&amp;ext_name=' . urlencode($name), $this->template->assign_block_vars('enabled', $block_vars);
));
$this->output_actions('enabled', array( $this->output_actions('enabled', array(
'DISABLE' => $this->u_action . '&amp;action=disable_pre&amp;ext_name=' . urlencode($name), 'DISABLE' => $this->u_action . '&amp;action=disable_pre&amp;ext_name=' . urlencode($name),
@ -297,11 +373,11 @@ class acp_extensions
} }
/** /**
* Lists all the disabled extensions and dumps to the template * Lists all the disabled extensions and dumps to the template
* *
* @param $phpbb_extension_manager An instance of the extension manager * @param $phpbb_extension_manager An instance of the extension manager
* @return null * @return null
*/ */
public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager) public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager)
{ {
$disabled_extension_meta_data = array(); $disabled_extension_meta_data = array();
@ -312,25 +388,39 @@ class acp_extensions
try try
{ {
$disabled_extension_meta_data[$name] = $md_manager->get_metadata('display-name'); $meta = $md_manager->get_metadata('all');
$disabled_extension_meta_data[$name] = array(
'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'),
'META_VERSION' => $meta['version'],
);
$force_update = $this->request->variable('versioncheck_force', false);
$updates = $this->version_check($md_manager, $force_update, !$force_update);
$disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
$disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
$disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&amp;action=details&amp;versioncheck_force=1&amp;ext_name=' . urlencode($md_manager->get_metadata('name'));
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->template->assign_block_vars('disabled', array( $this->template->assign_block_vars('disabled', array(
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
'S_VERSIONCHECK' => false,
)); ));
} }
catch (\RuntimeException $e)
{
$disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
}
} }
natcasesort($disabled_extension_meta_data); uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
foreach ($disabled_extension_meta_data as $name => $display_name) foreach ($disabled_extension_meta_data as $name => $block_vars)
{ {
$this->template->assign_block_vars('disabled', array( $block_vars['U_DETAILS'] = $this->u_action . '&amp;action=details&amp;ext_name=' . urlencode($name);
'META_DISPLAY_NAME' => $display_name,
'U_DETAILS' => $this->u_action . '&amp;action=details&amp;ext_name=' . urlencode($name), $this->template->assign_block_vars('disabled', $block_vars);
));
$this->output_actions('disabled', array( $this->output_actions('disabled', array(
'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($name), 'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($name),
@ -340,11 +430,11 @@ class acp_extensions
} }
/** /**
* Lists all the available extensions and dumps to the template * Lists all the available extensions and dumps to the template
* *
* @param $phpbb_extension_manager An instance of the extension manager * @param $phpbb_extension_manager An instance of the extension manager
* @return null * @return null
*/ */
public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager) public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager)
{ {
$uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured()); $uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured());
@ -357,25 +447,39 @@ class acp_extensions
try try
{ {
$available_extension_meta_data[$name] = $md_manager->get_metadata('display-name'); $meta = $md_manager->get_metadata('all');
$available_extension_meta_data[$name] = array(
'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'),
'META_VERSION' => $meta['version'],
);
$force_update = $this->request->variable('versioncheck_force', false);
$updates = $this->version_check($md_manager, $force_update, !$force_update);
$available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
$available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
$available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&amp;action=details&amp;versioncheck_force=1&amp;ext_name=' . urlencode($md_manager->get_metadata('name'));
} }
catch(\phpbb\extension\exception $e) catch(\phpbb\extension\exception $e)
{ {
$this->template->assign_block_vars('disabled', array( $this->template->assign_block_vars('disabled', array(
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
'S_VERSIONCHECK' => false,
)); ));
} }
catch (\RuntimeException $e)
{
$available_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
}
} }
natcasesort($available_extension_meta_data); uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
foreach ($available_extension_meta_data as $name => $display_name) foreach ($available_extension_meta_data as $name => $block_vars)
{ {
$this->template->assign_block_vars('disabled', array( $block_vars['U_DETAILS'] = $this->u_action . '&amp;action=details&amp;ext_name=' . urlencode($name);
'META_DISPLAY_NAME' => $display_name,
'U_DETAILS' => $this->u_action . '&amp;action=details&amp;ext_name=' . urlencode($name), $this->template->assign_block_vars('disabled', $block_vars);
));
$this->output_actions('disabled', array( $this->output_actions('disabled', array(
'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($name), 'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($name),
@ -400,4 +504,40 @@ class acp_extensions
)); ));
} }
} }
/**
* Check the version and return the available updates.
*
* @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check.
* @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
*/
protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false)
{
$meta = $md_manager->get_metadata('all');
if (!isset($meta['extra']['version-check']))
{
throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1);
}
$version_check = $meta['extra']['version-check'];
$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_update, $force_cache);
}
/**
* Sort helper for the table containing the metadata about the extensions.
*/
protected function sort_extension_meta_data_table($val1, $val2)
{
return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']);
}
} }

View file

@ -3030,7 +3030,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port
} }
else if (stripos($line, '404 not found') !== false) else if (stripos($line, '404 not found') !== false)
{ {
$errstr = $user->lang['FILE_NOT_FOUND'] . ': ' . $filename; $errstr = $user->lang('FILE_NOT_FOUND', $filename);
return false; return false;
} }
} }

View file

@ -1240,7 +1240,7 @@ function get_config()
$filename = $convert->options['forum_path'] . '/' . $convert->config_schema['filename']; $filename = $convert->options['forum_path'] . '/' . $convert->config_schema['filename'];
if (!file_exists($filename)) if (!file_exists($filename))
{ {
$convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__); $convert->p_master->error($user->lang('FILE_NOT_FOUND', $filename), __LINE__, __FILE__);
} }
if (isset($convert->config_schema['array_name'])) if (isset($convert->config_schema['array_name']))

View file

@ -97,6 +97,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_edite
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_last_subject', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('display_order', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('edit_time', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('extension_force_unstable', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1');

View file

@ -84,6 +84,7 @@ $lang = array_merge($lang, array(
'EXTENSION_DELETE_DATA_CONFIRM' => 'Are you sure that you wish to delete the data associated with “%s”?<br /><br />This removes all of its data and settings and cannot be undone!', 'EXTENSION_DELETE_DATA_CONFIRM' => 'Are you sure that you wish to delete the data associated with “%s”?<br /><br />This removes all of its data and settings and cannot be undone!',
'EXTENSION_DISABLE_CONFIRM' => 'Are you sure that you wish to disable the “%s” extension?', 'EXTENSION_DISABLE_CONFIRM' => 'Are you sure that you wish to disable the “%s” extension?',
'EXTENSION_ENABLE_CONFIRM' => 'Are you sure that you wish to enable the “%s” extension?', 'EXTENSION_ENABLE_CONFIRM' => 'Are you sure that you wish to enable the “%s” extension?',
'EXTENSION_FORCE_UNSTABLE_CONFIRM' => 'Are you sure that you wish to force the use of unstable version?',
'RETURN_TO_EXTENSION_LIST' => 'Return to the extension list', 'RETURN_TO_EXTENSION_LIST' => 'Return to the extension list',
@ -106,4 +107,14 @@ $lang = array_merge($lang, array(
'AUTHOR_EMAIL' => 'Email', 'AUTHOR_EMAIL' => 'Email',
'AUTHOR_HOMEPAGE' => 'Homepage', 'AUTHOR_HOMEPAGE' => 'Homepage',
'AUTHOR_ROLE' => 'Role', 'AUTHOR_ROLE' => 'Role',
'NOT_UP_TO_DATE' => '%s is not up to date',
'UP_TO_DATE' => '%s is up to date',
'ANNOUNCEMENT_TOPIC' => 'Release Announcement',
'DOWNLOAD_LATEST' => 'Download Version',
'NO_VERSIONCHECK' => 'No version check information given.',
'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all versions',
'FORCE_UNSTABLE' => 'Always check for unstable versions',
'EXTENSIONS_VERSION_CHECK_SETTINGS' => 'Version check settings',
)); ));

View file

@ -231,7 +231,7 @@ $lang = array_merge($lang, array(
'FILESIZE' => 'File size', 'FILESIZE' => 'File size',
'FILEDATE' => 'File date', 'FILEDATE' => 'File date',
'FILE_COMMENT' => 'File comment', 'FILE_COMMENT' => 'File comment',
'FILE_NOT_FOUND' => 'The requested file could not be found.', 'FILE_NOT_FOUND' => 'The requested file could not be found: %s',
'FIND_USERNAME' => 'Find a member', 'FIND_USERNAME' => 'Find a member',
'FOLDER' => 'Folder', 'FOLDER' => 'Folder',
'FORGOT_PASS' => 'I forgot my password', 'FORGOT_PASS' => 'I forgot my password',

View file

@ -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)),
);
}
}

View file

@ -158,15 +158,16 @@ class version_helper
} }
/** /**
* Gets the latest version for the current branch the user is on * 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_update Ignores cached data. Defaults to false.
* @return string * @param bool $force_cache Force the use of the cache. Override $force_update.
* @throws \RuntimeException * @return string
*/ * @throws \RuntimeException
public function get_latest_on_current_branch($force_update = false) */
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; $self = $this;
$current_version = $this->current_version; $current_version = $this->current_version;
@ -188,15 +189,16 @@ class version_helper
} }
/** /**
* Obtains the latest version information * Obtains the latest version information
* *
* @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_update Ignores cached data. Defaults to false.
* @return string * @param bool $force_cache Force the use of the cache. Override $force_update.
* @throws \RuntimeException * @return string
*/ * @throws \RuntimeException
public function get_suggested_updates($force_update = false) */
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; $self = $this;
$current_version = $this->current_version; $current_version = $this->current_version;
@ -208,15 +210,16 @@ class version_helper
} }
/** /**
* Obtains the latest version information matching the stability of the current install * 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_update Ignores cached data. Defaults to false.
* @return string Version info * @param bool $force_cache Force the use of the cache. Override $force_update.
* @throws \RuntimeException * @return string Version info
*/ * @throws \RuntimeException
public function get_versions_matching_stability($force_update = false) */
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) if ($this->force_stability !== null)
{ {
@ -227,19 +230,24 @@ class version_helper
} }
/** /**
* Obtains the latest version information * Obtains the latest version information
* *
* @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_update Ignores cached data. Defaults to false.
* @return string Version info, includes stable and unstable data * @param bool $force_cache Force the use of the cache. Override $force_update.
* @throws \RuntimeException * @return string Version info, includes stable and unstable data
*/ * @throws \RuntimeException
public function get_versions($force_update = false) */
public function get_versions($force_update = false, $force_cache = false)
{ {
$cache_file = 'versioncheck_' . $this->host . $this->path . $this->file; $cache_file = 'versioncheck_' . $this->host . $this->path . $this->file;
$info = $this->cache->get($cache_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 = ''; $errstr = $errno = '';
$info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno); $info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno);