diff options
-rw-r--r-- | lib/filecache.php | 14 | ||||
-rw-r--r-- | lib/filesystem.php | 4 | ||||
-rwxr-xr-x | lib/util.php | 4 |
3 files changed, 18 insertions, 4 deletions
diff --git a/lib/filecache.php b/lib/filecache.php index 07099bcccd5..305ba035fb5 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -488,6 +488,20 @@ class OC_FileCache{ $query->execute(); } } + + /** + * trigger an update for the cache by setting the mtimes to 0 + * @param string $user (optional) + */ + public static function triggerUpdate($user=''){ + if($user) { + $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 WHERE `user`=? AND `mimetype`="httpd/unix-directory"'); + $query->execute(array($user)); + }else{ + $query=OC_DB::prepare('UPDATE `*PREFIX*fscache` SET `mtime`=0 AND `mimetype`="httpd/unix-directory"'); + $query->execute(); + } + } } //watch for changes and try to keep the cache up to date diff --git a/lib/filesystem.php b/lib/filesystem.php index c6da826a339..6dbfc6a9bf4 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -240,7 +240,7 @@ class OC_Filesystem{ $mtime=filemtime(OC::$SERVERROOT.'/config/mount.php'); $previousMTime=OC_Appconfig::getValue('files','mountconfigmtime',0); if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated - OC_FileCache::clear(); + OC_FileCache::triggerUpdate(); OC_Appconfig::setValue('files','mountconfigmtime',$mtime); } } @@ -531,7 +531,7 @@ class OC_Filesystem{ if ($root) { // reduce path to the required part of it (no 'username/files') $fakeRootView = new OC_FilesystemView($root); $count = 1; - $path=str_replace(OC_App::getStorage("files")->getAbsolutePath(), "", $fakeRootView->getAbsolutePath($path), $count); + $path=str_replace(OC_App::getStorage("files")->getAbsolutePath($path), "", $fakeRootView->getAbsolutePath($path), $count); } $path = self::normalizePath($path); diff --git a/lib/util.php b/lib/util.php index 310ca6afec9..db715a7a0f3 100755 --- a/lib/util.php +++ b/lib/util.php @@ -62,7 +62,7 @@ class OC_Util { $mtime=filemtime($user_root.'/mount.php'); $previousMTime=OC_Preferences::getValue($user,'files','mountconfigmtime',0); if($mtime>$previousMTime) {//mount config has changed, filecache needs to be updated - OC_FileCache::clear($user); + OC_FileCache::triggerUpdate($user); OC_Preferences::setValue($user,'files','mountconfigmtime',$mtime); } } @@ -574,4 +574,4 @@ class OC_Util { } return $pseudo_byte; } -}
\ No newline at end of file +} |