// 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();
}
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) {
$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();
}
use OC\Files\Storage\Loader;
class Filesystem {
- const SPACE_NOT_COMPUTED = -1;
- const SPACE_UNKNOWN = -2;
- const SPACE_UNLIMITED = -3;
/**
* @var Mount\Manager $mounts
* @return int
*/
public function free_space($path) {
- return \OC\Files\Filesystem::SPACE_UNKNOWN;
+ return \OCP\Files\FileInfo::SPACE_UNKNOWN;
}
/**
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;
}
}
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;
}
}
return $data['size'];
} else {
- return \OC\Files\Filesystem::SPACE_NOT_COMPUTED;
+ return \OCP\Files\FileInfo::SPACE_NOT_COMPUTED;
}
}
} 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);
*/
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 {
}
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();
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'));
}
}
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;
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
*
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')),