diff options
author | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-15 17:39:29 (GMT) |
---|---|---|
committer | Aleksey Lim <alsroot@member.fsf.org> | 2009-11-15 17:39:29 (GMT) |
commit | bb9fdd405d87ea352220e8edf74c208adab09ecf (patch) | |
tree | 619204a7b65b86fa505c4c4dafb14ba1396d2cfa | |
parent | da54b908d62351ad17a736df8f39e4fae1001ab4 (diff) |
Calculate stat for specific date
-rwxr-xr-x | aslo/maintenance.sh | 12 | ||||
-rwxr-xr-x | bin/maintenance.php | 6 |
2 files changed, 11 insertions, 7 deletions
diff --git a/aslo/maintenance.sh b/aslo/maintenance.sh index 265345c..6772dbc 100755 --- a/aslo/maintenance.sh +++ b/aslo/maintenance.sh @@ -16,7 +16,14 @@ for type in downloads updatepings; do geo=US v=v >> $logfile done -php -f maintenance.php weekly >> $logfile +for time in now yesterday; do + date=$(date +%F -d $time) + php -f maintenance.php weekly $date >> $logfile + php -f maintenance.php global_stats $date >> $logfile + php -f maintenance.php collection_stats $date >> $logfile + php -f maintenance.php collection_subscribers $date >> $logfile +done + php -f maintenance.php total >> $logfile php -f maintenance.php ADU >> $logfile php -f maintenance.php gc >> $logfile @@ -31,6 +38,3 @@ php -f maintenance.php addons_collections_total >> $logfile php -f maintenance.php collections_ratings >> $logfile php -f maintenance.php share_count_totals >> $logfile php -f maintenance.php category_totals >> $logfile -php -f maintenance.php global_stats >> $logfile -php -f maintenance.php collection_stats >> $logfile -php -f maintenance.php collection_subscribers >> $logfile diff --git a/bin/maintenance.php b/bin/maintenance.php index 89c29ed..85605d2 100755 --- a/bin/maintenance.php +++ b/bin/maintenance.php @@ -128,7 +128,7 @@ switch ($action) { FROM `download_counts` WHERE - `date` >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) + `date` >= DATE_SUB('{$date}', INTERVAL 7 DAY) GROUP BY download_counts.addon_id ORDER BY @@ -812,7 +812,7 @@ switch ($action) { COUNT(collection_id) AS count, collection_id FROM collection_subscriptions - WHERE created >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) + WHERE created >= DATE_SUB('{$date}', INTERVAL 7 DAY) GROUP BY collection_id ) AS weekly ON (c.id = weekly.collection_id) INNER JOIN ( @@ -820,7 +820,7 @@ switch ($action) { COUNT(collection_id) AS count, collection_id FROM collection_subscriptions - WHERE created >= DATE_SUB(CURDATE(), INTERVAL 31 DAY) + WHERE created >= DATE_SUB('{$date}', INTERVAL 31 DAY) GROUP BY collection_id ) AS monthly ON (c.id = monthly.collection_id) SET c.weekly_subscribers = weekly.count, |