From b395930084b8a0cb1ca7a38daf6e0b36046dc3e3 Mon Sep 17 00:00:00 2001 From: mj-saunders Date: Sat, 5 May 2018 08:00:10 +0000 Subject: [PATCH] Improve some readability --- cronjob.pl | 4 ++++ update_db.pl | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cronjob.pl b/cronjob.pl index 2736b21..b79c185 100755 --- a/cronjob.pl +++ b/cronjob.pl @@ -41,12 +41,16 @@ if ($VERBOSE) {print STDOUT "Checking for new entries\n";} my $new_entries = 0; my @feeds = RSSTootalizer::Feed->all(); +# For each Feed stored in database FEED: foreach my $feed (@feeds){ next FEED unless $feed; next FEED unless $feed->{data}->{enabled}; + # If enabled, fetch the RSS xml my $entries = $feed->fetch_entries(); next FEED unless $entries; + # For each entry in the xml file ENTRY: foreach my $entry ($entries->items){ + # Does the entry already exist in the database? my @seen_entries = $feed->entry_by("entry_link", $entry->link()); next ENTRY if ((scalar @seen_entries) > 0); diff --git a/update_db.pl b/update_db.pl index 0295588..4ceeee8 100755 --- a/update_db.pl +++ b/update_db.pl @@ -27,7 +27,7 @@ binmode STDOUT, ":utf8"; my @migrations = glob ("migrations/*sql"); foreach my $migration (@migrations){ my $sth = RSSTootalizer::DB->doSELECT("SELECT * FROM migrations WHERE name = ?", $migration); - if (scalar(@$sth) == 0){ + if ( scalar(@$sth) == 0 ){ print "Running migration $migration\n"; open (M, "<", $migration); my $sql = "";