]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix Shared root problems with Watcher and Quota proxy
authorMichael Gapczynski <mtgap@owncloud.com>
Tue, 1 Jan 2013 16:19:33 +0000 (11:19 -0500)
committerMichael Gapczynski <mtgap@owncloud.com>
Tue, 1 Jan 2013 16:19:33 +0000 (11:19 -0500)
apps/files_sharing/lib/cache.php
apps/files_sharing/lib/sharedstorage.php
lib/fileproxy/quota.php

index a22e7af7f59a92014cd10b4f33863d0bd7e516ae..60f29ce5eebcdd4d6cc9047c05fcc2a7a44001a5 100644 (file)
@@ -169,6 +169,9 @@ class Shared_Cache extends Cache {
         * @return int, Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE
         */
        public function getStatus($file) {
+               if ($file == '') {
+                       return self::COMPLETE;
+               }
                if ($cache = $this->getSourceCache($file)) {
                        return $cache->getStatus($this->files[$file]);
                }
index cb9b36482faa74b244420b397700112300f92116..3a1d7ef101aa473c9d6ccdf1619d113472915948 100644 (file)
@@ -364,6 +364,9 @@ class Shared extends \OC\Files\Storage\Common {
        }
 
        public function free_space($path) {
+               if ($path == '') {
+                       return -1;
+               }
                $source = $this->getSourcePath($path);
                if ($source) {
                        list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
@@ -391,6 +394,13 @@ class Shared extends \OC\Files\Storage\Common {
                \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/');
        }
 
+       public function hasUpdated($path, $time) {
+               if ($path == '') {
+                       return false;
+               }
+               return $this->filemtime($path) > $time;
+       }
+
        public function getCache() {
                return new \OC\Files\Cache\Shared_Cache($this);
        }
@@ -404,6 +414,9 @@ class Shared extends \OC\Files\Storage\Common {
        }
 
        public function getOwner($path) {
+               if ($path == '') {
+                       return false;
+               }
                $source = $this->getFile($path);
                if ($source) {
                        return $source['uid_owner'];
index 80270728aba233d606e5580352b5ba5ed7ff52c5..c333efa6cdfa54f6d2c198518c108474a558723f 100644 (file)
@@ -63,6 +63,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{
                 */
                list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path);
                $owner=$storage->getOwner($internalPath);
+               if (!$owner) {
+                       return -1;
+               }
 
                $totalSpace=$this->getQuota($owner);
                if($totalSpace==-1) {
@@ -73,7 +76,6 @@ class OC_FileProxy_Quota extends OC_FileProxy{
 
                $rootInfo=$view->getFileInfo('/');
                $usedSpace=isset($rootInfo['size'])?$rootInfo['size']:0;
-               $usedSpace=isset($sharedInfo['size'])?$usedSpace-$sharedInfo['size']:$usedSpace;
                return $totalSpace-$usedSpace;
        }