diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php index e653050c5b..88d82d51e2 100644 --- a/apps/files_external/lib/google.php +++ b/apps/files_external/lib/google.php @@ -286,7 +286,7 @@ class Google extends \OC\Files\Storage\Common { // Check if this is a Google Doc if ($this->getMimeType($path) !== $file->getMimeType()) { // Return unknown file size - $stat['size'] = \OC\Files\Filesystem::SPACE_UNKNOWN; + $stat['size'] = \OCP\Files\FileInfo::SPACE_UNKNOWN; } else { $stat['size'] = $file->getFileSize(); } diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 4b9be4109e..07f6b9da10 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -377,7 +377,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage { list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source); return $storage->free_space($internalPath); } - return \OC\Files\Filesystem::SPACE_UNKNOWN; + return \OCP\Files\FileInfo::SPACE_UNKNOWN; } public function getLocalFile($path) { diff --git a/lib/private/connector/sabre/quotaplugin.php b/lib/private/connector/sabre/quotaplugin.php index a215a772c0..ebcc894d74 100644 --- a/lib/private/connector/sabre/quotaplugin.php +++ b/lib/private/connector/sabre/quotaplugin.php @@ -72,7 +72,7 @@ class OC_Connector_Sabre_QuotaPlugin extends \Sabre\DAV\ServerPlugin { $length -= $chunkHandler->getCurrentSize(); } $freeSpace = $this->getFreeSpace($parentUri); - if ($freeSpace !== \OC\Files\Filesystem::SPACE_UNKNOWN && $length > $freeSpace) { + if ($freeSpace !== \OCP\Files\FileInfo::SPACE_UNKNOWN && $length > $freeSpace) { if (isset($chunkHandler)) { $chunkHandler->cleanup(); } diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index 758a178088..1dbe66143a 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -33,9 +33,6 @@ namespace OC\Files; use OC\Files\Storage\Loader; class Filesystem { - const SPACE_NOT_COMPUTED = -1; - const SPACE_UNKNOWN = -2; - const SPACE_UNLIMITED = -3; /** * @var Mount\Manager $mounts diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 08c892cb7f..4799c86514 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -398,7 +398,7 @@ abstract class Common implements \OC\Files\Storage\Storage { * @return int */ public function free_space($path) { - return \OC\Files\Filesystem::SPACE_UNKNOWN; + return \OCP\Files\FileInfo::SPACE_UNKNOWN; } /** diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php index 93036b8ca4..bd7166c982 100644 --- a/lib/private/files/storage/dav.php +++ b/lib/private/files/storage/dav.php @@ -243,10 +243,10 @@ class DAV extends \OC\Files\Storage\Common { if (isset($response['{DAV:}quota-available-bytes'])) { return (int)$response['{DAV:}quota-available-bytes']; } else { - return \OC\Files\Filesystem::SPACE_UNKNOWN; + return \OCP\Files\FileInfo::SPACE_UNKNOWN; } } catch (\Exception $e) { - return \OC\Files\Filesystem::SPACE_UNKNOWN; + return \OCP\Files\FileInfo::SPACE_UNKNOWN; } } diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php index eeb7af5cd0..9df6cdef2a 100644 --- a/lib/private/files/storage/local.php +++ b/lib/private/files/storage/local.php @@ -218,7 +218,7 @@ if (\OC_Util::runningOnWindows()) { public function free_space($path) { $space = @disk_free_space($this->datadir . $path); if ($space === false || is_null($space)) { - return \OC\Files\Filesystem::SPACE_UNKNOWN; + return \OCP\Files\FileInfo::SPACE_UNKNOWN; } return $space; } diff --git a/lib/private/files/storage/wrapper/quota.php b/lib/private/files/storage/wrapper/quota.php index f9157ba84f..bf169e41f1 100644 --- a/lib/private/files/storage/wrapper/quota.php +++ b/lib/private/files/storage/wrapper/quota.php @@ -50,7 +50,7 @@ class Quota extends Wrapper { } return $data['size']; } else { - return \OC\Files\Filesystem::SPACE_NOT_COMPUTED; + return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; } } @@ -66,7 +66,7 @@ class Quota extends Wrapper { } else { $used = $this->getSize($this->sizeRoot); if ($used < 0) { - return \OC\Files\Filesystem::SPACE_NOT_COMPUTED; + return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED; } else { $free = $this->storage->free_space($path); $quotaFree = max($this->quota - $used, 0); diff --git a/lib/private/helper.php b/lib/private/helper.php index 840869e58c..17d3840a3e 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -887,7 +887,7 @@ class OC_Helper { */ public static function freeSpace($dir) { $freeSpace = \OC\Files\Filesystem::free_space($dir); - if ($freeSpace !== \OC\Files\Filesystem::SPACE_UNKNOWN) { + if ($freeSpace !== \OCP\Files\FileInfo::SPACE_UNKNOWN) { $freeSpace = max($freeSpace, 0); return $freeSpace; } else { @@ -960,7 +960,7 @@ class OC_Helper { } if ($includeExtStorage) { $quota = OC_Util::getUserQuota(\OCP\User::getUser()); - if ($quota !== \OC\Files\Filesystem::SPACE_UNLIMITED) { + if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) { // always get free space / total space from root + mount points $path = ''; return self::getGlobalStorageInfo(); diff --git a/lib/private/util.php b/lib/private/util.php index 28cc87bfdd..82c5acee67 100755 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -105,7 +105,7 @@ class OC_Util { if (is_object($storage->getUser())) { $user = $storage->getUser()->getUID(); $quota = OC_Util::getUserQuota($user); - if ($quota !== \OC\Files\Filesystem::SPACE_UNLIMITED) { + if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) { return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files')); } } @@ -1244,7 +1244,7 @@ class OC_Util { if (strpos($url, 'http://') !== 0 && strpos($url, 'https://') !== 0) { throw new Exception('$url must start with https:// or http://', 1); } - + if (function_exists('curl_init')) { $curl = curl_init(); $max_redirects = 10; diff --git a/lib/public/files/fileinfo.php b/lib/public/files/fileinfo.php index b9c8258f21..ece4409ca5 100644 --- a/lib/public/files/fileinfo.php +++ b/lib/public/files/fileinfo.php @@ -11,6 +11,10 @@ interface FileInfo { const TYPE_FILE = 'file'; const TYPE_FOLDER = 'dir'; + const SPACE_NOT_COMPUTED = -1; + const SPACE_UNKNOWN = -2; + const SPACE_UNLIMITED = -3; + /** * Get the Etag of the file or folder * diff --git a/tests/lib/connector/sabre/quotaplugin.php b/tests/lib/connector/sabre/quotaplugin.php index 1024ae6af8..3b144cf56b 100644 --- a/tests/lib/connector/sabre/quotaplugin.php +++ b/tests/lib/connector/sabre/quotaplugin.php @@ -63,7 +63,7 @@ class Test_OC_Connector_Sabre_QuotaPlugin extends PHPUnit_Framework_TestCase { array(1024, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), array(1024, array('HTTP_CONTENT_LENGTH' => '512')), array(1024, array('HTTP_OC_TOTAL_LENGTH' => '1024', 'HTTP_CONTENT_LENGTH' => '512')), - // OC\Files\FREE_SPACE_UNKNOWN = -2 + // \OCP\Files\FileInfo::SPACE_UNKNOWN = -2 array(-2, array()), array(-2, array('HTTP_X_EXPECTED_ENTITY_LENGTH' => '1024')), array(-2, array('HTTP_CONTENT_LENGTH' => '512')),