diff --git a/phpBB/phpbb/install/module/update_database/task/update_extensions.php b/phpBB/phpbb/install/module/update_database/task/update_extensions.php index 6d0016ddb3..64215e2f30 100644 --- a/phpBB/phpbb/install/module/update_database/task/update_extensions.php +++ b/phpBB/phpbb/install/module/update_database/task/update_extensions.php @@ -74,7 +74,7 @@ class update_extensions extends task_base * @var array List of default extensions to update, grouped by version * they were added */ - private $default_update = [ + static public $default_extensions_update = [ '3.2.0-b3' => ['phpbb/viglink'] ]; @@ -135,7 +135,7 @@ class update_extensions extends task_base // Create list of default extensions that need to be enabled in update $default_update_extensions = []; - foreach ($this->default_update as $version => $extensions) + foreach (self::$default_extensions_update as $version => $extensions) { if ($this->update_helper->phpbb_version_compare($version_from, $version, '<=')) { diff --git a/phpBB/phpbb/install/module/update_filesystem/task/file_check.php b/phpBB/phpbb/install/module/update_filesystem/task/file_check.php index 8777b747de..5b48350e73 100644 --- a/phpBB/phpbb/install/module/update_filesystem/task/file_check.php +++ b/phpBB/phpbb/install/module/update_filesystem/task/file_check.php @@ -118,6 +118,17 @@ class file_check extends task_base $this->iohandler->set_task_count($task_count); $this->iohandler->set_progress('UPDATE_CHECK_FILES', 0); + // Create list of default extensions that should have been added prior + // to this update + $default_update_extensions = []; + foreach (\phpbb\install\module\update_database\task\update_extensions::$default_extensions_update as $version => $extensions) + { + if ($this->update_helper->phpbb_version_compare($update_info['version']['from'], $version, '>')) + { + $default_update_extensions = array_merge($default_update_extensions, $extensions); + } + } + foreach ($update_info['files'] as $key => $filename) { $old_file = $old_path . $filename; @@ -138,13 +149,25 @@ class file_check extends task_base $progress_count++; $this->iohandler->set_progress('UPDATE_CHECK_FILES', $progress_count); - // Do not copy viglink again if the previous version was packaged - // with it but it does not exist (e.g. deleted by admin) - if (strpos($file, $this->phpbb_root_path . 'ext/phpbb/viglink') !== false && - $this->update_helper->phpbb_version_compare($update_info['version']['from'], '3.2.0', '>=') && - !$this->filesystem->exists($this->phpbb_root_path . 'ext/phpbb/viglink/composer.json')) + // Do not copy default extension again if the previous version was + // packaged with it but it does not exist (e.g. deleted by admin) + if (strpos($file, $this->phpbb_root_path . 'ext/') !== false) { - continue; + $skip_file = false; + foreach ($default_update_extensions as $ext_name) + { + if (strpos($file, $this->phpbb_root_path . 'ext/' . $ext_name) !== false && + !$this->filesystem->exists($this->phpbb_root_path . 'ext/' . $ext_name . '/composer.json')) + { + $skip_file = true; + break; + } + } + + if ($skip_file) + { + continue; + } } if (!$this->filesystem->exists($file))