From e0b2ceef833dee55a1701216d4f0823375e8fa74 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 14 Apr 2014 06:56:04 +0200 Subject: [PATCH 01/29] [ticket/11366] Extension's version's check Add a feature to check automatically the version of the installed extensions. The informations are cached for 24 hours (like for the global update check on the main page of the acp). The informations about the versions are display both on the global list and on the detailled page. To do this the developper has to to let the composer.json of the latest version available and add some informations into it : "extra": { "version-check": { "host": "", "directory": "", "filename": "" } } He can also add two extra informations which will be displayed if a new version is available : "extra": { "download": "", "annoucement": "", } Currently a notice is displayed when the "extra.version-check" informations are missing. Ticket: https://tracker.phpbb.com/browse/PHPBB3-11366 Signed-off-by: Nicofuma PHPBB3-11366 --- phpBB/adm/style/acp_ext_details.html | 35 +++ phpBB/adm/style/acp_ext_list.html | 24 ++- phpBB/includes/acp/acp_extensions.php | 137 +++++++++--- phpBB/language/en/acp/extensions.php | 7 + phpBB/phpbb/extension/version_helper.php | 257 +++++++++++++++++++++++ 5 files changed, 429 insertions(+), 31 deletions(-) create mode 100644 phpBB/phpbb/extension/version_helper.php diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 6aff4b29cc..435c36ccc6 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -6,6 +6,19 @@

{L_EXTENSIONS_ADMIN}

+ +
+

{L_VERSIONCHECK_FAIL}

+

{VERSIONCHECK_FAIL_REASON}

+

{L_VERSIONCHECK_FORCE_UPDATE}

+
+ + +
+

{UP_TO_DATE_MSG} - {L_VERSIONCHECK_FORCE_UPDATE}

+
+ +
{L_EXT_DETAILS} @@ -46,6 +59,28 @@
+ +
+ {L_LATEST_VERSION} +
+
+
{LATEST_VERSION}
+
+ +
+
+
{L_DOWNLOAD} {META_NAME} {LATEST_VERSION}
+
+ + +
+
+
{L_RELEASE_ANNOUNCEMENT}
+
+ +
+ +
{L_REQUIREMENTS} diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 2fcc6eab31..d612a959e8 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -7,22 +7,30 @@

{L_EXTENSIONS_EXPLAIN}

- + - - + + + + - + + + - + + + diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 9033fbbe60..ac26621b89 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -27,17 +27,19 @@ class acp_extensions private $config; private $template; private $user; + private $cache; private $log; function main() { // 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->config = $config; $this->template = $template; $this->user = $user; + $this->cache = $cache; $this->log = $phpbb_log; $user->add_lang(array('install', 'acp/extensions', 'migrator')); @@ -247,7 +249,24 @@ class acp_extensions // Output it to the template $md_manager->output_template_data(); - $template->assign_var('U_BACK', $this->u_action . '&action=list'); + try + { + $infos = array(); + $this->version_check($md_manager, $infos, $request->variable('versioncheck_force', false)); + $template->assign_vars($infos); + } + catch (\RuntimeException $e) + { + $template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', + )); + } + + $template->assign_vars(array( + 'U_BACK' => $this->u_action . '&action=list', + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), + )); $this->tpl_name = 'acp_ext_details'; break; @@ -270,25 +289,31 @@ class acp_extensions 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'], + ); + + $this->version_check($md_manager, $enabled_extension_meta_data[$name]); } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), + 'S_VERSIONCHECK' => false, )); } } - natcasesort($enabled_extension_meta_data); + uasort($enabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); - foreach ($enabled_extension_meta_data as $name => $display_name) + foreach ($enabled_extension_meta_data as $name => $infos) { - $this->template->assign_block_vars('enabled', array( - 'META_DISPLAY_NAME' => $display_name, - - 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name), - )); + $values = $infos; + $values['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('enabled', $values); $this->output_actions('enabled', array( 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name), @@ -312,25 +337,31 @@ class acp_extensions 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'], + ); + + $this->version_check($md_manager, $disabled_extension_meta_data[$name]); } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), + 'S_VERSIONCHECK' => false, )); } } - natcasesort($disabled_extension_meta_data); + uasort($disabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); - foreach ($disabled_extension_meta_data as $name => $display_name) + foreach ($disabled_extension_meta_data as $name => $infos) { - $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $display_name, - - 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name), - )); + $values = $infos; + $values['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $values); $this->output_actions('disabled', array( 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), @@ -357,25 +388,31 @@ class acp_extensions 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'], + ); + + $this->version_check($md_manager, $available_extension_meta_data[$name]); } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), + 'S_VERSIONCHECK' => false, )); } } - natcasesort($available_extension_meta_data); + uasort($available_extension_meta_data, array('self', 'sort_extension_meta_data_table')); - foreach ($available_extension_meta_data as $name => $display_name) + foreach ($available_extension_meta_data as $name => $infos) { - $this->template->assign_block_vars('disabled', array( - 'META_DISPLAY_NAME' => $display_name, - - 'U_DETAILS' => $this->u_action . '&action=details&ext_name=' . urlencode($name), - )); + $values = $infos; + $values['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $values); $this->output_actions('disabled', array( 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), @@ -400,4 +437,52 @@ class acp_extensions )); } } + + /** + * Check the version and dump to the template + * + * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. + * @param array $array_dest The array to bind to the template. + * @param bool $force Ignores cached data. Default to false. + */ + private function version_check(\phpbb\extension\metadata_manager $md_manager, &$array_dest, $force = false) + { + $meta = $md_manager->get_metadata('all'); + + if (! isset($meta['extra']['version-check'])) + { + throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK')); + } + + $version_helper = new \phpbb\extension\version_helper($this->cache, $this->user); + $version_helper->set_metadata($meta); + + try + { + $version_helper->get_version($force); + $version_compare = $version_helper->is_uptodate(); + + $array_dest = array_merge($array_dest, array( + 'S_VERSIONCHECK' => true, + 'S_UP_TO_DATE' => $version_compare, + 'LATEST_VERSION' => $version_helper->get_latest_version(), + 'LATEST_DOWNLOAD' => $version_helper->get_latest_download_link(), + 'LATEST_ANNOUNCEMENT' => $version_helper->get_latest_announcement_link(), + 'UP_TO_DATE_MSG' => $this->user->lang($version_compare ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), + )); + } + catch(\RuntimeException $e) + { + $array_dest['S_VERSIONCHECK'] = false; + } + } + + /** + * Sort helper for the table containing the metadata about the extensions. + */ + static private function sort_extension_meta_data_table($val1, $val2) + { + return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']); + } } diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 8b29558fdb..85aef7c2d3 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -106,4 +106,11 @@ $lang = array_merge($lang, array( 'AUTHOR_EMAIL' => 'Email', 'AUTHOR_HOMEPAGE' => 'Homepage', '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 Latest Version', + 'NO_VERSIONCHECK' => 'No informations about how get the latest version.', +// 'NO_INFO' => 'Version server could not be contacted', )); diff --git a/phpBB/phpbb/extension/version_helper.php b/phpBB/phpbb/extension/version_helper.php new file mode 100644 index 0000000000..5d7d4121f0 --- /dev/null +++ b/phpBB/phpbb/extension/version_helper.php @@ -0,0 +1,257 @@ +cache = $cache; + $this->user = $user; + } + + /** + * Set the informations concerning the current version from the metadata + * + * @param array $metadata + * @throws \RuntimeException + */ + public function set_metadata($metadata) + { + if (! isset($metadata['extra']['version-check'])) + { + throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK')); + } + + $meta_vc = $metadata['extra']['version-check']; + + $this->set_file_location($meta_vc['host'], $meta_vc['directory'], $meta_vc['filename']); + $this->set_extension($metadata['name']); + $this->set_current_version($metadata['version']); + } + + /** + * Set the name of the extention + * + * @param string Name of the extension + * @return version_helper + */ + public function set_extension($extension) + { + $this->extension = $extension; + + return $this; + } + + /** + * Set location to the file + * + * @param string $host Host (e.g. version.phpbb.com) + * @param string $path Path to file (e.g. /phpbb) + * @param string $file File name (Default: composer.json) + * @return version_helper + */ + public function set_file_location($host, $path, $file = 'composer.json') + { + $this->host = $host; + $this->path = $path; + $this->file = $file; + + 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; + } + + /** + * Wrapper for version_compare() that allows using uppercase A and B + * for alpha and beta releases. + * + * See http://www.php.net/manual/en/function.version-compare.php + * + * @param string $version1 First version number + * @param string $version2 Second version number + * @param string $operator Comparison operator (optional) + * + * @return mixed Boolean (true, false) if comparison operator is specified. + * Integer (-1, 0, 1) otherwise. + */ + public function compare($version1, $version2, $operator = null) + { + return phpbb_version_compare($version1, $version2, $operator); + } + + /** + * Say if the extension is up to date or not + * + * The informations about the lastest version are retrieved if needed + * + * @return bool true if the version is up to date + * @throws \RuntimeException + */ + public function is_uptodate() + { + if (empty($this->latest_version_metadata)) + { + $this->get_version(); + } + + return $this->compare($this->current_version, $this->latest_version_metadata['version'], '>='); + } + + /** + * Return the latest version number + * + * @return The latest version number ready to be displayed. + */ + public function get_latest_version() { + if (empty($this->latest_version_metadata)) + { + $this->get_version(); + } + + return htmlspecialchars($this->latest_version_metadata['version']); + } + + /** + * Return the latest download link + * + * @return The latest download link if existed, an empty string otherwise. + */ + public function get_latest_download_link() { + if (empty($this->latest_version_metadata)) + { + $this->get_version(); + } + + return isset($this->latest_version_metadata['extra']['download']) ? $this->latest_version_metadata['extra']['download']: ''; + } + + /** + * Return the latest announcement link + * + * @return The latest announcement link if existed, an empty string otherwise. + */ + public function get_latest_announcement_link() { + if (empty($this->latest_version_metadata)) + { + $this->get_version(); + } + + return isset($this->latest_version_metadata['extra']['announcement']) ? $this->latest_version_metadata['extra']['announcement']: ''; + } + + /** + * Obtains the latest version information + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @return string Version info + * @throws \RuntimeException + */ + public function get_version($force_update = false) + { +echo 'Force : ' . $force_update; + $cache_file = 'versioncheck_ext_' . $this->extension . ':' . $this->host . $this->path . $this->file; + + $info = $this->cache->get($cache_file); + + if ($info === false || $force_update) + { + $errstr = $errno = ''; + $info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno); + + if (!empty($errstr)) + { + throw new \RuntimeException($errstr); + } + + $info = json_decode($info, true); + + if (empty($info['version'])) + { + $this->user->add_lang('acp/common'); + + throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); + } + + // Replace & with & on announcement and download links + if (isset($info['extra']['announcement'])) + { + $info['extra']['announcement'] = str_replace('&', '&', $info['extra']['announcement']); + } + + if (isset($info['extra']['download'])) + { + $info['extra']['download'] = str_replace('&', '&', $info['extra']['download']); + } + + $this->cache->put($cache_file, $info, 86400); // 24 hours + } + + $this->latest_version_metadata = $info; + + return $info; + } +} From 44752c0dbfe11afb58de8956a79fbe5ec0f3e127 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 14 Apr 2014 19:09:06 +0200 Subject: [PATCH 02/29] [ticket/11366] Moving to \phpbb\version_helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit + bug fix (missing exception) + Using \phpbb\version_helper So, now, the version file have a new format : { "stable": { "": { "current": "", [ "announcement": "", ] [ "download": "", ] }, "": { ... } }, "unstable": { } } PHPBB3-11366 --- phpBB/adm/style/acp_ext_details.html | 36 ++-- phpBB/adm/style/acp_ext_list.html | 11 +- phpBB/includes/acp/acp_extensions.php | 77 ++++--- phpBB/language/en/acp/extensions.php | 2 +- phpBB/phpbb/extension/version_helper.php | 257 ----------------------- 5 files changed, 72 insertions(+), 311 deletions(-) delete mode 100644 phpBB/phpbb/extension/version_helper.php diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 435c36ccc6..95b23395dd 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -62,22 +62,26 @@
{L_LATEST_VERSION} -
-
-
{LATEST_VERSION}
-
- -
-
-
{L_DOWNLOAD} {META_NAME} {LATEST_VERSION}
-
- - -
-
-
{L_RELEASE_ANNOUNCEMENT}
-
- + +
+
+
+
{updates_available.current}
+
+ +
+
+
{L_DOWNLOAD} {META_NAME} {LATEST_VERSION}
+
+ + +
+
+
{L_RELEASE_ANNOUNCEMENT}
+
+ +
+
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index d612a959e8..2e949e5c3b 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -7,12 +7,11 @@

{L_EXTENSIONS_EXPLAIN}

{L_EXTENSION_NAME}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}{L_CURRENT_VERSION}{L_LATEST_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}
{L_EXTENSIONS_ENABLED}{L_EXTENSIONS_ENABLED}
{enabled.META_DISPLAY_NAME}{enabled.META_VERSION} + + style="color: #228822;"style="color: #BC2A4D;">{enabled.LATEST_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + + {L_DETAILS} @@ -36,11 +44,17 @@
{L_EXTENSIONS_DISABLED}{L_EXTENSIONS_DISABLED}
{disabled.META_DISPLAY_NAME}{disabled.META_VERSION} + + style="color: #228822;"style="color: #BC2A4D;">{disabled.LATEST_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + + {L_DETAILS}
- + - @@ -25,10 +24,9 @@ - @@ -44,15 +42,14 @@ - + - - + From e4aff6669c4a091e3b56f8c8a2b0c1eeba8bb4a9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 5 May 2014 18:21:40 +0200 Subject: [PATCH 06/29] [ticket/11366] Remove unused langage entry PHPBB3-11366 --- phpBB/language/en/acp/extensions.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 3a54dcf004..a2962407d1 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -112,5 +112,4 @@ $lang = array_merge($lang, array( 'ANNOUNCEMENT_TOPIC' => 'Release Announcement', 'DOWNLOAD_LATEST' => 'Download Version', 'NO_VERSIONCHECK' => 'No informations about how get the latest version.', -// 'NO_INFO' => 'Version server could not be contacted', )); From a80a9efa8de086e0100b1a6d33ac349e955e9d18 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Thu, 8 May 2014 19:16:06 +0200 Subject: [PATCH 07/29] [ticket/11366] Correct a sentence PHPBB3-11366 --- phpBB/language/en/acp/extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index a2962407d1..476f4352a3 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -111,5 +111,5 @@ $lang = array_merge($lang, array( 'UP_TO_DATE' => '%s is up to date', 'ANNOUNCEMENT_TOPIC' => 'Release Announcement', 'DOWNLOAD_LATEST' => 'Download Version', - 'NO_VERSIONCHECK' => 'No informations about how get the latest version.', + 'NO_VERSIONCHECK' => 'No information on how to check the version.', )); From 5e29ea77d813fb6f10583fa440ed4e55e78bd28d Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 13:04:00 +0200 Subject: [PATCH 08/29] [ticket/11366] Coding style PHPBB3-11366 --- phpBB/adm/style/acp_ext_details.html | 6 ++- phpBB/adm/style/acp_ext_list.html | 2 +- phpBB/includes/acp/acp_extensions.php | 66 +++++++++++++-------------- phpBB/language/en/acp/extensions.php | 2 +- 4 files changed, 40 insertions(+), 36 deletions(-) diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 95b23395dd..65a9d3c774 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -6,12 +6,16 @@

{L_EXTENSIONS_ADMIN}

- +

{L_VERSIONCHECK_FAIL}

{VERSIONCHECK_FAIL_REASON}

{L_VERSIONCHECK_FORCE_UPDATE}

+ +
+

{VERSIONCHECK_FAIL_REASON}

+
diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index a47b1bd576..0aed0243d9 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -13,7 +13,7 @@
- + diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 4db4d38f3a..b74e020edd 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -267,8 +267,8 @@ class acp_extensions catch (\RuntimeException $e) { $template->assign_vars(array( - 'S_VERSIONCHECK_FAIL' => true, - 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', + 'S_VERSIONCHECK_STATUS' => $e->getCode(), + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', )); } @@ -283,11 +283,11 @@ class acp_extensions } /** - * Lists all the enabled extensions and dumps to the template - * - * @param $phpbb_extension_manager An instance of the extension manager - * @return null - */ + * Lists all the enabled extensions and dumps to the template + * + * @param $phpbb_extension_manager An instance of the extension manager + * @return null + */ public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager) { $enabled_extension_meta_data = array(); @@ -323,7 +323,7 @@ class acp_extensions } } - uasort($enabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); + uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); foreach ($enabled_extension_meta_data as $name => $infos) { @@ -339,11 +339,11 @@ class acp_extensions } /** - * Lists all the disabled extensions and dumps to the template - * - * @param $phpbb_extension_manager An instance of the extension manager - * @return null - */ + * Lists all the disabled extensions and dumps to the template + * + * @param $phpbb_extension_manager An instance of the extension manager + * @return null + */ public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager) { $disabled_extension_meta_data = array(); @@ -379,7 +379,7 @@ class acp_extensions } } - uasort($disabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); + uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); foreach ($disabled_extension_meta_data as $name => $infos) { @@ -396,11 +396,11 @@ class acp_extensions } /** - * Lists all the available extensions and dumps to the template - * - * @param $phpbb_extension_manager An instance of the extension manager - * @return null - */ + * Lists all the available extensions and dumps to the template + * + * @param $phpbb_extension_manager An instance of the extension manager + * @return null + */ 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()); @@ -438,7 +438,7 @@ class acp_extensions } } - uasort($available_extension_meta_data, array('self', 'sort_extension_meta_data_table')); + uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table')); foreach ($available_extension_meta_data as $name => $infos) { @@ -472,33 +472,33 @@ class acp_extensions } /** - * Check the version and return the availables updates. - * - * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. - * @param bool $force Ignores cached data. Default to false. - */ - private function version_check(\phpbb\extension\metadata_manager $md_manager, $force = false) + * Check the version and return the availables updates. + * + * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. + * @param bool $force Ignores cached data. Default to false. + */ + protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force = false) { $meta = $md_manager->get_metadata('all'); - if (! isset($meta['extra']['version-check'])) + if (!isset($meta['extra']['version-check'])) { - throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK')); + throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1); } - $meta_vc = $meta['extra']['version-check']; + $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($meta_vc['host'], $meta_vc['directory'], $meta_vc['filename']); + $version_helper->set_file_location($version_check ['host'], $version_check ['directory'], $version_check ['filename']); return $updates = $version_helper->get_suggested_updates(true); } /** - * Sort helper for the table containing the metadata about the extensions. - */ - static private function sort_extension_meta_data_table($val1, $val2) + * 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']); } diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 476f4352a3..1df030cfca 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -111,5 +111,5 @@ $lang = array_merge($lang, array( 'UP_TO_DATE' => '%s is up to date', 'ANNOUNCEMENT_TOPIC' => 'Release Announcement', 'DOWNLOAD_LATEST' => 'Download Version', - 'NO_VERSIONCHECK' => 'No information on how to check the version.', + 'NO_VERSIONCHECK' => 'No version check information given.', )); From 29244c29d1fbc8e086073774a95ffb8ea50761df Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 14:15:20 +0200 Subject: [PATCH 09/29] [ticket/11366] Remove the double spaces PHPBB3-11366 --- phpBB/includes/acp/acp_extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index b74e020edd..548aad3df1 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -486,7 +486,7 @@ class acp_extensions throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1); } - $version_check = $meta['extra']['version-check']; + $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']); From bee6c6baeafdf894fd8e30de33e4d94185af5745 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 18:41:22 +0200 Subject: [PATCH 10/29] [ticket/11366] Fix detailed view PHPBB3-11366 --- phpBB/adm/style/acp_ext_details.html | 11 +++++------ phpBB/includes/acp/acp_extensions.php | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 65a9d3c774..830c2e3cb4 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -6,7 +6,11 @@

