diff options
author | Etienne Baroux <barouxe@phelma.grenoble-inp.fr> | 2014-06-02 10:12:18 +0200 |
---|---|---|
committer | Tristan Darricau <github@nicofuma.fr> | 2016-12-03 16:37:35 +0100 |
commit | 346f31a03156839d1b1931d2fc69cd2ab5656bc0 (patch) | |
tree | aed312ce3f9e890a260a02132119cdfff8764d9b /phpBB/includes/acp/acp_extensions.php | |
parent | 17e8726582df3e3115893668c7b1ea39b87028ba (diff) | |
download | forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar.gz forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar.bz2 forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.tar.xz forums-346f31a03156839d1b1931d2fc69cd2ab5656bc0.zip |
[ticket/12610] Add command to check if the board is up to date.
PHPBB3-12610
Diffstat (limited to 'phpBB/includes/acp/acp_extensions.php')
-rw-r--r-- | phpBB/includes/acp/acp_extensions.php | 46 |
1 files changed, 9 insertions, 37 deletions
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index d2e01c80cc..ec88a4a392 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -86,7 +86,7 @@ class acp_extensions // If they've specified an extension, let's load the metadata manager and validate it. if ($ext_name) { - $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path); + $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $phpbb_root_path); try { @@ -303,11 +303,11 @@ class acp_extensions case 'details': // Output it to the template - $md_manager->output_template_data(); + $md_manager->output_template_data($template); try { - $updates_available = $this->version_check($md_manager, $request->variable('versioncheck_force', false)); + $updates_available = $phpbb_extension_manager->version_check($md_manager, $request->variable('versioncheck_force', false), $this->config['extension_force_unstable'] ? 'unstable' : null); $template->assign_vars(array( 'S_UP_TO_DATE' => empty($updates_available), @@ -350,7 +350,7 @@ class acp_extensions foreach ($phpbb_extension_manager->all_enabled() as $name => $location) { - $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); + $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name); try { @@ -361,7 +361,7 @@ class acp_extensions ); $force_update = $this->request->variable('versioncheck_force', false); - $updates = $this->version_check($md_manager, $force_update, !$force_update); + $updates = $phpbb_extension_manager->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; @@ -408,7 +408,7 @@ class acp_extensions foreach ($phpbb_extension_manager->all_disabled() as $name => $location) { - $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); + $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name); try { @@ -419,7 +419,7 @@ class acp_extensions ); $force_update = $this->request->variable('versioncheck_force', false); - $updates = $this->version_check($md_manager, $force_update, !$force_update); + $updates = $phpbb_extension_manager->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; @@ -469,7 +469,7 @@ class acp_extensions foreach ($uninstalled as $name => $location) { - $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); + $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name); try { @@ -480,7 +480,7 @@ class acp_extensions ); $force_update = $this->request->variable('versioncheck_force', false); - $updates = $this->version_check($md_manager, $force_update, !$force_update); + $updates = $phpbb_extension_manager->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; @@ -534,34 +534,6 @@ 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, new \phpbb\file_downloader(), $this->user); - $version_helper->set_current_version($meta['version']); - $version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false); - $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) |