Skip to content
Snippets Groups Projects

Issue #3285631: Make it impossible to call CronUpdater::begin() directly

Merged Issue #3285631: Make it impossible to call CronUpdater::begin() directly
All threads resolved!
All threads resolved!
+ 3
9
@@ -96,14 +96,8 @@ class CronUpdater extends Updater {
/**
* {@inheritdoc}
*/
public function begin(array $project_versions, ?int $timeout = 300): string {
// Prevent mischievous callers from starting an update even if unattended
// updates are disabled. To start an update programmatically, use
// \Drupal\automatic_updates\Updater::begin().
if ($this->getMode() === static::DISABLED) {
throw new \LogicException('Unattended updates are disabled.');
}
return parent::begin($project_versions, $timeout);
final public function begin(array $project_versions, ?int $timeout = 300): string {
throw new \BadMethodCallException($project_versions, $timeout);
}
/**
@@ -126,7 +120,7 @@ class CronUpdater extends Updater {
// handle any exceptions or validation errors consistently, and destroy the
// stage regardless of whether the update succeeds.
try {
$this->begin(['drupal' => $target_version], $timeout);
parent::begin(['drupal' => $target_version], $timeout);
$this->stage();
$this->apply();
Loading