chiark / gitweb /
Stats-related things must be explicitly enabled (issue #51)
authorCiaran Gultnieks <ciaran@ciarang.com>
Fri, 31 Aug 2012 17:17:38 +0000 (18:17 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Fri, 31 Aug 2012 17:17:38 +0000 (18:17 +0100)
config.sample.py
fdroidserver/stats.py
fdroidserver/update.py

index a3c3da04af552d76d1adc224758122579518a9ee..3d652cbd0071440894c5ac8a5f18b754ea3a5c1c 100644 (file)
@@ -49,3 +49,8 @@ wiki_path = "/wiki/"
 wiki_user = "login"
 wiki_password = "1234"
 
+#Only set this to true when running a repository where you want to generate
+#stats, and only then on the master build servers, not a development
+#machine.
+update_stats = False
+
index e191f538b46cf73413067791c40f7d4ff3b74d0a..c4b4e69346e85069338075f3afd27d4ca61fd456 100644 (file)
@@ -33,8 +33,14 @@ import common
 def main():
 
     # Read configuration...
+    global update_stats
+    update_stats = False
     execfile('config.py', globals())
 
+    if not update_stats:
+        print "Stats are disabled - check your configuration"
+        sys.exit(1)
+
     # Parse command line...
     parser = OptionParser()
     parser.add_option("-v", "--verbose", action="store_true", default=False,
index 7654c908855b3f2b1ee20ca9f907f60dd90e2a65..16c3bd806ec2e7677e039abab16497e3a4a7bd66 100644 (file)
@@ -170,6 +170,8 @@ def update_wiki(apps, apks, verbose=False):
 def main():
 
     # Read configuration...
+    global update_stats
+    update_stats = False
     execfile('config.py', globals())
 
     # Parse command line...
@@ -650,24 +652,26 @@ def main():
     f.write(catdata)
     f.close()
 
-    # Update known apks info...
-    knownapks.writeifchanged()
-
-    # Generate latest apps data for widget
-    if os.path.exists(os.path.join('stats', 'latestapps.txt')):
-        data = ''
-        for line in file(os.path.join('stats', 'latestapps.txt')):
-            appid = line.rstrip()
-            data += appid + "\t"
-            for app in apps:
-                if app['id'] == appid:
-                    data += app['Name'] + "\t"
-                    data += app['icon'] + "\t"
-                    data += app['License'] + "\n"
-                    break
-        f = open('repo/latestapps.dat', 'w')
-        f.write(data)
-        f.close()
+    if update_stats:
+
+        # Update known apks info...
+        knownapks.writeifchanged()
+
+        # Generate latest apps data for widget
+        if os.path.exists(os.path.join('stats', 'latestapps.txt')):
+            data = ''
+            for line in file(os.path.join('stats', 'latestapps.txt')):
+                appid = line.rstrip()
+                data += appid + "\t"
+                for app in apps:
+                    if app['id'] == appid:
+                        data += app['Name'] + "\t"
+                        data += app['icon'] + "\t"
+                        data += app['License'] + "\n"
+                        break
+            f = open('repo/latestapps.dat', 'w')
+            f.write(data)
+            f.close()
 
     # Update the wiki...
     if options.wiki: