Issue #3432476 add ConsoleUserValidator
Closes #3432476
Merge request reports
Activity
- src/Validator/ConsoleUserValidator.php 0 → 100644
1 <?php 2 3 namespace Drupal\automatic_updates\Validator; 4 5 use Drupal\automatic_updates\ConsoleUpdateStage; 6 use Drupal\package_manager\Event\PreCreateEvent; 7 use Drupal\package_manager\Event\StatusCheckEvent; 8 use Symfony\Component\EventDispatcher\EventSubscriberInterface; 9 10 /** 11 * Validates that the `auto-update` script is not run as the root user. 12 * 13 * @todo Remove this validator in favor of exiting the `auto-update` script as 14 * early as possible if run as root in https://www.drupal.org/i/3432496. 15 */ 16 class ConsoleUserValidator implements EventSubscriberInterface { The main benefit is that if it is validator then this would flag an error on status report page because it works on the
StatusCheckEvent
.So if someone goes to status report page there is one location where they can see all the errors related to Automatic Updates, especially why unattended updates might not work now in or in the future. If we just log a warning to watchdog then on the status report page you would see all the errors that will affect unattended updates, except this problem with root user.
I do agree that 3.1.x when don't allow root to run at all this should not be a validator, thats I created the todo to https://www.drupal.org/i/3432496. But that is mainly because we are stopping the script because running as root is dangerous. So in that case we want to stop as early as possible.
Since until 3.1.x we are not stopping the update from running so there is not benefit from logging the error so early. It would be simpler obviously but think the benefit for getting the errors on the status report page with all the other
StatusCheckEvent
warnings and errors outweighs this, especially because the warning we are giving them is that with their current setup as soon as they update to 3.1.0 there unattended updates will stop working. So we really don't want them to miss this.
added 5 commits
-
9931ee63...78052119 - 2 commits from branch
project:3.0.x
- a588bfb0 - add ConsoleUserValidator
- 89008c7a - add cli check
- 6f112ef3 - remove from core version
Toggle commit list-
9931ee63...78052119 - 2 commits from branch