Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3406812
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
automatic_updates-3406812
Commits
666434b8
Commit
666434b8
authored
5 years ago
by
Lucas Hedding
Committed by
Lucas Hedding
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3046857
by heddn, eiriksm: Add entry to site status page when PSAs are posted
parent
3b477434
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
automatic_updates.info.yml
+2
-0
2 additions, 0 deletions
automatic_updates.info.yml
automatic_updates.install
+35
-0
35 additions, 0 deletions
automatic_updates.install
tests/src/Functional/AutomaticUpdatesTest.php
+7
-0
7 additions, 0 deletions
tests/src/Functional/AutomaticUpdatesTest.php
with
44 additions
and
0 deletions
automatic_updates.info.yml
+
2
−
0
View file @
666434b8
...
...
@@ -4,3 +4,5 @@ description: 'Drupal Automatic Updates'
core
:
8.x
package
:
'
Security'
configure
:
automatic_updates.admin_form
dependencies
:
-
drupal:update
This diff is collapsed.
Click to expand it.
automatic_updates.install
0 → 100644
+
35
−
0
View file @
666434b8
<?php
/**
* @file
* Automatic updates install file.
*/
use
Drupal\Core\StringTranslation\PluralTranslatableMarkup
;
/**
* Requirements checks for automatic updates.
*/
function
automatic_updates_requirements
()
{
$requirements
=
[];
if
(
!
\Drupal
::
config
(
'automatic_updates.settings'
)
->
get
(
'enable_psa'
))
{
return
$requirements
;
}
/** @var \Drupal\automatic_updates\Services\AutomaticUpdatesPsa $psa */
$psa
=
\Drupal
::
service
(
'automatic_updates.psa'
);
$messages
=
$psa
->
getPublicServiceMessages
();
$requirements
[
'automatic_updates_psa'
]
=
[
'title'
=>
t
(
'Drupal public service announcements'
),
'severity'
=>
REQUIREMENT_OK
,
'value'
=>
t
(
'No announcements requiring attention.'
),
];
if
(
!
empty
(
$messages
))
{
$requirements
[
'automatic_updates_psa'
][
'severity'
]
=
REQUIREMENT_ERROR
;
$requirements
[
'automatic_updates_psa'
][
'value'
]
=
new
PluralTranslatableMarkup
(
count
(
$messages
),
'@count urgent announcement requiring your attention:'
,
'@count urgent announcements requiring your attention:'
);
$requirements
[
'automatic_updates_psa'
][
'description'
]
=
[
'#theme'
=>
'item_list'
,
'#items'
=>
$messages
,
];
}
return
$requirements
;
}
This diff is collapsed.
Click to expand it.
tests/src/Functional/AutomaticUpdatesTest.php
+
7
−
0
View file @
666434b8
...
...
@@ -20,6 +20,7 @@ class AutomaticUpdatesTest extends BrowserTestBase {
public
static
$modules
=
[
'automatic_updates'
,
'test_automatic_updates'
,
'update'
,
];
/**
...
...
@@ -56,6 +57,10 @@ class AutomaticUpdatesTest extends BrowserTestBase {
$this
->
assertSession
()
->
pageTextContains
(
'Drupal Contrib Project PSA: Seven - Moderately critical - Access bypass - SA-CONTRIB-2019'
);
$this
->
assertSession
()
->
pageTextContains
(
'Drupal Contrib Project PSA: Standard - Moderately critical - Access bypass - SA-CONTRIB-2019'
);
// Test site status report.
$this
->
drupalGet
(
Url
::
fromRoute
(
'system.status'
));
$this
->
assertSession
()
->
pageTextContains
(
'4 announcements requiring your attention:'
);
// Test cache.
$end_point
=
'http://localhost/automatic_updates/test-json-denied'
;
$this
->
config
(
'automatic_updates.settings'
)
...
...
@@ -78,6 +83,8 @@ class AutomaticUpdatesTest extends BrowserTestBase {
drupal_flush_all_caches
();
$this
->
drupalGet
(
Url
::
fromRoute
(
'system.admin'
));
$this
->
assertSession
()
->
pageTextNotContains
(
'Drupal Core PSA: Critical Release - PSA-2019-02-19'
);
$this
->
drupalGet
(
Url
::
fromRoute
(
'system.status'
));
$this
->
assertSession
()
->
pageTextNotContains
(
'4 announcements requiring your attention:'
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment