Function: backupCourse()
function backupCourse(
context,
siteUrl,
courseId,
destDir,
__namedParameters?
): Promise<{
changed: string;
file: DownloadedFile;
}>;
Defined in: areas/backup/backup.ts:265
Backs a course up to a .mbz file, through Moodle's backup wizard (initial settings, schema,
confirmation), and downloads it into destDir. Without users' data unless withUsers, which
needs moodle/backup:userinfo (anonymize makes their names anonymous). An asynchronous backup
is waited for up to timeoutMs (ten minutes). Moodle keeps the file in the course's or the
person's backup area too.
With sections (section ids) or activities (course module ids: activities and resources), only
those go in: a section with everything in it, an activity alone (with its section's name, which
Moodle needs for it). A selection never carries people's data, nor what belongs to the course
rather than to its content (blocks, filters, badges, course events, groups, competencies, custom
fields, content bank, legacy files); the file is read afterwards to check that it holds what was
asked and no people's data.
anonymous (the default for a selection, not for a whole course) makes the file name no one and
no site, through anonymizeBackup: no user ids or authors, a neutral site, course and file name.
It's then saved as backup-moodle2-anonymous-<date>.mbz; the copy Moodle keeps in its backup area
stays as Moodle made it. anonymous: false keeps what Moodle wrote.
Parameters
| Parameter | Type | Description |
|---|---|---|
context | BrowserContext | - |
siteUrl | string | - |
courseId | number | - |
destDir | string | - |
__namedParameters | { activities?: number[]; anonymize?: boolean; anonymous?: boolean; sections?: number[]; timeoutMs?: number; withUsers?: boolean; } | - |
__namedParameters.activities? | number[] | Course module ids of activities and resources to back up, each alone. |
__namedParameters.anonymize? | boolean | - |
__namedParameters.anonymous? | boolean | The file naming no one and no site (anonymizeBackup): true unless given for a selection, false for a whole course. |
__namedParameters.sections? | number[] | Ids of the sections to back up, each with everything in it. |
__namedParameters.timeoutMs? | number | - |
__namedParameters.withUsers? | boolean | - |
Returns
Promise<{
changed: string;
file: DownloadedFile;
}>