Skip to content

Commit

Permalink
Get rid of ClearByPathBackupExclusion.
Browse files Browse the repository at this point in the history
We planned on keeping ClearByPathBackupExclusion around as temporary code to
clean up the mess we used to make in
/Library/Preferences/com.apple.TimeMachine.plist. Evidently, when we ask
CSBackupSetItemExcluded to include-by-path an item that was previously
excluded by path, it will remove the ExcludeByPath entry for the path from
that plist, but it will also add an IncludeByPath entry. There is no way
using this API to clean up the mess we made in the past, we can only trade
an "exclude" mess for an "include" mess. It's not worth attempting to modify
the file ourselves, avoiding the CSBackupSetItemExcluded API, and it's
probably not even possible because the plist will likely be rewritten by
a system process anyway.

BUG=86845, 85999
TEST=No changes made to the plist mentioned above.
Review URL: http://codereview.chromium.org/7206030

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89741 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
mark@chromium.org committed Jun 20, 2011
1 parent e0b85ab commit ab376ca
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 51 deletions.
6 changes: 0 additions & 6 deletions base/mac/mac_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ void ActivateProcess(pid_t pid);
// Excludes the file given by |file_path| from being backed up by Time Machine.
bool SetFileBackupExclusion(const FilePath& file_path);

// TODO(mrossetti): Remove in M15. See http://crbug.com/85999
// Remove possible exclude-by-path setting from |file_path|. Ignore errors since
// we don't care if the file does not exist or if it has not had its exclusion
// set by-path. This function is a NOOP for Mac OS X Lion or later.
void ClearByPathBackupExclusion(const FilePath& file_path);

// Sets the process name as displayed in Activity Monitor to process_name.
void SetProcessName(CFStringRef process_name);

Expand Down
21 changes: 0 additions & 21 deletions base/mac/mac_util.mm
Original file line number Diff line number Diff line change
Expand Up @@ -242,28 +242,7 @@ void ActivateProcess(pid_t pid) {
}
}

// TODO(mrossetti): Remove in M15. See http://crbug.com/85999
void ClearByPathBackupExclusion(const FilePath& file_path) {
if (IsOSSnowLeopardOrEarlier()) {
NSString* file_path_ns =
[NSString stringWithUTF8String:file_path.value().c_str()];
NSURL* file_url = [NSURL fileURLWithPath:file_path_ns];
// Ignore errors since the file may not exist.
CSBackupSetItemExcluded(base::mac::NSToCFCast(file_url), FALSE, TRUE);
}
}

bool SetFileBackupExclusion(const FilePath& file_path) {
// Do a pre-emptive unexclude by-path since by-path exclusions may have
// been performed on this file in the past. This feature is available to
// administrative users in 10.5 and 10.6, but is restricted to the root
// user in 10.7. Since it logs messages to the console in 10.7 and
// wouldn't work anyway, avoid calling it altogether in that version.
//
// TODO(mrossetti): Remove on the trunk after September
// 2011, M15. http://crbug.com/85999
ClearByPathBackupExclusion(file_path);

NSString* file_path_ns =
[NSString stringWithUTF8String:file_path.value().c_str()];
NSURL* file_url = [NSURL fileURLWithPath:file_path_ns];
Expand Down
12 changes: 0 additions & 12 deletions chrome/browser/history/history_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,6 @@ HistoryDatabase::~HistoryDatabase() {

sql::InitStatus HistoryDatabase::Init(const FilePath& history_name,
const FilePath& bookmarks_path) {
#if defined(OS_MACOSX)
// TODO(mrossetti): Remove in M15. See http://crbug.com/85999
// NOTE: Do not remove the SetFileBackupExclusion call below as part of this
// cleanup.
// Do a pre-emptive unexclude by-path since by-path exclusions may have
// been performed on this file in the past.
FilePath::StringType journal_name(history_name.value());
journal_name.append("-journal");
FilePath journal_path(journal_name);
base::mac::ClearByPathBackupExclusion(journal_path);
#endif

// Set the exceptional sqlite error handler.
db_.set_error_delegate(GetErrorHandlerForHistoryDb());

Expand Down
12 changes: 0 additions & 12 deletions chrome/browser/history/thumbnail_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,6 @@ sql::InitStatus ThumbnailDatabase::Init(
const FilePath& db_name,
const HistoryPublisher* history_publisher,
URLDatabase* url_db) {
#if defined(OS_MACOSX)
// TODO(mrossetti): Remove in M15. See http://crbug.com/85999
// NOTE: Do not remove the SetFileBackupExclusion call below as part of this
// cleanup.
// Do a pre-emptive unexclude by-path since by-path exclusions may have
// been performed on this file in the past.
FilePath::StringType journal_name(db_name.value());
journal_name.append("-journal");
FilePath journal_path(journal_name);
base::mac::ClearByPathBackupExclusion(journal_path);
#endif

history_publisher_ = history_publisher;
sql::InitStatus status = OpenDatabase(&db_, db_name);
if (status != sql::INIT_OK)
Expand Down

0 comments on commit ab376ca

Please sign in to comment.