+ /// update conflict in ancestor folders
+ // (not directly unset; maybe there are more conflicts below them)
+ String parentPath = file.getRemotePath();
+ if (parentPath.endsWith(OCFile.PATH_SEPARATOR)) {
+ parentPath = parentPath.substring(0, parentPath.length() - 1);
+ }
+ parentPath = parentPath.substring(0, parentPath.lastIndexOf(OCFile.PATH_SEPARATOR) + 1);
+
+ Log_OC.d(TAG, "checking parents to remove conflict; STARTING with " + parentPath);
+ while (parentPath.length() > 0) {
+
+ String where =
+ ProviderTableMeta.FILE_ETAG_IN_CONFLICT + " IS NOT NULL AND " +
+ ProviderTableMeta.FILE_CONTENT_TYPE + " != 'DIR' AND " +
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + " = ? AND " +
+ ProviderTableMeta.FILE_PATH + " LIKE ?";
+ Cursor descendentsInConflict = getContentResolver().query(
+ ProviderTableMeta.CONTENT_URI_FILE,
+ new String[]{ProviderTableMeta._ID},
+ where,
+ new String[]{mAccount.name, parentPath + "%"},
+ null
+ );
+ if (descendentsInConflict == null || descendentsInConflict.getCount() == 0) {
+ Log_OC.d(TAG, "NO MORE conflicts in " + parentPath);
+ if (getContentResolver() != null) {
+ updated = getContentResolver().update(
+ ProviderTableMeta.CONTENT_URI_FILE,
+ cv,
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " +
+ ProviderTableMeta.FILE_PATH + "=?",
+ new String[]{mAccount.name, parentPath}
+ );
+ } else {
+ try {
+ updated = getContentProviderClient().update(
+ ProviderTableMeta.CONTENT_URI_FILE,
+ cv,
+ ProviderTableMeta.FILE_ACCOUNT_OWNER + "=? AND " +
+ ProviderTableMeta.FILE_PATH + "=?"
+ , new String[]{mAccount.name, parentPath}
+ );
+ } catch (RemoteException e) {
+ Log_OC.e(TAG, "Failed saving conflict in database " + e.getMessage());
+ }
+ }