(fix) improve memory usage when importing very large address books

pull/225/head
Ludovic Marcotte 2016-10-17 08:54:24 -04:00
parent 984677796c
commit 8d6e0342ec
3 changed files with 21 additions and 15 deletions

1
NEWS
View File

@ -9,6 +9,7 @@ Bug fixes
- [web] fixed tasks list when some weekdays are disabled
- [web] fixed automatic refresh of calendar view
- [web] respect SOGoSearchMinimumWordLength in contacts list editor
- [web] improve memory usage when importing very large address books
3.2.0 (2016-10-03)

View File

@ -1,14 +1,14 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2016 Inverse inc.
This file is part of SOGo
This file is part of OpenGroupware.org.
OGo is free software; you can redistribute it and/or modify it under
SOGo is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
OGo is distributed in the hope that it will be useful, but WITHOUT ANY
SOGo is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
License for more details.
@ -30,8 +30,6 @@
@protocol SOGoContactObject;
@interface UIxContactFolderActions : UIxComponent
{
}
- (int) importLdifData: (NSString *) ldifData;
- (int) importVcardData: (NSString *) vcardData;

View File

@ -1,6 +1,5 @@
/*
Copyright (C) 2004-2005 SKYRIX Software AG
Copyright (C) 2006-2014 Inverse inc.
Copyright (C) 2006-2016 Inverse inc.
This file is part of SOGo
@ -57,7 +56,6 @@
- (id <WOActionResults>) exportAction
{
WORequest *request;
WOResponse *response;
NSArray *contactsId;
NSEnumerator *uids;
@ -67,7 +65,6 @@
NSMutableString *content;
content = [NSMutableString string];
request = [context request];
sourceFolder = [self clientObject];
contactsId = [[[[context request] contentAsString] objectFromJSONString] objectForKey: @"uids"];
@ -245,17 +242,21 @@
- (int) importVcardData: (NSString *) vcardData
{
NSAutoreleasePool *pool;
NSArray *allCards;
int rc;
int rc, count;
rc = 0;
pool = [[NSAutoreleasePool alloc] init];
allCards = [NGVCard parseFromSource: vcardData];
if (allCards && [allCards count])
count = [allCards count];
if (allCards && count)
{
int i;
for (i = 0; i < [allCards count]; i++)
for (i = 0; i < count; i++)
{
if (![self importVcard: [allCards objectAtIndex: i]])
{
@ -267,18 +268,23 @@
}
}
RELEASE(pool);
return rc;
}
- (BOOL) importVcard: (NGVCard *) card
{
NSString *uid;
SOGoContactGCSFolder *folder;
SOGoContactGCSEntry *contact;
NSAutoreleasePool *pool;
NSString *uid;
BOOL rc = NO;
if (card)
{
pool = [[NSAutoreleasePool alloc] init];
folder = [self clientObject];
uid = [folder globallyUniqueObjectId];
@ -291,6 +297,7 @@
[contact saveComponent: card];
rc = YES;
RELEASE(pool);
}
return rc;