if(!$view->file_exists($path)) {
return false;
}
- $cachedData=OC_FileCache_Cached::get($path,$root);
+ $cachedData=OC_FileCache_Cached::get($path, $root);
if(isset($cachedData['mtime'])) {
$cachedMTime=$cachedData['mtime'];
if($folder) {
- return $view->hasUpdated($path.'/',$cachedMTime);
+ return $view->hasUpdated($path.'/', $cachedMTime);
}else{
- return $view->hasUpdated($path,$cachedMTime);
+ return $view->hasUpdated($path, $cachedMTime);
}
}else{//file not in cache, so it has to be updated
if(($path=='/' or $path=='') and $root===false) {//dont auto update the home folder, it will be scanned
$file=$view->getRelativePath($path);
if(!$view->file_exists($file)) {
if($root===false) {//filesystem hooks are only valid for the default root
- OC_Hook::emit('OC_Filesystem','post_delete',array('path'=>$file));
+ OC_Hook::emit('OC_Filesystem', 'post_delete', array('path'=>$file));
}else{
- self::delete($file,$root);
+ self::delete($file, $root);
}
}
}
while (($filename = readdir($dh)) !== false) {
if($filename != '.' and $filename != '..') {
$file=$path.'/'.$filename;
- if(self::hasUpdated($file,$root)) {
+ if(self::hasUpdated($file, $root)) {
if($root===false) {//filesystem hooks are only valid for the default root
- OC_Hook::emit('OC_Filesystem','post_write',array('path'=>$file));
+ OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$file));
}else{
- self::update($file,$root);
+ self::update($file, $root);
}
}
}
}
}
- self::cleanFolder($path,$root);
+ self::cleanFolder($path, $root);
//update the folder last, so we can calculate the size correctly
if($root===false) {//filesystem hooks are only valid for the default root
- OC_Hook::emit('OC_Filesystem','post_write',array('path'=>$path));
+ OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$path));
}else{
- self::update($path,$root);
+ self::update($path, $root);
}
}
public static function fileSystemWatcherRename($params) {
$oldPath=$params['oldpath'];
$newPath=$params['newpath'];
- self::rename($oldPath,$newPath);
+ self::rename($oldPath, $newPath);
}
/**
$cachedSize=isset($cached['size'])?$cached['size']:0;
if($view->is_dir($path.'/')) {
- if(OC_FileCache::inCache($path,$root)) {
- $cachedContent=OC_FileCache_Cached::getFolderContent($path,$root);
+ if(OC_FileCache::inCache($path, $root)) {
+ $cachedContent=OC_FileCache_Cached::getFolderContent($path, $root);
foreach($cachedContent as $file) {
$size+=$file['size'];
}
$mtime=$view->filemtime($path.'/');
$ctime=$view->filectime($path.'/');
$writable=$view->is_writable($path.'/');
- OC_FileCache::put($path,array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
+ OC_FileCache::put($path, array('size'=>$size,'mtime'=>$mtime,'ctime'=>$ctime,'mimetype'=>$mimetype,'writable'=>$writable));
}else{
$count=0;
- OC_FileCache::scan($path,null,$count,$root);
+ OC_FileCache::scan($path, null, $count, $root);
return; //increaseSize is already called inside scan
}
}else{
- $size=OC_FileCache::scanFile($path,$root);
+ $size=OC_FileCache::scanFile($path, $root);
}
- OC_FileCache::increaseSize(dirname($path),$size-$cachedSize,$root);
+ OC_FileCache::increaseSize(dirname($path), $size-$cachedSize, $root);
}
/**
* @param string root (optional)
*/
public static function delete($path,$root=false) {
- $cached=OC_FileCache_Cached::get($path,$root);
+ $cached=OC_FileCache_Cached::get($path, $root);
if(!isset($cached['size'])) {
return;
}
$size=$cached['size'];
- OC_FileCache::increaseSize(dirname($path),-$size,$root);
- OC_FileCache::delete($path,$root);
+ OC_FileCache::increaseSize(dirname($path), -$size, $root);
+ OC_FileCache::delete($path, $root);
}
/**
* @param string root (optional)
*/
public static function rename($oldPath,$newPath,$root=false) {
- if(!OC_FileCache::inCache($oldPath,$root)) {
+ if(!OC_FileCache::inCache($oldPath, $root)) {
return;
}
if($root===false) {
$view=new OC_FilesystemView($root);
}
- $cached=OC_FileCache_Cached::get($oldPath,$root);
+ $cached=OC_FileCache_Cached::get($oldPath, $root);
$oldSize=$cached['size'];
- OC_FileCache::increaseSize(dirname($oldPath),-$oldSize,$root);
- OC_FileCache::increaseSize(dirname($newPath),$oldSize,$root);
- OC_FileCache::move($oldPath,$newPath);
+ OC_FileCache::increaseSize(dirname($oldPath), -$oldSize, $root);
+ OC_FileCache::increaseSize(dirname($newPath), $oldSize, $root);
+ OC_FileCache::move($oldPath, $newPath);
}
}
\ No newline at end of file