function statspro_cron in Statistics Pro 6
Same name and namespace in other branches
- 6.2 statspro.module \statspro_cron()
Implementation of hook_menu().
File
- ./
statspro.module, line 84 - Main module of Statistcs pro module
Code
function statspro_cron() {
require_once drupal_get_path('module', 'statspro') . '/statspro.inc';
$statspro = new statspro();
$last_run = variable_get('statspro_last_run', 0);
// force rebuild
//$last_run = 0;
$days = $statspro
->get_days_data($last_run);
if (count($days) > 0) {
foreach ($days as $date => $values) {
$statspro
->store_day($date, $values);
}
watchdog('statspro', 'New statistics available');
}
$term_rebuild = variable_get('statspro_term_rebuild', FALSE);
if ($term_rebuild) {
db_query('TRUNCATE TABLE {statspro_term}');
$statspro
->generate_term_stats();
variable_set('statspro_term_rebuild', FALSE);
}
// we always store last run
variable_set('statspro_last_run', mktime());
}