New sogo-tool cleanup user feature (cont'd)

pull/228/head
Francis Lachapelle 2016-12-01 10:27:22 -05:00
parent 9aa00d049d
commit 3e448d2c2c
3 changed files with 10 additions and 8 deletions

View File

@ -1690,11 +1690,11 @@ andAttribute: (EOAttribute *)_attribute
if ([GCSFolderManager singleStoreMode]) if ([GCSFolderManager singleStoreMode])
sqlString = [NSMutableString stringWithFormat: sqlString = [NSMutableString stringWithFormat:
@"SELECT COUNT(*) AS CNT FROM %@ WHERE c_folder_id = %@", @"SELECT COUNT(*) AS cnt FROM %@ WHERE c_folder_id = %@",
[self storeTableName], folderId]; [self storeTableName], folderId];
else else
sqlString = [NSMutableString stringWithFormat: sqlString = [NSMutableString stringWithFormat:
@"SELECT COUNT(*) AS CNT FROM %@", @"SELECT COUNT(*) AS cnt FROM %@",
[self storeTableName]]; [self storeTableName]];
if (excludeDeleted) if (excludeDeleted)
{ {
@ -1715,7 +1715,7 @@ andAttribute: (EOAttribute *)_attribute
{ {
attrs = [channel describeResults: NO]; attrs = [channel describeResults: NO];
row = [channel fetchAttributes: attrs withZone: NULL]; row = [channel fetchAttributes: attrs withZone: NULL];
count = [[row objectForKey: @"CNT"] unsignedIntValue]; count = [[row objectForKey: @"cnt"] unsignedIntValue];
[channel cancelFetch]; [channel cancelFetch];
} }
[self releaseChannel: channel]; [self releaseChannel: channel];
@ -1744,12 +1744,12 @@ andAttribute: (EOAttribute *)_attribute
if ([GCSFolderManager singleStoreMode]) if ([GCSFolderManager singleStoreMode])
sqlString = [NSMutableString stringWithFormat: sqlString = [NSMutableString stringWithFormat:
@"SELECT COUNT(*) AS CNT FROM %@" @"SELECT COUNT(*) AS cnt FROM %@"
@" WHERE c_folder_id = %@ AND c_lastmodified < %u AND c_deleted = 1", @" WHERE c_folder_id = %@ AND c_lastmodified < %u AND c_deleted = 1",
[self storeTableName], folderId, delta]; [self storeTableName], folderId, delta];
else else
sqlString = [NSMutableString stringWithFormat: sqlString = [NSMutableString stringWithFormat:
@"SELECT COUNT(*) AS CNT FROM %@" @"SELECT COUNT(*) AS cnt FROM %@"
@" WHERE c_lastmodified < %u AND c_deleted = 1", @" WHERE c_lastmodified < %u AND c_deleted = 1",
[self storeTableName], delta]; [self storeTableName], delta];
@ -1764,7 +1764,7 @@ andAttribute: (EOAttribute *)_attribute
{ {
attrs = [channel describeResults: NO]; attrs = [channel describeResults: NO];
row = [channel fetchAttributes: attrs withZone: NULL]; row = [channel fetchAttributes: attrs withZone: NULL];
count = [[row objectForKey: @"CNT"] unsignedIntValue]; count = [[row objectForKey: @"cnt"] unsignedIntValue];
[channel cancelFetch]; [channel cancelFetch];
} }
[self releaseChannel: channel]; [self releaseChannel: channel];

View File

@ -137,7 +137,6 @@
int count, max; int count, max;
lm = [SOGoUserManager sharedUserManager]; lm = [SOGoUserManager sharedUserManager];
pool = [[NSAutoreleasePool alloc] init];
max = [users count]; max = [users count];
user = [users objectAtIndex: 0]; user = [users objectAtIndex: 0];
@ -173,9 +172,11 @@
users = allSqlUsers; users = allSqlUsers;
max = [users count]; max = [users count];
[allSqlUsers autorelease];
} }
} }
pool = [[NSAutoreleasePool alloc] init];
allUsers = [NSMutableArray new]; allUsers = [NSMutableArray new];
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
{ {

View File

@ -92,7 +92,6 @@
int count, max; int count, max;
lm = [SOGoUserManager sharedUserManager]; lm = [SOGoUserManager sharedUserManager];
pool = [[NSAutoreleasePool alloc] init];
max = [users count]; max = [users count];
user = [users objectAtIndex: 0]; user = [users objectAtIndex: 0];
@ -127,9 +126,11 @@
users = allSqlUsers; users = allSqlUsers;
max = [users count]; max = [users count];
[allSqlUsers autorelease];
} }
} }
pool = [[NSAutoreleasePool alloc] init];
allUsers = [NSMutableArray new]; allUsers = [NSMutableArray new];
for (count = 0; count < max; count++) for (count = 0; count < max; count++)
{ {