Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Interface needed to handle storage and export of H5P Content. More...
Public Member Functions | |
cacheAssets (&$files, $key) | |
Will concatenate all JavaScrips and Stylesheets into two files in order to improve page performance. | |
cloneContent ($id, $newId) | |
Creates a stored copy of the content folder. | |
cloneContentFile ($file, $fromId, $toId) | |
Copy a file from another content or editor tmp dir. | |
deleteCachedAssets ($keys) | |
Remove the aggregated cache files. | |
deleteContent ($content) | |
Remove content folder. | |
deleteExport ($filename) | |
Removes given export file. | |
deleteLibrary ($library) | |
Delete library folder. | |
exportContent ($id, $target) | |
Fetch content folder and save in target directory. | |
exportLibrary ($library, $target) | |
Fetch library folder and save in target directory. | |
getCachedAssets ($key) | |
Will check if there are cache assets available for content. | |
getContent ($file_path) | |
Read file content of given file and then return it. | |
getContentFile ($file, $contentId) | |
Checks to see if content has the given file. | |
getTmpPath () | |
Get path to a new unique tmp folder. | |
getUpgradeScript ($machineName, $majorVersion, $minorVersion) | |
Check if upgrades script exist for library. | |
hasExport ($filename) | |
Check if the given export file exists. | |
hasPresave ($libraryName, $developmentPath=null) | |
Check if the library has a presave.js in the root folder. | |
hasWriteAccess () | |
Check if server setup has write permission to the required folders. | |
moveContentDirectory ($source, $contentId=NULL) | |
Copy a content from one directory to another. | |
removeContentFile ($file, $contentId) | |
Remove content files that are no longer used. | |
saveContent ($source, $content) | |
Store the content folder. | |
saveExport ($source, $filename) | |
Save export in file system. | |
saveFile ($file, $contentId) | |
Save files uploaded through the editor. | |
saveFileFromZip ($path, $file, $stream) | |
Store the given stream into the given file. | |
saveLibrary ($library) | |
Store the library folder. | |
Interface needed to handle storage and export of H5P Content.
Moodle\H5PFileStorage::cacheAssets | ( | & | $files, |
$key ) |
Will concatenate all JavaScrips and Stylesheets into two files in order to improve page performance.
array | $files | A set of all the assets required for content to display |
string | $key | Hashed key for cached asset |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::cloneContent | ( | $id, | |
$newId ) |
Creates a stored copy of the content folder.
string | $id | Identifier of content to clone. |
int | $newId | The cloned content's identifier |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::cloneContentFile | ( | $file, | |
$fromId, | |||
$toId ) |
Copy a file from another content or editor tmp dir.
Used when copy pasting content in H5P.
string | $file | path + name |
string | int | $fromId | Content ID or 'editor' string |
int | $toId | Target Content ID |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::deleteCachedAssets | ( | $keys | ) |
Remove the aggregated cache files.
array | $keys | The hash keys of removed files |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::deleteContent | ( | $content | ) |
Remove content folder.
array | $content | Content properties |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::deleteExport | ( | $filename | ) |
Moodle\H5PFileStorage::deleteLibrary | ( | $library | ) |
Moodle\H5PFileStorage::exportContent | ( | $id, | |
$target ) |
Fetch content folder and save in target directory.
int | $id | Content identifier |
string | $target | Where the content folder will be saved |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::exportLibrary | ( | $library, | |
$target ) |
Fetch library folder and save in target directory.
array | $library | Library properties |
string | $target | Where the library folder will be saved |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::getCachedAssets | ( | $key | ) |
Will check if there are cache assets available for content.
string | $key | Hashed key for cached asset |
array |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::getContent | ( | $file_path | ) |
Read file content of given file and then return it.
string | $file_path |
string | contents |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::getContentFile | ( | $file, | |
$contentId ) |
Checks to see if content has the given file.
Used when saving content.
string | $file | path + name |
int | $contentId |
string|int | File ID or NULL if not found |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::getTmpPath | ( | ) |
Moodle\H5PFileStorage::getUpgradeScript | ( | $machineName, | |
$majorVersion, | |||
$minorVersion ) |
Check if upgrades script exist for library.
string | $machineName | |
int | $majorVersion | |
int | $minorVersion |
string | Relative path |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::hasExport | ( | $filename | ) |
Check if the given export file exists.
string | $filename |
boolean |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::hasPresave | ( | $libraryName, | |
$developmentPath = null ) |
Check if the library has a presave.js in the root folder.
string | $libraryName | |
string | $developmentPath |
bool |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::hasWriteAccess | ( | ) |
Check if server setup has write permission to the required folders.
bool | True if server has the proper write access |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::moveContentDirectory | ( | $source, | |
$contentId = NULL ) |
Copy a content from one directory to another.
Defaults to cloning content from the current temporary upload folder to the editor path.
string | $source | path to source directory |
string | $contentId | Id of content |
object | Object containing h5p json and content json data |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::removeContentFile | ( | $file, | |
$contentId ) |
Remove content files that are no longer used.
Used when saving content.
string | $file | path + name |
int | $contentId |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::saveContent | ( | $source, | |
$content ) |
Store the content folder.
string | $source | Path on file system to content directory. |
array | $content | Content properties |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::saveExport | ( | $source, | |
$filename ) |
Save export in file system.
string | $source | Path on file system to temporary export file. |
string | $filename | Name of export file. |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::saveFile | ( | $file, | |
$contentId ) |
Save files uploaded through the editor.
The files must be marked as temporary until the content form is saved.
H5peditorFile | $file | |
int | $contentId |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::saveFileFromZip | ( | $path, | |
$file, | |||
$stream ) |
Store the given stream into the given file.
string | $path | |
string | $file | |
resource | $stream |
bool |
Implemented in core_h5p\file_storage.
Moodle\H5PFileStorage::saveLibrary | ( | $library | ) |
Store the library folder.
array | $library | Library properties |
Implemented in core_h5p\file_storage.