filestorage.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. 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 is_readable($path);
  35. abstract public function is_writable($path);
  36. abstract public function file_exists($path);
  37. abstract public function filectime($path);
  38. abstract public function filemtime($path);
  39. abstract public function file_get_contents($path);
  40. abstract public function file_put_contents($path,$data);
  41. abstract public function unlink($path);
  42. abstract public function rename($path1,$path2);
  43. abstract public function copy($path1,$path2);
  44. abstract public function fopen($path,$mode);
  45. abstract public function getMimeType($path);
  46. abstract public function hash($type,$path,$raw);
  47. abstract public function free_space($path);
  48. abstract public function search($query);
  49. abstract public function touch($path, $mtime=null);
  50. abstract public function getLocalFile($path);// get a path to a local version of the file, whether the original file is local or remote
  51. /**
  52. * check if a file or folder has been updated since $time
  53. * @param int $time
  54. * @return bool
  55. *
  56. * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed.
  57. * returning true for other changes in the folder is optional
  58. */
  59. abstract public function hasUpdated($path,$time);
  60. }