clear the filecache if the mount configuration has changed
This commit is contained in:
parent
39577495e1
commit
2144b2f37a
2 changed files with 21 additions and 0 deletions
|
@ -474,6 +474,20 @@ class OC_FileCache{
|
|||
$query=OC_DB::prepare('DELETE FROM `*PREFIX*fscache` WHERE LENGTH(`path_hash`)<30');
|
||||
$query->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* clear filecache entries
|
||||
* @param string user (optonal)
|
||||
*/
|
||||
public static function clear($user=''){
|
||||
if($user){
|
||||
$query=OC_DB::prepare('DELETE FROM `*PREFIX*fscache` WHERE user=?');
|
||||
$query->execute(array($user));
|
||||
}else{
|
||||
$query=OC_DB::prepare('DELETE FROM `*PREFIX*fscache`');
|
||||
$query->execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//watch for changes and try to keep the cache up to date
|
||||
|
|
|
@ -236,6 +236,13 @@ 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_Appconfig::setValue('files','mountconfigmtime',$mtime);
|
||||
}
|
||||
}
|
||||
|
||||
self::$loaded=true;
|
||||
|
|
Loading…
Reference in a new issue