Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Mobility

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-2010, 09:42 AM
Moderator
 
Posts: 7,929
Default Funambol, BlackBerries and duplicate appointments

Hi,

If anybody is running this configuration do you suffer from duplicated appointments ? One of our clients has just managed to get their BB to send out 300 calendar entries

I have a script to de-dupe them but was wondering if anybody else has seen the same thing ?
__________________
Reply With Quote
  #2 (permalink)  
Old 03-10-2010, 02:47 PM
New Member
 
Posts: 4
Default

I can confirm the issue. I don't analyze yet if all the appointments or which and why...
Can you post the script? Have you done any analysis?
Reply With Quote
  #3 (permalink)  
Old 03-11-2010, 02:25 AM
Moderator
 
Posts: 7,929
Default

Code:
#!/usr/bin/perl

use DBI;

$account = $ARGV[0];
$subject = $ARGV[1];
open(PIPE,"zmlocalconfig -s zimbra_mysql_password|");  ($passwd) = <PIPE> =~ /zimbra_mysql_password = (.*)/; close(PIPE);

$dsn = "DBI:mysql:zimbra;mysql_read_default_file=/opt/zimbra/conf/my.cnf;mysql_socket=/opt/zimbra/db/mysql.sock";
$dbh = DBI->connect($dsn, 'zimbra', $passwd) || die "Could not connect to database: $DBI::errstr";

$sql = "select id from mailbox where comment = '${account}'";
$sth = $dbh->prepare($sql);
$sth->execute();
@result = $sth->fetchrow_array; $mailbox = $result[0];

$sth->finish();
$dbh->disconnect;

my @dupes = (); my @dupes_subject = ();

$dsn = "DBI:mysql:mboxgroup${mailbox};mysql_read_default_file=/opt/zimbra/conf/my.cnf;mysql_socket=/opt/zimbra/db/mysql.sock";
$dbh = DBI->connect($dsn, 'zimbra', $passwd) || die "Could not connect to database: $DBI::errstr";

$sql = "select a.start_time, a.end_time, b.subject, count(*) from appointment a, mail_item b ";
$sql = $sql . "where a.item_id = b.id ";
$sql = $sql . "group by b.subject, a.start_time, a.end_time having count(*) > 1 order by b.subject, a.start_time, a.end_time";

$sth = $dbh->prepare($sql); $sth->execute();

while (($start_time, $end_time, $subject, $count) = $sth->fetchrow_array) {

    $sql = "select a.item_id from appointment a, mail_item b ";
    $sql = $sql . "where a.start_time = '$start_time' and a.end_time = '$end_time' and b.subject = \"$subject\" and a.item_id = b.id ";
    $sql = $sql . "order by a.item_id";

    $dupe = 0;
    $sth2 = $dbh->prepare($sql); $sth2->execute();
    while ($id = $sth2->fetchrow_array) {
        if ($dupe > 0) { print "zmmailbox -z -m $account deleteitem $id\n"; }
        $dupe += 1;
    }
    $sth2->finish();
}

$sth->finish();
$dbh->disconnect;
The script is required to be run as the zimbra user and the only argument it expects is the email account name you wish to de-dupe. I recommend that you back up the account before running the script and probably should test it first.

Unfortunately have not been able to track down why it is happening yet as I do not have access to a BB myself. Will keep hunting though
__________________
Reply With Quote
  #4 (permalink)  
Old 03-12-2010, 12:49 AM
Moderator
 
Posts: 7,929
Default

Funambol is failing with a different Blackberry bug where every time the Blackberry receives a meeting request from someone else, it then reinterprets the meeting request as a new meeting it has created and sends its own meeting requests to every other recipient of the original meeting request Is this the same as what you are seeing ?
__________________
Reply With Quote
  #5 (permalink)  
Old 03-12-2010, 03:02 AM
Moderator
 
Posts: 7,929
Default

