From 3b0ae7dcd700c655170d69e1a7f20cf0501c7f7e Mon Sep 17 00:00:00 2001 From: Tomasz Muras Date: Tue, 14 Jan 2025 21:41:50 +0100 Subject: [PATCH] Do not login. Option to not login as admin user when executing a command. Shuold help with #503. --- moosh.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/moosh.php b/moosh.php index fb5d3be2..d0e04230 100755 --- a/moosh.php +++ b/moosh.php @@ -41,6 +41,7 @@ $appspecs->add('p|moodle-path:', "Moodle directory."); $appspecs->add('u|user:', "Moodle user, by default ADMIN"); $appspecs->add('n|no-user-check', "Don't check if Moodle data is owned by the user running script"); +$appspecs->add('l|no-login', "Do not log in as admin user"); $appspecs->add('t|performance', "Show performance information including timings"); $appspecs->add('h|help', "Show global help."); $appspecs->add('list-commands', "Show all possible commands"); @@ -280,6 +281,7 @@ function string_exists() { if ($subcommand->bootstrapLevel() != MooshCommand::$BOOTSTRAP_CONFIG && $subcommand->bootstrapLevel() != MooshCommand::$BOOTSTRAP_FULL_NO_ADMIN_CHECK + && !$app_options->has('no-login') ) { // By default set up $USER to admin user. if ($app_options->has('user')) {