diff --git a/db_structure.xml b/db_structure.xml index 82d2a731d4..2df218d359 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -67,8 +67,7 @@ path_hash text - - + true 32 diff --git a/files/ajax/scan.php b/files/ajax/scan.php index 565275911b..db09b7d5c6 100644 --- a/files/ajax/scan.php +++ b/files/ajax/scan.php @@ -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{ diff --git a/lib/filecache.php b/lib/filecache.php index a8c48e3f14..86d865ed9f 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -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