Skip to content

Commit

Permalink
Non default imageresizemethod courses only.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 22, 2024
1 parent 7657b28 commit 6b8a3c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
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 @@ -216,7 +216,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 6b8a3c1

Please sign in to comment.