1
0

Files.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. // use OCP namespace for all classes that are considered public.
  34. // This means that they should be used by apps instead of the internal ownCloud classes
  35. namespace OCP;
  36. /**
  37. * This class provides access to the internal filesystem abstraction layer. Use
  38. * this class exlusively if you want to access files
  39. * @since 5.0.0
  40. * @deprecated 14.0.0
  41. */
  42. class Files {
  43. /**
  44. * Recusive deletion of folders
  45. * @return bool
  46. * @since 5.0.0
  47. * @deprecated 14.0.0
  48. */
  49. public static function rmdirr($dir) {
  50. return \OC_Helper::rmdirr($dir);
  51. }
  52. /**
  53. * Get the mimetype form a local file
  54. * @param string $path
  55. * @return string
  56. * does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
  57. * @since 5.0.0
  58. * @deprecated 14.0.0
  59. */
  60. public static function getMimeType($path) {
  61. return \OC::$server->getMimeTypeDetector()->detect($path);
  62. }
  63. /**
  64. * Search for files by mimetype
  65. * @param string $mimetype
  66. * @return array
  67. * @since 6.0.0
  68. * @deprecated 14.0.0
  69. */
  70. public static function searchByMime($mimetype) {
  71. return \OC\Files\Filesystem::searchByMime($mimetype);
  72. }
  73. /**
  74. * Copy the contents of one stream to another
  75. * @param resource $source
  76. * @param resource $target
  77. * @return int the number of bytes copied
  78. * @since 5.0.0
  79. * @deprecated 14.0.0
  80. */
  81. public static function streamCopy($source, $target) {
  82. [$count, ] = \OC_Helper::streamCopy($source, $target);
  83. return $count;
  84. }
  85. /**
  86. * Adds a suffix to the name in case the file exists
  87. * @param string $path
  88. * @param string $filename
  89. * @return string
  90. * @since 5.0.0
  91. * @deprecated 14.0.0 use getNonExistingName of the OCP\Files\Folder object
  92. */
  93. public static function buildNotExistingFileName($path, $filename) {
  94. return \OC_Helper::buildNotExistingFileName($path, $filename);
  95. }
  96. /**
  97. * Gets the Storage for an app - creates the needed folder if they are not
  98. * existent
  99. * @param string $app
  100. * @return \OC\Files\View
  101. * @since 5.0.0
  102. * @deprecated 14.0.0 use IAppData instead
  103. */
  104. public static function getStorage($app) {
  105. return \OC_App::getStorage($app);
  106. }
  107. }