-
-
Notifications
You must be signed in to change notification settings - Fork 944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ticket/13981] Add events to capture avatar deletion or overwriting #3738
Conversation
An event to capture overwriting, and another to capture deletion. Includes better error processing. PHPBB3-13981
@@ -80,6 +80,8 @@ public function prepare_form($request, $template, $user, $row, &$error) | |||
*/ | |||
public function process_form($request, $template, $user, $row, &$error) | |||
{ | |||
global $phpbb_dispatcher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The phpbb_dispatcher should be passed as a service and not be global.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
An event to capture overwriting, and another to capture deletion. Includes better error processing. Replaced global by dependency injection. PHPBB3-13981
* @param \phpbb\cache\driver\driver_interface $cache Cache driver | ||
*/ | ||
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $cache = null) | ||
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $dispatcher, \phpbb\cache\driver\driver_interface $cache = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dispatcher is not \phpbb\cache\driver\driver_interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops... Copy&paste creep. Fixed.
An event to capture overwriting, and another to capture deletion. Includes better error processing. Replaced global by dependency injection. Fix typo. PHPBB3-13981
Are the Travis and Bamboo errors relevant, or just caused because we have changed the constructor parameters, and therefore the tests do not match the new prototype? |
No, you need to update the constructor(s) of the upload avatar in the tests. Travis is telling you which files you need to look in. |
I don't know how to do that, I have never used Travis myself. I will look into it though. |
An event to capture overwriting, and another to capture deletion. Includes better error processing. Replaced global by dependency injection. Fix Travis tests. PHPBB3-13981
These tests failing seem unrelated to the submitted PR
|
'row', | ||
'error', | ||
); | ||
extract($this->dispatcher->trigger_event('core.avatar_driver_upload_overwrite_before', compact($vars))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like it more if you could change the name to core.avatar_driver_upload_move_file_before. It's not always overwriting a file so calling it that is somewhat not correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, change is coming.
An event to capture new avatar moving in place (and maybe overwriting existing avatar), and another to capture deletion. Includes better error processing. Rename event. PHPBB3-13981
[ticket/13981] Add events to capture avatar deletion or overwriting
[ticket/13981] Add events to capture avatar deletion or overwriting
PHPBB3-13981