Issue #2015149 by dagmar, Jo Fitzgerald, hanoii, pritish.kumar, Pol, Lendude, damiankloip, nicolas.rafaelli, alansaviolobo, Psikik, yoroy, dawehner, alexpott, catch, jibran: Replace dblog recent log entries with a view
parent
6d68ffd476
commit
c99c526c6d
|
@ -0,0 +1,712 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- dblog
|
||||
- user
|
||||
id: watchdog
|
||||
label: Watchdog
|
||||
module: views
|
||||
description: 'Recent log messages'
|
||||
tag: ''
|
||||
base_table: watchdog
|
||||
base_field: wid
|
||||
core: 8.x
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
id: default
|
||||
display_title: Master
|
||||
position: 0
|
||||
display_options:
|
||||
access:
|
||||
type: perm
|
||||
options:
|
||||
perm: 'access site reports'
|
||||
cache:
|
||||
type: none
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
options:
|
||||
disable_sql_rewrite: false
|
||||
distinct: false
|
||||
replica: false
|
||||
query_comment: ''
|
||||
query_tags: { }
|
||||
exposed_form:
|
||||
type: basic
|
||||
options:
|
||||
submit_button: Filter
|
||||
reset_button: true
|
||||
reset_button_label: Reset
|
||||
exposed_sorts_label: 'Sort by'
|
||||
expose_sort_order: false
|
||||
sort_asc_label: Asc
|
||||
sort_desc_label: Desc
|
||||
pager:
|
||||
type: mini
|
||||
options:
|
||||
items_per_page: 50
|
||||
offset: 0
|
||||
id: 0
|
||||
total_pages: null
|
||||
expose:
|
||||
items_per_page: false
|
||||
items_per_page_label: 'Items per page'
|
||||
items_per_page_options: '5, 10, 25, 50'
|
||||
items_per_page_options_all: false
|
||||
items_per_page_options_all_label: '- All -'
|
||||
offset: false
|
||||
offset_label: Offset
|
||||
tags:
|
||||
previous: ‹‹
|
||||
next: ››
|
||||
style:
|
||||
type: table
|
||||
options:
|
||||
grouping: { }
|
||||
row_class: '{{ type }} {{ severity }}'
|
||||
default_row_class: true
|
||||
override: true
|
||||
sticky: false
|
||||
caption: ''
|
||||
summary: ''
|
||||
description: ''
|
||||
columns:
|
||||
nothing: nothing
|
||||
wid: wid
|
||||
severity: severity
|
||||
type: type
|
||||
timestamp: timestamp
|
||||
message: message
|
||||
name: name
|
||||
link: link
|
||||
info:
|
||||
nothing:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-medium
|
||||
wid:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-low
|
||||
severity:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-low
|
||||
type:
|
||||
sortable: true
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-medium
|
||||
timestamp:
|
||||
sortable: true
|
||||
default_sort_order: desc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-low
|
||||
message:
|
||||
sortable: false
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-high
|
||||
name:
|
||||
sortable: true
|
||||
default_sort_order: asc
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-medium
|
||||
link:
|
||||
align: ''
|
||||
separator: ''
|
||||
empty_column: false
|
||||
responsive: priority-low
|
||||
default: timestamp
|
||||
empty_table: false
|
||||
row:
|
||||
type: fields
|
||||
fields:
|
||||
nothing:
|
||||
id: nothing
|
||||
table: views
|
||||
field: nothing
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: Icon
|
||||
label: ''
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: true
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: icon
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: false
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: false
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: false
|
||||
plugin_id: custom
|
||||
wid:
|
||||
id: wid
|
||||
table: watchdog
|
||||
field: wid
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: WID
|
||||
exclude: true
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
plugin_id: standard
|
||||
severity:
|
||||
id: severity
|
||||
table: watchdog
|
||||
field: severity
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Severity
|
||||
exclude: true
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
machine_name: false
|
||||
plugin_id: machine_name
|
||||
type:
|
||||
id: type
|
||||
table: watchdog
|
||||
field: type
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Type
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
plugin_id: standard
|
||||
timestamp:
|
||||
id: timestamp
|
||||
table: watchdog
|
||||
field: timestamp
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Date
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
date_format: short
|
||||
custom_date_format: ''
|
||||
timezone: ''
|
||||
plugin_id: date
|
||||
message:
|
||||
id: message
|
||||
table: watchdog
|
||||
field: message
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Message
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: true
|
||||
path: 'admin/reports/dblog/event/{{ wid }}'
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: '{{ message }}'
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 56
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: true
|
||||
trim: true
|
||||
preserve_tags: ''
|
||||
html: true
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
replace_variables: true
|
||||
plugin_id: dblog_message
|
||||
name:
|
||||
id: name
|
||||
table: users_field_data
|
||||
field: name
|
||||
relationship: uid
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: User
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
click_sort_column: value
|
||||
type: user_name
|
||||
settings:
|
||||
link_to_entity: true
|
||||
group_column: value
|
||||
group_columns: { }
|
||||
group_rows: true
|
||||
delta_limit: 0
|
||||
delta_offset: 0
|
||||
delta_reversed: false
|
||||
delta_first_last: false
|
||||
multi_type: separator
|
||||
separator: ', '
|
||||
field_api_classes: false
|
||||
entity_type: user
|
||||
entity_field: name
|
||||
plugin_id: field
|
||||
link:
|
||||
id: link
|
||||
table: watchdog
|
||||
field: link
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
label: Operations
|
||||
exclude: false
|
||||
alter:
|
||||
alter_text: false
|
||||
text: ''
|
||||
make_link: false
|
||||
path: ''
|
||||
absolute: false
|
||||
external: false
|
||||
replace_spaces: false
|
||||
path_case: none
|
||||
trim_whitespace: false
|
||||
alt: ''
|
||||
rel: ''
|
||||
link_class: ''
|
||||
prefix: ''
|
||||
suffix: ''
|
||||
target: ''
|
||||
nl2br: false
|
||||
max_length: 0
|
||||
word_boundary: true
|
||||
ellipsis: true
|
||||
more_link: false
|
||||
more_link_text: ''
|
||||
more_link_path: ''
|
||||
strip_tags: false
|
||||
trim: false
|
||||
preserve_tags: ''
|
||||
html: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
hide_alter_empty: true
|
||||
plugin_id: dblog_operations
|
||||
filters:
|
||||
type:
|
||||
id: type
|
||||
table: watchdog
|
||||
field: type
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
operator: in
|
||||
value: { }
|
||||
group: 1
|
||||
exposed: true
|
||||
expose:
|
||||
operator_id: type_op
|
||||
label: Type
|
||||
description: ''
|
||||
use_operator: false
|
||||
operator: type_op
|
||||
identifier: type
|
||||
required: false
|
||||
remember: false
|
||||
multiple: true
|
||||
remember_roles:
|
||||
authenticated: authenticated
|
||||
anonymous: '0'
|
||||
administrator: '0'
|
||||
reduce: false
|
||||
is_grouped: false
|
||||
group_info:
|
||||
label: ''
|
||||
description: ''
|
||||
identifier: ''
|
||||
optional: true
|
||||
widget: select
|
||||
multiple: false
|
||||
remember: false
|
||||
default_group: All
|
||||
default_group_multiple: { }
|
||||
group_items: { }
|
||||
plugin_id: dblog_types
|
||||
severity:
|
||||
id: severity
|
||||
table: watchdog
|
||||
field: severity
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
operator: in
|
||||
value: { }
|
||||
group: 1
|
||||
exposed: true
|
||||
expose:
|
||||
operator_id: severity_op
|
||||
label: Severity
|
||||
description: ''
|
||||
use_operator: false
|
||||
operator: severity_op
|
||||
identifier: severity
|
||||
required: false
|
||||
remember: false
|
||||
multiple: true
|
||||
remember_roles:
|
||||
authenticated: authenticated
|
||||
anonymous: '0'
|
||||
administrator: '0'
|
||||
reduce: false
|
||||
is_grouped: false
|
||||
group_info:
|
||||
label: ''
|
||||
description: ''
|
||||
identifier: ''
|
||||
optional: true
|
||||
widget: select
|
||||
multiple: false
|
||||
remember: false
|
||||
default_group: All
|
||||
default_group_multiple: { }
|
||||
group_items: { }
|
||||
plugin_id: in_operator
|
||||
sorts:
|
||||
timestamp:
|
||||
id: timestamp
|
||||
table: watchdog
|
||||
field: timestamp
|
||||
order: DESC
|
||||
entity_type: null
|
||||
entity_field: null
|
||||
plugin_id: date
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
exposed: false
|
||||
expose:
|
||||
label: ''
|
||||
granularity: second
|
||||
title: 'Recent log messages'
|
||||
header: { }
|
||||
footer: { }
|
||||
empty:
|
||||
area:
|
||||
id: area
|
||||
table: views
|
||||
field: area
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
empty: true
|
||||
tokenize: false
|
||||
content:
|
||||
value: 'No log messages available.'
|
||||
format: basic_html
|
||||
plugin_id: text
|
||||
relationships:
|
||||
uid:
|
||||
id: uid
|
||||
table: watchdog
|
||||
field: uid
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: User
|
||||
required: false
|
||||
plugin_id: standard
|
||||
arguments: { }
|
||||
display_extenders: { }
|
||||
filter_groups:
|
||||
operator: AND
|
||||
groups:
|
||||
1: AND
|
||||
css_class: admin-dblog
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.permissions
|
||||
tags: { }
|
||||
page:
|
||||
display_plugin: page
|
||||
id: page
|
||||
display_title: Page
|
||||
position: 1
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: admin/reports/dblog
|
||||
cache_metadata:
|
||||
max-age: 0
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
- url
|
||||
- url.query_args
|
||||
- user.permissions
|
||||
tags: { }
|
|
@ -13,6 +13,7 @@ use Drupal\Core\Form\FormStateInterface;
|
|||
use Drupal\Core\Routing\RouteMatchInterface;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Drupal\views\ViewEntityInterface;
|
||||
use Drupal\views\ViewExecutable;
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
|
@ -187,3 +188,12 @@ function dblog_view_presave(ViewEntityInterface $view) {
|
|||
$view->set('display', $displays);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_pre_render().
|
||||
*/
|
||||
function dblog_views_pre_render(ViewExecutable $view) {
|
||||
if (isset($view) && ($view->storage->get('base_table') == 'watchdog')) {
|
||||
$view->element['#attached']['library'][] = 'dblog/drupal.dblog';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Post update functions for the Database Logging module.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Config\FileStorage;
|
||||
use Drupal\Core\Config\InstallStorage;
|
||||
use Drupal\views\Entity\View;
|
||||
|
||||
/**
|
||||
* Replace 'Recent log messages' with a view.
|
||||
*/
|
||||
function dblog_post_update_convert_recent_messages_to_view() {
|
||||
// Only create if the views module is enabled and the watchdog view doesn't
|
||||
// exist.
|
||||
if (\Drupal::moduleHandler()->moduleExists('views')) {
|
||||
if (!View::load('watchdog')) {
|
||||
// Save the watchdog view to config.
|
||||
$module_handler = \Drupal::moduleHandler();
|
||||
$optional_install_path = $module_handler->getModule('dblog')->getPath() . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY;
|
||||
$storage = new FileStorage($optional_install_path);
|
||||
|
||||
\Drupal::entityTypeManager()
|
||||
->getStorage('view')
|
||||
->create($storage->read('views.view.watchdog'))
|
||||
->save();
|
||||
|
||||
return t('The watchdog view has been created.');
|
||||
}
|
||||
|
||||
return t("The watchdog view already exists and was not replaced. To replace the 'Recent log messages' with a view, rename the watchdog view and uninstall and install the 'Database Log' module");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\dblog\Tests\Update;
|
||||
|
||||
use Drupal\system\Tests\Update\UpdatePathTestBase;
|
||||
|
||||
/**
|
||||
* Ensures that update hook that creates the watchdog view ran sucessfully.
|
||||
*
|
||||
* @group Update
|
||||
*/
|
||||
class DblogRecentLogsUsingViewsUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setDatabaseDumpFiles() {
|
||||
$this->databaseDumpFiles = [
|
||||
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that update hook is run for dblog module.
|
||||
*/
|
||||
public function testUpdate() {
|
||||
// Make sure the watchog view doesn't exist before the updates.
|
||||
$view = \Drupal::entityTypeManager()->getStorage('view')->load('watchdog');
|
||||
$this->assertNull($view);
|
||||
|
||||
$this->runUpdates();
|
||||
|
||||
// Ensure the watchdog view is present after run updates.
|
||||
$view = \Drupal::entityTypeManager()->getStorage('view')->load('watchdog');
|
||||
$displays = $view->get('display');
|
||||
|
||||
$this->assertIdentical($displays['page']['display_options']['path'], 'admin/reports/dblog', 'Recent logs message view exists.');
|
||||
}
|
||||
|
||||
}
|
|
@ -253,10 +253,10 @@ class DbLogTest extends BrowserTestBase {
|
|||
*/
|
||||
protected function filterLogsEntries($type = NULL, $severity = NULL) {
|
||||
$edit = [];
|
||||
if (!is_null($type)) {
|
||||
if (isset($type)) {
|
||||
$edit['type[]'] = $type;
|
||||
}
|
||||
if (!is_null($severity)) {
|
||||
if (isset($severity)) {
|
||||
$edit['severity[]'] = $severity;
|
||||
}
|
||||
$this->drupalPostForm(NULL, $edit, t('Filter'));
|
||||
|
@ -283,6 +283,12 @@ class DbLogTest extends BrowserTestBase {
|
|||
$this->assertText(t('Recent log messages'), 'DBLog report was displayed');
|
||||
}
|
||||
|
||||
$this->drupalGet('admin/reports/dblog/confirm');
|
||||
$this->assertResponse($response);
|
||||
if ($response == 200) {
|
||||
$this->assertText(t('Are you sure you want to delete the recent logs?'), 'DBLog clear logs form was displayed');
|
||||
}
|
||||
|
||||
// View the database log page-not-found report page.
|
||||
$this->drupalGet('admin/reports/page-not-found');
|
||||
$this->assertResponse($response);
|
||||
|
@ -804,7 +810,7 @@ class DbLogTest extends BrowserTestBase {
|
|||
$this->drupalGet('admin/reports/dblog');
|
||||
$this->assertResponse(200);
|
||||
// Make sure HTML tags are filtered out.
|
||||
$this->assertRaw('title="alert('foo');Lorem ipsum dolor sit amet, consectetur adipiscing & elit. Entry #0"><script>alert('foo');</script>Lorem ipsum dolor sit…</a>');
|
||||
$this->assertRaw('title="alert('foo');Lorem');
|
||||
$this->assertNoRaw("<script>alert('foo');</script>");
|
||||
|
||||
// Make sure HTML tags are filtered out in admin/reports/dblog/event/ too.
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\dblog\Functional;
|
||||
|
||||
use Drupal\filter\Entity\FilterFormat;
|
||||
|
||||
/**
|
||||
* Generate events and verify dblog entries; verify user access to log reports
|
||||
* based on permissions. Using the dblog UI generated by a View.
|
||||
*
|
||||
* @see Drupal\dblog\Tests\DbLogTest
|
||||
*
|
||||
* @group dblog
|
||||
*/
|
||||
class DbLogViewsTest extends DbLogTest {
|
||||
|
||||
/**
|
||||
* Modules to enable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $modules = ['dblog', 'node', 'forum', 'help', 'block', 'views'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getLogsEntriesTable() {
|
||||
return $this->xpath('.//table[contains(@class, "views-view-table")]/tbody/tr');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function filterLogsEntries($type = NULL, $severity = NULL) {
|
||||
$query = [];
|
||||
if (isset($type)) {
|
||||
$query['type[]'] = $type;
|
||||
}
|
||||
if (isset($severity)) {
|
||||
$query['severity[]'] = $severity;
|
||||
}
|
||||
|
||||
$this->drupalGet('admin/reports/dblog', ['query' => $query]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function testDBLogAddAndClear() {
|
||||
// Is necesary to create the basic_html format because if absent after
|
||||
// delete the logs, a new log entry is created indicating that basic_html
|
||||
// format do not exists.
|
||||
$basic_html_format = FilterFormat::create([
|
||||
'format' => 'basic_html',
|
||||
'name' => 'Basic HTML',
|
||||
'filters' => [
|
||||
'filter_html' => [
|
||||
'status' => 1,
|
||||
'settings' => [
|
||||
'allowed_html' => '<p> <br> <strong> <a> <em>',
|
||||
],
|
||||
],
|
||||
],
|
||||
]);
|
||||
$basic_html_format->save();
|
||||
|
||||
parent::testDBLogAddAndClear();
|
||||
}
|
||||
|
||||
}
|
|
@ -65,7 +65,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase {
|
|||
'user' => 7,
|
||||
'user_role' => 6,
|
||||
'menu_link_content' => 4,
|
||||
'view' => 14,
|
||||
'view' => 15,
|
||||
'date_format' => 11,
|
||||
'entity_form_display' => 19,
|
||||
'entity_form_mode' => 1,
|
||||
|
|
|
@ -66,7 +66,7 @@ class MigrateUpgrade7Test extends MigrateUpgradeTestBase {
|
|||
'user' => 4,
|
||||
'user_role' => 3,
|
||||
'menu_link_content' => 7,
|
||||
'view' => 14,
|
||||
'view' => 15,
|
||||
'date_format' => 11,
|
||||
'entity_form_display' => 18,
|
||||
'entity_form_mode' => 1,
|
||||
|
|
Loading…
Reference in New Issue