Skip to content

Commit

Permalink
Issue #2912540 by Jon Pugh, colan, helmo: Add the ALL type to get any…
Browse files Browse the repository at this point in the history
… log message
  • Loading branch information
helmo committed Jul 12, 2018
1 parent 8b198de commit e8fb753
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hosting.module
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions task/hosting_task.module
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e8fb753

Please sign in to comment.