summaryrefslogtreecommitdiff
path: root/lib/exe
diff options
context:
space:
mode:
authorMykola Ostrovskyy <spambox03@mail.ru>2009-09-20 19:19:54 +0200
committerMykola Ostrovskyy <spambox03@mail.ru>2009-09-20 19:19:54 +0200
commit8ec12455ec81c8832085594acd6c082b1f9e625a (patch)
treea27e37534c1f1a03a8078800a79df74de5444f5b /lib/exe
parent190c56e8489990bddc9a3ab5afa21896b9bd17dc (diff)
downloadrpg-8ec12455ec81c8832085594acd6c082b1f9e625a.tar.gz
rpg-8ec12455ec81c8832085594acd6c082b1f9e625a.tar.bz2
Prevent unnecessary updates of the changelog (FS#1758)
Ignore-this: 5653cc47ce2ee6412ba82c82eb2b45fe darcs-hash:20090920171954-40dc4-0c4249b424314a930cdcbe710796db2820330aef.gz
Diffstat (limited to 'lib/exe')
-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);