Wipe
in package
Clear a course's importable content so a cartridge can load onto a blank outline.
Files go through BlobUtil::deleteBlob so the last blob_file row for a sha256 also removes the single-instance blob (blob_blob or the dataroot file). Reserved Student / Public / Private folders stay; import recreates the rest.
Table of Contents
Methods
- beforeImport() : void
- Pages, Files, Quiz1, gradebook results, resource links, cc_object, empty Lessons.
- emptyLessonsDocument() : array<string, mixed>
- Lessons v2 with no modules, so import can write the cartridge outline in place.
- isFolderRow() : bool
- True when a blob_file row is a Files-tool folder, not a real file.
- isLmsAnalyticsLinkKey() : bool
- Local LMS tool links (Files, Pages, …) use this prefix, not LTI resource_link_id.
- isReservedRootFolderRow() : bool
- True for the top-level Student, Public, or Private folder.
- files() : void
- lessons() : void
- pages() : void
- quizzes() : void
- resourceLinks() : void
- Drop LTI resource links. Keep `lms:` analytics rows for local tools.
- results() : void
- Remove every gradebook result in this course, including grades on kept LMS tool links.
Methods
beforeImport()
Pages, Files, Quiz1, gradebook results, resource links, cc_object, empty Lessons.
public
static beforeImport(int $context_id, int $user_id) : void
LMS analytics links (lms:…) stay so Files and other local tools keep their
synthetic link_id. Resource links and all results for this course are removed.
Parameters
- $context_id : int
- $user_id : int
emptyLessonsDocument()
Lessons v2 with no modules, so import can write the cartridge outline in place.
public
static emptyLessonsDocument(string $title) : array<string, mixed>
Parameters
- $title : string
Return values
array<string, mixed>isFolderRow()
True when a blob_file row is a Files-tool folder, not a real file.
public
static isFolderRow(array<string, mixed> $row) : bool
Parameters
- $row : array<string, mixed>
Return values
boolisLmsAnalyticsLinkKey()
Local LMS tool links (Files, Pages, …) use this prefix, not LTI resource_link_id.
public
static isLmsAnalyticsLinkKey(mixed $link_key) : bool
Parameters
- $link_key : mixed
Return values
boolisReservedRootFolderRow()
True for the top-level Student, Public, or Private folder.
public
static isReservedRootFolderRow(array<string, mixed> $row) : bool
Parameters
- $row : array<string, mixed>
Return values
boolfiles()
private
static files(int $context_id) : void
Parameters
- $context_id : int
lessons()
private
static lessons(int $context_id, int $user_id) : void
Parameters
- $context_id : int
- $user_id : int
pages()
private
static pages(int $context_id) : void
Parameters
- $context_id : int
quizzes()
private
static quizzes(int $context_id) : void
Parameters
- $context_id : int
resourceLinks()
Drop LTI resource links. Keep `lms:` analytics rows for local tools.
private
static resourceLinks(int $context_id) : void
Parameters
- $context_id : int
results()
Remove every gradebook result in this course, including grades on kept LMS tool links.
private
static results(int $context_id) : void
Parameters
- $context_id : int