Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2012-09-07 17:22:01 +0400
committerThomas Mueller <thomas.mueller@tmit.eu>2012-09-07 17:22:01 +0400
commit3829460ab8cbb6de65c53583a20fd04cbe7927dd (patch)
tree4dc24845a5eb31b17510a621e14c15b51f16bf7b /lib/filecache
parent785aa751bb5f9a4bcdd677b96207550482e17d3c (diff)
adding space between) and {
Diffstat (limited to 'lib/filecache')
-rw-r--r--lib/filecache/cached.php18
-rw-r--r--lib/filecache/update.php62
2 files changed, 40 insertions, 40 deletions
diff --git a/lib/filecache/cached.php b/lib/filecache/cached.php
index 505f1a5e2a0..261bd2f572b 100644
--- a/lib/filecache/cached.php
+++ b/lib/filecache/cached.php
@@ -13,20 +13,20 @@
class OC_FileCache_Cached{
public static $savedData=array();
- public static function get($path,$root=false){
- if($root===false){
+ public static function get($path,$root=false) {
+ if($root===false) {
$root=OC_Filesystem::getRoot();
}
$path=$root.$path;
$query=OC_DB::prepare('SELECT `path`,`ctime`,`mtime`,`mimetype`,`size`,`encrypted`,`versioned`,`writable` FROM `*PREFIX*fscache` WHERE `path_hash`=?');
$result=$query->execute(array(md5($path)))->fetchRow();
- if(is_array($result)){
- if(isset(self::$savedData[$path])){
+ if(is_array($result)) {
+ if(isset(self::$savedData[$path])) {
$result=array_merge($result,self::$savedData[$path]);
}
return $result;
}else{
- if(isset(self::$savedData[$path])){
+ if(isset(self::$savedData[$path])) {
return self::$savedData[$path];
}else{
return array();
@@ -50,17 +50,17 @@ class OC_FileCache_Cached{
* - encrypted
* - versioned
*/
- public static function getFolderContent($path,$root=false,$mimetype_filter=''){
- if($root===false){
+ public static function getFolderContent($path,$root=false,$mimetype_filter='') {
+ if($root===false) {
$root=OC_Filesystem::getRoot();
}
$parent=OC_FileCache::getId($path,$root);
- if($parent==-1){
+ if($parent==-1) {
return array();
}
$query=OC_DB::prepare('SELECT `id`,`path`,`name`,`ctime`,`mtime`,`mimetype`,`size`,`encrypted`,`versioned`,`writable` FROM `*PREFIX*fscache` WHERE `parent`=? AND (`mimetype` LIKE ? OR `mimetype` = ?)');
$result=$query->execute(array($parent, $mimetype_filter.'%', 'httpd/unix-directory'))->fetchAll();
- if(is_array($result)){
+ if(is_array($result)) {
return $result;
}else{
OC_Log::write('files','getFolderContent(): file not found in cache ('.$path.')',OC_Log::DEBUG);
diff --git a/lib/filecache/update.php b/lib/filecache/update.php
index 7b5f18fe5c1..3d10f5ea7b6 100644
--- a/lib/filecache/update.php
+++ b/lib/filecache/update.php
@@ -18,25 +18,25 @@ class OC_FileCache_Update{
* @param boolean folder
* @return bool
*/
- public static function hasUpdated($path,$root=false,$folder=false){
- if($root===false){
+ public static function hasUpdated($path,$root=false,$folder=false) {
+ if($root===false) {
$view=OC_Filesystem::getView();
}else{
$view=new OC_FilesystemView($root);
}
- if(!$view->file_exists($path)){
+ if(!$view->file_exists($path)) {
return false;
}
$cachedData=OC_FileCache_Cached::get($path,$root);
- if(isset($cachedData['mtime'])){
+ if(isset($cachedData['mtime'])) {
$cachedMTime=$cachedData['mtime'];
- if($folder){
+ if($folder) {
return $view->hasUpdated($path.'/',$cachedMTime);
}else{
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
+ if(($path=='/' or $path=='') and $root===false) {//dont auto update the home folder, it will be scanned
return false;
}
return true;
@@ -46,19 +46,19 @@ class OC_FileCache_Update{
/**
* delete non existing files from the cache
*/
- public static function cleanFolder($path,$root=false){
- if($root===false){
+ public static function cleanFolder($path,$root=false) {
+ if($root===false) {
$view=OC_Filesystem::getView();
}else{
$view=new OC_FilesystemView($root);
}
$cachedContent=OC_FileCache_Cached::getFolderContent($path,$root);
- foreach($cachedContent as $fileData){
+ foreach($cachedContent as $fileData) {
$path=$fileData['path'];
$file=$view->getRelativePath($path);
- if(!$view->file_exists($file)){
- if($root===false){//filesystem hooks are only valid for the default root
+ 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));
}else{
self::delete($file,$root);
@@ -72,19 +72,19 @@ class OC_FileCache_Update{
* @param string path
* @param string root (optional)
*/
- public static function updateFolder($path,$root=false){
- if($root===false){
+ public static function updateFolder($path,$root=false) {
+ if($root===false) {
$view=OC_Filesystem::getView();
}else{
$view=new OC_FilesystemView($root);
}
$dh=$view->opendir($path.'/');
- if($dh){//check for changed/new files
+ if($dh) {//check for changed/new files
while (($filename = readdir($dh)) !== false) {
- if($filename != '.' and $filename != '..'){
+ if($filename != '.' and $filename != '..') {
$file=$path.'/'.$filename;
- if(self::hasUpdated($file,$root)){
- if($root===false){//filesystem hooks are only valid for the default 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));
}else{
self::update($file,$root);
@@ -97,7 +97,7 @@ class OC_FileCache_Update{
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
+ if($root===false) {//filesystem hooks are only valid for the default root
OC_Hook::emit('OC_Filesystem','post_write',array('path'=>$path));
}else{
self::update($path,$root);
@@ -109,7 +109,7 @@ class OC_FileCache_Update{
* @param array $params
* @param string root (optional)
*/
- public static function fileSystemWatcherWrite($params){
+ public static function fileSystemWatcherWrite($params) {
$path=$params['path'];
self::update($path);
}
@@ -119,7 +119,7 @@ class OC_FileCache_Update{
* @param array $params
* @param string root (optional)
*/
- public static function fileSystemWatcherDelete($params){
+ public static function fileSystemWatcherDelete($params) {
$path=$params['path'];
self::delete($path);
}
@@ -129,7 +129,7 @@ class OC_FileCache_Update{
* @param array $params
* @param string root (optional)
*/
- public static function fileSystemWatcherRename($params){
+ public static function fileSystemWatcherRename($params) {
$oldPath=$params['oldpath'];
$newPath=$params['newpath'];
self::rename($oldPath,$newPath);
@@ -140,8 +140,8 @@ class OC_FileCache_Update{
* @param string path
* @param string root (optional)
*/
- public static function update($path,$root=false){
- if($root===false){
+ public static function update($path,$root=false) {
+ if($root===false) {
$view=OC_Filesystem::getView();
}else{
$view=new OC_FilesystemView($root);
@@ -153,10 +153,10 @@ class OC_FileCache_Update{
$cached=OC_FileCache_Cached::get($path,$root);
$cachedSize=isset($cached['size'])?$cached['size']:0;
- if($view->is_dir($path.'/')){
- if(OC_FileCache::inCache($path,$root)){
+ if($view->is_dir($path.'/')) {
+ if(OC_FileCache::inCache($path,$root)) {
$cachedContent=OC_FileCache_Cached::getFolderContent($path,$root);
- foreach($cachedContent as $file){
+ foreach($cachedContent as $file) {
$size+=$file['size'];
}
$mtime=$view->filemtime($path.'/');
@@ -179,9 +179,9 @@ class OC_FileCache_Update{
* @param string path
* @param string root (optional)
*/
- public static function delete($path,$root=false){
+ public static function delete($path,$root=false) {
$cached=OC_FileCache_Cached::get($path,$root);
- if(!isset($cached['size'])){
+ if(!isset($cached['size'])) {
return;
}
$size=$cached['size'];
@@ -195,11 +195,11 @@ class OC_FileCache_Update{
* @param string newPath
* @param string root (optional)
*/
- public static function rename($oldPath,$newPath,$root=false){
- if(!OC_FileCache::inCache($oldPath,$root)){
+ public static function rename($oldPath,$newPath,$root=false) {
+ if(!OC_FileCache::inCache($oldPath,$root)) {
return;
}
- if($root===false){
+ if($root===false) {
$view=OC_Filesystem::getView();
}else{
$view=new OC_FilesystemView($root);