Skip to content

Commit c4971ef

Browse files
FragoniteTomoTsuyuki
authored andcommitted
Fix Adhoc task failed: mod_cms\task\update_files_context,Class 'csv_export_writer' not found
1 parent 878ad9f commit c4971ef

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

classes/task/update_files_context.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ public function execute(): void {
6161
* @return csv_export_writer The CSV export writer containing the results of the task.
6262
*/
6363
private static function update_contexts(?int $courseid, bool $dryrun): csv_export_writer {
64-
global $DB;
64+
global $CFG, $DB;
65+
66+
require_once($CFG->libdir . '/csvlib.class.php');
6567

6668
$sql = "SELECT f.*, ctx.id AS ctxid, cms.course AS courseid
6769
FROM {files} f

db/upgrade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,12 @@ function xmldb_cms_upgrade($oldversion) {
413413
upgrade_mod_savepoint(true, 2024090303, 'cms');
414414
}
415415

416-
if ($oldversion < 2024090304) {
416+
if ($oldversion < 2024090305) {
417417
// Run ad hoc task for updating contextid in the files table.
418418
$task = \mod_cms\task\update_files_context::instance(null, false);
419419
manager::queue_adhoc_task($task);
420420

421-
upgrade_mod_savepoint(true, 2024090304, 'cms');
421+
upgrade_mod_savepoint(true, 2024090305, 'cms');
422422
}
423423

424424
return true;

version.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
defined('MOODLE_INTERNAL') || die();
2727

28-
$plugin->version = 2024090303;
28+
$plugin->version = 2024090305;
2929
$plugin->requires = 2022112800; // Moodle 4.1 and above.
3030
$plugin->supported = [401, 401]; // Moodle 4.1.
3131
$plugin->component = 'mod_cms';

0 commit comments

Comments
 (0)