summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-10-26 23:05:02 +0200
committerRobin Appelman <icewind@owncloud.com>2012-10-26 23:05:02 +0200
commit6db81afab9d68ccd50c1e164622252e47ae76c2f (patch)
treed4ae92ab7ee21805e52a29e4099daeb4649ca79e /lib
parent4b616764e825022e9394a4cb26af2012276285b4 (diff)
downloadnextcloud-server-6db81afab9d68ccd50c1e164622252e47ae76c2f.tar.gz
nextcloud-server-6db81afab9d68ccd50c1e164622252e47ae76c2f.zip
move some stuff to the new api
Diffstat (limited to 'lib')
-rw-r--r--lib/connector/sabre/directory.php6
-rw-r--r--lib/connector/sabre/node.php4
-rw-r--r--lib/fileproxy/quota.php12
-rw-r--r--lib/files.php2
-rw-r--r--lib/files/filesystem.php13
-rw-r--r--lib/files/view.php1
-rw-r--r--lib/ocs.php4
-rw-r--r--lib/public/share.php15
-rw-r--r--lib/search/provider/file.php2
9 files changed, 35 insertions, 24 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 3df85b2bbbe..d4f58527d21 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -93,7 +93,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
$path = $this->path . '/' . $name;
if (is_null($info)) {
- $info = OC_Files::getFileInfo($path);
+ $info = \OC\Files\Filesystem::getFileInfo($path);
}
if (!$info) {
@@ -117,7 +117,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function getChildren() {
- $folder_content = OC_Files::getDirectoryContent($this->path);
+ $folder_content = \OC\Files\Filesystem::getDirectoryContent($this->path);
$paths = array();
foreach($folder_content as $info) {
$paths[] = $this->path.'/'.$info['name'];
@@ -178,7 +178,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
* @return array
*/
public function getQuotaInfo() {
- $rootInfo=OC_FileCache_Cached::get('');
+ $rootInfo=\OC\Files\Filesystem::getFileInfo('');
return array(
$rootInfo['size'],
\OC\Files\Filesystem::free_space()
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index e7e83507ea2..2095c956e5f 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -95,11 +95,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
}
/**
- * Make sure the fileinfo cache is filled. Uses OC_FileCache or a direct stat
+ * Make sure the fileinfo cache is filled. Uses the file cache or a direct stat
*/
protected function getFileinfoCache() {
if (!isset($this->fileinfo_cache)) {
- if ($fileinfo_cache = \OC\Files\Filesystem::get($this->path)) {
+ if ($fileinfo_cache = \OC\Files\Filesystem::getFileInfo($this->path)) {
} else {
$fileinfo_cache = \OC\Files\Filesystem::stat($this->path);
}
diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php
index d120f309998..cd9a2f4a192 100644
--- a/lib/fileproxy/quota.php
+++ b/lib/fileproxy/quota.php
@@ -57,7 +57,7 @@ class OC_FileProxy_Quota extends OC_FileProxy{
* @return int
*/
private function getFreeSpace($path) {
- $storage=OC_Filesystem::getStorage($path);
+ list($storage,)=\OC\Files\Filesystem::resolvePath($path);
$owner=$storage->getOwner($path);
$totalSpace=$this->getQuota($owner);
@@ -65,13 +65,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
return 0;
}
- $rootInfo=OC_FileCache::get('', "/".$owner."/files");
- // TODO Remove after merge of share_api
- if (OC_FileCache::inCache('/Shared', "/".$owner."/files")) {
- $sharedInfo=OC_FileCache::get('/Shared', "/".$owner."/files");
- } else {
- $sharedInfo = null;
- }
+ $view = new \OC\Files\View("/".$owner."/files");
+
+ $rootInfo=$view->getFileInfo('/');
$usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
$usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace;
return $totalSpace-$usedSpace;
diff --git a/lib/files.php b/lib/files.php
index 422e7f4ffe7..6a063f216d5 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -146,7 +146,7 @@ class OC_Files {
$dirname = basename($dir);
$zip->addEmptyDir($internalDir . $dirname);
$internalDir .= $dirname .= '/';
- $files = OC_Files::getdirectorycontent($dir);
+ $files = \OC\Files\Filesystem::getDirectoryContent($dir);
foreach ($files as $file) {
$filename = $file['name'];
$file = $dir . '/' . $filename;
diff --git a/lib/files/filesystem.php b/lib/files/filesystem.php
index 4031c0c5b80..b3c92f38558 100644
--- a/lib/files/filesystem.php
+++ b/lib/files/filesystem.php
@@ -628,6 +628,19 @@ class Filesystem {
}
/**
+ * change file metadata
+ *
+ * @param string $path
+ * @param array $data
+ * @return int
+ *
+ * returns the fileid of the updated file
+ */
+ public static function putFileInfo($path, $data) {
+ return self::$defaultInstance->putFileInfo($path, $data);
+ }
+
+ /**
* get the content of a directory
*
* @param string $directory path under datadirectory
diff --git a/lib/files/view.php b/lib/files/view.php
index ee95cce0c1d..e9b583f8ae6 100644
--- a/lib/files/view.php
+++ b/lib/files/view.php
@@ -451,7 +451,6 @@ class View {
array(Filesystem::signal_param_path => $path2)
);
} else { // no real copy, file comes from somewhere else, e.g. version rollback -> just update the file cache and the webdav properties without all the other post_write actions
-// OC_FileCache_Update::update($path2, $this->fakeRoot);
Filesystem::removeETagHook(array("path" => $path2), $this->fakeRoot);
}
return $result;
diff --git a/lib/ocs.php b/lib/ocs.php
index 645380ddba8..c6bcd2c06e1 100644
--- a/lib/ocs.php
+++ b/lib/ocs.php
@@ -590,8 +590,8 @@ class OC_OCS {
// calculate the disc space
$user_dir = '/'.$user.'/files';
\OC\Files\Filesystem::init($user_dir);
- $rootInfo=OC_FileCache::get('');
- $sharedInfo=OC_FileCache::get('/Shared');
+ $rootInfo=\OC\Files\Filesystem::getFileInfo('');
+ $sharedInfo=\OC\Files\Filesystem::getFileInfo('/Shared');
$used=$rootInfo['size']-$sharedInfo['size'];
$free=\OC\Files\Filesystem::free_space();
$total=$free+$used;
diff --git a/lib/public/share.php b/lib/public/share.php
index 7a9a087d1bd..dd6c841c99d 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -285,10 +285,10 @@ class Share {
// If the item is a folder, scan through the folder looking for equivalent item types
if ($itemType == 'folder') {
$parentFolder = self::put('folder', $itemSource, $shareType, $shareWith, $uidOwner, $permissions, true);
- if ($parentFolder && $files = \OC_Files::getDirectoryContent($itemSource)) {
+ if ($parentFolder && $files = \OC\Files\Filesystem::getDirectoryContent($itemSource)) {
for ($i = 0; $i < count($files); $i++) {
$name = substr($files[$i]['name'], strpos($files[$i]['name'], $itemSource) - strlen($itemSource));
- if ($files[$i]['mimetype'] == 'httpd/unix-directory' && $children = \OC_Files::getDirectoryContent($name, '/')) {
+ if ($files[$i]['mimetype'] == 'httpd/unix-directory' && $children = \OC\Files\Filesystem::getDirectoryContent($name, '/')) {
// Continue scanning into child folders
array_push($files, $children);
} else {
@@ -768,9 +768,10 @@ class Share {
if ($row['item_type'] == 'file' || $row['item_type'] == 'folder') {
$childItem['file_source'] = $child['source'];
} else {
- $childItem['file_source'] = \OC_FileCache::getId($child['file_path']);
+ $meta = \OC\Files\Filesystem::getFileInfo($child['file_path']);
+ $childItem['file_source'] = $meta['fileid'];
}
- $childItem['file_target'] = \OC_Filesystem::normalizePath($child['file_path']);
+ $childItem['file_target'] = \OC\Files\Filesystem::normalizePath($child['file_path']);
}
if (isset($item)) {
if ($childItem[$column] == $item) {
@@ -881,7 +882,8 @@ class Share {
if ($itemType == 'file' || $itemType == 'folder') {
$fileSource = $itemSource;
} else {
- $fileSource = \OC_FileCache::getId($filePath);
+ $meta = \OC\Files\Filesystem::getFileInfo($filePath);
+ $fileSource = $meta['fileid'];
}
if ($fileSource == -1) {
$message = 'Sharing '.$itemSource.' failed, because the file could not be found in the file cache';
@@ -1063,7 +1065,8 @@ class Share {
}
if ($item['uid_owner'] == $uidOwner) {
if ($itemType == 'file' || $itemType == 'folder') {
- if ($item['file_source'] == \OC_FileCache::getId($itemSource)) {
+ $meta = \OC\Files\Filesystem::getFileInfo($itemSource);
+ if ($item['file_source'] == $meta['fileid']) {
return $target;
}
} else if ($item['item_source'] == $itemSource) {
diff --git a/lib/search/provider/file.php b/lib/search/provider/file.php
index 0d4b332b792..456e12b5ec2 100644
--- a/lib/search/provider/file.php
+++ b/lib/search/provider/file.php
@@ -2,7 +2,7 @@
class OC_Search_Provider_File extends OC_Search_Provider{
function search($query) {
- $files=OC_FileCache::search($query, true);
+ $files=\OC\Files\Filesystem::search($query, true);
$results=array();
$l=OC_L10N::get('lib');
foreach($files as $fileData) {