filestorage.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Frank Karlitschek
  6. * @copyright 2012 Frank Karlitschek frank@owncloud.org
  7. *
  8. * This library is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  10. * License as published by the Free Software Foundation; either
  11. * version 3 of the License, or any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public
  19. * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /**
  22. * Provde a common interface to all different storage options
  23. */
  24. abstract class OC_Filestorage{
  25. abstract public function __construct($parameters);
  26. abstract public function mkdir($path);
  27. abstract public function rmdir($path);
  28. abstract public function opendir($path);
  29. abstract public function is_dir($path);
  30. abstract public function is_file($path);
  31. abstract public function stat($path);
  32. abstract public function filetype($path);
  33. abstract public function filesize($path);
  34. abstract public function isCreatable($path);
  35. abstract public function isReadable($path);
  36. abstract public function isUpdatable($path);
  37. abstract public function isDeletable($path);
  38. abstract public function isSharable($path);
  39. abstract public function file_exists($path);
  40. abstract public function filectime($path);
  41. abstract public function filemtime($path);
  42. abstract public function file_get_contents($path);
  43. abstract public function file_put_contents($path, $data);
  44. abstract public function unlink($path);
  45. abstract public function rename($path1, $path2);
  46. abstract public function copy($path1, $path2);
  47. abstract public function fopen($path, $mode);
  48. abstract public function getMimeType($path);
  49. abstract public function hash($type, $path, $raw = false);
  50. abstract public function free_space($path);
  51. abstract public function search($query);
  52. abstract public function touch($path, $mtime=null);
  53. abstract public function getLocalFile($path);// get a path to a local version of the file, whether the original file is local or remote
  54. abstract public function getLocalFolder($path);// get a path to a local version of the folder, whether the original file is local or remote
  55. /**
  56. * check if a file or folder has been updated since $time
  57. * @param int $time
  58. * @return bool
  59. *
  60. * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
  61. * returning true for other changes in the folder is optional
  62. */
  63. abstract public function hasUpdated($path, $time);
  64. abstract public function getOwner($path);
  65. }