Skip to content

Instantly share code, notes, and snippets.

@mudrd8mz
Created October 15, 2019 18:52
Show Gist options
  • Save mudrd8mz/14f1a8144dbd9cc8d9357300c42ca985 to your computer and use it in GitHub Desktop.
Save mudrd8mz/14f1a8144dbd9cc8d9357300c42ca985 to your computer and use it in GitHub Desktop.
// ...
$done = 0;
foreach ($courses as $course) {
if ($options['skip-recycle-bin']) {
// This is a hack, we pretend to be executed by the restore process
// so that the recycle bin hook is skipped.
$course->deletesource = 'restore';
}
if (!delete_course($course, false)) {
throw new moodle_exception('cannotdeletecategorycourse', '', '', $course->shortname);
}
$done++;
cli_write("\r".$done."/".$count." (".floor($done / $count * 100)."%) ");
}
cli_writeln("done!");
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment