瀏覽代碼

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…
取消
儲存