aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-08-20 23:23:42 +0200
committerLukas Reschke <lukas@owncloud.com>2014-08-20 23:23:42 +0200
commit92c80dd946d12e0f6094d40a3a3f4784ea2dfec4 (patch)
tree4609c9ae126e93a06b40cc9fa85fc4afcb8284b6 /lib
parent74af852c34ad32f900c96717619ae2a8989c792b (diff)
parentab6ee6a600a5d373c28bad988f5a7ac9eca52b54 (diff)
downloadnextcloud-server-92c80dd946d12e0f6094d40a3a3f4784ea2dfec4.tar.gz
nextcloud-server-92c80dd946d12e0f6094d40a3a3f4784ea2dfec4.zip
Merge pull request #10518 from owncloud/fix_storage_const_autoload
Fix storage const autoload
Diffstat (limited to 'lib')
-rw-r--r--lib/private/connector/sabre/quotaplugin.php2
-rw-r--r--lib/private/files/filesystem.php4
-rw-r--r--lib/private/files/storage/common.php2
-rw-r--r--lib/private/files/storage/dav.php4
-rw-r--r--lib/private/files/storage/local.php2
-rw-r--r--lib/private/files/storage/wrapper/quota.php4
-rw-r--r--lib/private/helper.php4
-rwxr-xr-xlib/private/util.php6
-rw-r--r--lib/public/files/fileinfo.php13
9 files changed, 26 insertions, 15 deletions
diff --git a/lib/private/connector/sabre/quotaplugin.php b/lib/private/connector/sabre/quotaplugin.php
index cf3c1103f84..ebcc894d744 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\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 4774d25ad9e..1dbe66143ac 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -31,11 +31,9 @@
namespace OC\Files;
use OC\Files\Storage\Loader;
-const SPACE_NOT_COMPUTED = -1;
-const SPACE_UNKNOWN = -2;
-const SPACE_UNLIMITED = -3;
class Filesystem {
+
/**
* @var Mount\Manager $mounts
*/
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php
index 0720b8180c9..4799c865142 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\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 ce447417d20..bd7166c9823 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\SPACE_UNKNOWN;
+ return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}
} catch (\Exception $e) {
- return \OC\Files\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 a8b420e978a..9df6cdef2af 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\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 c57c797f87a..bf169e41f13 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\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\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 79df2e3255c..17d3840a3ea 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\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\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 4959cb5a786..7070d0bcece 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\SPACE_UNLIMITED) {
+ if ($quota !== \OCP\Files\FileInfo::SPACE_UNLIMITED) {
return new \OC\Files\Storage\Wrapper\Quota(array('storage' => $storage, 'quota' => $quota, 'root' => 'files'));
}
}
@@ -197,7 +197,7 @@ class OC_Util {
$userQuota = $config->getAppValue('files', 'default_quota', 'none');
}
if($userQuota === 'none') {
- return \OC\Files\SPACE_UNLIMITED;
+ return \OCP\Files\FileInfo::SPACE_UNLIMITED;
}else{
return OC_Helper::computerFileSize($userQuota);
}
@@ -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 b9c8258f21e..0279050b858 100644
--- a/lib/public/files/fileinfo.php
+++ b/lib/public/files/fileinfo.php
@@ -11,6 +11,19 @@ interface FileInfo {
const TYPE_FILE = 'file';
const TYPE_FOLDER = 'dir';
+ /*
+ * @const \OCP\Files\FileInfo::SPACE_NOT_COMPUTED Return value for a not computed space value
+ */
+ const SPACE_NOT_COMPUTED = -1;
+ /*
+ * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unknown space value
+ */
+ const SPACE_UNKNOWN = -2;
+ /*
+ * @const \OCP\Files\FileInfo::SPACE_UNKNOWN Return value for unlimited space
+ */
+ const SPACE_UNLIMITED = -3;
+
/**
* Get the Etag of the file or folder
*