(feat) added delete capability to sogo-tool checkup
This commit is contained in:
parent
fe42180bc0
commit
cc52e82524
|
@ -43,6 +43,7 @@
|
||||||
@interface SOGoToolCheckup : SOGoTool
|
@interface SOGoToolCheckup : SOGoTool
|
||||||
{
|
{
|
||||||
NSArray *usersToCheckup;
|
NSArray *usersToCheckup;
|
||||||
|
BOOL delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -64,6 +65,7 @@
|
||||||
if ((self = [super init]))
|
if ((self = [super init]))
|
||||||
{
|
{
|
||||||
usersToCheckup = nil;
|
usersToCheckup = nil;
|
||||||
|
delete = NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -77,8 +79,9 @@
|
||||||
|
|
||||||
- (void) usage
|
- (void) usage
|
||||||
{
|
{
|
||||||
fprintf (stderr, "checkup [user]...\n\n"
|
fprintf (stderr, "checkup [-d] user...\n\n"
|
||||||
" user the user to purge the records or ALL for everybody\n\n"
|
" -d delete the corrupted records\n"
|
||||||
|
" user the user to check the records or ALL for everybody\n\n"
|
||||||
"Example: sogo-tool checkup jdoe\n");
|
"Example: sogo-tool checkup jdoe\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,8 +184,9 @@
|
||||||
int max;
|
int max;
|
||||||
|
|
||||||
max = [arguments count];
|
max = [arguments count];
|
||||||
if (max == 1)
|
if (max > 0 && max < 3)
|
||||||
{
|
{
|
||||||
|
delete = (max == 2);
|
||||||
rc = [self fetchUserIDs: arguments];
|
rc = [self fetchUserIDs: arguments];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -226,6 +230,8 @@
|
||||||
[[content substringFromIndex: [content length]-13] caseInsensitiveCompare: @"END:VCALENDAR"] != NSOrderedSame)
|
[[content substringFromIndex: [content length]-13] caseInsensitiveCompare: @"END:VCALENDAR"] != NSOrderedSame)
|
||||||
{
|
{
|
||||||
NSLog(@"Corrupted calendar item (missing tags) in path %@ with c_name = %@", folder, c_name);
|
NSLog(@"Corrupted calendar item (missing tags) in path %@ with c_name = %@", folder, c_name);
|
||||||
|
if (delete)
|
||||||
|
[gcsFolder deleteContentWithName: c_name];
|
||||||
rc = NO;
|
rc = NO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -234,6 +240,8 @@
|
||||||
if (!calendar)
|
if (!calendar)
|
||||||
{
|
{
|
||||||
NSLog(@"Corrupted calendar item (unparsable) in path %@ with c_name = %@", folder, c_name);
|
NSLog(@"Corrupted calendar item (unparsable) in path %@ with c_name = %@", folder, c_name);
|
||||||
|
if (delete)
|
||||||
|
[gcsFolder deleteContentWithName: c_name];
|
||||||
rc = NO;
|
rc = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,6 +255,8 @@
|
||||||
if (!card)
|
if (!card)
|
||||||
{
|
{
|
||||||
NSLog(@"Corrupted card item (unparsable) in path %@ with c_name = %@", folder, c_name);
|
NSLog(@"Corrupted card item (unparsable) in path %@ with c_name = %@", folder, c_name);
|
||||||
|
if (delete)
|
||||||
|
[gcsFolder deleteContentWithName: c_name];
|
||||||
rc = NO;
|
rc = NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue