diff --git a/classes/cli_helper.php b/classes/cli_helper.php index 30b9667..cda89d6 100644 --- a/classes/cli_helper.php +++ b/classes/cli_helper.php @@ -141,8 +141,8 @@ public function validate_and_clean_args(): void { } if (isset($cliargs['manifestpath'])) { if (isset($cliargs['directory']) && strlen($cliargs['directory']) > 0 ) { - echo "\nYou have supplied a manifest file path and a directory. " . - "Please use only one.\n"; + echo "\nYou have supplied a manifest file path (possibly as a default in your config file) " . + "and a directory. Please use only one.\n"; static::call_exit(); } } @@ -189,8 +189,8 @@ public function validate_and_clean_args(): void { if (isset($cliargs['coursename']) || isset($cliargs['modulename']) || isset($cliargs['coursecategory']) || (isset($cliargs['instanceid']) || isset($cliargs['contextlevel']) )) { - echo "\nYou have specified a manifest file. Contextlevel, instance id, " . - "course name, module name and/or course category are not needed. " . + echo "\nYou have specified a manifest file (possibly as a default in your config file). " . + "Contextlevel, instance id, course name, module name and/or course category are not needed. " . "Context data can be extracted from the file.\n"; static::call_exit(); } diff --git a/cli/config_sample.txt b/cli/config_sample.txt index b20dafe..40c4493 100644 --- a/cli/config_sample.txt +++ b/cli/config_sample.txt @@ -45,5 +45,12 @@ $instance = 'instance1'; // Windows users must change backslash \ to forward slash /. $rootdirectory = '/home/user/questions'; +// You can set a default manifest file path for import, export and delete. +// You will need to run createrepo or importrepotomoodle first to create the file. +// You will need to set the default back to null if you want to import or delete +// from a new context. Setting the contextlevel CLI parameter will not +// override this path and will cause the script to abort. +$manifestpath = null; + // Are you using Git and wanting repository checks performed automatically? $usegit = true; diff --git a/cli/deletefrommoodle.php b/cli/deletefrommoodle.php index dcfb7e6..b1c0ab9 100755 --- a/cli/deletefrommoodle.php +++ b/cli/deletefrommoodle.php @@ -52,7 +52,7 @@ 'longopt' => 'manifestpath', 'shortopt' => 'f', 'description' => 'Filepath of manifest file relative to root directory.', - 'default' => null, + 'default' => $manifestpath, 'variable' => 'manifestpath', 'valuerequired' => true, ], diff --git a/cli/exportrepofrommoodle.php b/cli/exportrepofrommoodle.php index e1a37d0..370b726 100644 --- a/cli/exportrepofrommoodle.php +++ b/cli/exportrepofrommoodle.php @@ -53,7 +53,7 @@ 'longopt' => 'manifestpath', 'shortopt' => 'f', 'description' => 'Filepath of manifest file relative to root directory.', - 'default' => null, + 'default' => $manifestpath, 'variable' => 'manifestpath', 'valuerequired' => true, ], diff --git a/cli/importrepotomoodle.php b/cli/importrepotomoodle.php index 614e8a9..58ebf16 100755 --- a/cli/importrepotomoodle.php +++ b/cli/importrepotomoodle.php @@ -52,7 +52,7 @@ 'longopt' => 'manifestpath', 'shortopt' => 'f', 'description' => 'Filepath of manifest file relative to root directory.', - 'default' => null, + 'default' => $manifestpath, 'variable' => 'manifestpath', 'valuerequired' => true, ],