From e8fb7535e97df1ad1cdb63e4911083ee4be8727f Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Thu, 12 Jul 2018 16:55:31 +0200 Subject: [PATCH] Issue #2912540 by Jon Pugh, colan, helmo: Add the ALL type to get any log message --- hosting.module | 2 +- task/hosting_task.module | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hosting.module b/hosting.module index 9f376d12..b9635993 100644 --- a/hosting.module +++ b/hosting.module @@ -1335,7 +1335,7 @@ function hosting_settings($form, &$form_state) { $form['hosting_task_logs_types_display'] = array( '#type' => 'textarea', '#title' => t('Task Logs to Display'), - '#description' => t('Enter the types of logs you wish to show to the user, separated by spaces. Available log types are: %types', array( + '#description' => t('Enter the types of logs you wish to show to the user, separated by spaces. Use the special type "ALL" to get any type. Available log types are: %types', array( '%types' => $types, )), '#rows' => 2, diff --git a/task/hosting_task.module b/task/hosting_task.module index 69ef2eec..bda02efd 100644 --- a/task/hosting_task.module +++ b/task/hosting_task.module @@ -1241,9 +1241,18 @@ function hosting_task_view($node, $view_mode, $langcode = NULL) { */ function _hosting_task_log_table($node, $last_position = 0) { - $types = explode(' ', variable_get('hosting_task_logs_types_display', 'error warning info message ok status success warning')); + $query_args = array(':vid' => $node->vid, ':lid' => $last_position); - $result = db_query("SELECT * FROM {hosting_task_log} WHERE vid = :vid AND lid > :lid AND type IN (:types) ORDER BY lid", array(':vid' => $node->vid, ':lid' => $last_position, ':types' => $types)); + $types_string = variable_get('hosting_task_logs_types_display', 'error warning info message ok status success warning'); + if ($types_string == 'ALL') { + $type_query = ""; + } + else { + $type_query = "AND type IN (:types)"; + $query_args[':types'] = explode(' ', $types_string); + } + + $result = db_query("SELECT * FROM {hosting_task_log} WHERE vid = :vid AND lid > :lid $type_query ORDER BY lid", $query_args); if ($result) { $headers = array('data' => 'Log message', 'execution_time' => 'Execution time', ''); $rows = array();