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

[ticket/17153] Use routing helper instead of controller helper in upload avatar

The controller helper class is not needed, routing helper brings all the
needed functionality already.

PHPBB3-17153
This commit is contained in:
Marc Alexander
2023-07-01 19:31:00 +02:00
parent 4db4a5571b
commit aac7d5a99c
4 changed files with 12 additions and 14 deletions

View File

@@ -56,11 +56,11 @@ services:
class: phpbb\avatar\driver\upload
arguments:
- '@config'
- '@controller.helper'
- '%core.root_path%'
- '%core.php_ext%'
- '@storage.avatar'
- '@path_helper'
- '@routing.helper'
- '@event_dispatcher'
- '@files.factory'
- '@php_ini'

View File

@@ -15,10 +15,10 @@ namespace phpbb\avatar\driver;
use bantu\IniGetWrapper\IniGetWrapper;
use phpbb\config\config;
use phpbb\controller\helper;
use phpbb\event\dispatcher_interface;
use phpbb\files\factory;
use phpbb\path_helper;
use phpbb\routing\helper;
use phpbb\storage\exception\exception as storage_exception;
use phpbb\storage\storage;
@@ -30,7 +30,7 @@ class upload extends \phpbb\avatar\driver\driver
/**
* @var helper
*/
private $controller_helper;
private $routing_helper;
/**
* @var storage
@@ -56,23 +56,23 @@ class upload extends \phpbb\avatar\driver\driver
* Construct a driver object
*
* @param config $config phpBB configuration
* @param helper $controller_helper
* @param string $phpbb_root_path Path to the phpBB root
* @param string $php_ext PHP file extension
* @param storage $storage phpBB avatar storage
* @param path_helper $path_helper phpBB path helper
* @param helper $routing_helper phpBB routing helper
* @param dispatcher_interface $dispatcher phpBB Event dispatcher object
* @param factory $files_factory File classes factory
* @param IniGetWrapper $php_ini ini_get() wrapper
*/
public function __construct(config $config, helper $controller_helper, string $phpbb_root_path, string $php_ext, storage $storage, path_helper $path_helper, dispatcher_interface $dispatcher, factory $files_factory, IniGetWrapper $php_ini)
public function __construct(config $config, string $phpbb_root_path, string $php_ext, storage $storage, path_helper $path_helper, helper $routing_helper, dispatcher_interface $dispatcher, factory $files_factory, IniGetWrapper $php_ini)
{
$this->config = $config;
$this->controller_helper = $controller_helper;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
$this->storage = $storage;
$this->path_helper = $path_helper;
$this->routing_helper = $routing_helper;
$this->dispatcher = $dispatcher;
$this->files_factory = $files_factory;
$this->php_ini = $php_ini;
@@ -84,7 +84,7 @@ class upload extends \phpbb\avatar\driver\driver
public function get_data($row)
{
return array(
'src' => $this->controller_helper->route('phpbb_storage_avatar', ['file' => $row['avatar']]),
'src' => $this->routing_helper->route('phpbb_storage_avatar', ['file' => $row['avatar']]),
'width' => $row['avatar_width'],
'height' => $row['avatar_height'],
);