You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Files.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bart Visscher <bartv@thisnet.nl>
  6. * @author Björn Schießle <bjoern@schiessle.org>
  7. * @author Frank Karlitschek <frank@karlitschek.de>
  8. * @author Georg Ehrke <oc.list@georgehrke.com>
  9. * @author Joas Schilling <coding@schilljs.com>
  10. * @author Jörn Friedrich Dreyer <jfd@butonic.de>
  11. * @author Morris Jobke <hey@morrisjobke.de>
  12. * @author Robin Appelman <robin@icewind.nl>
  13. * @author Roeland Jago Douma <roeland@famdouma.nl>
  14. * @author Stefan Weil <sw@weilnetz.de>
  15. * @author Thomas Müller <thomas.mueller@tmit.eu>
  16. *
  17. * @license AGPL-3.0
  18. *
  19. * This code is free software: you can redistribute it and/or modify
  20. * it under the terms of the GNU Affero General Public License, version 3,
  21. * as published by the Free Software Foundation.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU Affero General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU Affero General Public License, version 3,
  29. * along with this program. If not, see <http://www.gnu.org/licenses/>
  30. *
  31. */
  32. /**
  33. * Public interface of ownCloud for apps to use.
  34. * Files Class
  35. *
  36. */
  37. // use OCP namespace for all classes that are considered public.
  38. // This means that they should be used by apps instead of the internal ownCloud classes
  39. namespace OCP;
  40. /**
  41. * This class provides access to the internal filesystem abstraction layer. Use
  42. * this class exlusively if you want to access files
  43. * @since 5.0.0
  44. * @deprecated 14.0.0
  45. */
  46. class Files {
  47. /**
  48. * Recusive deletion of folders
  49. * @return bool
  50. * @since 5.0.0
  51. * @deprecated 14.0.0
  52. */
  53. static public function rmdirr( $dir ) {
  54. return \OC_Helper::rmdirr( $dir );
  55. }
  56. /**
  57. * Get the mimetype form a local file
  58. * @param string $path
  59. * @return string
  60. * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
  61. * @since 5.0.0
  62. * @deprecated 14.0.0
  63. */
  64. static public function getMimeType( $path ) {
  65. return \OC::$server->getMimeTypeDetector()->detect($path);
  66. }
  67. /**
  68. * Search for files by mimetype
  69. * @param string $mimetype
  70. * @return array
  71. * @since 6.0.0
  72. * @deprecated 14.0.0
  73. */
  74. static public function searchByMime($mimetype) {
  75. return \OC\Files\Filesystem::searchByMime($mimetype);
  76. }
  77. /**
  78. * Copy the contents of one stream to another
  79. * @param resource $source
  80. * @param resource $target
  81. * @return int the number of bytes copied
  82. * @since 5.0.0
  83. * @deprecated 14.0.0
  84. */
  85. public static function streamCopy( $source, $target ) {
  86. list($count, ) = \OC_Helper::streamCopy( $source, $target );
  87. return $count;
  88. }
  89. /**
  90. * Adds a suffix to the name in case the file exists
  91. * @param string $path
  92. * @param string $filename
  93. * @return string
  94. * @since 5.0.0
  95. * @deprecated 14.0.0 use getNonExistingName of the OCP\Files\Folder object
  96. */
  97. public static function buildNotExistingFileName($path, $filename) {
  98. return \OC_Helper::buildNotExistingFileName($path, $filename);
  99. }
  100. /**
  101. * Gets the Storage for an app - creates the needed folder if they are not
  102. * existent
  103. * @param string $app
  104. * @return \OC\Files\View
  105. * @since 5.0.0
  106. * @deprecated 14.0.0 use IAppData instead
  107. */
  108. public static function getStorage($app) {
  109. return \OC_App::getStorage( $app );
  110. }
  111. }