1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/16955] Clean up installer classes for psalm

PHPBB3-16955
This commit is contained in:
Marc Alexander
2022-12-26 14:42:23 +01:00
parent d9c179f9ef
commit 40e8a737c3
22 changed files with 54 additions and 42 deletions

View File

@@ -102,7 +102,7 @@ class add_languages extends database_task
]);
$installed_languages = $this->config->get('installed_languages', []);
array_push($installed_languages, (int) $this->get_last_insert_id());
$installed_languages[] = (int) $this->get_last_insert_id();
$this->config->set('installed_languages', $installed_languages);
}

View File

@@ -42,7 +42,7 @@ class install_extensions extends database_task
protected $iohandler;
/**
* @var db
* @var \phpbb\config\config
*/
protected $config;
@@ -106,9 +106,9 @@ class install_extensions extends database_task
// Make sure asset version exists in config. Otherwise we might try to
// insert the assets_version setting into the database and cause a
// duplicate entry error.
if (!isset($this->config['assets_version']))
if (!$this->config->offsetExists('assets_version'))
{
$this->config['assets_version'] = 0;
$this->config->offsetSet('assets_version', 0);
}
parent::__construct(

View File

@@ -75,6 +75,7 @@ class obtain_update_files extends task_base
// The file should be checked in the requirements, so we assume that it exists
$update_info_file = $this->phpbb_root_path . 'install/update/index.' . $this->php_ext;
include($update_info_file);
/** @var array $update_info */
$info = (empty($update_info) || !is_array($update_info)) ? false : $update_info;
// If the file is invalid, abort mission

View File

@@ -137,6 +137,7 @@ class check_update extends task_base
// Recover version numbers
$update_info = array();
@include($this->phpbb_root_path . 'install/update/index.' . $this->php_ext);
/** @var array|false $info */
$info = (empty($update_info) || !is_array($update_info)) ? false : $update_info;
$update_version = false;

View File

@@ -45,7 +45,7 @@ class update_extensions extends task_base
protected $update_helper;
/**
* @var \phpbb\config\db
* @var \phpbb\config\config
*/
protected $config;
@@ -111,9 +111,9 @@ class update_extensions extends task_base
// Make sure asset version exists in config. Otherwise we might try to
// insert the assets_version setting into the database and cause a
// duplicate entry error.
if (!isset($this->config['assets_version']))
if (!$this->config->offsetExists('assets_version'))
{
$this->config['assets_version'] = 0;
$this->config->offsetSet('assets_version', 0);
}
parent::__construct(true);

View File

@@ -224,7 +224,7 @@ class update_files extends task_base
}
$file_updater_method = $this->installer_config->get('file_update_method', '');
if ($file_updater_method === 'compression' || $file_updater_method === 'ftp')
if ($file_updater_method === 'compression' || $file_updater_method === 'ftp' && method_exists($this->file_updater, 'close'))
{
$this->file_updater->close();
}