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.4KB

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