diff --git a/tools/application_mailer.php b/tools/application_mailer.php index 381d4f3..f18b0d1 100644 --- a/tools/application_mailer.php +++ b/tools/application_mailer.php @@ -45,7 +45,8 @@ inner join authority on application.authority_id = authority.authority_id where date_scraped > " . $db->quote(mysql_date(time() - (24 * 60 * 60))) . " and (application.x > " . $user_results[$i][3] . " and application.x < " . $user_results[$i][5] . ") - and (application.y > " . $user_results[$i][4] . " and application.y < " . $user_results[$i][6] . ")"; + and (application.y > " . $user_results[$i][4] . " and application.y < " . $user_results[$i][6] . + and (application.y <> 0 and application.y <> 0 ")"; $application_results = $db->getAll($sql); diff --git a/tools/application_parser.php b/tools/application_parser.php index e462860..53cc8c6 100644 --- a/tools/application_parser.php +++ b/tools/application_parser.php @@ -1,15 +1,22 @@ date = getdate(strtotime("-" . SCRAPE_DELAY . " days")); - $application_parser->run(); - //class + //Scrape for the last X days (apps already in the database are ignored) + for ($i=0; $i < SCRAPE_DELAY; $i++){ + $application_parser->date = getdate(strtotime("-" . $i . " days")); + $application_parser->run(); + } + + //Send email + $application_parser->email_log(); + + //Parser class class application_parser{ //Properties @@ -85,10 +92,6 @@ sleep($this->sleep_interval); } - - //Email log - send_text_email(LOG_EMAIL, "parser@" . DOMAIN, "parser@" . DOMAIN, "Planning parser log", print_r($this->log, true)); - $this->store_log("Debug email sent to " . LOG_EMAIL); } @@ -164,7 +167,11 @@ print $text . "\n\n"; } - + function email_log(){ + //Email log + send_text_email(LOG_EMAIL, "parser@" . DOMAIN, "parser@" . DOMAIN, "Planning parser log", print_r($this->log, true)); + $this->store_log("Debug email sent to " . LOG_EMAIL); + } }