-
Notifications
You must be signed in to change notification settings - Fork 254
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
command='' | ||
quoteopen='no' | ||
for (( i=2; i<=$#; i++)); do | ||
part=${!i} | ||
if [[ "$quoteopen" == 'yes' && "$part" == "-"* ]]; then | ||
command="$command\"" | ||
quoteopen='no' | ||
fi | ||
eqsign="${part//[^=]}" | ||
if [ ${#eqsign} -eq 1 ]; then | ||
part="${part//=/=\"}" | ||
quoteopen='yes' | ||
fi | ||
command="$command $part" | ||
done | ||
|
||
if [ "$quoteopen" == 'yes' ]; then | ||
command="$command\"" | ||
quoteopen='no' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
eval "cp ../scripts/fixversions.php fixversions.php" | ||
eval "php fixversions.php" | ||
eval "rm fixversions.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
DIR="${BASH_SOURCE%/*}" | ||
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi | ||
. "$DIR/mcommon" | ||
|
||
case "$1" in | ||
moodle) | ||
eval "php admin/cli/install_database.php --agree-license --fullname=\"Moodle\" --shortname=\"moodle\" --summary=\"Moodle site\" --adminpass=\"admin\" --adminemail=\"[email protected]\" ${command}" | ||
;; | ||
phpunit) | ||
eval "php admin/tool/phpunit/cli/init.php ${command}" | ||
;; | ||
behat) | ||
eval "php admin/tool/behat/cli/init.php -a -o ${command}" | ||
;; | ||
*) | ||
SCRIPT_NAME=`basename "$0"` | ||
echo "Usage: $SCRIPT_NAME {moodle|phpunit|behat} [arguments]" | ||
exit 1 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
DIR="${BASH_SOURCE%/*}" | ||
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi | ||
. "$DIR/mcommon" | ||
|
||
case "$1" in | ||
phpunit) | ||
eval "vendor/bin/phpunit ${command}" | ||
;; | ||
behat) | ||
eval "php admin/tool/behat/cli/run.php ${command}" | ||
;; | ||
*) | ||
SCRIPT_NAME=`basename "$0"` | ||
echo "Usage: $SCRIPT_NAME {phpunit|behat} [arguments]" | ||
exit 1 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
DIR="${BASH_SOURCE%/*}" | ||
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi | ||
. "$DIR/mcommon" | ||
|
||
case "$1" in | ||
phpunit) | ||
eval "php admin/tool/phpunit/cli/util.php ${command}" | ||
;; | ||
behat) | ||
eval "php admin/tool/behat/cli/util.php ${command}" | ||
;; | ||
*) | ||
SCRIPT_NAME=`basename "$0"` | ||
echo "Usage: $SCRIPT_NAME {phpunit|behat} [arguments]" | ||
exit 1 | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
define('CLI_SCRIPT', true); | ||
require(getcwd().'/config.php'); | ||
require_once($CFG->libdir.'/clilib.php'); | ||
require("$CFG->dirroot/version.php"); | ||
|
||
cli_separator(); | ||
cli_heading('Resetting all version numbers'); | ||
|
||
$manager = core_plugin_manager::instance(); | ||
|
||
// Purge caches to make sure we have the fresh information about versions. | ||
$manager::reset_caches(); | ||
$configcache = cache::make('core', 'config'); | ||
$configcache->purge(); | ||
|
||
$plugininfo = $manager->get_plugins(); | ||
foreach ($plugininfo as $type => $plugins) { | ||
foreach ($plugins as $name => $plugin) { | ||
if ($plugin->get_status() !== core_plugin_manager::PLUGIN_STATUS_DOWNGRADE) { | ||
continue; | ||
} | ||
|
||
$frankenstyle = sprintf("%s_%s", $type, $name); | ||
|
||
mtrace("Updating {$frankenstyle} from {$plugin->versiondb} to {$plugin->versiondisk}"); | ||
$DB->set_field('config_plugins', 'value', $plugin->versiondisk, array('name' => 'version', 'plugin' => $frankenstyle)); | ||
} | ||
} | ||
|
||
// Check that the main version hasn't changed. | ||
if ((float) $CFG->version !== $version) { | ||
set_config('version', $version); | ||
mtrace("Updated main version from {$CFG->version} to {$version}"); | ||
} | ||
|
||
// Purge relevant caches again. | ||
$manager::reset_caches(); | ||
$configcache->purge(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
DIR="${BASH_SOURCE%/*}" | ||
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi | ||
eval "$DIR/moodle-docker-compose exec webserver bash -c '${@}'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
DIR="${BASH_SOURCE%/*}" | ||
if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi | ||
eval "$DIR/moodle-docker-compose exec $1 bash -c '${@:2}'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG MOODLE_DOCKER_PHP_VERSION=7.4 | ||
FROM moodlehq/moodle-php-apache:${MOODLE_DOCKER_PHP_VERSION} | ||
|
||
# Custom commands | ||
COPY assets/web/commands/mcommon /usr/local/bin/mcommon | ||
RUN chmod +x /usr/local/bin/mcommon | ||
COPY assets/web/commands/minstall /usr/local/bin/minstall | ||
RUN chmod +x /usr/local/bin/minstall | ||
COPY assets/web/commands/mutil /usr/local/bin/mutil | ||
RUN chmod +x /usr/local/bin/mutil | ||
COPY assets/web/commands/mtest /usr/local/bin/mtest | ||
RUN chmod +x /usr/local/bin/mtest | ||
COPY assets/web/commands/mfixversion /usr/local/bin/mfixversion | ||
RUN chmod +x /usr/local/bin/mfixversion | ||
COPY assets/web/scripts /var/www/scripts |