Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
   1  <?php
   2  
   3  namespace Box\Spout\Common\Helper;
   4  
   5  /**
   6   * Class FileSystemHelperInterface
   7   * This interface describes helper functions to help with the file system operations
   8   * like files/folders creation & deletion
   9   */
  10  interface FileSystemHelperInterface
  11  {
  12      /**
  13       * Creates an empty folder with the given name under the given parent folder.
  14       *
  15       * @param string $parentFolderPath The parent folder path under which the folder is going to be created
  16       * @param string $folderName The name of the folder to create
  17       * @throws \Box\Spout\Common\Exception\IOException If unable to create the folder or if the folder path is not inside of the base folder
  18       * @return string Path of the created folder
  19       */
  20      public function createFolder($parentFolderPath, $folderName);
  21  
  22      /**
  23       * Creates a file with the given name and content in the given folder.
  24       * The parent folder must exist.
  25       *
  26       * @param string $parentFolderPath The parent folder path where the file is going to be created
  27       * @param string $fileName The name of the file to create
  28       * @param string $fileContents The contents of the file to create
  29       * @throws \Box\Spout\Common\Exception\IOException If unable to create the file or if the file path is not inside of the base folder
  30       * @return string Path of the created file
  31       */
  32      public function createFileWithContents($parentFolderPath, $fileName, $fileContents);
  33  
  34      /**
  35       * Delete the file at the given path
  36       *
  37       * @param string $filePath Path of the file to delete
  38       * @throws \Box\Spout\Common\Exception\IOException If the file path is not inside of the base folder
  39       * @return void
  40       */
  41      public function deleteFile($filePath);
  42  
  43      /**
  44       * Delete the folder at the given path as well as all its contents
  45       *
  46       * @param string $folderPath Path of the folder to delete
  47       * @throws \Box\Spout\Common\Exception\IOException If the folder path is not inside of the base folder
  48       * @return void
  49       */
  50      public function deleteFolderRecursively($folderPath);
  51  }