mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-17 05:06:17 +02:00
Restore capability to allow non-sync tasks while sync is running
* Restore lost functionality to allow non-sync tasks to operate while a sync is running - #2106 , #2112
This commit is contained in:
parent
46dfb051fe
commit
68d6921a11
84
src/config.d
84
src/config.d
|
@ -2098,6 +2098,90 @@ class ApplicationConfig {
|
||||||
if (getValueLong("ip_protocol_version") == 1) addLogEntry("Forcing client to use IPv4 connections only");
|
if (getValueLong("ip_protocol_version") == 1) addLogEntry("Forcing client to use IPv4 connections only");
|
||||||
if (getValueLong("ip_protocol_version") == 2) addLogEntry("Forcing client to use IPv6 connections only");
|
if (getValueLong("ip_protocol_version") == 2) addLogEntry("Forcing client to use IPv6 connections only");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Has a 'no-sync' task been requested?
|
||||||
|
bool hasNoSyncOperationBeenRequested() {
|
||||||
|
|
||||||
|
bool noSyncOperation = false;
|
||||||
|
|
||||||
|
// Are we performing some sort of 'no-sync' task?
|
||||||
|
// - Are we obtaining the Office 365 Drive ID for a given Office 365 SharePoint Shared Library?
|
||||||
|
// - Are we displaying the sync satus?
|
||||||
|
// - Are we getting the URL for a file online?
|
||||||
|
// - Are we listing who modified a file last online?
|
||||||
|
// - Are we listing OneDrive Business Shared Items?
|
||||||
|
// - Are we createing a shareable link for an existing file on OneDrive?
|
||||||
|
// - Are we just creating a directory online, without any sync being performed?
|
||||||
|
// - Are we just deleting a directory online, without any sync being performed?
|
||||||
|
// - Are we renaming or moving a directory?
|
||||||
|
// - Are we displaying the quota information?
|
||||||
|
|
||||||
|
// Return a true|false if any of these have been set, so that we use the 'dry-run' DB copy, to execute these tasks, incase the client is currently operational
|
||||||
|
|
||||||
|
// --get-sharepoint-drive-id - Get the SharePoint Library drive_id
|
||||||
|
if (getValueString("sharepoint_library_name") != "") {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --display-sync-status - Query the sync status
|
||||||
|
if (getValueBool("display_sync_status")) {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --get-file-link - Get the URL path for a synced file?
|
||||||
|
if (getValueString("get_file_link") != "") {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --modified-by - Are we listing the modified-by details of a provided path?
|
||||||
|
if (getValueString("modified_by") != "") {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --list-shared-items - Are we listing OneDrive Business Shared Items
|
||||||
|
if (getValueBool("list_business_shared_items")) {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --create-share-link - Are we createing a shareable link for an existing file on OneDrive?
|
||||||
|
if (getValueString("create_share_link") != "") {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --create-directory - Are we just creating a directory online, without any sync being performed?
|
||||||
|
if ((getValueString("create_directory") != "")) {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --remove-directory - Are we just deleting a directory online, without any sync being performed?
|
||||||
|
if ((getValueString("remove_directory") != "")) {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Are we renaming or moving a directory online?
|
||||||
|
// onedrive --source-directory 'path/as/source/' --destination-directory 'path/as/destination'
|
||||||
|
if ((getValueString("source_directory") != "") && (getValueString("destination_directory") != "")) {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Are we displaying the quota information?
|
||||||
|
if (getValueBool("display_quota")) {
|
||||||
|
// flag that a no sync operation has been requested
|
||||||
|
noSyncOperation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return result
|
||||||
|
return noSyncOperation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output the full application help when --help is passed in
|
// Output the full application help when --help is passed in
|
||||||
|
|
13
src/main.d
13
src/main.d
|
@ -261,12 +261,15 @@ int main(string[] cliArgs) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for --dry-run operation
|
// Check for --dry-run operation or a 'no-sync' operation where the 'dry-run' DB copy should be used
|
||||||
// If this has been requested, we need to ensure that all actions are performed against the dry-run database copy, and,
|
// If this has been requested, we need to ensure that all actions are performed against the dry-run database copy, and,
|
||||||
// no actual action takes place - such as deleting files if deleted online, moving files if moved online or local, downloading new & changed files, uploading new & changed files
|
// no actual action takes place - such as deleting files if deleted online, moving files if moved online or local, downloading new & changed files, uploading new & changed files
|
||||||
|
if ((appConfig.getValueBool("dry_run")) || (appConfig.hasNoSyncOperationBeenRequested())) {
|
||||||
|
|
||||||
if (appConfig.getValueBool("dry_run")) {
|
if (appConfig.getValueBool("dry_run")) {
|
||||||
// this is a --dry-run operation
|
// This is a --dry-run operation
|
||||||
addLogEntry("DRY-RUN Configured. Output below shows what 'would' have occurred.");
|
addLogEntry("DRY-RUN Configured. Output below shows what 'would' have occurred.");
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup any existing dry-run elements ... these should never be left hanging around
|
// Cleanup any existing dry-run elements ... these should never be left hanging around
|
||||||
cleanupDryRunDatabaseFiles(appConfig.databaseFilePathDryRun);
|
cleanupDryRunDatabaseFiles(appConfig.databaseFilePathDryRun);
|
||||||
|
@ -276,13 +279,17 @@ int main(string[] cliArgs) {
|
||||||
// In a --dry-run --resync scenario, we should not copy the existing database file
|
// In a --dry-run --resync scenario, we should not copy the existing database file
|
||||||
if (!appConfig.getValueBool("resync")) {
|
if (!appConfig.getValueBool("resync")) {
|
||||||
// Copy the existing DB file to the dry-run copy
|
// Copy the existing DB file to the dry-run copy
|
||||||
|
if (appConfig.getValueBool("dry_run")) {
|
||||||
addLogEntry("DRY-RUN: Copying items.sqlite3 to items-dryrun.sqlite3 to use for dry run operations");
|
addLogEntry("DRY-RUN: Copying items.sqlite3 to items-dryrun.sqlite3 to use for dry run operations");
|
||||||
|
}
|
||||||
copy(appConfig.databaseFilePath,appConfig.databaseFilePathDryRun);
|
copy(appConfig.databaseFilePath,appConfig.databaseFilePathDryRun);
|
||||||
} else {
|
} else {
|
||||||
// No database copy due to --resync
|
// No database copy due to --resync
|
||||||
|
if (appConfig.getValueBool("dry_run")) {
|
||||||
addLogEntry("DRY-RUN: No database copy created for --dry-run due to --resync also being used");
|
addLogEntry("DRY-RUN: No database copy created for --dry-run due to --resync also being used");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// update runtimeDatabaseFile now that we are using the dry run path
|
// update runtimeDatabaseFile now that we are using the dry run path
|
||||||
runtimeDatabaseFile = appConfig.databaseFilePathDryRun;
|
runtimeDatabaseFile = appConfig.databaseFilePathDryRun;
|
||||||
}
|
}
|
||||||
|
@ -551,7 +558,7 @@ int main(string[] cliArgs) {
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Are we renaming or moving a directory?
|
// Are we renaming or moving a directory online?
|
||||||
// onedrive --source-directory 'path/as/source/' --destination-directory 'path/as/destination'
|
// onedrive --source-directory 'path/as/source/' --destination-directory 'path/as/destination'
|
||||||
if ((appConfig.getValueString("source_directory") != "") && (appConfig.getValueString("destination_directory") != "")) {
|
if ((appConfig.getValueString("source_directory") != "") && (appConfig.getValueString("destination_directory") != "")) {
|
||||||
// We are renaming or moving a directory
|
// We are renaming or moving a directory
|
||||||
|
|
Loading…
Reference in a new issue