Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
The default file storage class for H5P. More...
Public Member Functions | |
__construct ($path, $alteditorpath=NULL) | |
The great Constructor! | |
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) | |
exportContent ($id, $target) | |
Fetch content folder and save in target directory. | |
exportLibrary ($library, $target, $developmentPath=NULL) | |
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 ($libraryFolder, $developmentPath=null) | |
Check if the file presave.js exists in the root of the library. | |
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) | |
Checks to see if content has the given file. | |
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. | |
The default file storage class for H5P.
Will carry out the requested file operations using PHP's standard file operation functions.
Some implementations of H5P that doesn't use the standard file system will want to create their own implementation of the H5P\FileStorage interface.
H5PDefaultStorage::__construct | ( | $path, | |
$alteditorpath = NULL ) |
The great Constructor!
string | $path | The base location of H5P files |
string | $alteditorpath | Optional. Use a different editor path |
H5PDefaultStorage::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 |
H5PDefaultStorage::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 |
H5PDefaultStorage::cloneContentFile | ( | $file, | |
$fromId, | |||
$toId ) |
Copy a file from another content or editor tmp dir.
Used when copy pasting content in H5P Editor.
string | $file | path + name |
string | int | $fromid | Content ID or 'editor' string |
int | $toid | Target Content ID |
H5PDefaultStorage::deleteCachedAssets | ( | $keys | ) |
Remove the aggregated cache files.
array | $keys | The hash keys of removed files |
H5PDefaultStorage::deleteContent | ( | $content | ) |
Remove content folder.
array | $content | Content properties |
H5PDefaultStorage::deleteExport | ( | $filename | ) |
Removes given export file.
string | $filename |
H5PDefaultStorage::exportContent | ( | $id, | |
$target ) |
Fetch content folder and save in target directory.
int | $id | Content identifier |
string | $target | Where the content folder will be saved |
H5PDefaultStorage::exportLibrary | ( | $library, | |
$target, | |||
$developmentPath = NULL ) |
Fetch library folder and save in target directory.
array | $library | Library properties |
string | $target | Where the library folder will be saved |
string | $developmentPath | Folder that library resides in |
H5PDefaultStorage::getCachedAssets | ( | $key | ) |
Will check if there are cache assets available for content.
string | $key | Hashed key for cached asset |
array |
H5PDefaultStorage::getContent | ( | $file_path | ) |
Read file content of given file and then return it.
string | $file_path |
string |
H5PDefaultStorage::getContentFile | ( | $file, | |
$contentId ) |
Checks to see if content has the given file.
Used when saving content.
string | $file | path + name |
int | $contentId |
string | File ID or NULL if not found |
H5PDefaultStorage::getTmpPath | ( | ) |
Get path to a new unique tmp folder.
string | Path |
H5PDefaultStorage::getUpgradeScript | ( | $machineName, | |
$majorVersion, | |||
$minorVersion ) |
Check if upgrades script exist for library.
string | $machineName | |
int | $majorVersion | |
int | $minorVersion |
string | Relative path |
H5PDefaultStorage::hasExport | ( | $filename | ) |
Check if the given export file exists.
string | $filename |
boolean |
H5PDefaultStorage::hasPresave | ( | $libraryFolder, | |
$developmentPath = null ) |
Check if the file presave.js exists in the root of the library.
string | $libraryFolder | |
string | $developmentPath |
bool |
H5PDefaultStorage::hasWriteAccess | ( | ) |
Check if server setup has write permission to the required folders.
bool | True if site can write to the H5P files folder |
H5PDefaultStorage::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 contentarray |
H5PDefaultStorage::removeContentFile | ( | $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 |
H5PDefaultStorage::saveContent | ( | $source, | |
$content ) |
Store the content folder.
string | $source | Path on file system to content directory. |
array | $content | Content properties |
H5PDefaultStorage::saveExport | ( | $source, | |
$filename ) |
Save export in file system.
string | $source | Path on file system to temporary export file. |
string | $filename | Name of export file. |
Exception | Unable to save the file |
H5PDefaultStorage::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 |
H5PDefaultStorage::saveFileFromZip | ( | $path, | |
$file, | |||
$stream ) |
Store the given stream into the given file.
string | $path | |
string | $file | |
resource | $stream |
bool |
H5PDefaultStorage::saveLibrary | ( | $library | ) |
Store the library folder.
array | $library | Library properties |