From f0987b912180890d40c1574c6a6247887dca3976 Mon Sep 17 00:00:00 2001 From: "[Peter Burnett]" <[peterburnett@catalyst-au.net]> Date: Fri, 11 Oct 2019 09:11:13 +1000 Subject: [PATCH 1/2] Added additional check_DB_schema command --- bin/moodle-plugin-ci | 2 ++ src/Command/CheckDBSchemaCommand.php | 52 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 src/Command/CheckDBSchemaCommand.php diff --git a/bin/moodle-plugin-ci b/bin/moodle-plugin-ci index 2300b30..0ae620e 100755 --- a/bin/moodle-plugin-ci +++ b/bin/moodle-plugin-ci @@ -14,6 +14,7 @@ use MoodlePluginCI\Command\AddConfigCommand; use MoodlePluginCI\Command\AddPluginCommand; use MoodlePluginCI\Command\BehatCommand; +use MoodlePluginCI\Command\CheckDBSchemaCommand; use MoodlePluginCI\Command\CodeCheckerCommand; use MoodlePluginCI\Command\CodeFixerCommand; use MoodlePluginCI\Command\CompletionCommand; @@ -60,6 +61,7 @@ $application = new Application('Moodle Plugin CI', '@package_version@'); $application->add(new AddConfigCommand()); $application->add(new AddPluginCommand(ENV_FILE)); $application->add(new BehatCommand()); +$application->add(new CheckDBSchemaCommand()); $application->add(new CodeCheckerCommand()); $application->add(new CodeFixerCommand()); $application->add(new CompletionCommand()); diff --git a/src/Command/CheckDBSchemaCommand.php b/src/Command/CheckDBSchemaCommand.php new file mode 100644 index 0000000..7812205 --- /dev/null +++ b/src/Command/CheckDBSchemaCommand.php @@ -0,0 +1,52 @@ +setName('checkdbschema') + ->setDescription('Run check_database_schema on the Moodle database'); + } + + protected function initialize(InputInterface $input, OutputInterface $output) + { + parent::initialize($input, $output); + $this->initializeExecute($output, $this->getHelper('process')); + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->outputHeading($output, 'Checking Moodle Database Schema'); + $process = new MoodleProcess('admin/cli/check_database_schema.php', $this->moodle->directory); + $code = 0; + $this->execute->passThroughProcess($process); + if (!$process->isSuccessful()) { + $code = 1; + } + + return $code; + } +} From a37e87e2ed34bbebf2ed769e12fa24cfb9f0ad05 Mon Sep 17 00:00:00 2001 From: "[Peter Burnett]" <[peterburnett@catalyst-au.net]> Date: Tue, 15 Oct 2019 09:15:32 +1000 Subject: [PATCH 2/2] Added generated documentation --- docs/CLI.md | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/docs/CLI.md b/docs/CLI.md index ecd5ae0..92ed5ff 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -8,6 +8,7 @@ title: Moodle Plugin CI Commands * [`add-config`](#add-config) * [`add-plugin`](#add-plugin) * [`behat`](#behat) +* [`checkdbschema`](#checkdbschema) * [`codechecker`](#codechecker) * [`coveralls-upload`](#coveralls-upload) * [`grunt`](#grunt) @@ -382,6 +383,101 @@ Do not ask any interactive question * Is multiple: no * Default: `false` +`checkdbschema` +--------------- + +Run check_database_schema on the Moodle database + +### Usage + +* `checkdbschema [-m|--moodle MOODLE] [--] ` + +Run check_database_schema on the Moodle database + +### Arguments + +#### `plugin` + +Path to the plugin + +* Is required: yes +* Is array: no +* Default: `NULL` + +### Options + +#### `--moodle|-m` + +Path to Moodle + +* Accept value: yes +* Is value required: yes +* Is multiple: no +* Default: `'.'` + +#### `--help|-h` + +Display this help message + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + +#### `--quiet|-q` + +Do not output any message + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + +#### `--verbose|-v|-vv|-vvv` + +Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + +#### `--version|-V` + +Display this application version + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + +#### `--ansi` + +Force ANSI output + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + +#### `--no-ansi` + +Disable ANSI output + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + +#### `--no-interaction|-n` + +Do not ask any interactive question + +* Accept value: no +* Is value required: no +* Is multiple: no +* Default: `false` + `codechecker` ------------- @@ -1993,4 +2089,4 @@ Do not ask any interactive question * Accept value: no * Is value required: no * Is multiple: no -* Default: `false` +* Default: `false` \ No newline at end of file