Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Adhoc task failed: mod_cms\task\update_files_context,Class 'csv_export_writer' not found #140

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = 2024090304;
$plugin->version = 2024090305;
$plugin->requires = 2020061500; // Moodle 3.9.0 and above.
$plugin->supported = [39, 401]; // Moodle 3.9 to 4.1 inclusive.
$plugin->component = 'mod_cms';
Expand Down
Loading