Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import os
- import uuid
- import kopano
- import mysql.connector
- USER="root"
- PASSWORD=""
- HOST="localhost"
- DB="kopano"
- cnx = mysql.connector.connect(user=USER, password=PASSWORD,
- host=HOST,
- database=DB)
- cursor = cnx.cursor()
- cursor.execute("select user_name from stores WHERE user_name LIKE '%@%';")
- users = cursor.fetchall()
- for x in users:
- print "Fixing:",x[0]
- storeguid=kopano.Server().user(x[0]).store
- hierarchyid=kopano.Server().user(x[0]).folder("Gesendete Objekte")
- query = ("SELECT id FROM hierarchy WHERE parent=%d AND type=5" % hierarchyid.hierarchyid)
- cursor = cnx.cursor()
- cursor.execute(query)
- result = []
- for (id,) in cursor:
- result.append(id)
- for id in result:
- newentryid = '00000000' + storeguid.guid + '0100000005000000' + uuid.uuid4().hex.upper() + '00000000'
- query = ("UPDATE indexedproperties SET val_binary = UNHEX('%s') WHERE tag = 4095 AND hierarchyid = %d" % (newentryid, id))
- cursor.execute(query)
- cnx.commit()
- cnx.close()
- os.system("/usr/sbin/kopano-srvadm --clear-cache all")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement