From 1f303feac8524227c3953b762a17a2de52778671 Mon Sep 17 00:00:00 2001 From: Shawn Kwang Date: Wed, 13 Mar 2019 15:02:50 -0500 Subject: [PATCH] Drupal: Add new admin notification rules to boinc_standard Feature. New rules part of boinc_standard Feature. Adds new rules category for 'admin notification', and adds the two new rules to that category. --- .../boinc_standard.features.inc | 131 ++++++++++++++++++ .../boinc_standard/boinc_standard.info | 1 + 2 files changed, 132 insertions(+) diff --git a/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc b/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc index 710580b4f9..caf90b4873 100644 --- a/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc +++ b/drupal/sites/all/features/boinc_standard/boinc_standard.features.inc @@ -201,6 +201,137 @@ function boinc_standard_node_info() { function boinc_standard_rules_defaults() { return array( 'rules' => array( + 'rules_notify_admins_about_circular_merge_error' => array( + '#type' => 'rule', + '#set' => 'event_boincwork_circular_merge_error', + '#label' => 'Notify admins about circular merge error', + '#active' => 1, + '#weight' => '0', + '#categories' => array( + '0' => 'boinc_standard', + '1' => 'admin notification', + ), + '#status' => 'default', + '#conditions' => array(), + '#actions' => array( + '0' => array( + '#type' => 'action', + '#settings' => array( + 'from' => '', + 'subject' => 'Circular host merging error', + 'message' => 'User tried to merge a host (old_host) into a target host where the target host\'s rpc_seqno is equal to the old_host\'s id. + +Information about this host merge attempt: +uid); +print "Username: " . $account->boincuser_name . "\\n"; +print "BOINC id: " . $account->boincuser_id . "\\n"; +print "Drupal UID: " . $user->uid . "\\n"; +?>', + '#eval input' => array( + 'token_rules_input_evaluator' => array( + 'subject' => array( + '0' => ':global', + ), + 'message' => array( + '0' => ':global', + ), + 'from' => array( + '0' => ':global', + ), + ), + 'rules_input_evaluator_php' => array( + 'message' => array( + '0' => 'oldhost_id', + '1' => 'targethost_id', + '2' => 'user', + ), + ), + ), + ), + '#name' => 'boinccore_rules_action_mail_to_admins', + '#info' => array( + 'label' => 'Notify admins via email', + 'module' => 'BOINC core', + 'eval input' => array( + '0' => 'subject', + '1' => 'message', + '2' => 'from', + ), + ), + '#weight' => 0.0, + ), + ), + '#version' => 6003, + ), + 'rules_notify_admins_about_zombie_merge_attempt' => array( + '#type' => 'rule', + '#set' => 'event_boincwork_zombie_merge_error', + '#label' => 'Notify admins about zombie merge attempt', + '#active' => 1, + '#weight' => '0', + '#categories' => array( + '0' => 'boinc_standard', + '1' => 'admin notification', + ), + '#status' => 'default', + '#conditions' => array(), + '#actions' => array( + '0' => array( + '#type' => 'action', + '#settings' => array( + 'from' => '', + 'subject' => 'Zombie host merging error', + 'message' => 'User tried to merge a host (old_host) into a target host where the target host\'s userid is equal to 0, a zombie host. +I.e., $target_host->userid == 0 + +Information about this host merge attempt: +uid); +print "Username: " . $account->boincuser_name . "\\n"; +print "BOINC id: " . $account->boincuser_id . "\\n"; +print "Drupal UID: " . $user->uid . "\\n"; +?>', + '#eval input' => array( + 'token_rules_input_evaluator' => array( + 'subject' => array( + '0' => ':global', + ), + 'message' => array( + '0' => ':global', + ), + 'from' => array( + '0' => ':global', + ), + ), + 'rules_input_evaluator_php' => array( + 'message' => array( + '0' => 'oldhost_id', + '1' => 'targethost_id', + '2' => 'user', + ), + ), + ), + ), + '#name' => 'boinccore_rules_action_mail_to_admins', + '#info' => array( + 'label' => 'Notify admins via email', + 'module' => 'BOINC core', + 'eval input' => array( + '0' => 'subject', + '1' => 'message', + '2' => 'from', + ), + ), + '#weight' => 0.0, + ), + ), + '#version' => 6003, + ), 'rules_comment_converted_to_new_forum_topic_by_moderator_or_admin' => array( '#type' => 'rule', '#set' => 'event_boinccore_comment_convert', diff --git a/drupal/sites/all/features/boinc_standard/boinc_standard.info b/drupal/sites/all/features/boinc_standard/boinc_standard.info index b4c33314ba..86c3a8f549 100644 --- a/drupal/sites/all/features/boinc_standard/boinc_standard.info +++ b/drupal/sites/all/features/boinc_standard/boinc_standard.info @@ -95,6 +95,7 @@ features[role_export][] = "community_member" features[role_export][] = "content_editor" features[role_export][] = "verified_contributor" features[rules_categories][] = "moderator notification" +features[rules_categories][] = "admin notification" features[user_permission][] = "Use PHP input for field settings (dangerous - grant with care)" features[user_permission][] = "access administration pages" features[user_permission][] = "access all views"