Skip to content

Commit

Permalink
deprecated warnings php 8.1^ fix #448
Browse files Browse the repository at this point in the history
  • Loading branch information
mi7chal committed Aug 29, 2024
1 parent 4be1f10 commit 5dbf4fe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions moosh.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,18 @@
define('MOOSH_VERSION', '1.21');
define('MOODLE_INTERNAL', true);

$appspecs = new OptionCollection;
$spec_verbose = $appspecs->add('v|verbose', "be verbose");
// suppressing warnings for php > 8
$appspecs = @new OptionCollection;
$spec_verbose = @$appspecs->add('v|verbose', "be verbose");
$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('t|performance', "Show performance information including timings");
$appspecs->add('h|help', "Show global help.");
$appspecs->add('list-commands', "Show all possible commands");

$parser = new ContinuousOptionParser($appspecs);
$app_options = $parser->parse($argv);
$parser = @new ContinuousOptionParser($appspecs);
$app_options = @$parser->parse($argv);

if ($app_options->has('moodle-path')) {
$top_dir = $app_options['moodle-path']->value;
Expand Down Expand Up @@ -248,6 +249,7 @@ function string_exists() {
if ($subcommand->bootstrapLevel() == MooshCommand::$BOOTSTRAP_CONFIG) {
define('ABORT_AFTER_CONFIG', true);
}

if (!$top_dir) {
echo "Could not find Moodle installation!\n";
exit(1);
Expand Down

0 comments on commit 5dbf4fe

Please sign in to comment.