1 (edited by bigweb 2019-03-10 23:32:44)

Topic: delete mailbox script bug

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 0.9.9
- Deployed with iRedMail Easy or the downloadable installer? INstaller
- Linux/BSD distribution name and version:  Ubuntu 18
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? Yes
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====

Hi ,

another bug i experience on new install with moved mails , when delete_maillboxes.py :

1. It wont delete old mails , as old maild does not have datestamp in name , and some of rows have NULL in column.

2. So i run it with both parameters set to TRUE  to work , and getting such error :

File "./delete_mailboxes.py", line 229, in <module>
what='LOWER(CONCAT(storagebasedirectory, '/', storagenode, '/', maildir, '/')) AS maildir')
TypeError: unsupported operand type(s) for /: 'str' and 'str'

Any hints ?

UPD: if i change '/' to "/"  im getting another error: AttributeError: MySQLDB instance has no __call__ method

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: delete mailbox script bug

Sorry about this trouble. Here's patch to fix it:

diff -r 543c40ae544d tools/delete_mailboxes.py
--- a/tools/delete_mailboxes.py Fri Mar 08 16:25:19 2019 +0800
+++ b/tools/delete_mailboxes.py Sun Mar 10 23:51:47 2019 +0800
@@ -223,8 +223,8 @@
                 all_maildirs.append(_dir)
     elif settings.backend in ['mysql', 'pgsql']:
         # WARNING: always append '/' in returned maildir path.
-        _qr = conn_vmail('mailbox',
-                         what='LOWER(CONCAT(storagebasedirectory, '/', storagenode, '/', maildir, '/')) AS maildir')
+        _qr = conn_vmail.select('mailbox',
+                                what="LOWER(CONCAT(storagebasedirectory, '/', storagenode, '/', maildir, '/')) AS maildir")
 
         all_maildirs = [str(i.maildir).replace('//', '/') for i in _qr]

3

Re: delete mailbox script bug

Worked fine,

thanks for fast fix !