Problem/Motivation

Part of #2847428: [Meta] Modernize dblog module.

The dblog.admin.inc file contains only a function that could be incorporated into another class. That will allow us to delete the necessity of having an extra file and also override the functionality of dblog_filters by extending the class (Related to #582622: provide hook for dblog_filters.

Proposed resolution

Move dblog_filters into a method of another class. The first candidate is DblogFilterForm.

Remaining tasks

User interface changes

None

API changes

dblog_filters is deprecated.

Data model changes

None

Comments

dagmar created an issue. See original summary.

dagmar’s picture

Status: Active » Needs review
StatusFileSize
new4.41 KB

An initial patch to discuss the approach.

Status: Needs review » Needs work

The last submitted patch, 2: 2852990-2.patch, failed testing.

dagmar’s picture

Status: Needs work » Needs review
StatusFileSize
new4.4 KB
new1.27 KB
daffie’s picture

@dagmar: I think that we can just deprecated the dblog_filters() function and not change its code. We can then change the way we want to filter the dblogs. Like you want to do in #2458191-67: Provide a storage backend for dblog module. So do not do this:

+++ b/core/modules/dblog/dblog.admin.inc
@@ -19,25 +20,5 @@
-  $filters = array();
-
-  foreach (_dblog_get_message_types() as $type) {
-    $types[$type] = t($type);
-  }
-
-  if (!empty($types)) {
-    $filters['type'] = array(
-      'title' => t('Type'),
-      'where' => "w.type = ?",
-      'options' => $types,
-    );
-  }
-
-  $filters['severity'] = array(
-    'title' => t('Severity'),
-    'where' => 'w.severity = ?',
-    'options' => RfcLogLevel::getLevels(),
-  );
-
-  return $filters;
+  return \Drupal\dblog\Form\DblogFilterForm::logFilters();

Edit: If you change what the function returns it will be a BC break.

Pavan B S’s picture

StatusFileSize
new3.84 KB
new1.79 KB
+++ b/core/modules/dblog/dblog.admin.inc
@@ -5,11 +5,12 @@
+ * @deprecated in Drupal 8.4.x and will be removed before 9.0.0. Use
+ *   Drupal\dblog\Form\DblogFilterForm::logFilters() instead.
...
@@ -19,25 +20,5 @@

+++ b/core/modules/dblog/src/Form/DblogFilterForm.php
@@ -93,4 +94,39 @@ public function resetForm(array &$form, FormStateInterface $form_state) {
+   *   element names for the filters, and the values are arrays with the following

Line exceeding 80 characters
Applying the patch for the comment # 5 and also there was a minor error of one line. Please verify the patch.

Status: Needs review » Needs work

The last submitted patch, 6: 2852990-6.patch, failed testing.

gaurav.kapoor’s picture

Status: Needs work » Needs review
StatusFileSize
new3.79 KB

Status: Needs review » Needs work

The last submitted patch, 8: drupal-deprecate_db_log-filter-2852990-8.patch, failed testing.

gaurav.kapoor’s picture

Status: Needs work » Needs review
StatusFileSize
new3.61 KB

Combining all the suggestions.

Status: Needs review » Needs work

The last submitted patch, 10: drupal-deprecate_db_log-filters-2852990-10.patch, failed testing.

jofitz’s picture

Status: Needs work » Needs review
StatusFileSize
new3.59 KB

Re-rolled.

Status: Needs review » Needs work

The last submitted patch, 12: drupal-deprecate_db_log-filters-2852990-12.patch, failed testing.

dagmar’s picture

Status: Needs work » Postponed

Thanks everyone!.

As @daffie said:

I think that we can just deprecated the dblog_filters() function and not change its code

If you take a look to my comment on #2458191-67: Provide a storage backend for dblog module we need first to determinate what parameters will receive the loadMultiple method.

If you want to help move forward the dblog modernization (#2847428: [Meta] Modernize dblog module), help reviewing this issue #2851293: dblog is using the wrong views field, filter and relationships definitions which is blocking almost everything related dblog.

dawehner’s picture

Status: Postponed » Needs review
+++ b/core/modules/dblog/dblog.admin.inc
@@ -5,11 +5,12 @@
  * Creates a list of database log administration filters that can be applied.
  *
+ * @deprecated in Drupal 8.4.x and will be removed before 9.0.0. Use
+ *   Drupal\dblog\Form\DblogFilterForm::logFilters() instead.
+ *

This could use trigger_error now, see #2575081: [policy, no patch] Use E_USER_DEPRECATED in Drupal 8 minor releases

dagmar’s picture

Status: Needs review » Postponed

Thanks @dawehner. We cannot deprecate a function that we are still using in core. As I said, this is blocked until we have a review on #2851293: dblog is using the wrong views field, filter and relationships definitions which unblocks #2458191: Provide a storage backend for dblog module

dawehner’s picture

OH sorry, I didn't meant it to set it to needs review.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

feuerwagen’s picture

Issue summary: View changes

Postponed now on #2401463: Make dblog entities I guess.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

nicxvan’s picture

This is now a duplicate #3560398: Move _dblog_get_message_types and dblog_filters to a DbLogFilters service and deprecate them.

Typically we keep the older issue but the other is rtbc already, not sure how I missed this.

I took care of credits too.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.