Skip to content

Commit

Permalink
Update to 'Fix not using course image resize method' update task. Non…
Browse files Browse the repository at this point in the history
… default imageresizemethod courses only.
  • Loading branch information
gjb2048 committed Sep 23, 2024
1 parent 236571c commit bfb50e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----------------------------
Expand Down
12 changes: 8 additions & 4 deletions classes/task/update_displayed_images_task.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
2 changes: 1 addition & 1 deletion db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down

0 comments on commit bfb50e5

Please sign in to comment.