summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/exe/indexer.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index b114d4b3b..1f08fb56a 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -68,8 +68,9 @@ function runTrimRecentChanges($media_changes = false) {
// changes or $conf['recent'] items, which ever is larger.
// The trimming is only done once a day.
if (@file_exists($fn) &&
- (filectime($fn)+86400)<time() &&
+ (@filemtime($fn.'.trimmed')+86400)<time() &&
!@file_exists($fn.'_tmp')) {
+ @touch($fn.'.trimmed');
io_lock($fn);
$lines = file($fn);
if (count($lines)<=$conf['recent']) {
@@ -92,6 +93,13 @@ function runTrimRecentChanges($media_changes = false) {
}
}
+ if (count($lines)==count($out_lines)) {
+ // nothing to trim
+ @unlink($fn.'_tmp');
+ io_unlock($fn);
+ return false;
+ }
+
// sort the final result, it shouldn't be necessary,
// however the extra robustness in making the changelog cache self-correcting is worth it
ksort($out_lines);