Browse Source

changed parser so that it scrapes the last X number of days. we were missing too many apps

master
memespring 17 years ago
parent
commit
43fc9eb558
2 changed files with 20 additions and 12 deletions
  1. +2
    -1
      tools/application_mailer.php
  2. +18
    -11
      tools/application_parser.php

+ 2
- 1
tools/application_mailer.php View File

@@ -45,7 +45,8 @@
inner join authority on application.authority_id = authority.authority_id inner join authority on application.authority_id = authority.authority_id
where date_scraped > " . $db->quote(mysql_date(time() - (24 * 60 * 60))) . 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.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); $application_results = $db->getAll($sql);




+ 18
- 11
tools/application_parser.php View File

@@ -1,15 +1,22 @@
<?php <?php


require_once('tools_ini.php');
require_once('application.php');
require_once('DB.php');
require_once('tools_ini.php');
require_once('application.php');
require_once('DB.php');
//Initialise //Initialise
$application_parser = new application_parser(); $application_parser = new application_parser();
$application_parser->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{ class application_parser{


//Properties //Properties
@@ -85,10 +92,6 @@
sleep($this->sleep_interval); 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"; 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);
}
} }



Loading…
Cancel
Save