clean pre-path_hash fscache entries

This commit is contained in:
Robin Appelman 2012-03-30 19:44:38 +02:00
parent 284955573c
commit 65eee1f69d
3 changed files with 10 additions and 2 deletions

View File

@ -67,8 +67,7 @@
<field>
<name>path_hash</name>
<type>text</type>
<default>
</default>
<default></default>
<notnull>true</notnull>
<length>32</length>
</field>

View File

@ -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{

View File

@ -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