Funambol :: Duplicate Calendar Entries
__________________
Reply With Quote
  #6 (permalink)  
Old 03-19-2010, 09:43 AM
New Member
 
Posts: 4
Default

Can I ask you how works the perl script you posted?
If I download the .ics file and check the number of duplicate elements it is very low instead the script number output is hight.
I try it and it works but why if I deleted a duplicated appointment via webGUI and I count the delete $id lines before and after the result is the same?

Thanks a lot again.
Reply With Quote
  #7 (permalink)  
Old 03-19-2010, 10:12 AM
Moderator
 
Posts: 7,929
Default

I look at where the subject, start time and end time are the same. If the count is > 1 then I treated it as a duplicate.
__________________
Reply With Quote
  #8 (permalink)  
Old 05-16-2010, 09:52 PM
Active Member
 
Posts: 30
Default

I had this issue, what a mess....
Reply With Quote
  #9 (permalink)  
Old 07-08-2011, 01:20 AM
Intermediate Member
 
Posts: 24
Post Improved script for detecting duplicated calendar appointments

Quote:
Originally Posted by uxbod View Post
The script is required to be run as the zimbra user and the only argument it expects is the email account name you wish to de-dupe. I recommend that you back up the account before running the script and probably should test it first.
Thank you very much uxbod!

I have updated the script because it did not reflect the mailbox group rotation that have mailbox users as described on Account_mailbox_database_structure.

It would be nice if you could check my changes so that I have not made any mistake. Thank you again!

Code:
#!/usr/bin/perl

use DBI;

$account = $ARGV[0];
$subject = $ARGV[1];
open(PIPE,"zmlocalconfig -s zimbra_mysql_password|");  ($passwd) = <PIPE> =~ /zimbra_mysql_password = (.*)/; close(PIPE);

$dsn = "DBI:mysql:zimbra;mysql_read_default_file=/opt/zimbra/conf/my.cnf;mysql_socket=/opt/zimbra/db/mysql.sock";
$dbh = DBI->connect($dsn, 'zimbra', $passwd) || die "Could not connect to database: $DBI::errstr";


$sql = "select id,group_id from mailbox where comment = '${account}'";
$sth = $dbh->prepare($sql);
$sth->execute();
@result = $sth->fetchrow_array; 
  $mailbox = $result[0];
  $mailbox_group = $result[1];

$sth->finish();
$dbh->disconnect;

my @dupes = (); my @dupes_subject = ();

$dsn = "DBI:mysql:mboxgroup${mailbox_group};mysql_read_default_file=/opt/zimbra/conf/my.cnf;mysql_socket=/opt/zimbra/db/mysql.sock";
$dbh = DBI->connect($dsn, 'zimbra', $passwd) || die "Could not connect to database: $DBI::errstr";

$sql = "select a.start_time, a.end_time, b.subject, count(*) from appointment a, mail_item b ";
$sql = $sql . "where (a.item_id = b.id) and (b.mailbox_id = " . $mailbox . ")";
$sql = $sql . "group by b.subject, a.start_time, a.end_time having count(*) > 1 order by b.subject, a.start_time, a.end_time";

$sth = $dbh->prepare($sql); $sth->execute();

while (($start_time, $end_time, $subject, $count) = $sth->fetchrow_array) {

    $sql = "select a.item_id from appointment a, mail_item b ";
	$sql = $sql . "where a.start_time = '$start_time' and a.end_time = '$end_time' and b.subject = \"$subject\" and a.item_id = b.id ";
	$sql = $sql . "order by a.item_id";

	$dupe = 0;
	$sth2 = $dbh->prepare($sql); $sth2->execute();
	while ($id = $sth2->fetchrow_array) {
	    if ($dupe > 0) { print "zmmailbox -z -m $account deleteitem $id\n"; }
	    $dupe += 1;
    }
    $sth2->finish();
}

$sth->finish();
$dbh->disconnect;
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.