From 2dd3792ae6545c7f7f7c00e33cd001c6bc73c398 Mon Sep 17 00:00:00 2001 From: Kevin Pham Date: Wed, 19 Jan 2022 22:52:11 +1100 Subject: [PATCH] [#164] Fix Unexpected Moodle Internal errors/warnings in CI --- classes/event_processor.php | 2 -- classes/helper/datafield_manager.php | 2 -- classes/helper/processor_helper.php | 2 -- classes/json/json_export.php | 2 -- classes/learn_process.php | 1 - classes/output/manageworkflows/renderer.php | 2 -- classes/privacy/provider.php | 2 -- classes/steps/actions/assign_cohort_action_step.php | 4 ++-- classes/steps/actions/base_action_step.php | 2 -- classes/steps/actions/email_action_step.php | 2 -- classes/steps/actions/http_post_action_step.php | 2 -- classes/steps/actions/logdump_action_step.php | 2 -- classes/steps/actions/role_assign_action_step.php | 2 -- classes/steps/actions/role_unassign_action_step.php | 2 -- classes/steps/actions/roles_unassign_action_step.php | 2 -- classes/steps/base/base_step.php | 2 -- classes/steps/debounce/debounce_step.php | 2 -- classes/steps/filters/base_filter_step.php | 2 -- classes/steps/filters/fail_filter_step.php | 2 -- classes/steps/filters/numcompare_filter_step.php | 2 -- classes/steps/filters/stringcompare_filter_step.php | 2 -- classes/steps/lookups/base_lookup_step.php | 2 -- classes/steps/lookups/cohort_lookup_step.php | 5 ++--- classes/steps/lookups/course_cat_lookup_step.php | 2 -- classes/steps/lookups/course_lookup_step.php | 2 -- classes/steps/lookups/roles_lookup_step.php | 2 -- classes/task/cleanup.php | 1 - classes/task/cleanup_history.php | 1 - classes/task/learn.php | 1 - classes/task/process_workflows.php | 1 - classes/task/update_trigger_helper_task.php | 2 -- classes/workflow.php | 2 -- classes/workflow_manager.php | 2 -- classes/workflow_process.php | 2 -- db/install.php | 2 -- db/upgrade.php | 2 -- lib.php | 2 -- tests/privacy_test.php | 2 -- 38 files changed, 4 insertions(+), 72 deletions(-) diff --git a/classes/event_processor.php b/classes/event_processor.php index 00c2f71..de8ee77 100644 --- a/classes/event_processor.php +++ b/classes/event_processor.php @@ -27,8 +27,6 @@ use tool_trigger\helper\processor_helper; use tool_trigger\task\process_workflows; -defined('MOODLE_INTERNAL') || die(); - /** * Process trigger system events. * diff --git a/classes/helper/datafield_manager.php b/classes/helper/datafield_manager.php index 38814a5..667e305 100644 --- a/classes/helper/datafield_manager.php +++ b/classes/helper/datafield_manager.php @@ -25,8 +25,6 @@ namespace tool_trigger\helper; -defined('MOODLE_INTERNAL') || die; - /** * A lookup step that takes a user's ID and adds standard data about the * user. diff --git a/classes/helper/processor_helper.php b/classes/helper/processor_helper.php index a602c35..ca404ca 100644 --- a/classes/helper/processor_helper.php +++ b/classes/helper/processor_helper.php @@ -25,8 +25,6 @@ namespace tool_trigger\helper; -defined('MOODLE_INTERNAL') || die(); - trait processor_helper { /** diff --git a/classes/json/json_export.php b/classes/json/json_export.php index f62e7d8..1971fc7 100644 --- a/classes/json/json_export.php +++ b/classes/json/json_export.php @@ -24,8 +24,6 @@ namespace tool_trigger\json; -defined('MOODLE_INTERNAL') || die(); - /** * Process trigger system events. * diff --git a/classes/learn_process.php b/classes/learn_process.php index 15e300e..9d11b9a 100644 --- a/classes/learn_process.php +++ b/classes/learn_process.php @@ -23,7 +23,6 @@ */ namespace tool_trigger; -defined('MOODLE_INTERNAL') || die(); /** * Process learnt events. * diff --git a/classes/output/manageworkflows/renderer.php b/classes/output/manageworkflows/renderer.php index 603ddb2..7741dfb 100644 --- a/classes/output/manageworkflows/renderer.php +++ b/classes/output/manageworkflows/renderer.php @@ -24,8 +24,6 @@ namespace tool_trigger\output\manageworkflows; -defined('MOODLE_INTERNAL') || die; - /** * Renderer class for manage rules page. * diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 310526c..fcaf22a 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -24,8 +24,6 @@ */ namespace tool_trigger\privacy; -defined('MOODLE_INTERNAL') || die(); - use core_privacy\local\metadata\collection; use core_privacy\local\request\contextlist; use core_privacy\local\request\approved_contextlist; diff --git a/classes/steps/actions/assign_cohort_action_step.php b/classes/steps/actions/assign_cohort_action_step.php index c920747..faff968 100644 --- a/classes/steps/actions/assign_cohort_action_step.php +++ b/classes/steps/actions/assign_cohort_action_step.php @@ -27,8 +27,8 @@ defined('MOODLE_INTERNAL') || die; require_once($CFG->dirroot.'/cohort/lib.php'); -class assign_cohort_action_step extends base_action_step -{ +class assign_cohort_action_step extends base_action_step { + use \tool_trigger\helper\datafield_manager; diff --git a/classes/steps/actions/base_action_step.php b/classes/steps/actions/base_action_step.php index 0718dff..bb8a5c5 100644 --- a/classes/steps/actions/base_action_step.php +++ b/classes/steps/actions/base_action_step.php @@ -29,8 +29,6 @@ use tool_trigger\steps\base\base_step; -defined('MOODLE_INTERNAL') || die; - /** * Base action step class. * diff --git a/classes/steps/actions/email_action_step.php b/classes/steps/actions/email_action_step.php index b68bc8a..1ccdb9c 100644 --- a/classes/steps/actions/email_action_step.php +++ b/classes/steps/actions/email_action_step.php @@ -25,8 +25,6 @@ namespace tool_trigger\steps\actions; -defined('MOODLE_INTERNAL') || die; - /** * email action step class. * diff --git a/classes/steps/actions/http_post_action_step.php b/classes/steps/actions/http_post_action_step.php index b802b11..aca43c0 100644 --- a/classes/steps/actions/http_post_action_step.php +++ b/classes/steps/actions/http_post_action_step.php @@ -24,8 +24,6 @@ namespace tool_trigger\steps\actions; -defined('MOODLE_INTERNAL') || die; - /** * HTTP Post action step class. * diff --git a/classes/steps/actions/logdump_action_step.php b/classes/steps/actions/logdump_action_step.php index 216b50f..4c2f009 100644 --- a/classes/steps/actions/logdump_action_step.php +++ b/classes/steps/actions/logdump_action_step.php @@ -16,8 +16,6 @@ namespace tool_trigger\steps\actions; -defined('MOODLE_INTERNAL') || die; - /** * Action step that just does a var_dump to the logs. * diff --git a/classes/steps/actions/role_assign_action_step.php b/classes/steps/actions/role_assign_action_step.php index 3136308..8df3caa 100644 --- a/classes/steps/actions/role_assign_action_step.php +++ b/classes/steps/actions/role_assign_action_step.php @@ -24,8 +24,6 @@ namespace tool_trigger\steps\actions; -defined('MOODLE_INTERNAL') || die; - class role_assign_action_step extends base_action_step { use \tool_trigger\helper\datafield_manager; diff --git a/classes/steps/actions/role_unassign_action_step.php b/classes/steps/actions/role_unassign_action_step.php index e7e4fd9..7d18110 100644 --- a/classes/steps/actions/role_unassign_action_step.php +++ b/classes/steps/actions/role_unassign_action_step.php @@ -25,8 +25,6 @@ namespace tool_trigger\steps\actions; -defined('MOODLE_INTERNAL') || die; - class role_unassign_action_step extends base_action_step { use \tool_trigger\helper\datafield_manager; diff --git a/classes/steps/actions/roles_unassign_action_step.php b/classes/steps/actions/roles_unassign_action_step.php index c9b5dd8..0c17d2a 100644 --- a/classes/steps/actions/roles_unassign_action_step.php +++ b/classes/steps/actions/roles_unassign_action_step.php @@ -24,8 +24,6 @@ namespace tool_trigger\steps\actions; -defined('MOODLE_INTERNAL') || die; - /** * HTTP Post action step class. * diff --git a/classes/steps/base/base_step.php b/classes/steps/base/base_step.php index eadc93d..1e0a629 100644 --- a/classes/steps/base/base_step.php +++ b/classes/steps/base/base_step.php @@ -24,8 +24,6 @@ namespace tool_trigger\steps\base; -defined('MOODLE_INTERNAL') || die; - /** * Base step class. * diff --git a/classes/steps/debounce/debounce_step.php b/classes/steps/debounce/debounce_step.php index e08f019..dbca148 100644 --- a/classes/steps/debounce/debounce_step.php +++ b/classes/steps/debounce/debounce_step.php @@ -31,8 +31,6 @@ use xmldb_table; use xmldb_field; -defined('MOODLE_INTERNAL') || die; - /** * Debounce step class. * diff --git a/classes/steps/filters/base_filter_step.php b/classes/steps/filters/base_filter_step.php index 7d8f4ab..0f84804 100644 --- a/classes/steps/filters/base_filter_step.php +++ b/classes/steps/filters/base_filter_step.php @@ -29,8 +29,6 @@ use tool_trigger\steps\base\base_step; -defined('MOODLE_INTERNAL') || die; - /** * Base filter step class. * diff --git a/classes/steps/filters/fail_filter_step.php b/classes/steps/filters/fail_filter_step.php index ad6284d..75a8d9a 100644 --- a/classes/steps/filters/fail_filter_step.php +++ b/classes/steps/filters/fail_filter_step.php @@ -27,8 +27,6 @@ namespace tool_trigger\steps\filters; -defined('MOODLE_INTERNAL') || die; - /** * Fail filter step class. * diff --git a/classes/steps/filters/numcompare_filter_step.php b/classes/steps/filters/numcompare_filter_step.php index e21cc13..62aa1fc 100644 --- a/classes/steps/filters/numcompare_filter_step.php +++ b/classes/steps/filters/numcompare_filter_step.php @@ -27,8 +27,6 @@ namespace tool_trigger\steps\filters; -defined('MOODLE_INTERNAL') || die; - /** * Base filter step class. * diff --git a/classes/steps/filters/stringcompare_filter_step.php b/classes/steps/filters/stringcompare_filter_step.php index 29267c6..85bf557 100644 --- a/classes/steps/filters/stringcompare_filter_step.php +++ b/classes/steps/filters/stringcompare_filter_step.php @@ -27,8 +27,6 @@ namespace tool_trigger\steps\filters; -defined('MOODLE_INTERNAL') || die; - /** * Base filter step class. * diff --git a/classes/steps/lookups/base_lookup_step.php b/classes/steps/lookups/base_lookup_step.php index 4fc328f..abd40f5 100644 --- a/classes/steps/lookups/base_lookup_step.php +++ b/classes/steps/lookups/base_lookup_step.php @@ -30,8 +30,6 @@ use tool_trigger\steps\base\base_step; -defined('MOODLE_INTERNAL') || die; - /** * Base lookup step class. * diff --git a/classes/steps/lookups/cohort_lookup_step.php b/classes/steps/lookups/cohort_lookup_step.php index 97d0ad9..483076f 100644 --- a/classes/steps/lookups/cohort_lookup_step.php +++ b/classes/steps/lookups/cohort_lookup_step.php @@ -16,7 +16,6 @@ namespace tool_trigger\steps\lookups; -defined('MOODLE_INTERNAL') || die; /** * A lookup step that takes a user's ID and returns a string of * all the cohorts that the user is currently assigned to @@ -26,8 +25,8 @@ * @copyright Catalyst IT, 2018 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class cohort_lookup_step extends base_lookup_step -{ +class cohort_lookup_step extends base_lookup_step { + use \tool_trigger\helper\datafield_manager; diff --git a/classes/steps/lookups/course_cat_lookup_step.php b/classes/steps/lookups/course_cat_lookup_step.php index aeafb0f..a50cab0 100644 --- a/classes/steps/lookups/course_cat_lookup_step.php +++ b/classes/steps/lookups/course_cat_lookup_step.php @@ -16,8 +16,6 @@ namespace tool_trigger\steps\lookups; -defined('MOODLE_INTERNAL') || die; - /** * A lookup step that takes a category ID and adds all data about the category. * diff --git a/classes/steps/lookups/course_lookup_step.php b/classes/steps/lookups/course_lookup_step.php index bffba3d..1b3f324 100644 --- a/classes/steps/lookups/course_lookup_step.php +++ b/classes/steps/lookups/course_lookup_step.php @@ -16,8 +16,6 @@ namespace tool_trigger\steps\lookups; -defined('MOODLE_INTERNAL') || die; - /** * A lookup step that takes a course's ID and adds standard data about the * course. diff --git a/classes/steps/lookups/roles_lookup_step.php b/classes/steps/lookups/roles_lookup_step.php index c85f7ce..9c5394e 100644 --- a/classes/steps/lookups/roles_lookup_step.php +++ b/classes/steps/lookups/roles_lookup_step.php @@ -16,8 +16,6 @@ namespace tool_trigger\steps\lookups; -defined('MOODLE_INTERNAL') || die; - /** * A lookup step that takes a user's ID and adds roles of the user. * diff --git a/classes/task/cleanup.php b/classes/task/cleanup.php index e53ed39..6de5e12 100644 --- a/classes/task/cleanup.php +++ b/classes/task/cleanup.php @@ -25,7 +25,6 @@ namespace tool_trigger\task; -defined('MOODLE_INTERNAL') || die(); /** * Task to cleanup old queue. */ diff --git a/classes/task/cleanup_history.php b/classes/task/cleanup_history.php index 264de28..0f9d6d4 100644 --- a/classes/task/cleanup_history.php +++ b/classes/task/cleanup_history.php @@ -25,7 +25,6 @@ namespace tool_trigger\task; -defined('MOODLE_INTERNAL') || die(); /** * Task to cleanup old queue. */ diff --git a/classes/task/learn.php b/classes/task/learn.php index 2afb7ba..7698c10 100644 --- a/classes/task/learn.php +++ b/classes/task/learn.php @@ -24,7 +24,6 @@ namespace tool_trigger\task; -defined('MOODLE_INTERNAL') || die(); /** * Task to learn from processed events. */ diff --git a/classes/task/process_workflows.php b/classes/task/process_workflows.php index 019dbd0..1809383 100644 --- a/classes/task/process_workflows.php +++ b/classes/task/process_workflows.php @@ -26,7 +26,6 @@ use tool_trigger\helper\processor_helper; -defined('MOODLE_INTERNAL') || die(); /** * Simple task to rocess queued workflows. */ diff --git a/classes/task/update_trigger_helper_task.php b/classes/task/update_trigger_helper_task.php index 650422c..e1a3ff3 100644 --- a/classes/task/update_trigger_helper_task.php +++ b/classes/task/update_trigger_helper_task.php @@ -25,8 +25,6 @@ namespace tool_trigger\task; -defined('MOODLE_INTERNAL') || die(); - /** * Helper task to offload upgrade processing diff --git a/classes/workflow.php b/classes/workflow.php index 176474d..b5adbff 100644 --- a/classes/workflow.php +++ b/classes/workflow.php @@ -24,8 +24,6 @@ namespace tool_trigger; -defined('MOODLE_INTERNAL') || die(); - /** * Worklfow class. * diff --git a/classes/workflow_manager.php b/classes/workflow_manager.php index 1e84012..69dd2fb 100644 --- a/classes/workflow_manager.php +++ b/classes/workflow_manager.php @@ -24,8 +24,6 @@ namespace tool_trigger; -defined('MOODLE_INTERNAL') || die(); - /** * Workflow manager class. * diff --git a/classes/workflow_process.php b/classes/workflow_process.php index a7ac552..66228c0 100644 --- a/classes/workflow_process.php +++ b/classes/workflow_process.php @@ -24,8 +24,6 @@ namespace tool_trigger; -defined('MOODLE_INTERNAL') || die(); - /** * Process workflow form. * diff --git a/db/install.php b/db/install.php index adf4ca2..1a77f17 100644 --- a/db/install.php +++ b/db/install.php @@ -23,8 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die; - /** * Add events fields from fixture file to database. */ diff --git a/db/upgrade.php b/db/upgrade.php index 7a0066c..1cf5bfb 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -23,8 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); - /** * Upgrade the plugin. * diff --git a/lib.php b/lib.php index 0deabb9..09e496e 100644 --- a/lib.php +++ b/lib.php @@ -25,8 +25,6 @@ use tool_trigger\steps\base\base_form; use tool_trigger\import_form; -defined('MOODLE_INTERNAL') || die; - /** * Renders the top part of the "new workflow step" modal form. (The part with * the "Step type" and "Step" menus. diff --git a/tests/privacy_test.php b/tests/privacy_test.php index 44f8411..3d2fb9e 100644 --- a/tests/privacy_test.php +++ b/tests/privacy_test.php @@ -23,8 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -defined('MOODLE_INTERNAL') || die(); - use \tool_trigger\privacy\provider; use \core_privacy\local\request\approved_contextlist; use \core_privacy\local\request\approved_userlist;