summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-03-30 19:44:38 +0200
committerRobin Appelman <icewind@owncloud.com>2012-03-30 19:44:49 +0200
commit65eee1f69dbbbe86bb4bf0716a464dc9f2c66a67 (patch)
tree65c97f31bb6285074bf408f0f3990d67e3221f95
parent284955573c59e91ed4cab7771487d1cebbb44262 (diff)
downloadnextcloud-server-65eee1f69dbbbe86bb4bf0716a464dc9f2c66a67.tar.gz
nextcloud-server-65eee1f69dbbbe86bb4bf0716a464dc9f2c66a67.zip
clean pre-path_hash fscache entries
-rw-r--r--db_structure.xml3
-rw-r--r--files/ajax/scan.php1
-rw-r--r--lib/filecache.php8
3 files changed, 10 insertions, 2 deletions
diff --git a/db_structure.xml b/db_structure.xml
index 82d2a731d4c..2df218d359c 100644
--- a/db_structure.xml
+++ b/db_structure.xml
@@ -67,8 +67,7 @@
<field>
<name>path_hash</name>
<type>text</type>
- <default>
- </default>
+ <default></default>
<notnull>true</notnull>
<length>32</length>
</field>
diff --git a/files/ajax/scan.php b/files/ajax/scan.php
index 565275911b4..db09b7d5c64 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 a8c48e3f144..86d865ed9f3 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