Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
automatic_updates
Merge requests
!339
Issue
#3285631
: Make it impossible to call CronUpdater::begin() directly
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Issue
#3285631
: Make it impossible to call CronUpdater::begin() directly
issue/automatic_updates-3285631:3285631-make-it-impossible
into
8.x-2.x
Overview
11
Commits
12
Pipelines
0
Changes
4
Merged
Theresa Grannum
requested to merge
issue/automatic_updates-3285631:3285631-make-it-impossible
into
8.x-2.x
2 years ago
Overview
11
Commits
12
Pipelines
0
Changes
4
Expand
0
0
Merge request reports
Compare
8.x-2.x
version 9
2370b879
2 years ago
version 8
2590c429
2 years ago
version 7
74785510
2 years ago
version 6
fa273753
2 years ago
version 5
661648d9
2 years ago
version 4
dbb07e9d
2 years ago
version 3
ef677f05
2 years ago
version 2
b468744d
2 years ago
version 1
c9844ee4
2 years ago
8.x-2.x (base)
and
latest version
latest version
2370b879
12 commits,
2 years ago
version 9
2370b879
12 commits,
2 years ago
version 8
2590c429
11 commits,
2 years ago
version 7
74785510
9 commits,
2 years ago
version 6
fa273753
8 commits,
2 years ago
version 5
661648d9
7 commits,
2 years ago
version 4
dbb07e9d
6 commits,
2 years ago
version 3
ef677f05
4 commits,
2 years ago
version 2
b468744d
3 commits,
2 years ago
version 1
c9844ee4
2 commits,
2 years ago
4 files
+
110
−
217
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
src/CronUpdater.php
+
11
−
9
Options
@@ -118,14 +118,15 @@ 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
{
// Unattended updates should never be started using this method. They should
// only be done by ::handleCron(), which has a strong opinion about which
// release to update to. Throwing an exception here is just to enforce this
// boundary. To update to a specific version of core, use
// \Drupal\automatic_updates\Updater::begin() (which is called in
// ::performUpdate() to start the update to the target version of core
// chosen by ::handleCron()).
throw
new
\BadMethodCallException
(
__METHOD__
.
'() cannot be called directly.'
);
}
/**
@@ -148,7 +149,8 @@ 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
);
// @see ::begin()
parent
::
begin
([
'drupal'
=>
$target_version
],
$timeout
);
$this
->
stage
();
$this
->
apply
();
Loading