remove deprecated OCP\Files

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
remove_depreated_files
Roeland Jago Douma 2 years ago committed by Vincent Petry (Rebase PR Action)
parent 3b7cc31f64
commit 30d09612b2

@ -215,7 +215,7 @@ class SFTP extends \OC\Files\Storage\Common {
*/
private function hostKeysPath() {
try {
$storage_view = \OCP\Files::getStorage('files_external');
$storage_view = \OC_App::getStorage('files_external');
if ($storage_view) {
return \OC::$server->getConfig()->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data') .
$storage_view->getAbsolutePath('') .

@ -42,7 +42,6 @@ use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\ICloudFederationFactory;
use OCP\Federation\ICloudFederationProviderManager;
use OCP\Files;
use OCP\Files\NotFoundException;
use OCP\Files\Storage\IStorageFactory;
use OCP\Http\Client\IClientService;
@ -182,7 +181,7 @@ class Manager {
return null;
}
$mountPoint = Files::buildNotExistingFileName('/', $name);
$mountPoint = \OC_Helper::buildNotExistingFileName('/', $name);
$mountPoint = Filesystem::normalizePath('/' . $mountPoint);
$hash = md5($mountPoint);
@ -314,7 +313,7 @@ class Manager {
if ($share) {
\OC_Util::setupFS($this->uid);
$shareFolder = Helper::getShareFolder(null, $this->uid);
$mountPoint = Files::buildNotExistingFileName($shareFolder, $share['name']);
$mountPoint = \OC_Helper::buildNotExistingFileName($shareFolder, $share['name']);
$mountPoint = Filesystem::normalizePath($mountPoint);
$hash = md5($mountPoint);
$userShareAccepted = false;

@ -252,7 +252,6 @@ return array(
'OCP\\Federation\\ICloudFederationShare' => $baseDir . '/lib/public/Federation/ICloudFederationShare.php',
'OCP\\Federation\\ICloudId' => $baseDir . '/lib/public/Federation/ICloudId.php',
'OCP\\Federation\\ICloudIdManager' => $baseDir . '/lib/public/Federation/ICloudIdManager.php',
'OCP\\Files' => $baseDir . '/lib/public/Files.php',
'OCP\\Files\\AlreadyExistsException' => $baseDir . '/lib/public/Files/AlreadyExistsException.php',
'OCP\\Files\\AppData\\IAppDataFactory' => $baseDir . '/lib/public/Files/AppData/IAppDataFactory.php',
'OCP\\Files\\Cache\\AbstractCacheEvent' => $baseDir . '/lib/public/Files/Cache/AbstractCacheEvent.php',

@ -285,7 +285,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OCP\\Federation\\ICloudFederationShare' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudFederationShare.php',
'OCP\\Federation\\ICloudId' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudId.php',
'OCP\\Federation\\ICloudIdManager' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudIdManager.php',
'OCP\\Files' => __DIR__ . '/../../..' . '/lib/public/Files.php',
'OCP\\Files\\AlreadyExistsException' => __DIR__ . '/../../..' . '/lib/public/Files/AlreadyExistsException.php',
'OCP\\Files\\AppData\\IAppDataFactory' => __DIR__ . '/../../..' . '/lib/public/Files/AppData/IAppDataFactory.php',
'OCP\\Files\\Cache\\AbstractCacheEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/AbstractCacheEvent.php',

@ -255,7 +255,7 @@ class TAR extends Archive {
if ($success) {
rename($tmp . $path, $dest);
}
\OCP\Files::rmdirr($tmp);
\OC_Helper::rmdirr($tmp);
return $success;
}
@ -301,7 +301,7 @@ class TAR extends Archive {
//no proper way to delete, extract entire archive, delete file and remake archive
$tmp = \OC::$server->getTempManager()->getTemporaryFolder();
$this->tar->extract($tmp);
\OCP\Files::rmdirr($tmp . $path);
\OC_Helper::rmdirr($tmp . $path);
$this->tar = null;
unlink($this->path);
$this->reopen();

@ -1,114 +0,0 @@
<?php
/**
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Bart Visscher <bartv@thisnet.nl>
* @author Björn Schießle <bjoern@schiessle.org>
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
* @author Frank Karlitschek <frank@karlitschek.de>
* @author Georg Ehrke <oc.list@georgehrke.com>
* @author Joas Schilling <coding@schilljs.com>
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
* @author Morris Jobke <hey@morrisjobke.de>
* @author Robin Appelman <robin@icewind.nl>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Stefan Weil <sw@weilnetz.de>
* @author Thomas Müller <thomas.mueller@tmit.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
// use OCP namespace for all classes that are considered public.
// This means that they should be used by apps instead of the internal ownCloud classes
namespace OCP;
/**
* This class provides access to the internal filesystem abstraction layer. Use
* this class exlusively if you want to access files
* @since 5.0.0
* @deprecated 14.0.0
*/
class Files {
/**
* Recusive deletion of folders
* @return bool
* @since 5.0.0
* @deprecated 14.0.0
*/
public static function rmdirr($dir) {
return \OC_Helper::rmdirr($dir);
}
/**
* Get the mimetype form a local file
* @param string $path
* @return string
* does NOT work for ownClouds filesystem, use OC_FileSystem::getMimeType instead
* @since 5.0.0
* @deprecated 14.0.0
*/
public static function getMimeType($path) {
return \OC::$server->getMimeTypeDetector()->detect($path);
}
/**
* Search for files by mimetype
* @param string $mimetype
* @return array
* @since 6.0.0
* @deprecated 14.0.0
*/
public static function searchByMime($mimetype) {
return \OC\Files\Filesystem::searchByMime($mimetype);
}
/**
* Copy the contents of one stream to another
* @param resource $source
* @param resource $target
* @return int the number of bytes copied
* @since 5.0.0
* @deprecated 14.0.0
*/
public static function streamCopy($source, $target) {
[$count, ] = \OC_Helper::streamCopy($source, $target);
return $count;
}
/**
* Adds a suffix to the name in case the file exists
* @param string $path
* @param string $filename
* @return string
* @since 5.0.0
* @deprecated 14.0.0 use getNonExistingName of the OCP\Files\Folder object
*/
public static function buildNotExistingFileName($path, $filename) {
return \OC_Helper::buildNotExistingFileName($path, $filename);
}
/**
* Gets the Storage for an app - creates the needed folder if they are not
* existent
* @param string $app
* @return \OC\Files\View
* @since 5.0.0
* @deprecated 14.0.0 use IAppData instead
*/
public static function getStorage($app) {
return \OC_App::getStorage($app);
}
}

@ -91,7 +91,7 @@ abstract class TestBase extends \Test\TestCase {
$this->instance = $this->getNew();
$fh = $this->instance->getStream('lorem.txt', 'w');
$source = fopen($dir.'/lorem.txt', 'r');
\OCP\Files::streamCopy($source, $fh);
\OC_Helper::streamCopy($source, $fh);
fclose($source);
fclose($fh);
$this->assertTrue($this->instance->fileExists('lorem.txt'));
@ -117,7 +117,7 @@ abstract class TestBase extends \Test\TestCase {
$this->assertEquals(true, file_exists($tmpDir.'dir/lorem.txt'));
$this->assertEquals(true, file_exists($tmpDir.'logo-wide.png'));
$this->assertEquals(file_get_contents($dir.'/lorem.txt'), file_get_contents($tmpDir.'lorem.txt'));
\OCP\Files::rmdirr($tmpDir);
\OC_Helper::rmdirr($tmpDir);
}
public function testMoveRemove() {
$dir = \OC::$SERVERROOT.'/tests/data';

@ -208,13 +208,13 @@ class UtilTest extends \Test\TestCase {
touch($dataDir . '/.ocdata');
$errors = \OC_Util::checkDataDirectoryValidity($dataDir);
$this->assertEmpty($errors);
\OCP\Files::rmdirr($dataDir);
\OC_Helper::rmdirr($dataDir);
$dataDir = \OC::$server->getTempManager()->getTemporaryFolder();
// no touch
$errors = \OC_Util::checkDataDirectoryValidity($dataDir);
$this->assertNotEmpty($errors);
\OCP\Files::rmdirr($dataDir);
\OC_Helper::rmdirr($dataDir);
$errors = \OC_Util::checkDataDirectoryValidity('relative/path');
$this->assertNotEmpty($errors);

Loading…
Cancel
Save