]> source.dussan.org Git - nextcloud-server.git/commitdiff
add free_space to OC_FILESYSTEM
authorRobin Appelman <icewind1991@gmail.com>
Sun, 17 Apr 2011 14:40:44 +0000 (16:40 +0200)
committerRobin Appelman <icewind1991@gmail.com>
Sun, 17 Apr 2011 14:40:44 +0000 (16:40 +0200)
lib/filestorage.php
lib/filesystem.php
settings/index.php

index 66b91fc19aa58eff7a494a9922d0cb3e32d6ec8c..5161e7f0e57a9f20e770d5058948ac299bcaf1cc 100644 (file)
@@ -75,6 +75,7 @@ class OC_FILESTORAGE{
        public function find($path){}
        public function getTree($path){}
        public function hash($type,$path,$raw){}
+       public function free_space($path){}
 }
 
 
@@ -466,6 +467,10 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
                }
                return $return;
        }
+       
+       public function free_space($path){
+               return disk_free_space($this->datadir.$path);
+       }
 
        /**
         * @brief get the size of folder and it's content
index 54b2ad9ce77d31a620bf777ed2e4697b1ab2a3a9..033f50e2aba729047d956b94d56911464f2310cf 100644 (file)
@@ -386,5 +386,11 @@ class OC_FILESYSTEM{
                        return $storage->hash($type,self::getInternalPath($path),$raw);
                }
        }
+       
+       static public function free_space($path='/'){
+               if(self::canRead($path) and $storage=self::getStorage($path)){
+                       return $storage->free_space($path);
+               }
+       }
 }
 ?>
index 521f2ade9da8b0d4ec4680f2ae71faac47a2f3e2..0e3b3f285500f109b769f11db0f9dbc0349f57ff 100644 (file)
@@ -10,7 +10,7 @@ if( !OC_USER::isLoggedIn()){
 
 $tmpl = new OC_TEMPLATE( "settings", "index", "admin");
 $used=OC_FILESYSTEM::filesize('/');
-$free=disk_free_space(OC_CONFIG::getValue('datadirectory'));
+$free=OC_FILESYSTEM::free_space();
 $total=$free+$used;
 $relative=round(($used/$total)*100);
 $tmpl->assign('usage',OC_HELPER::humanFileSize($used));