{L_EXTENSIONS_ADMIN}

- + +
+

{UP_TO_DATE_MSG} - {L_VERSIONCHECK_FORCE_UPDATE}

+
+

{L_VERSIONCHECK_FAIL}

{VERSIONCHECK_FAIL_REASON}

@@ -17,11 +21,6 @@

{VERSIONCHECK_FAIL_REASON}

- -
-

{UP_TO_DATE_MSG} - {L_VERSIONCHECK_FORCE_UPDATE}

-
-
{L_EXT_DETAILS} diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 548aad3df1..2c06050e5c 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -472,10 +472,12 @@ class acp_extensions } /** - * Check the version and return the availables updates. + * 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 Ignores cached data. Default to false. + * @return string + * @throws RuntimeException */ protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force = false) { @@ -492,7 +494,7 @@ class acp_extensions $version_helper->set_current_version($meta['version']); $version_helper->set_file_location($version_check ['host'], $version_check ['directory'], $version_check ['filename']); - return $updates = $version_helper->get_suggested_updates(true); + return $updates = $version_helper->get_suggested_updates($force); } /** From 9173e7d7fd062cd2c0aed12c119e253cfec107f4 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 18:48:45 +0200 Subject: [PATCH 11/29] [ticket/11366] Align language strings PHPBB3-11366 --- phpBB/language/en/acp/extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 1df030cfca..e15b304225 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -107,7 +107,7 @@ $lang = array_merge($lang, array( 'AUTHOR_HOMEPAGE' => 'Homepage', 'AUTHOR_ROLE' => 'Role', - 'NOT_UP_TO_DATE' => '%s is not up to date', + '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', From 492c1952c1059772d75c04cf6a1c589ff37768e9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 21:39:13 +0200 Subject: [PATCH 12/29] [ticket/11366] Update var names PHPBB3-11366 --- phpBB/includes/acp/acp_extensions.php | 29 ++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 2c06050e5c..3ae33c6284 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -309,7 +309,7 @@ class acp_extensions $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 . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); - } + } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( @@ -325,12 +325,11 @@ class acp_extensions uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); - foreach ($enabled_extension_meta_data as $name => $infos) + foreach ($enabled_extension_meta_data as $name => $block_vars) { - $values = $infos; - $values['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); - - $this->template->assign_block_vars('enabled', $values); + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('enabled', $block_vars); $this->output_actions('enabled', array( 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name), @@ -381,12 +380,11 @@ class acp_extensions uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); - foreach ($disabled_extension_meta_data as $name => $infos) + foreach ($disabled_extension_meta_data as $name => $block_vars) { - $values = $infos; - $values['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); - - $this->template->assign_block_vars('disabled', $values); + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); $this->output_actions('disabled', array( 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), @@ -440,12 +438,11 @@ class acp_extensions uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table')); - foreach ($available_extension_meta_data as $name => $infos) + foreach ($available_extension_meta_data as $name => $block_vars) { - $values = $infos; - $values['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); - - $this->template->assign_block_vars('disabled', $values); + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); $this->output_actions('disabled', array( 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), From 08ddd1c628f5aff1a5b5a586ce6d87132068a27a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 21:41:30 +0200 Subject: [PATCH 13/29] [ticket/11366] Update FILE_NOT_FOUND language string This var is always used with a colon. PHPBB3-11366 --- phpBB/language/en/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 7d14875976..fea1f7c6bf 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -231,7 +231,7 @@ $lang = array_merge($lang, array( 'FILESIZE' => 'File size', 'FILEDATE' => 'File date', 'FILE_COMMENT' => 'File comment', - 'FILE_NOT_FOUND' => 'The requested file could not be found.', + 'FILE_NOT_FOUND' => 'The requested file could not be found', 'FIND_USERNAME' => 'Find a member', 'FOLDER' => 'Folder', 'FORGOT_PASS' => 'I forgot my password', From 537d8b3c1691a3676bf1788c57fa37b00ad9faf6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 21:45:23 +0200 Subject: [PATCH 14/29] [ticket/11366] Fix whitespaces PHPBB3-11366 --- phpBB/includes/acp/acp_extensions.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 3ae33c6284..d2b3cb97f0 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -305,7 +305,7 @@ class acp_extensions ); $updates = $this->version_check($md_manager); - + $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 . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); @@ -360,7 +360,7 @@ class acp_extensions ); $updates = $this->version_check($md_manager); - + $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 . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); @@ -486,7 +486,7 @@ class acp_extensions } $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']); From 64467f50db496d0cc388e437dd9d843d5faf6449 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 21:54:19 +0200 Subject: [PATCH 15/29] [ticket/11366] Update FILE_NOT_FOUND language string PHPBB3-11366 --- phpBB/includes/functions_admin.php | 2 +- phpBB/includes/functions_convert.php | 2 +- phpBB/language/en/common.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 4463226707..3000a18668 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3030,7 +3030,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port } else if (stripos($line, '404 not found') !== false) { - $errstr = $user->lang['FILE_NOT_FOUND'] . ': ' . $filename; + $errstr = $user->lang('FILE_NOT_FOUND', $filename); return false; } } diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 6f01fc48dd..e68e770b3a 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1240,7 +1240,7 @@ function get_config() $filename = $convert->options['forum_path'] . '/' . $convert->config_schema['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'])) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index fea1f7c6bf..5e524a6164 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -231,7 +231,7 @@ $lang = array_merge($lang, array( 'FILESIZE' => 'File size', 'FILEDATE' => 'File date', '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', 'FOLDER' => 'Folder', 'FORGOT_PASS' => 'I forgot my password', From 521fe2b8e29fdb61ab0c02ec40f20b652d66623a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 12:30:27 +0200 Subject: [PATCH 16/29] [ticket/11366] Force the use of the cache on the list page PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 8 ++- phpBB/includes/acp/acp_extensions.php | 11 ++-- phpBB/phpbb/version_helper.php | 72 +++++++++++++++------------ 3 files changed, 53 insertions(+), 38 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 0aed0243d9..e0d432ccd3 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -26,7 +26,9 @@
@@ -49,7 +51,9 @@ - + diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index a91f6fba8b..6b22ba7fe0 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -91,6 +91,8 @@ class acp_extensions $this->list_disabled_exts($phpbb_extension_manager); $this->list_available_exts($phpbb_extension_manager); + $this->template->assign_var('U_VERSIONCHECK_FORCE', $this->u_action . '&action=list&versioncheck_force=1'); + $this->tpl_name = 'acp_ext_list'; break; diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index e15b304225..e151c041f3 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -112,4 +112,6 @@ $lang = array_merge($lang, array( 'ANNOUNCEMENT_TOPIC' => 'Release Announcement', 'DOWNLOAD_LATEST' => 'Download Version', 'NO_VERSIONCHECK' => 'No version check information given.', + + 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all', )); From f4d598559f28ef2f16b47d7e33d90305fd42173e Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 12:45:02 +0200 Subject: [PATCH 18/29] [ticket/11366] Use force_cache on the list page PHPBB3-11366 --- phpBB/includes/acp/acp_extensions.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 6b22ba7fe0..f1372ddb3e 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -308,7 +308,8 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); + $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; @@ -363,7 +364,8 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); + $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; @@ -421,7 +423,8 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $updates = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); + $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; @@ -476,11 +479,12 @@ 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 Ignores cached data. Default to false. + * @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 = false) + protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false) { $meta = $md_manager->get_metadata('all'); @@ -496,7 +500,7 @@ class acp_extensions $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, true); + return $updates = $version_helper->get_suggested_updates($force_update, $force_cache); } /** From 8dc10d6971ede7fbc63fb3fd92512f95d9ec5dfb Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 17:23:50 +0200 Subject: [PATCH 19/29] [ticket/11366] Add $config['extension_force_unstable'] PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 21 ++++++++++++ phpBB/includes/acp/acp_extensions.php | 32 ++++++++++++++++++- phpBB/language/en/acp/extensions.php | 5 ++- ...xtensions_version_check_force_unstable.php | 25 +++++++++++++++ 4 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index d77c7690f7..372d9e8599 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -6,6 +6,27 @@

{L_EXTENSIONS_EXPLAIN}

+
+ +
+ {L_EXTENSIONS_VERSION_CHECK_SETTINGS} +
+
+
+ + +
+
+ +

+   + + + {S_FORM_TOKEN} +

+
+ +
{L_EXTENSION_NAME} {L_CURRENT_VERSION}{L_LATEST_VERSION} {L_EXTENSION_OPTIONS} {L_EXTENSION_ACTIONS}
{enabled.META_DISPLAY_NAME}{enabled.META_VERSION} - style="color: #228822;"style="color: #BC2A4D;">{enabled.LATEST_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;">{enabled.META_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] {L_DETAILS}
{L_EXTENSIONS_DISABLED}{L_EXTENSIONS_DISABLED}
{disabled.META_DISPLAY_NAME}{disabled.META_VERSION} - style="color: #228822;"style="color: #BC2A4D;">{disabled.LATEST_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;">{disabled.META_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index ac26621b89..0aeb0968a4 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -251,9 +251,18 @@ class acp_extensions try { - $infos = array(); - $this->version_check($md_manager, $infos, $request->variable('versioncheck_force', false)); - $template->assign_vars($infos); + $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) { @@ -295,7 +304,15 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $this->version_check($md_manager, $enabled_extension_meta_data[$name]); + $updates = $this->version_check($md_manager); + + $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 . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + catch (\RuntimeException $e) + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; } catch(\phpbb\extension\exception $e) { @@ -343,7 +360,15 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $this->version_check($md_manager, $disabled_extension_meta_data[$name]); + $updates = $this->version_check($md_manager); + + $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 . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + catch (\RuntimeException $e) + { + $disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false; } catch(\phpbb\extension\exception $e) { @@ -394,7 +419,15 @@ class acp_extensions 'META_VERSION' => $meta['version'], ); - $this->version_check($md_manager, $available_extension_meta_data[$name]); + $updates = $this->version_check($md_manager); + + $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 . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + catch (\RuntimeException $e) + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; } catch(\phpbb\extension\exception $e) { @@ -439,13 +472,12 @@ class acp_extensions } /** - * Check the version and dump to the template + * Check the version and return the availables updates. * * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. - * @param array $array_dest The array to bind to the template. * @param bool $force Ignores cached data. Default to false. */ - private function version_check(\phpbb\extension\metadata_manager $md_manager, &$array_dest, $force = false) + private function version_check(\phpbb\extension\metadata_manager $md_manager, $force = false) { $meta = $md_manager->get_metadata('all'); @@ -453,29 +485,14 @@ class acp_extensions { throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK')); } + + $meta_vc = $meta['extra']['version-check']; - $version_helper = new \phpbb\extension\version_helper($this->cache, $this->user); - $version_helper->set_metadata($meta); + $version_helper = new \phpbb\version_helper($this->cache, $this->config, $this->user); + $version_helper->set_current_version($meta['version']); + $version_helper->set_file_location($meta_vc['host'], $meta_vc['directory'], $meta_vc['filename']); - try - { - $version_helper->get_version($force); - $version_compare = $version_helper->is_uptodate(); - - $array_dest = array_merge($array_dest, array( - 'S_VERSIONCHECK' => true, - 'S_UP_TO_DATE' => $version_compare, - 'LATEST_VERSION' => $version_helper->get_latest_version(), - 'LATEST_DOWNLOAD' => $version_helper->get_latest_download_link(), - 'LATEST_ANNOUNCEMENT' => $version_helper->get_latest_announcement_link(), - 'UP_TO_DATE_MSG' => $this->user->lang($version_compare ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), - 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), - )); - } - catch(\RuntimeException $e) - { - $array_dest['S_VERSIONCHECK'] = false; - } + return $updates = $version_helper->get_suggested_updates(true); } /** diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 85aef7c2d3..3a54dcf004 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -110,7 +110,7 @@ $lang = array_merge($lang, array( '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 Latest Version', + 'DOWNLOAD_LATEST' => 'Download Version', 'NO_VERSIONCHECK' => 'No informations about how get the latest version.', // 'NO_INFO' => 'Version server could not be contacted', )); diff --git a/phpBB/phpbb/extension/version_helper.php b/phpBB/phpbb/extension/version_helper.php deleted file mode 100644 index 5d7d4121f0..0000000000 --- a/phpBB/phpbb/extension/version_helper.php +++ /dev/null @@ -1,257 +0,0 @@ -cache = $cache; - $this->user = $user; - } - - /** - * Set the informations concerning the current version from the metadata - * - * @param array $metadata - * @throws \RuntimeException - */ - public function set_metadata($metadata) - { - if (! isset($metadata['extra']['version-check'])) - { - throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK')); - } - - $meta_vc = $metadata['extra']['version-check']; - - $this->set_file_location($meta_vc['host'], $meta_vc['directory'], $meta_vc['filename']); - $this->set_extension($metadata['name']); - $this->set_current_version($metadata['version']); - } - - /** - * Set the name of the extention - * - * @param string Name of the extension - * @return version_helper - */ - public function set_extension($extension) - { - $this->extension = $extension; - - return $this; - } - - /** - * Set location to the file - * - * @param string $host Host (e.g. version.phpbb.com) - * @param string $path Path to file (e.g. /phpbb) - * @param string $file File name (Default: composer.json) - * @return version_helper - */ - public function set_file_location($host, $path, $file = 'composer.json') - { - $this->host = $host; - $this->path = $path; - $this->file = $file; - - 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; - } - - /** - * Wrapper for version_compare() that allows using uppercase A and B - * for alpha and beta releases. - * - * See http://www.php.net/manual/en/function.version-compare.php - * - * @param string $version1 First version number - * @param string $version2 Second version number - * @param string $operator Comparison operator (optional) - * - * @return mixed Boolean (true, false) if comparison operator is specified. - * Integer (-1, 0, 1) otherwise. - */ - public function compare($version1, $version2, $operator = null) - { - return phpbb_version_compare($version1, $version2, $operator); - } - - /** - * Say if the extension is up to date or not - * - * The informations about the lastest version are retrieved if needed - * - * @return bool true if the version is up to date - * @throws \RuntimeException - */ - public function is_uptodate() - { - if (empty($this->latest_version_metadata)) - { - $this->get_version(); - } - - return $this->compare($this->current_version, $this->latest_version_metadata['version'], '>='); - } - - /** - * Return the latest version number - * - * @return The latest version number ready to be displayed. - */ - public function get_latest_version() { - if (empty($this->latest_version_metadata)) - { - $this->get_version(); - } - - return htmlspecialchars($this->latest_version_metadata['version']); - } - - /** - * Return the latest download link - * - * @return The latest download link if existed, an empty string otherwise. - */ - public function get_latest_download_link() { - if (empty($this->latest_version_metadata)) - { - $this->get_version(); - } - - return isset($this->latest_version_metadata['extra']['download']) ? $this->latest_version_metadata['extra']['download']: ''; - } - - /** - * Return the latest announcement link - * - * @return The latest announcement link if existed, an empty string otherwise. - */ - public function get_latest_announcement_link() { - if (empty($this->latest_version_metadata)) - { - $this->get_version(); - } - - return isset($this->latest_version_metadata['extra']['announcement']) ? $this->latest_version_metadata['extra']['announcement']: ''; - } - - /** - * Obtains the latest version information - * - * @param bool $force_update Ignores cached data. Defaults to false. - * @return string Version info - * @throws \RuntimeException - */ - public function get_version($force_update = false) - { -echo 'Force : ' . $force_update; - $cache_file = 'versioncheck_ext_' . $this->extension . ':' . $this->host . $this->path . $this->file; - - $info = $this->cache->get($cache_file); - - if ($info === false || $force_update) - { - $errstr = $errno = ''; - $info = get_remote_file($this->host, $this->path, $this->file, $errstr, $errno); - - if (!empty($errstr)) - { - throw new \RuntimeException($errstr); - } - - $info = json_decode($info, true); - - if (empty($info['version'])) - { - $this->user->add_lang('acp/common'); - - throw new \RuntimeException($this->user->lang('VERSIONCHECK_FAIL')); - } - - // Replace & with & on announcement and download links - if (isset($info['extra']['announcement'])) - { - $info['extra']['announcement'] = str_replace('&', '&', $info['extra']['announcement']); - } - - if (isset($info['extra']['download'])) - { - $info['extra']['download'] = str_replace('&', '&', $info['extra']['download']); - } - - $this->cache->put($cache_file, $info, 86400); // 24 hours - } - - $this->latest_version_metadata = $info; - - return $info; - } -} From 2552a0fef230ac02173c0dfe69b80dafaf636873 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 14 Apr 2014 21:13:15 +0200 Subject: [PATCH 03/29] [ticket/11366] Bug Fix: Extensions removed but still registred in DB Fix the bug with the Extensions removed but still registred in DB PHPBB3-11366 --- phpBB/includes/acp/acp_extensions.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 0aeb0968a4..8723bef58d 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -310,10 +310,6 @@ class acp_extensions $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; $enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); } - catch (\RuntimeException $e) - { - $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; - } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( @@ -321,6 +317,10 @@ class acp_extensions 'S_VERSIONCHECK' => false, )); } + catch (\RuntimeException $e) + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } } uasort($enabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); @@ -366,10 +366,6 @@ class acp_extensions $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; $disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); } - catch (\RuntimeException $e) - { - $disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false; - } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( @@ -377,6 +373,10 @@ class acp_extensions 'S_VERSIONCHECK' => false, )); } + catch (\RuntimeException $e) + { + $disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } } uasort($disabled_extension_meta_data, array('self', 'sort_extension_meta_data_table')); From f5da195a039ba82c9629e06392a8ed34096fdbfa Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Mon, 14 Apr 2014 22:54:53 +0200 Subject: [PATCH 04/29] [ticket/11366] Adding a missing commit PHPBB3-11366 --- phpBB/includes/acp/acp_extensions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 8723bef58d..4db4d38f3a 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -425,10 +425,6 @@ class acp_extensions $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; $available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); } - catch (\RuntimeException $e) - { - $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; - } catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( @@ -436,6 +432,10 @@ class acp_extensions 'S_VERSIONCHECK' => false, )); } + catch (\RuntimeException $e) + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } } uasort($available_extension_meta_data, array('self', 'sort_extension_meta_data_table')); From 9cd25cc828da47fc2d8b5fa044519d406cad4d11 Mon Sep 17 00:00:00 2001 From: Nicofuma Date: Fri, 2 May 2014 23:05:18 +0200 Subject: [PATCH 05/29] [ticket/11366] Set the size of the 'current version' column to 20% PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 2e949e5c3b..a47b1bd576 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -11,7 +11,7 @@
{L_EXTENSION_NAME}{L_CURRENT_VERSION}{L_CURRENT_VERSION} {L_EXTENSION_OPTIONS} {L_EXTENSION_ACTIONS}
{L_EXTENSION_NAME} {L_CURRENT_VERSION} {L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}{L_EXTENSION_ACTIONS}
{enabled.META_DISPLAY_NAME} - style="color: #228822;"style="color: #BC2A4D;">{enabled.META_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;">{enabled.META_VERSION} + + {enabled.META_VERSION} {L_DETAILS}{disabled.META_DISPLAY_NAME} - style="color: #228822;"style="color: #BC2A4D;">{disabled.META_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] + style="color: #228822;"style="color: #BC2A4D;">{disabled.META_VERSION} + + {disabled.META_VERSION} diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index d2b3cb97f0..a91f6fba8b 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -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); } /** diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index 5991744e76..968a57428f 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -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); From 13ecddf85bce88cb0b99684040578ffa766db782 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 12:40:16 +0200 Subject: [PATCH 17/29] [ticket/11366] Add recheck-all link PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 2 +- phpBB/includes/acp/acp_extensions.php | 2 ++ phpBB/language/en/acp/extensions.php | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index e0d432ccd3..d77c7690f7 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -11,7 +11,7 @@
{L_EXTENSION_NAME}{L_CURRENT_VERSION}{L_CURRENT_VERSION} [ {L_VERSIONCHECK_FORCE_UPDATE_ALL} ] {L_EXTENSION_OPTIONS} {L_EXTENSION_ACTIONS}
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index f1372ddb3e..88b6a9c270 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -85,13 +85,43 @@ class acp_extensions // What are we doing? 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': 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_disabled_exts($phpbb_extension_manager); $this->list_available_exts($phpbb_extension_manager); - $this->template->assign_var('U_VERSIONCHECK_FORCE', $this->u_action . '&action=list&versioncheck_force=1'); + $this->template->assign_vars(array( + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&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'; break; diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index e151c041f3..4dc70fb951 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -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”?

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_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', @@ -113,5 +114,7 @@ $lang = array_merge($lang, array( 'DOWNLOAD_LATEST' => 'Download Version', 'NO_VERSIONCHECK' => 'No version check information given.', - 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all', + 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all', + 'FORCE_UNSTABLE' => 'Always check for unstable versions', + 'EXTENSIONS_VERSION_CHECK_SETTINGS' => 'Version check settings', )); diff --git a/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php b/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php new file mode 100644 index 0000000000..5941c3aa54 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php @@ -0,0 +1,25 @@ + Date: Mon, 12 May 2014 18:28:18 +0200 Subject: [PATCH 20/29] [ticket/11366] Move "recheck all" link PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 372d9e8599..0b4a7d9fd2 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -32,7 +32,7 @@ - + @@ -91,7 +91,11 @@
{L_EXTENSION_NAME}{L_CURRENT_VERSION} [ {L_VERSIONCHECK_FORCE_UPDATE_ALL} ]{L_CURRENT_VERSION} {L_EXTENSION_OPTIONS} {L_EXTENSION_ACTIONS}
-
+ +
+

{L_VERSIONCHECK_FORCE_UPDATE_ALL}

+ {S_FORM_TOKEN} +
From 82c97b0a3fb9409747220fe2138016a1208c0dda Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 18:36:05 +0200 Subject: [PATCH 21/29] [ticket/11366] Better language string for "recheck all" PHPBB3-11366 --- phpBB/language/en/acp/extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index 4dc70fb951..e9f1c3ac5c 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -114,7 +114,7 @@ $lang = array_merge($lang, array( 'DOWNLOAD_LATEST' => 'Download Version', 'NO_VERSIONCHECK' => 'No version check information given.', - 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all', + 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all versions', 'FORCE_UNSTABLE' => 'Always check for unstable versions', 'EXTENSIONS_VERSION_CHECK_SETTINGS' => 'Version check settings', )); From 9b756b9b98aca4a3817d4c7857ade8582e0cbe25 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 18:47:49 +0200 Subject: [PATCH 22/29] [ticket/11366] Versions, options and actions heading should be centered PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 0b4a7d9fd2..3a725ee069 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -32,9 +32,9 @@ - - - + + + From edc3b3fb752d758a2fd4baca485b514beafca39a Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 18:55:52 +0200 Subject: [PATCH 23/29] [ticket/11366] Hide the version check settings by default PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 3a725ee069..3809eeda09 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -6,7 +6,7 @@

{L_EXTENSIONS_EXPLAIN}

-
+
{L_EXTENSIONS_VERSION_CHECK_SETTINGS} @@ -93,7 +93,7 @@
{L_EXTENSION_NAME}{L_CURRENT_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}{L_CURRENT_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}
-

{L_VERSIONCHECK_FORCE_UPDATE_ALL}

+

{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS}

{S_FORM_TOKEN}
From 9cbec4deb272552bc7e890af161d4b7307075eb3 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 19:13:53 +0200 Subject: [PATCH 24/29] [ticket/11366] Move the links to the top of the page PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 3809eeda09..95c194cc1d 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -27,6 +27,11 @@
+
+

{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS}

+ {S_FORM_TOKEN} +
+ @@ -92,11 +97,6 @@
-
-

{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS}

- {S_FORM_TOKEN} -
- From ccddd44105ddf5de9905b27b9848ad769be227d6 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 19:15:32 +0200 Subject: [PATCH 25/29] [ticket/11366] Remove the extra {S_FORM_TOKEN} PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index 95c194cc1d..bcd98335af 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -29,7 +29,6 @@

{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS}

- {S_FORM_TOKEN}
{L_EXTENSION_UPDATE_HEADLINE}
From f3aaab93d66ac36359a225a335c8036dda0a12ce Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 19:44:28 +0200 Subject: [PATCH 26/29] [ticket/11366] Exchange links and settings' form PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index bcd98335af..f0d1f789db 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -6,6 +6,10 @@

{L_EXTENSIONS_EXPLAIN}

+
+ {L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS} +
+
@@ -27,10 +31,6 @@
-
-

{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS}

-
-
From 73cdfae42bce9de97c662fba84fb6592aa810326 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 20:02:24 +0200 Subject: [PATCH 27/29] [ticket/11366] Fix HTML PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index f0d1f789db..d3a7913f7d 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -17,7 +17,7 @@
- +
@@ -44,7 +44,7 @@
- + From 629c47acfefd844eeb996a650a94f4c6e34045bf Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 20:03:49 +0200 Subject: [PATCH 28/29] [ticket/11366] Add config value in schema_data.sql PHPBB3-11366 --- phpBB/install/schemas/schema_data.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 82cf4d8418..7afed448ad 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -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_order', '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 ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); From fde5a9d472976b2b19eb4e9852b86ab7c2347949 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 12 May 2014 20:09:00 +0200 Subject: [PATCH 29/29] [ticket/11366] Fix headings css in list page PHPBB3-11366 --- phpBB/adm/style/acp_ext_list.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index d3a7913f7d..f96da7e26a 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -36,9 +36,9 @@ - - - + + +
{L_EXTENSIONS_ENABLED}{L_EXTENSIONS_ENABLED}
{L_EXTENSION_NAME}{L_CURRENT_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}{L_CURRENT_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}