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
dce1e81f
Commit
dce1e81f
authored
Jul 08, 2019
by
heddn
Committed by
heddn
Jul 08, 2019
Browse files
Issue
#3063129
by heddn, tatarbj: Backport DiskSpace
parent
2e5593b5
Changes
3
Hide whitespace changes
Inline
Side-by-side
ReadinessCheckers/DiskSpace.php
0 → 100644
View file @
dce1e81f
<?php
/**
* Disk space checker.
*/
class
DiskSpace
implements
ReadinessCheckerInterface
{
/**
* Minimum disk space (in bytes) is 10mb.
*/
const
MINIMUM_DISK_SPACE
=
10000000
;
/**
* Megabyte divisor.
*/
const
MEGABYTE_DIVISOR
=
1000000
;
/**
* {@inheritdoc}
*/
public
static
function
run
()
{
return
static
::
diskSpaceCheck
();
}
/**
* Check if the filesystem has sufficient disk space.
*
* @return array
* An array of translatable strings if there is not sufficient space.
*/
protected
static
function
diskSpaceCheck
()
{
$messages
=
[];
if
(
disk_free_space
(
DRUPAL_ROOT
)
<
static
::
MINIMUM_DISK_SPACE
)
{
$messages
[]
=
t
(
'Logical disk "@root" has insufficient space. There must be at least @space megabytes free.'
,
[
'@root'
=>
DRUPAL_ROOT
,
'@space'
=>
static
::
MINIMUM_DISK_SPACE
/
static
::
MEGABYTE_DIVISOR
,
]);
}
return
$messages
;
}
}
ReadinessCheckers/ReadinessCheckerManager.php
View file @
dce1e81f
...
...
@@ -27,7 +27,7 @@ class ReadinessCheckerManager {
static
::
$checkers
[
'warning'
][
0
][]
=
'MissingProjectInfo'
;
static
::
$checkers
[
'warning'
][
0
][]
=
'ModifiedFiles'
;
static
::
$checkers
[
'warning'
][
0
][]
=
'PhpSapi'
;
static
::
$checkers
[
'error'
][
0
][]
=
'
PhpSapi
'
;
static
::
$checkers
[
'error'
][
0
][]
=
'
DiskSpace
'
;
static
::
$checkers
[
'error'
][
0
][]
=
'ReadOnlyFilesystem'
;
return
static
::
$checkers
;
...
...
automatic_updates.info
View file @
dce1e81f
...
...
@@ -11,6 +11,7 @@ files[] = ModifiedFilesService.php
files
[]
=
ReadinessCheckers
/
ReadinessCheckerManager
.
php
files
[]
=
ReadinessCheckers
/
ReadinessCheckerInterface
.
php
files
[]
=
ReadinessCheckers
/
BlacklistPhp72Versions
.
php
files
[]
=
ReadinessCheckers
/
DiskSpace
.
php
files
[]
=
ReadinessCheckers
/
FileOwnership
.
php
files
[]
=
ReadinessCheckers
/
MissingProjectInfo
.
php
files
[]
=
ReadinessCheckers
/
ModifiedFiles
.
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