+ if not Cnf["Rhona::Options::No-Action"]:
+ before = time.time();
+ sys.stdout.write("[Deleting from files table... ");
+ projectB.query("DELETE FROM files WHERE last_used <= '%s'" % (delete_date));
+ sys.stdout.write("done. (%d)]\n" % (int(time.time()-before)));
+ if count > 0:
+ sys.stderr.write("Cleaned %d files, %s.\n" % (count, utils.size_type(size)));
+
+def clean_maintainers():
+ print "Cleaning out unused Maintainer entries..."
+
+ used = {};
+ q = projectB.query("SELECT maintainer FROM binaries WHERE maintainer IS NOT NULL");
+ for i in q.getresult():
+ used[i[0]] = "";
+ q = projectB.query("SELECT maintainer FROM source WHERE maintainer IS NOT NULL");
+ for i in q.getresult():
+ used[i[0]] = "";
+
+ all = {};
+ q = projectB.query("SELECT id, name FROM maintainer");
+ for i in q.getresult():
+ all[i[0]] = i[1];
+
+ count = 0;
+ projectB.query("BEGIN WORK");
+ for id in all.keys():
+ if not used.has_key(id):
+ if not Cnf["Rhona::Options::No-Action"]:
+ projectB.query("DELETE FROM maintainer WHERE id = %s" % (id));
+ count = count + 1;
+ projectB.query("COMMIT WORK");
+
+ if count > 0:
+ sys.stderr.write("Cleared out %d maintainer entries.\n" % (count));