How to cleanup one specific account from centralized database
Posted by , Last modified by on 12 March 2013 06:35 AM
What is PDO?
PDO is PHP Data Object layer that is used to access databases.
IceWarp Server supports SQLite, MySQL, and MSSQL (ODBC) databases. Webclient uses the database for caching folders and items.
What is the problem?
In older versions of IceWarp there were some bugs which could break Webclient database integrity. In most cases the problems appeared with SQLITE databases. For solving the problem it is enough deleting the database of the specific user with problems:
How to delete an account cache from WebClient database?
When a centralized database is used there are not single databases for every user, however there is only one database which keeps the records for all users and the administrator should delete the records from this database.
First the administrator should connect to the database with some SQL manager. It is possible to use the manager distributed with the database or use IceWarp SQL Manager instead (in console System ~ Tools ~ SQL manager).
Next step is selecting the Webclient database. For IceWarp SQL Manager the administrator should click on “Database” and write down the correct information for connecting the database.
The administrator has to execute two queries and he just have to exchange firstname.lastname@example.org with the correct address of the user.
DELETE i FROM item AS i INNER JOIN folder on i.folder_id = folder.folder_id
WHERE folder.account_id = 'email@example.com'
It is very important to delete the information of the user from the table ITEM first!
This query must be fully executed without errors before executing the next query. Otherwise some data may remain in the database and it may cause problems afterwards.
Administrator can perform the query again if it fails for some reason. When the query is executed without problems and 0 rows are affected, the administrator can be sure that no items for the account are longer cached in the database.
DELETE FROM folder WHERE folder.account_id = 'firstname.lastname@example.org'
The administrator must check if the query finished without problems or repeat steps like with the query described above.
After these two queries are excuted all the folders and items of the user are deleted and when the users logs in webmail again the data will be re-cached.
Notice : If the user is using permanent session, that session should be deleted and the user should not be logged in webclient during whole operation.