Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Differences Between: [Versions 402 and 403]

(no description)

File Size: 327 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: FileSystemHelper  - X-Ref


__construct(string $baseFolderPath, ZipHelper $zipHelper, string $creator)   X-Ref

param: string    $baseFolderPath The path of the base folder where all the I/O can occur
param: ZipHelper $zipHelper      Helper to perform tasks with Zip archive
param: string    $creator        document creator

createFolder(string $parentFolderPath, string $folderName)   X-Ref
No description

createFileWithContents(string $parentFolderPath, string $fileName, string $fileContents)   X-Ref
No description

deleteFile(string $filePath)   X-Ref
No description

deleteFolderRecursively(string $folderPath)   X-Ref
No description

getRootFolder()   X-Ref
No description

getSheetsContentTempFolder()   X-Ref
No description

createBaseFilesAndFolders()   X-Ref
Creates all the folders needed to create a ODS file, as well as the files that won't change.


createContentFile(WorksheetManager $worksheetManager, StyleManager $styleManager, array $worksheets)   X-Ref
Creates the "content.xml" file under the root folder.

param: Worksheet[] $worksheets

deleteWorksheetTempFolder()   X-Ref
Deletes the temporary folder where sheets content was stored.


createStylesFile(StyleManager $styleManager, int $numWorksheets)   X-Ref
Creates the "styles.xml" file under the root folder.

param: int $numWorksheets Number of created worksheets

zipRootFolderAndCopyToStream($streamPointer)   X-Ref
Zips the root folder and streams the contents of the zip into the given stream.

param: resource $streamPointer Pointer to the stream to copy the zip

createRootFolder()   X-Ref
Creates the folder that will be used as root.


createMetaInfoFolderAndFile()   X-Ref
Creates the "META-INF" folder under the root folder as well as the "manifest.xml" file in it.


createManifestFile()   X-Ref
Creates the "manifest.xml" file under the "META-INF" folder (under root).


createSheetsContentTempFolder()   X-Ref
Creates the temp folder where specific sheets content will be written to.
This folder is not part of the final ODS file and is only used to be able to jump between sheets.


createMetaFile()   X-Ref
Creates the "meta.xml" file under the root folder.


createMimetypeFile()   X-Ref
Creates the "mimetype" file under the root folder.


copyFileContentsToTarget(string $sourceFilePath, $targetResource)   X-Ref
Streams the content of the file at the given path into the target resource.
Depending on which mode the target resource was created with, it will truncate then copy
or append the content to the target file.

param: string   $sourceFilePath Path of the file whose content will be copied
param: resource $targetResource Target resource that will receive the content