Skip to content

Commit

Permalink
Fix Adhoc task failed: mod_cms\task\update_files_context,Class 'csv_e…
Browse files Browse the repository at this point in the history
…xport_writer' not found
  • Loading branch information
Fragonite authored and TomoTsuyuki committed Dec 2, 2024
1 parent 878ad9f commit c4971ef
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion classes/task/update_files_context.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ public function execute(): void {
* @return csv_export_writer The CSV export writer containing the results of the task.
*/
private static function update_contexts(?int $courseid, bool $dryrun): csv_export_writer {
global $DB;
global $CFG, $DB;

require_once($CFG->libdir . '/csvlib.class.php');

$sql = "SELECT f.*, ctx.id AS ctxid, cms.course AS courseid
FROM {files} f
Expand Down
4 changes: 2 additions & 2 deletions db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,12 @@ function xmldb_cms_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2024090303, 'cms');
}

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

upgrade_mod_savepoint(true, 2024090304, 'cms');
upgrade_mod_savepoint(true, 2024090305, 'cms');
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

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

$plugin->version = 2024090303;
$plugin->version = 2024090305;
$plugin->requires = 2022112800; // Moodle 4.1 and above.
$plugin->supported = [401, 401]; // Moodle 4.1.
$plugin->component = 'mod_cms';
Expand Down

0 comments on commit c4971ef

Please sign in to comment.