Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Issue forks
automatic_updates-3242724
Commits
36f2c34b
Commit
36f2c34b
authored
Jul 01, 2019
by
heddn
Committed by
heddn
Jul 01, 2019
Browse files
Issue
#3063137
by heddn, tatarbj: Backport ReadOnlyFilesystem
parent
b0c26b36
Changes
3
Hide whitespace changes
Inline
Side-by-side
ReadinessCheckers/ReadOnlyFilesystem.php
0 → 100644
View file @
36f2c34b
<?php
/**
* Read only filesystem checker.
*/
class
ReadOnlyFilesystem
implements
ReadinessCheckerInterface
{
/**
* {@inheritdoc}
*/
public
static
function
run
()
{
return
static
::
readOnlyCheck
();
}
/**
* Check if the filesystem is read only.
*
* @return array
* An array of translatable strings if any checks fail.
*/
protected
static
function
readOnlyCheck
()
{
$messages
=
[];
// If we can copy and delete a file, then we don't have a read only
// file system.
$file_path
=
DRUPAL_ROOT
;
$file
=
'modules/node/node.api.php'
;
if
(
file_unmanaged_copy
(
"
$file_path
/
$file
"
,
"
$file_path
/
$file
.automatic_updates"
,
FILE_EXISTS_REPLACE
))
{
// Delete it after copying.
file_unmanaged_delete
(
"
$file_path
/
$file
.automatic_updates"
);
}
else
{
$error
=
t
(
'Filesystem at "@path" is read only. Updates to Drupal core cannot be applied against a read only file system.'
,
[
'@path'
=>
DRUPAL_ROOT
]);
watchdog
(
'automatic_updates'
,
$error
,
[],
WATCHDOG_ERROR
);
$messages
[]
=
$error
;
}
return
$messages
;
}
}
ReadinessCheckers/ReadinessCheckerManager.php
View file @
36f2c34b
...
...
@@ -26,6 +26,7 @@ class ReadinessCheckerManager {
static
::
$checkers
[
'warning'
][
0
][]
=
'ModifiedFiles'
;
static
::
$checkers
[
'warning'
][
0
][]
=
'PhpSapi'
;
static
::
$checkers
[
'error'
][
0
][]
=
'PhpSapi'
;
static
::
$checkers
[
'error'
][
0
][]
=
'ReadOnlyFilesystem'
;
return
static
::
$checkers
;
}
...
...
automatic_updates.info
View file @
36f2c34b
...
...
@@ -12,3 +12,4 @@ files[] = ReadinessCheckers/ReadinessCheckerInterface.php
files
[]
=
ReadinessCheckers
/
FileOwnership
.
php
files
[]
=
ReadinessCheckers
/
ModifiedFiles
.
php
files
[]
=
ReadinessCheckers
/
PhpSapi
.
php
files
[]
=
ReadinessCheckers
/
ReadOnlyFilesystem
.
php
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment