From 2cb3f0f466839e76e809553441cd15c34e3c8acf Mon Sep 17 00:00:00 2001 From: Angel Ortega Date: Wed, 8 Feb 2012 13:45:15 +0100 Subject: [PATCH] Avoid creating 'search by date' files over and over. --- bin/gruta-snapshot | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/gruta-snapshot b/bin/gruta-snapshot index 22098cf..7485ac0 100755 --- a/bin/gruta-snapshot +++ b/bin/gruta-snapshot @@ -128,13 +128,19 @@ foreach my $t (sort $g->source->topics()) { my $d = $story->date('%y%m%d'); - mkdir $folder . '/' . $d; + if ($d) { + mkdir $folder . '/' . $d; - out($g, 'SEARCH_BY_DATE', "${d}/index.html", { - from => "${d}000000", - to => "${d}235959" + my $f = $folder . '/' . $d . '/index.html'; + + if (! -f $f || (-M $folder . '/index.html' < -M $f)) { + out($g, 'SEARCH_BY_DATE', "${d}/index.html", { + from => "${d}000000", + to => "${d}235959" + } + ); } - ); + } } out($g, 'TOPIC', "$t/index.html", { 'topic' => $t, 'num' => $topic_num }); -- 2.11.4.GIT