Fixed ADSL traffic collection, and migrated Task to Minion

This commit is contained in:
Deon George
2013-06-01 23:43:31 +10:00
parent 86afba378c
commit 2ac7389223
10 changed files with 115 additions and 126 deletions

View File

@@ -37,13 +37,13 @@ class Service_Traffic_Adsl_Exetelhspa extends Service_Traffic_Adsl {
// Find our services that need to be collected this way.
$update = array();
foreach ($this->so->services() as $so) {
foreach ($this->aso->services() as $so) {
if (Minion_CLI::options('verbose'))
echo " = Service: ".$so->name()."\n";
if ($so->plugin()->service_stats_collect AND $so->plugin()->service_stats_lastupdate < $date) {
// Start Session
$request = Request::factory($this->so->stats_url)
$request = Request::factory($this->aso->stats_url)
->method('POST')
->post($this->login_user_field,$so->plugin()->service_username)
->post($this->login_pass_field,$so->plugin()->service_password)
@@ -59,14 +59,14 @@ class Service_Traffic_Adsl_Exetelhspa extends Service_Traffic_Adsl {
if (! $data) {
// @todo Log into a log file
printf('Bad fetch for %s [%s]',$so->plugin()->service_number,$this->so->stats_lastupdate);
printf('Bad fetch for %s [%s]',$so->plugin()->service_number,$this->aso->stats_lastupdate);
#$html = new simple_html_dom();
#$html->load($data);
#$html->save(sprintf('/afs/local/tmp/usage.%s.%s.login.html',$so->plugin()->service_number,'login'));
continue;
}
for ($servicedate=date('Y-m-d',strtotime($this->so->stats_lastupdate.'+1 day'));
for ($servicedate=date('Y-m-d',strtotime($this->aso->stats_lastupdate.'+1 day'));
$servicedate <= $this->today;
$servicedate=date('Y-m-d',strtotime('+1 month',strtotime(date('Y-m',strtotime($servicedate)).'-01')))) {
#print_r(array('sn'=>$so->plugin()->service_number,'sd'=>$servicedate));
@@ -78,7 +78,7 @@ class Service_Traffic_Adsl_Exetelhspa extends Service_Traffic_Adsl {
$html = new simple_html_dom();
$notdebug = TRUE;
if ($notdebug) {
$request = Request::factory($this->so->stats_url.'usage_customize_query.php')
$request = Request::factory($this->aso->stats_url.'usage_customize_query.php')
->method('POST')
->post('year_search_key',date('Y',strtotime($servicedate)))
->post('month_search_key',date('m',strtotime($servicedate)))

View File

@@ -37,10 +37,13 @@ class Service_Traffic_Adsl_Exetelpe extends Service_Traffic_Adsl {
// Find our services that need to be collected this way.
$update = array();
foreach ($this->so->services() as $so) {
foreach ($this->aso->services() as $so) {
if (Minion_CLI::options('verbose'))
echo " = Service: ".$so->name()."\n";
if ($so->plugin()->service_stats_collect AND $so->plugin()->service_stats_lastupdate < $date) {
// Start Session
$request = Request::factory($this->so->stats_url)
$request = Request::factory($this->aso->stats_url)
->method('POST')
->post($this->login_user_field,$so->plugin()->service_username == NULL ? '' : $so->plugin()->service_username)
->post($this->login_pass_field,$so->plugin()->service_password == NULL ? '' : $so->plugin()->service_password)
@@ -56,14 +59,14 @@ class Service_Traffic_Adsl_Exetelpe extends Service_Traffic_Adsl {
if (! $data) {
// @todo Log into a log file
printf('Bad fetch for %s [%s]',$so->plugin()->service_number,$this->so->stats_lastupdate);
printf('Bad fetch for %s [%s]',$so->plugin()->service_number,$this->aso->stats_lastupdate);
#$html = new simple_html_dom();
#$html->load($data);
#$html->save(sprintf('/afs/local/tmp/usage.%s.%s.login.html',$so->plugin()->service_number,'login'));
continue;
}
for ($servicedate=date('Y-m-d',strtotime($this->so->stats_lastupdate.'+1 day'));
for ($servicedate=date('Y-m-d',strtotime($this->aso->stats_lastupdate.'+1 day'));
$servicedate <= $this->today;
$servicedate=date('Y-m-d',strtotime('+1 month',strtotime(date('Y-m',strtotime($servicedate)).'-01')))) {
@@ -74,7 +77,7 @@ class Service_Traffic_Adsl_Exetelpe extends Service_Traffic_Adsl {
$html = new simple_html_dom();
$notdebug = TRUE;
if ($notdebug) {
$request = Request::factory($this->so->stats_url.'usage_customize_query.php')
$request = Request::factory($this->aso->stats_url.'usage_customize_query.php')
->method('POST')
->post('year_search_key',date('Y',strtotime($servicedate)))
->post('month_search_key',date('m',strtotime($servicedate)))

View File

@@ -20,10 +20,10 @@ class Service_Traffic_Adsl_Exetelvisp extends Service_Traffic_Adsl {
// Assume we have a bad fetch, unless otherwise specified.
$this->fetchresult = FALSE;
$request = Request::factory($this->so->stats_url)
$request = Request::factory($this->aso->stats_url)
->method('POST')
->post($this->login_user_field,$this->so->stats_username)
->post($this->login_pass_field,$this->so->stats_password)
->post($this->login_user_field,$this->aso->stats_username)
->post($this->login_pass_field,$this->aso->stats_password)
->post($this->date_field,$date);
$request->client()->options($this->curlopts+array(