diff --git a/Changes.md b/Changes.md index 62ddf446..dc022bf9 100644 --- a/Changes.md +++ b/Changes.md @@ -5,6 +5,7 @@ Version 401.2.5 - ---------------------------- 1. Fix section zero showing after section on single section page. This has caused the removal of 'sectionzeroingrid' setting. If you want this functionality, please upgrade to the M4.4+ version. +2. Update to 'Fix not using course image resize method' update task. Version 401.2.4 - 21/09/2024 ---------------------------- diff --git a/classes/task/update_displayed_images_task.php b/classes/task/update_displayed_images_task.php index 4c0dbf68..2fcb4e2b 100644 --- a/classes/task/update_displayed_images_task.php +++ b/classes/task/update_displayed_images_task.php @@ -41,15 +41,19 @@ class update_displayed_images_task { /** * Queue the tasks for each grid format course. */ - public static function update_displayed_images() { + public static function update_displayed_images_imageresizemethod() { global $DB; $gridcourses = $DB->get_records('course', ['format' => 'grid'], '', 'id'); foreach ($gridcourses as $gridcourse) { - $task = new update_displayed_images_adhoc(); - $task->set_custom_data($gridcourse->id); - \core\task\manager::queue_adhoc_task($task); + $format = course_get_format($gridcourse->id); + $imageresizemethod = $format->get_format_options()['imageresizemethod']; + if ($imageresizemethod != 0) { + $task = new update_displayed_images_adhoc(); + $task->set_custom_data($gridcourse->id); + \core\task\manager::queue_adhoc_task($task); + } } } } diff --git a/db/upgrade.php b/db/upgrade.php index e201beb0..ae6defce 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -195,7 +195,7 @@ function xmldb_format_grid_upgrade($oldversion = 0) { $codebase = get_config('format_grid', 'codebase'); if ((empty($codebase)) || ((!empty($codebase)) && ($codebase < 2024090700))) { // No! - \format_grid\task\update_displayed_images_task::update_displayed_images(); + \format_grid\task\update_displayed_images_task::update_displayed_images_imageresizemethod(); set_config('codebase', 2024090700, 'format_grid'); }