Преглед изворни кода

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

master
memespring пре 17 година
родитељ
комит
43fc9eb558
2 измењених фајлова са 20 додато и 12 уклоњено
  1. +2
    -1
      tools/application_mailer.php
  2. +18
    -11
      tools/application_parser.php

+ 2
- 1
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);



+ 18
- 11
tools/application_parser.php Прегледај датотеку

@@ -1,15 +1,22 @@
<?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
$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{

//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);
}
}


Loading…
Откажи
Сачувај