+2007-07-09 John Sullivan <sullivan@apple.com>
+
+ Reviewed by Darin
+
+ - fixed <rdar://problem/5320208> WebKit should prevent Time Machine from backing up WebKit clients' icon databases
+
+ * Misc/WebIconDatabase.mm:
+ (-[WebIconDatabase init]):
+ Re-added the code to exclude the icon database from backups. We now do this at the same time we (try to) import
+ the old icon database format, which happens only once per icon database's lifetime.
+ (-[WebIconDatabase _importToWebCoreFormat]):
+ Assert that we haven't imported yet rather than bailing out. It's now the caller's responsibility to check
+ whether we've imported yet.
+
2007-07-08 John Sullivan <sullivan@apple.com>
* Misc/WebIconDatabase.mm:
// Open the WebCore icon database and import the old WebKit icon database
if (!iconDatabase()->open(databaseDirectory))
LOG_ERROR("Unable to open icon database");
- else {
- if ([self _isEnabled])
- [self _importToWebCoreFormat];
+ else if ([self _isEnabled] && !iconDatabase()->imported()) {
+ [self _importToWebCoreFormat];
+
+#ifndef BUILDING_ON_TIGER
+ // Tell backup software (i.e., Time Machine) to never back up the icon database, because
+ // it's a large file that changes frequently, thus using a lot of backup disk space, and
+ // it's unlikely that many users would be upset about it not being backed up. We do this
+ // here because this code is only executed once for each icon database instance. We could
+ // make this configurable on a per-client basis someday if that seemed useful.
+ // See <rdar://problem/5320208>.
+ CFStringRef databasePath = iconDatabase()->databasePath().createCFString();
+ CFURLRef databasePathURL = CFURLCreateWithFileSystemPath(0, databasePath, kCFURLPOSIXPathStyle, FALSE);
+ CFRelease(databasePath);
+ CSBackupSetItemExcluded(databasePathURL, true, true);
+ CFRelease(databasePathURL);
+#endif
}
iconDatabase()->setPrivateBrowsingEnabled([[WebPreferences standardPreferences] privateBrowsingEnabled]);
- (void)_importToWebCoreFormat
{
- ASSERT(_private);
-
- // If we've already performed the import once we shouldn't try to do it again
- if (iconDatabase()->imported())
- return;
+ ASSERT(_private);
+
+ // If we've already performed the import once we shouldn't be trying to do it again
+ ASSERT(!iconDatabase()->imported());
// Get the directory the old icon database *should* be in
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];