Check if the identity is available when injecting into the local adapter #43588
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of Changes
When the local adapter is loaded through a console application it crashes.
Testing Instructions
Add the following line to the file /plugins/task/sessiongc/src/Extension/SessionGC.php inside the sessionGC function after line number 104:
$this->getApplication()->bootComponent('media')->getMVCFactory()->createmodel('Media', 'Administrator')->getProviders();
Then run the following commend in the console:
php cli/joomla.php scheduler:run -i 2
If the session GC task has a different id than 2, adapt the command accordingly.
Actual result BEFORE applying this Pull Request
The command fails with the current message:
Joomla\Plugin\Filesystem\Local\Adapter\LocalAdapter::setCurrentUser(): Argument #1 ($currentUser) must be of type Joomla\CMS\User\User, null given, called in /plugins/filesystem/local/src/Extension/Local.php on line 138
Expected result AFTER applying this Pull Request
Task runs trough.
Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed