diff --git a/CHANGES.md b/CHANGES.md index 6e6d383..0d0f51b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2023-10-14 - Make codechecker happy again * 2023-10-10 - Updated Moodle Plugin CI to latest upstream recommendations * 2023-04-30 - Tests: Updated Moodle Plugin CI to use PHP 8.1 and Postgres 13 from Moodle 4.1 on. diff --git a/classes/event/courses_sorted.php b/classes/event/courses_sorted.php index 1058fe6..2053a96 100644 --- a/classes/event/courses_sorted.php +++ b/classes/event/courses_sorted.php @@ -70,6 +70,6 @@ public function get_description() { * @return \moodle_url */ public function get_url() { - return new \moodle_url('/course/index.php', array('categoryid' => $this->objectid)); + return new \moodle_url('/course/index.php', ['categoryid' => $this->objectid]); } } diff --git a/db/events.php b/db/events.php index d0e9049..c0ecad1 100644 --- a/db/events.php +++ b/db/events.php @@ -24,15 +24,15 @@ defined('MOODLE_INTERNAL') || die(); -$observers = array( - array( +$observers = [ + [ 'eventname' => '\core\event\course_created', 'includefile' => '/local/resort_courses/locallib.php', 'callback' => 'resort_course_eventhandler', - ), - array( + ], + [ 'eventname' => '\core\event\course_updated', 'includefile' => '/local/resort_courses/locallib.php', 'callback' => 'resort_course_eventhandler', - ), -); + ], +]; diff --git a/db/tasks.php b/db/tasks.php index dcdc9b5..368c9a6 100644 --- a/db/tasks.php +++ b/db/tasks.php @@ -24,8 +24,8 @@ defined('MOODLE_INTERNAL') || die(); -$tasks = array( - array( +$tasks = [ + [ 'classname' => 'local_resort_courses\task\resort_courses', 'blocking' => 0, 'minute' => '0', @@ -33,6 +33,6 @@ 'day' => '*', 'month' => '*', 'dayofweek' => '0', - 'disabled' => 1 - ) -); + 'disabled' => 1, + ], +]; diff --git a/locallib.php b/locallib.php index 991f994..992067c 100644 --- a/locallib.php +++ b/locallib.php @@ -57,7 +57,7 @@ function resort_course_eventhandler($eventdata) { } // Get category. - $category = $DB->get_record('course_categories', array('id' => $eventcourse->category)); + $category = $DB->get_record('course_categories', ['id' => $eventcourse->category]); if (!$category) { // Now we have an error, but if we return false, the event will stay in the event queue. // Let's return and leave the category unsorted. @@ -178,7 +178,7 @@ function resort_course_category($category, $cronrunning = false) { // Do the resorting. $i = 1; foreach ($courses as $course) { - $DB->set_field('course', 'sortorder', $category->sortorder + $i, array('id' => $course->id)); + $DB->set_field('course', 'sortorder', $category->sortorder + $i, ['id' => $course->id]); $i++; } @@ -187,13 +187,13 @@ function resort_course_category($category, $cronrunning = false) { cache_helper::purge_by_event('changesincourse'); // Log the event. - $logevent = \local_resort_courses\event\courses_sorted::create(array( + $logevent = \local_resort_courses\event\courses_sorted::create([ 'objectid' => $category->id, 'context' => context_coursecat::instance($category->id), - 'other' => array( + 'other' => [ 'cronrunning' => $cronrunning, - ) - )); + ], + ]); $logevent->trigger(); } diff --git a/settings.php b/settings.php index da4cbc2..df2ab58 100644 --- a/settings.php +++ b/settings.php @@ -67,7 +67,7 @@ $page->add(new admin_setting_configmultiselect('local_resort_courses/skipcategories', get_string('skipcategories', 'local_resort_courses', null, true), get_string('skipcategories_desc', 'local_resort_courses', null, true), - array(), + [], $categories)); // Create skip categories recursively widget.