add free_space to OC_FILESYSTEM
This commit is contained in:
parent
f7c708b22a
commit
225ad85e90
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue