Monotone-Parent: 1cab635a2c57c6953c8a393b67f593bdaccb43b9
Monotone-Revision: 97bd3b4f7ef7920ded0314bd1d5eadce2a2af62a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2009-08-14T19:17:53 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
584c3cae01
commit
bd43877c6b
|
@ -1,5 +1,8 @@
|
|||
2009-08-14 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* Tools/SOGoToolBackup.m (-parseArguments): modified to either
|
||||
accept "ALL" or a list of identifiers as arguments.
|
||||
|
||||
* Tools/SOGoToolRestore.m: new "sogo-tool" utility that restores
|
||||
the specified user data previously created by the "backup"
|
||||
command.
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
- (void) usage
|
||||
{
|
||||
fprintf (stderr, "backup directory user|ALL\n\n"
|
||||
fprintf (stderr, "backup directory ALL|user1 [user2] ...\n\n"
|
||||
" folder the folder where backup files will be stored\n"
|
||||
" user the user of whom to save the data\n");
|
||||
}
|
||||
|
@ -116,51 +116,51 @@
|
|||
return rc;
|
||||
}
|
||||
|
||||
- (BOOL) fetchUserIDs: (NSString *) identifier
|
||||
- (BOOL) fetchUserIDs: (NSArray *) users
|
||||
{
|
||||
BOOL rc;
|
||||
LDAPUserManager *lm;
|
||||
NSDictionary *infos;
|
||||
NSString *userID;
|
||||
NSArray *allUsers;
|
||||
NSString *user;
|
||||
id allUsers;
|
||||
int count, max;
|
||||
|
||||
lm = [LDAPUserManager sharedUserManager];
|
||||
if ([identifier isEqualToString: @"ALL"])
|
||||
{
|
||||
rc = YES;
|
||||
max = [users count];
|
||||
user = [users objectAtIndex: 0];
|
||||
if (max == 1 && [user isEqualToString: @"ALL"])
|
||||
allUsers = [lm fetchUsersMatching: @"."];
|
||||
ASSIGN (userIDs, [allUsers objectsForKey: @"c_uid"
|
||||
notFoundMarker: nil]);
|
||||
}
|
||||
else
|
||||
{
|
||||
infos = [lm contactInfosForUserWithUIDorEmail: identifier];
|
||||
userID = [infos objectForKey: @"c_uid"];
|
||||
if (userID)
|
||||
allUsers = [NSMutableArray array];
|
||||
for (count = 0; count < max; count++)
|
||||
{
|
||||
rc = YES;
|
||||
ASSIGN (userIDs, [NSArray arrayWithObject: userID]);
|
||||
}
|
||||
user = [users objectAtIndex: count];
|
||||
infos = [lm contactInfosForUserWithUIDorEmail: user];
|
||||
if (infos)
|
||||
[allUsers addObject: infos];
|
||||
else
|
||||
{
|
||||
rc = NO;
|
||||
NSLog (@"user '%@' not found", identifier);
|
||||
NSLog (@"user '%@' unknown", user);
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
ASSIGN (userIDs, [allUsers objectsForKey: @"c_uid" notFoundMarker: nil]);
|
||||
|
||||
return ([userIDs count] > 0);
|
||||
}
|
||||
|
||||
- (BOOL) parseArguments
|
||||
{
|
||||
BOOL rc;
|
||||
NSString *identifier;
|
||||
NSRange rest;
|
||||
int max;
|
||||
|
||||
if ([arguments count] > 1)
|
||||
max = [arguments count];
|
||||
if (max > 1)
|
||||
{
|
||||
ASSIGN (directory, [arguments objectAtIndex: 0]);
|
||||
identifier = [arguments objectAtIndex: 1];
|
||||
rc = ([self checkDirectory] && [self fetchUserIDs: identifier]);
|
||||
rest = NSMakeRange (1, max - 1);
|
||||
rc = ([self checkDirectory]
|
||||
&& [self fetchUserIDs: [arguments subarrayWithRange: rest]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -287,7 +287,7 @@
|
|||
{
|
||||
folder = [NSString stringWithFormat: @"%@/%@",
|
||||
basePath, [folders objectAtIndex: count]];
|
||||
NSLog (@"folder %d: %@", count, folder);
|
||||
// NSLog (@"folder %d: %@", count, folder);
|
||||
[self extractFolder: folder withFM: fm
|
||||
intoRecord: tables];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue