1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-25 18:13:28 +01:00

[ticket/14492] Use same list for checking if extension should be updated

PHPBB3-14492
This commit is contained in:
Marc Alexander 2016-03-04 00:24:04 +01:00
parent 4f0627de03
commit edfc4f3efc
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
2 changed files with 31 additions and 8 deletions

View File

@ -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, '<='))
{

View File

@ -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))