[Swift-commit] r6155 - www/usage

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Tue Jan 15 16:27:07 CST 2013


Author: davidk
Date: 2013-01-15 16:27:07 -0600 (Tue, 15 Jan 2013)
New Revision: 6155

Modified:
   www/usage/update_data.php
Log:
Write data as tabular text for gnuplot rather thanml for flash graphs


Modified: www/usage/update_data.php
===================================================================
--- www/usage/update_data.php	2013-01-14 08:47:41 UTC (rev 6154)
+++ www/usage/update_data.php	2013-01-15 22:27:07 UTC (rev 6155)
@@ -115,72 +115,38 @@
 }
  
 # Total runs
-$usageFile = fopen("usage.xml", 'w');
-fwrite($usageFile, "<chart>\n<chart_label position='over' size='12' color='000000' alpha='90'/>\n<axis_category size='12' />\n<axis_value size='12' />\n<chart_data>\n<row>\n<null/>\n");
+$usageFile = fopen("usage.txt", 'w');
 foreach($months as $key => $value) {
-  fwrite($usageFile, "<string>$key</string>\n");
+   fwrite($usageFile, "$key " . $value['runs'] . "\n");
 }
-fwrite($usageFile, "</row>\n");
-fwrite($usageFile, "<row>\n<string>Swift runs</string>\n");
-foreach($months as $key => $value) {
-   fwrite($usageFile, "<number>" . $value['runs'] . "</number>\n");
-}
-fwrite($usageFile, "</row>\n</chart_data>\n<chart_type>3d column</chart_type>\n<chart_pref rotation_x='10' rotation_y='0' />\n</chart>\n");
 fclose($usageFile);
 
 # Total runs longer than 1 minute
-$longUsage1File = fopen("longUsage1.xml", 'w');
-fwrite($longUsage1File, "<chart>\n<chart_label position='over' size='12' color='000000' alpha='90'/>\n<axis_category size='12' />\n<axis_value size='12' />\n<chart_data>\n<row>\n<null/>\n");
+$longUsage1File = fopen("longUsage1.txt", 'w');
 foreach($months as $key => $value) {
-  fwrite($longUsage1File, "<string>$key</string>\n");
+  fwrite($longUsage1File, "$key " . $value['longruns1'] . "\n");
 }
-fwrite($longUsage1File, "</row>\n");
-fwrite($longUsage1File, "<row>\n<string>Swift runs (longer than 1 minute)</string>\n");
-foreach($months as $key => $value) {
-   fwrite($longUsage1File, "<number>" . $value['longruns1'] . "</number>\n");
-}
-fwrite($longUsage1File, "</row>\n</chart_data>\n<chart_type>3d column</chart_type>\n<chart_pref rotation_x='10' rotation_y='0' />\n</chart>\n");
 fclose($longUsage1File);
 
 # Total runs longer than 5 minutes
-$longUsage5File = fopen("longUsage5.xml", 'w');
-fwrite($longUsage5File, "<chart>\n<chart_label position='over' size='12' color='000000' alpha='90'/>\n<axis_category size='12' />\n<axis_value size='12' />\n<chart_data>\n<row>\n<null/>\n");
+$longUsage5File = fopen("longUsage5.txt", 'w');
 foreach($months as $key => $value) {
-  fwrite($longUsage5File, "<string>$key</string>\n");
+  fwrite($longUsage5File, "$key " . $value['longruns5'] . "\n");
 }
-fwrite($longUsage5File, "</row>\n");
-fwrite($longUsage5File, "<row>\n<string>Swift runs (longer than 5 minutes)</string>\n");
-foreach($months as $key => $value) {
-   fwrite($longUsage5File, "<number>" . $value['longruns5'] . "</number>\n");
-}
-fwrite($longUsage5File, "</row>\n</chart_data>\n<chart_type>3d column</chart_type>\n<chart_pref rotation_x='10' rotation_y='0' />\n</chart>\n");
 fclose($longUsage5File);
 
-
 # Unique users per month
-$users_per_month_file = fopen("users_per_month.xml", 'w');
-fwrite($users_per_month_file, "<chart>\n<chart_label position='over' size='12' color='000000' alpha='90'/>\n<axis_category size='12' />\n<axis_value size='12' />\n<chart_data>\n<row>\n<null/>\n");
+$users_per_month_file = fopen("users_per_month.txt", 'w');
 foreach($months as $key => $value) {
-   fwrite($users_per_month_file, "<string>$key</string>\n");
+   fwrite($users_per_month_file, "$key " . count($value['users']) . "\n");
 }
-fwrite($users_per_month_file, "</row>\n<row>\n<string>Unique Users Per Month</string>\n");
-foreach($months as $key => $value) {
-   fwrite($users_per_month_file, "<number>" . count($value['users']) . "</number>\n");
-}
-fwrite($users_per_month_file, "</row>\n</chart_data>\n<chart_type>3d column</chart_type>\n<chart_pref rotation_x='10' rotation_y='0' />\n</chart>\n");
 fclose($users_per_month_file);
 
 # New users per month
-$new_users_per_month_file = fopen("new_users_per_month.xml", 'w');
-fwrite($new_users_per_month_file, "<chart>\n<chart_label position='over' size='12' color='000000' alpha='90'/>\n<axis_category size='12' />\n<axis_value size='12' />\n<chart_data>\n<row>\n<null/>\n");
+$new_users_per_month_file = fopen("new_users_per_month.txt", 'w');
 foreach($months as $key => $value) {
-   fwrite($new_users_per_month_file, "<string>$key</string>\n");
+   fwrite($new_users_per_month_file, "$key " . count($value['newusers']) . "\n");
 }
-fwrite($new_users_per_month_file, "</row>\n<row>\n<string>New Users Per Month</string>\n");
-foreach($months as $key => $value) {
-   fwrite($new_users_per_month_file, "<number>" . count($value['newusers']) . "</number>\n");
-}
-fwrite($new_users_per_month_file, "</row>\n</chart_data>\n<chart_type>3d column</chart_type>\n<chart_pref rotation_x='10' rotation_y='0' />\n</chart>\n");
 fclose($new_users_per_month_file);
 
 mysql_free_result($result);




More information about the Swift-commit mailing list