r23300 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23299‎ | r23300 | r23301 >
Date:19:16, 23 June 2007
Author:Mark Bergsma
Status:old
Tags:
Comment:
Make sure the script doesn't move its own backup files if they exist under mbroot
Modified paths:
  • /trunk/wmfmailadmin/mbcleanup.py (modified) (history)

Diff [purge]

Index: trunk/wmfmailadmin/mbcleanup.py
@@ -27,9 +27,10 @@
2828 mailboxes = set()
2929 for domain in os.listdir(mbroot):
3030 domaindir = os.path.join(mbroot, domain)
31 - if os.path.isdir(domaindir):
 31+ if not domain.startswith('.') and os.path.isdir(domaindir):
3232 for localpart in os.listdir(domaindir):
33 - if os.path.isdir(os.path.join(domaindir, localpart)):
 33+ if not localpart.startswith('.') and not localpart.find('@') and \
 34+ os.path.isdir(os.path.join(domaindir, localpart)):
3435 mailboxes.add((unicode(domain), unicode(localpart)))
3536
3637 return mailboxes
@@ -42,7 +43,7 @@
4344 for mb in mailboxes:
4445 date = time.strftime('%Y%m%d%H%M')
4546 oldpath = os.path.join(mbroot, mb[0], mb[1])
46 - newpath = os.path.join(mbbackuproot, mb[0], mb[1]) + '.' + date
 47+ newpath = os.path.join(mbbackuproot, mb[0], mb[1]) + '@' + date
4748 print 'Moving', oldpath, '=>', newpath
4849 os.makedirs(newpath)
4950 os.rename(oldpath, newpath)

Status & tagging log