mirror of
https://github.com/nextcloud/server.git
synced 2026-03-04 18:28:08 +01:00
clean pre-path_hash fscache entries
This commit is contained in:
@@ -67,8 +67,7 @@
|
||||
<field>
|
||||
<name>path_hash</name>
|
||||
<type>text</type>
|
||||
<default>
|
||||
</default>
|
||||
<default></default>
|
||||
<notnull>true</notnull>
|
||||
<length>32</length>
|
||||
</field>
|
||||
|
||||
@@ -17,6 +17,7 @@ if($force or !OC_FileCache::inCache('')){
|
||||
if(!$checkOnly){
|
||||
OC_DB::beginTransaction();
|
||||
OC_FileCache::scan('',$eventSource);
|
||||
OC_FileCache::clean();
|
||||
OC_DB::commit();
|
||||
$eventSource->send('success',true);
|
||||
}else{
|
||||
|
||||
@@ -637,6 +637,14 @@ class OC_FileCache{
|
||||
self::fileSystemWatcherWrite(array('path'=>$path),$root);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clean old pre-path_hash entries
|
||||
*/
|
||||
public static function clean(){
|
||||
$query=OC_DB::prepare('DELETE FROM *PREFIX*fscache WHERE LENGTH(path_hash)<30');
|
||||
$query->execute();
|
||||
}
|
||||
}
|
||||
|
||||
//watch for changes and try to keep the cache up to date
|
||||
|
||||
Reference in New Issue
Block a user