[CalendarServer-changes] [8634] CalendarServer/trunk/calendarserver/tools/purge.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Feb 8 10:51:09 PST 2012


Revision: 8634
          http://trac.macosforge.org/projects/calendarserver/changeset/8634
Author:   dre at apple.com
Date:     2012-02-08 10:51:09 -0800 (Wed, 08 Feb 2012)
Log Message:
-----------
Add undocumented option for allowing principal purge without implicit scheduling; much faster deletes

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/purge.py

Modified: CalendarServer/trunk/calendarserver/tools/purge.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/purge.py	2012-02-08 16:57:20 UTC (rev 8633)
+++ CalendarServer/trunk/calendarserver/tools/purge.py	2012-02-08 18:51:09 UTC (rev 8634)
@@ -199,7 +199,7 @@
         directory = rootResource.getDirectory()
         total = (yield purgeUIDs(directory, rootResource, self.uids,
             verbose=self.verbose, dryrun=self.dryrun,
-            completely=self.completely))
+            completely=self.completely, doimplicit=self.doimplicit))
         if self.verbose:
             amount = "%d event%s" % (total, "s" if total > 1 else "")
             if self.dryrun:
@@ -357,6 +357,7 @@
                 "config=",
                 "help",
                 "verbose",
+                "noimplicit",
             ],
         )
     except GetoptError, e:
@@ -369,6 +370,7 @@
     dryrun = False
     verbose = False
     completely = False
+    doimplicit = True
 
     for opt, arg in optargs:
         if opt in ("-h", "--help"):
@@ -386,6 +388,9 @@
         elif opt in ("-f", "--config"):
             configFileName = arg
 
+        elif opt in ("--noimplicit"):
+            doimplicit = False
+
         else:
             raise NotImplementedError(opt)
 
@@ -394,6 +399,7 @@
     PurgePrincipalService.completely = completely
     PurgePrincipalService.dryrun = dryrun
     PurgePrincipalService.verbose = verbose
+    PurgePrincipalService.doimplicit = doimplicit
 
 
     utilityMain(
@@ -497,14 +503,14 @@
 
 @inlineCallbacks
 def purgeUIDs(directory, root, uids, verbose=False, dryrun=False,
-    completely=False):
+    completely=False, doimplicit=True):
     total = 0
 
     allAssignments = { }
 
     for uid in uids:
         count, allAssignments[uid] = (yield purgeUID(uid, directory, root,
-            verbose=verbose, dryrun=dryrun, completely=completely))
+            verbose=verbose, dryrun=dryrun, completely=completely, doimplicit=doimplicit))
         total += count
 
     # TODO: figure out what to do with the purged proxy assignments...
@@ -621,7 +627,7 @@
 
 @inlineCallbacks
 def purgeUID(uid, directory, root, verbose=False, dryrun=False, proxies=True,
-    when=None, completely=False):
+    when=None, completely=False, doimplicit=True):
 
     if when is None:
         when = PyCalendarDateTime.getNowUTC()
@@ -726,7 +732,7 @@
                         else:
                             print "Deleting: %s" % (uri,)
                     if not dryrun:
-                        result = (yield childResource.storeRemove(request, True, uri))
+                        result = (yield childResource.storeRemove(request, doimplicit, uri))
                         if result != NO_CONTENT:
                             print "Error deleting %s/%s/%s: %s" % (uid,
                                 collName, childName, result)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120208/8574c61d/attachment.html>


More information about the calendarserver-changes mailing list