[GH-ISSUE #131] Migration fails using bash script #102

Closed
opened 2026-02-26 09:35:54 +03:00 by kerem · 0 comments
Owner

Originally created by @leader32 on GitHub (Mar 17, 2015).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/131

RHEL 6.6, PostgreSQL 9.3.6,

# nginx -v
nginx version: nginx/1.6.2
# php-fpm -v
PHP 5.4.38 (fpm-fcgi) (built: Feb 20 2015 03:28:41)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

VimbAdmin on commit 549882ea71 (Sat Mar 14 15:21:08 2015 +0100)

When I try to import users from csv file using bash functions, then they didn't shows correctly in web interface.
If I try to import only 10 mailboxes, they seems to be correctly imported, and in ViMbAdmin frontend they shown properly. But when I try to import 50 or more than mailboxes, it appears like this (only 4 of 60 mailboxes shown, and 4th haven't all operations as 3 others; in addition, you can't switch all of them to inactive):
vimbadmin_durak

I tried to trace SQL queries, which vimbadmin executes during creating/modifying/deleting domain/mailboxes, and here is the part of generated sql script for creating mailbox in a vimbadmin database :

BEGIN;
INSERT INTO vimbadmin.log (action, data, timestamp, id, Admin_id, Domain_id) SELECT 'MAILBOX_ADD', 'admin@domain.com added mailbox user1@domain.com', '2015-03-17 17:34:47', NEXTVAL('vimbadmin.log_id_seq'), '2', id FROM vimbadmin.domain WHERE domain = 'domain.com';
-- This nextval executes, because it presents in PostgreSQL's log_statement
SELECT NEXTVAL('vimbadmin.mailbox_id_seq');
INSERT INTO vimbadmin.alias (address, goto, active, created, modified, id, Domain_id) SELECT 'user1@domain.com', 'user1@domain.com', 't', '2015-03-17 17:34:47', NULL, NEXTVAL('vimbadmin.alias_id_seq'), id FROM vimbadmin.domain WHERE domain = 'domain.com';
INSERT INTO vimbadmin.mailbox (username, password, name, alt_email, quota, local_part, active, access_restriction, homedir, maildir, uid, gid, homedir_size, maildir_size, size_at, delete_pending, created, modified, id, Domain_id) SELECT 'user1@domain.com', '$1$Rmwge5fD$rOdDwofkDiW1JNt00N098/', 'user1@domain.com', '', '25000000', 'user1', 't', 'ALL', '/var/mails/domain.com/user1', 'maildir:/var/mails/domain.com/user1/Maildir', '10000', '10000', NULL, NULL, NULL, 'f', '2015-03-17 17:34:47', NULL, NEXTVAL('vimbadmin.mailbox_id_seq'), id FROM vimbadmin.domain WHERE domain = 'domain.com';
UPDATE vimbadmin.domain SET mailbox_count = count.mailbox FROM ( SELECT COUNT(id) AS mailbox FROM vimbadmin.mailbox WHERE domain_id = '2') AS count WHERE id = '2';
COMMIT;
--... and the same transactions as above for 59 others

If you need, I can give full bash script, which generates these sql queries.
And if you know php-console way to add mailboxes-aliases-domains, I will be very grateful to you.

Originally created by @leader32 on GitHub (Mar 17, 2015). Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/131 RHEL 6.6, PostgreSQL 9.3.6, ``` # nginx -v nginx version: nginx/1.6.2 # php-fpm -v PHP 5.4.38 (fpm-fcgi) (built: Feb 20 2015 03:28:41) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies ``` VimbAdmin on commit 549882ea71d1e44914dbe0f661fa8bb73bcd0ff4 (Sat Mar 14 15:21:08 2015 +0100) When I try to import users from csv file using bash functions, then they didn't shows correctly in web interface. If I try to import only 10 mailboxes, they seems to be correctly imported, and in ViMbAdmin frontend they shown properly. But when I try to import 50 or more than mailboxes, it appears like this (only 4 of 60 mailboxes shown, and 4th haven't all operations as 3 others; in addition, you can't switch all of them to inactive): ![vimbadmin_durak](https://cloud.githubusercontent.com/assets/11519236/6687634/82957406-ccce-11e4-9e8a-d81436ab09b1.jpg) I tried to trace SQL queries, which vimbadmin executes during creating/modifying/deleting domain/mailboxes, and here is the part of generated sql script for creating mailbox in a vimbadmin database : ``` sql BEGIN; INSERT INTO vimbadmin.log (action, data, timestamp, id, Admin_id, Domain_id) SELECT 'MAILBOX_ADD', 'admin@domain.com added mailbox user1@domain.com', '2015-03-17 17:34:47', NEXTVAL('vimbadmin.log_id_seq'), '2', id FROM vimbadmin.domain WHERE domain = 'domain.com'; -- This nextval executes, because it presents in PostgreSQL's log_statement SELECT NEXTVAL('vimbadmin.mailbox_id_seq'); INSERT INTO vimbadmin.alias (address, goto, active, created, modified, id, Domain_id) SELECT 'user1@domain.com', 'user1@domain.com', 't', '2015-03-17 17:34:47', NULL, NEXTVAL('vimbadmin.alias_id_seq'), id FROM vimbadmin.domain WHERE domain = 'domain.com'; INSERT INTO vimbadmin.mailbox (username, password, name, alt_email, quota, local_part, active, access_restriction, homedir, maildir, uid, gid, homedir_size, maildir_size, size_at, delete_pending, created, modified, id, Domain_id) SELECT 'user1@domain.com', '$1$Rmwge5fD$rOdDwofkDiW1JNt00N098/', 'user1@domain.com', '', '25000000', 'user1', 't', 'ALL', '/var/mails/domain.com/user1', 'maildir:/var/mails/domain.com/user1/Maildir', '10000', '10000', NULL, NULL, NULL, 'f', '2015-03-17 17:34:47', NULL, NEXTVAL('vimbadmin.mailbox_id_seq'), id FROM vimbadmin.domain WHERE domain = 'domain.com'; UPDATE vimbadmin.domain SET mailbox_count = count.mailbox FROM ( SELECT COUNT(id) AS mailbox FROM vimbadmin.mailbox WHERE domain_id = '2') AS count WHERE id = '2'; COMMIT; --... and the same transactions as above for 59 others ``` If you need, I can give full bash script, which generates these sql queries. And if you know php-console way to add mailboxes-aliases-domains, I will be very grateful to you.
kerem closed this issue 2026-02-26 09:35:54 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ViMbAdmin-opensolutions#102
No description provided.