Compare commits
313 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d35d7b884 | |||
| 7817f82c15 | |||
| cabf0dbd40 | |||
| cd326efb57 | |||
| 39f2c0f711 | |||
| 02dae40716 | |||
| 408beb96d6 | |||
| c4e2c3ba9b | |||
| 4d59af4afa | |||
| 695ecfc67d | |||
| e02155048a | |||
| 0177319237 | |||
| e5f8c4d2e3 | |||
| edbb4f6e53 | |||
| 07b51eebf3 | |||
| 5240013d21 | |||
| a0984c46a1 | |||
| f361d3e20f | |||
| b238a8658f | |||
| 4513906883 | |||
| 1052567d7e | |||
| 1f43996636 | |||
| 0d18a2c74d | |||
| 3302964844 | |||
| 70d71d3af7 | |||
| 0b841c0c72 | |||
| bc66f3d7b2 | |||
| f3008d2a08 | |||
| 7de2aa1a95 | |||
| 69b2e68d27 | |||
| b7327c6c19 | |||
| f06196976a | |||
| 44f9a36089 | |||
| d92624e11f | |||
| 2264a0454c | |||
| 0944647413 | |||
| 8917f657a1 | |||
| 41d53f9bd5 | |||
| 793d034c4a | |||
| 45b9bcd9a0 | |||
| f45a62e469 | |||
| 650d4000cb | |||
| a411fd9ad7 | |||
| 9c35910821 | |||
| 47e5ed8e30 | |||
| b2e6bee53e | |||
| e217f4914a | |||
| 1ba350d146 | |||
| ec921c9d7b | |||
| ec3be4584c | |||
| e8f73b9edd | |||
| e9716eda2f | |||
| df8d12b685 | |||
| 1c529d9897 | |||
| 4ac2ded44b | |||
| f11ab3b3ed | |||
| 471b5b73a3 | |||
| ebc7b73150 | |||
| a06ed7e888 | |||
| 92a25cff43 | |||
| e5549f4f16 | |||
| 0d4fda7843 | |||
| f083859e96 | |||
| 29d83deae9 | |||
| 2217e2fea9 | |||
| 68927e83e5 | |||
| 819020ac57 | |||
| 1e5a066247 | |||
| 24a7fc2f07 | |||
| 03f0b4fc14 | |||
| 17af025b52 | |||
| ac56855bbc | |||
| 6f6ef56253 | |||
| 79d202c36d | |||
| 962aca6ad6 | |||
| 7473e54a3d | |||
| 105370c407 | |||
| 869ffde772 | |||
| 73d2934ba5 | |||
| 74a51dd48a | |||
| 9005a3bb96 | |||
| 6fccd1fe35 | |||
| ea78dbdf50 | |||
| db3cdb6d25 | |||
| ccc297f01a | |||
| 8dd7e73294 | |||
| f2087a7fcb | |||
| b1fe9348db | |||
| c3183cb6fe | |||
| d47064c4b2 | |||
| 66a28fbaa4 | |||
| d5d7d57d6d | |||
| db3bcaba14 | |||
| 145467fadf | |||
| 07021369d7 | |||
| 836172f366 | |||
| 2c3d0c3b6f | |||
| 1388dece19 | |||
| 41ec284720 | |||
| 62e799ac84 | |||
| 2945fe403b | |||
| 6af9a4e21c | |||
| 86c5e56baf | |||
| bde99c5a4b | |||
| abde041907 | |||
| bba453b9ed | |||
| 8abf3701a6 | |||
| d607b840b8 | |||
| c65d2ccb13 | |||
| 9149eaae18 | |||
| b35e24e254 | |||
| 8a0c8192c8 | |||
| f5f86a68ac | |||
| 57b1d3ea85 | |||
| 9611df0f92 | |||
| 74c19577c9 | |||
| c7231d5235 | |||
| 3cf111c8d3 | |||
| e0518a0940 | |||
| b000642c03 | |||
| aae5800486 | |||
| 9ef2475cdd | |||
| 8513fdd0ba | |||
| 19da0bad13 | |||
| ff64873ece | |||
| 7bd6de4822 | |||
| eb127e0b21 | |||
| 9797983c6f | |||
| 6767a5d631 | |||
| 1507697d9f | |||
| daf7e2a478 | |||
| 771e49de0c | |||
| c19896ff95 | |||
| 68494c8ef2 | |||
| 0a44e7d8cc | |||
| 345f365555 | |||
| 8079f3343f | |||
| 005f7c8b24 | |||
| a6f084c9c5 | |||
| 0e7a5b346f | |||
| 8640c059d8 | |||
| a3f65f8b5b | |||
| 88cece4bd7 | |||
| ddfebd633e | |||
| ac4baac8b9 | |||
| a0ef20cfe4 | |||
| e819a58b6e | |||
| 2adbbcac0a | |||
| 4e5e185f80 | |||
| 68cbd0599d | |||
| 2134746dea | |||
| 4d56fe7d60 | |||
| 1c4bc77d44 | |||
| bc91b91ab1 | |||
| 9887a4cbae | |||
| 7d8fb1962e | |||
| 07fbf4515c | |||
| e81e12cd79 | |||
| f318ef32bc | |||
| 696f3dcc83 | |||
| 804a5f59ce | |||
| 3f45d8fece | |||
| dfe989c826 | |||
| ed6277f9f7 | |||
| 48db0e02cd | |||
| 6ace0f59ae | |||
| fbf528eb95 | |||
| 220ea7cd09 | |||
| 7f1c642112 | |||
| 6530c22a11 | |||
| ab37a1c815 | |||
| 75b13bba36 | |||
| 2cebc825e9 | |||
| ffe7dd3769 | |||
| f41205a84c | |||
| 3046ae85cc | |||
| 536892fd4c | |||
| 2cae0d3b15 | |||
| bdb1cab348 | |||
| d08bcc4ded | |||
| 2f1473ac6d | |||
| 899f21fc26 | |||
| c60a3ef656 | |||
| 8262d6133a | |||
| e662941230 | |||
| 89feea07d3 | |||
| 9c2784ca30 | |||
| e18b4b0918 | |||
| 14d8971cd6 | |||
| 7c8149d6af | |||
| 096a908dbe | |||
| 68dfa89fea | |||
| e64751fb8a | |||
| 490c5cabb4 | |||
| 4269cac414 | |||
| cd319f3f2f | |||
| da14ce45dd | |||
| 818f90abd3 | |||
| 13ce9a38a2 | |||
| d5699018b0 | |||
| fbb8579c1a | |||
| f248c81e5a | |||
| 7d05696b12 | |||
| 716c7536cb | |||
| 4cdf94a602 | |||
| c9f2b241e0 | |||
| 8dbe8449e0 | |||
| 4841169211 | |||
| 3fe4b72c34 | |||
| 3c1e7a0759 | |||
| 98ad5c6191 | |||
| 0872bf3175 | |||
| 6e8ca8a6ce | |||
| e2de9c6b6d | |||
| 59b25acd22 | |||
| af145cdac1 | |||
| bf68d558af | |||
| f3d159dea1 | |||
| 3af4f54efb | |||
| 6698b06b11 | |||
| 545d2c9290 | |||
| 7cac3f6fe9 | |||
| db198f615a | |||
| bbf7cf2c44 | |||
| 0f62dd32c7 | |||
| 67e82ebe0b | |||
| ac16eaa936 | |||
| bfe6b3cdd1 | |||
| f1bf39c2f8 | |||
| 6064114c32 | |||
| e0d74e610a | |||
| 8948d04695 | |||
| 9993c6bcc0 | |||
| 1da82165ef | |||
| cf139e224e | |||
| f8bce590ba | |||
| 715eb9438c | |||
| 9c461eae4e | |||
| fe6a3c0531 | |||
| 793c80165d | |||
| a4f457e111 | |||
| 4110561f3e | |||
| b1549e4127 | |||
| 724513e5d8 | |||
| c14fbe69f5 | |||
| 8b4e2418f6 | |||
| 8568798f76 | |||
| 66533b249e | |||
| e5baddebcd | |||
| 0efd3318b2 | |||
| 16acfc55f4 | |||
| 31328e3ede | |||
| c83c1ee838 | |||
| 95f83b70b0 | |||
| 53253aea3a | |||
| c244cd14b7 | |||
| a1b7cd7090 | |||
| e4ffce07cf | |||
| 6b4ce43d1d | |||
| 107ab59c29 | |||
| 4cd0bc7ece | |||
| 42952482c9 | |||
| 3804a59fb6 | |||
| 174faea612 | |||
| dec56ff204 | |||
| c6d3f0d107 | |||
| 8f36db0be5 | |||
| f554e04a27 | |||
| 20c532caf8 | |||
| a1b0938c16 | |||
| 3e1da76d54 | |||
| e3dcc260fb | |||
| ae50bef5e6 | |||
| 1b1e4d2670 | |||
| c31a650aad | |||
| 76943b900c | |||
| c05a3e254c | |||
| 63385ff2b5 | |||
| 42d7bc64f5 | |||
| f0aa5b7e3b | |||
| 40e33b6e75 | |||
| e06768b331 | |||
| ab58f3ee49 | |||
| 6a30312beb | |||
| 8c4dbdfd56 | |||
| e9b0443000 | |||
| fab5233096 | |||
| 2748bf5900 | |||
| 2adf914723 | |||
| 96a2e4086f | |||
| a2d94f3d20 | |||
| 33784bd64b | |||
| 4e5efb5c0c | |||
| 5cb434f62b | |||
| 6117291e6b | |||
| 4e342f5397 | |||
| 6b85e6affd | |||
| e71116f768 | |||
| a0172a28fc | |||
| 60020ccaa9 | |||
| 3987e19c3f | |||
| 2068b31847 | |||
| 9a5f3f7672 | |||
| 75aa0f73db | |||
| 2efce29560 | |||
| a4c6ffd85f | |||
| 184169cd76 | |||
| 55d5b4168e | |||
| 6ccff3ba5d | |||
| 44f23c7ec1 | |||
| 492b025f5f | |||
| 7f98e36008 | |||
| f53c016704 |
@@ -1,17 +0,0 @@
|
||||
*/**/yui/src/*/meta/
|
||||
*/**/build/
|
||||
node_modules/
|
||||
vendor/
|
||||
lib/editor/atto/yui/src/rangy/js/
|
||||
lib/editor/tinymce/plugins/pdw/tinymce/
|
||||
lib/editor/tinymce/tiny_mce/
|
||||
lib/requirejs/
|
||||
lib/yuilib/
|
||||
lib/jquery/
|
||||
lib/htmlpurifier/
|
||||
lib/flowplayer/
|
||||
lib/xhprof/
|
||||
lib/amd/src/loglevel.js
|
||||
lib/amd/src/mustache.js
|
||||
theme/bootstrapbase/javascript/html5shiv.js
|
||||
theme/bootstrapbase/amd/src/bootstrap.js
|
||||
@@ -1,172 +0,0 @@
|
||||
{
|
||||
'env': {
|
||||
'browser': true,
|
||||
'amd': true
|
||||
},
|
||||
'globals': {
|
||||
'M': true,
|
||||
'Y': true
|
||||
},
|
||||
'rules': {
|
||||
// See http://eslint.org/docs/rules/ for all rules and explanations of all
|
||||
// rules.
|
||||
|
||||
// === Possible Errors ===
|
||||
'comma-dangle': 'off',
|
||||
'no-cond-assign': 'error',
|
||||
'no-console': 'error',
|
||||
'no-constant-condition': 'error',
|
||||
'no-control-regex': 'error',
|
||||
'no-debugger': 'error',
|
||||
'no-dupe-args': 'error',
|
||||
'no-dupe-keys': 'error',
|
||||
'no-duplicate-case': 'error',
|
||||
'no-empty': 'warn',
|
||||
'no-empty-character-class': 'error',
|
||||
'no-ex-assign': 'error',
|
||||
'no-extra-boolean-cast': 'error',
|
||||
'no-extra-parens': 'off',
|
||||
'no-extra-semi': 'error',
|
||||
'no-func-assign': 'error',
|
||||
'no-inner-declarations': 'error',
|
||||
'no-invalid-regexp': 'error',
|
||||
'no-irregular-whitespace': 'error',
|
||||
'no-negated-in-lhs': 'error',
|
||||
'no-obj-calls': 'error',
|
||||
'no-prototype-builtins': 'off',
|
||||
'no-regex-spaces': 'error',
|
||||
'no-sparse-arrays': 'error',
|
||||
'no-unexpected-multiline': 'error',
|
||||
'no-unreachable': 'warn',
|
||||
'no-unsafe-finally': 'error',
|
||||
'use-isnan': 'error',
|
||||
'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
|
||||
'valid-typeof': 'error',
|
||||
|
||||
// === Best Practices ===
|
||||
// (these mostly match our jshint config)
|
||||
'array-callback-return': 'warn',
|
||||
'block-scoped-var': 'warn',
|
||||
'complexity': 'warn',
|
||||
'consistent-return': 'warn',
|
||||
'curly': 'error',
|
||||
'dot-notation': 'warn',
|
||||
'no-alert': 'warn',
|
||||
'no-caller': 'error',
|
||||
'no-case-declarations': 'error',
|
||||
'no-div-regex': 'error',
|
||||
'no-empty-pattern': 'error',
|
||||
'no-empty-function': 'warn',
|
||||
'no-eq-null': 'error',
|
||||
'no-eval': 'error',
|
||||
'no-extend-native': 'error',
|
||||
'no-extra-bind': 'warn',
|
||||
'no-fallthrough': 'error',
|
||||
'no-floating-decimal': 'warn',
|
||||
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
|
||||
'no-implied-eval': 'error',
|
||||
'no-invalid-this': 'error',
|
||||
'no-iterator': 'error',
|
||||
'no-labels': 'error',
|
||||
'no-loop-func': 'error',
|
||||
'no-multi-spaces': 'warn',
|
||||
'no-multi-str': 'error',
|
||||
'no-native-reassign': 'warn',
|
||||
'no-new-func': 'error',
|
||||
'no-new-wrappers': 'error',
|
||||
'no-octal': 'error',
|
||||
'no-octal-escape': 'error',
|
||||
'no-proto': 'error',
|
||||
'no-redeclare': 'warn',
|
||||
'no-return-assign': 'error',
|
||||
'no-script-url': 'error',
|
||||
'no-self-assign': 'error',
|
||||
'no-self-compare': 'error',
|
||||
'no-sequences': 'warn',
|
||||
'no-throw-literal': 'warn',
|
||||
'no-unmodified-loop-condition': 'error',
|
||||
'no-unused-expressions': 'error',
|
||||
'no-unused-labels': 'error',
|
||||
'no-useless-call': 'warn',
|
||||
'no-useless-escape': 'warn',
|
||||
'no-with': 'error',
|
||||
'wrap-iife': ['error', 'any'],
|
||||
|
||||
// === Variables ===
|
||||
'no-delete-var': 'error',
|
||||
'no-undef': 'error',
|
||||
'no-undef-init': 'error',
|
||||
'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
|
||||
|
||||
// === Stylistic Issues ===
|
||||
'array-bracket-spacing': 'warn',
|
||||
'block-spacing': 'warn',
|
||||
'brace-style': ['warn', '1tbs'],
|
||||
'camelcase': 'warn',
|
||||
'comma-spacing': ['warn', { 'before': false, 'after': true }],
|
||||
'comma-style': ['warn', 'last'],
|
||||
'computed-property-spacing': 'error',
|
||||
'consistent-this': 'off',
|
||||
'eol-last': 'off',
|
||||
'func-names': 'off',
|
||||
'func-style': 'off',
|
||||
// indent currently not doing well with our wrapping style, so disabled.
|
||||
'indent': ['off', 4, { 'SwitchCase': 1 }],
|
||||
'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
|
||||
'keyword-spacing': 'warn',
|
||||
'linebreak-style': ['error', 'unix'],
|
||||
'lines-around-comment': 'off',
|
||||
'max-len': ['error', 132],
|
||||
'max-lines': 'off',
|
||||
'max-depth': 'warn',
|
||||
'max-nested-callbacks': ['warn', 5],
|
||||
'max-params': 'off',
|
||||
'max-statements': 'off',
|
||||
'max-statements-per-line': ['warn', { max: 2 }],
|
||||
'new-cap': ['warn', { 'properties': false }],
|
||||
'new-parens': 'warn',
|
||||
'newline-after-var': 'off',
|
||||
'newline-before-return': 'off',
|
||||
'newline-per-chained-call': 'off',
|
||||
'no-array-constructor': 'off',
|
||||
'no-bitwise': 'error',
|
||||
'no-continue': 'off',
|
||||
'no-inline-comments': 'off',
|
||||
'no-lonely-if': 'off',
|
||||
'no-mixed-operators': 'off',
|
||||
'no-mixed-spaces-and-tabs': 'error',
|
||||
'no-multiple-empty-lines': 'warn',
|
||||
'no-negated-condition': 'off',
|
||||
'no-nested-ternary': 'warn',
|
||||
'no-new-object': 'off',
|
||||
'no-plusplus': 'off',
|
||||
'no-spaced-func': 'warn',
|
||||
'no-ternary': 'off',
|
||||
'no-trailing-spaces': 'error',
|
||||
'no-underscore-dangle': 'off',
|
||||
'no-unneeded-ternary': 'off',
|
||||
'no-whitespace-before-property': 'warn',
|
||||
'object-curly-newline': 'off',
|
||||
'object-curly-spacing': 'warn',
|
||||
'object-property-newline': 'off',
|
||||
'one-var': 'off',
|
||||
'one-var-declaration-per-line': ['warn', 'initializations'],
|
||||
'operator-assignment': 'off',
|
||||
'operator-linebreak': 'off',
|
||||
'padded-blocks': 'off',
|
||||
'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
|
||||
'quotes': 'off',
|
||||
'require-jsdoc': 'warn',
|
||||
'semi': 'error',
|
||||
'semi-spacing': ['warn', {'before': false, 'after': true}],
|
||||
'sort-vars': 'off',
|
||||
'space-before-blocks': 'warn',
|
||||
'space-before-function-paren': ['warn', 'never'],
|
||||
'space-in-parens': 'warn',
|
||||
'space-infix-ops': 'warn',
|
||||
'space-unary-ops': 'warn',
|
||||
'spaced-comment': 'warn',
|
||||
'unicode-bom': 'error',
|
||||
'wrap-regex': 'off',
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
**/yui/build/** -diff
|
||||
**/amd/build/** -diff
|
||||
theme/bootstrapbase/style/editor.css -diff
|
||||
theme/bootstrapbase/style/moodle.css -diff
|
||||
@@ -27,16 +27,13 @@ env:
|
||||
# Postgres is significantly is pretty reasonable in its run-time.
|
||||
|
||||
# Run unit tests on MySQL
|
||||
- DB=mysqli TASK=PHPUNIT
|
||||
- DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
|
||||
|
||||
# Run CI Tests without running PHPUnit.
|
||||
- DB=none TASK=CITEST
|
||||
- DB=none PHPUNIT=false INSTALL=false CITEST=true
|
||||
|
||||
# Run unit tests on Postgres
|
||||
- DB=pgsql TASK=PHPUNIT
|
||||
|
||||
# Perform an upgrade test too.
|
||||
- DB=pgsql TASK=UPGRADE
|
||||
- DB=pgsql PHPUNIT=true INSTALL=false CITEST=false
|
||||
|
||||
matrix:
|
||||
# Enable fast finish.
|
||||
@@ -44,64 +41,37 @@ matrix:
|
||||
# It will not stop the jobs from running.
|
||||
fast_finish: true
|
||||
|
||||
include:
|
||||
# Run grunt/npm install on lowest supported npm version
|
||||
- php: 7
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='0.10'
|
||||
# Run grunt/npm install on highest version ('node' is an alias for the latest node.js version.)
|
||||
- php: 7
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='node'
|
||||
|
||||
exclude:
|
||||
# MySQL - it's just too slow.
|
||||
# Exclude it on all versions except for 7.0
|
||||
# - env: DB=mysqli TASK=PHPUNIT
|
||||
# - env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
|
||||
# php: 5.6
|
||||
#
|
||||
# - env: DB=mysqli TASK=PHPUNIT
|
||||
# - env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
|
||||
# php: 5.5
|
||||
|
||||
- env: DB=mysqli TASK=PHPUNIT
|
||||
- env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
|
||||
php: 5.4
|
||||
|
||||
- env: DB=none TASK=GRUNT
|
||||
php: 5.4
|
||||
|
||||
# Moodle 2.7 is not compatible with PHP 7 for the upgrade test.
|
||||
- env: DB=pgsql TASK=UPGRADE
|
||||
php: 7.0
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
- $HOME/.npm
|
||||
|
||||
install:
|
||||
- >
|
||||
if [ "$TASK" = 'PHPUNIT' ];
|
||||
then
|
||||
if [ -n "$GITHUB_APITOKEN" ]; then
|
||||
composer config github-oauth.github.com $GITHUB_APITOKEN;
|
||||
echo 'auth.json' >> .git/info/exclude
|
||||
fi
|
||||
# Disable xdebug. We aren't generating code coverage, and it has a huge impact upon test performance.
|
||||
- rm /home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
|
||||
|
||||
# Install composer dependencies.
|
||||
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
|
||||
# Typically it should be able to use the Composer cache if any other job has already completed before we started here.
|
||||
travis_retry composer install --prefer-dist --no-interaction;
|
||||
fi
|
||||
# Set the encrypted GITHUB_TOKEN if it's available to raise the API limit.
|
||||
- if [ -n "$GITHUB_APITOKEN" ]; then composer config github-oauth.github.com $GITHUB_APITOKEN; fi
|
||||
|
||||
- >
|
||||
if [ "$TASK" = 'GRUNT' ];
|
||||
then
|
||||
nvm install $NVM_VERSION ;
|
||||
nvm use $NVM_VERSION ;
|
||||
fi
|
||||
# Install composer dependencies.
|
||||
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
|
||||
# Typically it should be able to use the Composer cache if any other job has already completed before we started here.
|
||||
- travis_retry composer install --prefer-dist --no-interaction
|
||||
|
||||
before_script:
|
||||
- phpenv config-rm xdebug.ini
|
||||
- >
|
||||
if [ "$TASK" = 'PHPUNIT' -o "$TASK" = 'UPGRADE' ];
|
||||
if [ "$INSTALL" = 'true' -o "$PHPUNIT" = 'true' ];
|
||||
then
|
||||
# Copy generic configuration in place.
|
||||
cp config-dist.php config.php ;
|
||||
@@ -137,44 +107,44 @@ before_script:
|
||||
sed -i \
|
||||
-e "s%= 'pgsql'%= 'mysqli'%" \
|
||||
-e "s%= 'username'%= 'travis'%" \
|
||||
-e "s%=> 'utf8mb4_unicode_ci'%=> 'utf8mb4_bin'%" \
|
||||
config.php;
|
||||
|
||||
mysql -u root -e 'SET GLOBAL innodb_file_format=barracuda;' ;
|
||||
mysql -u root -e 'SET GLOBAL innodb_file_per_table=ON;' ;
|
||||
mysql -u root -e 'SET GLOBAL innodb_large_prefix=ON;' ;
|
||||
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;' ;
|
||||
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;' ;
|
||||
fi
|
||||
|
||||
if [ "$PHPUNIT" = 'true' ];
|
||||
then
|
||||
# Create a directory for the phpunit dataroot.
|
||||
mkdir -p "$HOME"/roots/phpunit
|
||||
|
||||
# The phpunit dataroot and prefix..
|
||||
sed -i \
|
||||
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
|
||||
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
|
||||
config.php ;
|
||||
|
||||
# Initialise PHPUnit for Moodle.
|
||||
php admin/tool/phpunit/cli/init.php
|
||||
fi
|
||||
fi
|
||||
|
||||
script:
|
||||
########################################################################
|
||||
# PHPUnit
|
||||
########################################################################
|
||||
- >
|
||||
if [ "$TASK" = 'PHPUNIT' ];
|
||||
if [ "$PHPUNIT" = 'true' ];
|
||||
then
|
||||
# Create a directory for the phpunit dataroot.
|
||||
mkdir -p "$HOME"/roots/phpunit
|
||||
|
||||
# The phpunit dataroot and prefix..
|
||||
sed -i \
|
||||
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
|
||||
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
|
||||
config.php ;
|
||||
|
||||
# Initialise PHPUnit for Moodle.
|
||||
php admin/tool/phpunit/cli/init.php
|
||||
fi
|
||||
|
||||
- >
|
||||
if [ "$TASK" = 'GRUNT' ];
|
||||
then
|
||||
npm install --no-spin;
|
||||
npm install --no-spin -g grunt ;
|
||||
vendor/bin/phpunit;
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
# CI Tests
|
||||
########################################################################
|
||||
- >
|
||||
if [ "$TASK" = 'CITEST' ];
|
||||
if [ "$CITEST" = 'true' ];
|
||||
then
|
||||
# Note - this is deliberately placed in the script section as we
|
||||
# should not add any code until after phpunit has run.
|
||||
@@ -186,7 +156,7 @@ before_script:
|
||||
# We need the official upstream for comparison
|
||||
git remote add upstream https://github.com/moodle/moodle.git;
|
||||
|
||||
git fetch upstream MOODLE_31_STABLE;
|
||||
git fetch upstream MOODLE_30_STABLE;
|
||||
export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`";
|
||||
export GIT_COMMIT="$TRAVIS_COMMIT";
|
||||
export UPSTREAM_FETCH_HEAD=`git rev-parse FETCH_HEAD`
|
||||
@@ -197,68 +167,9 @@ before_script:
|
||||
export phpcmd=`which php`;
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
# Upgrade test
|
||||
########################################################################
|
||||
# Actually run the CI Tests - do this outside of the main test to make output clearer.
|
||||
- >
|
||||
if [ "$TASK" = 'UPGRADE' ];
|
||||
then
|
||||
# We need the official upstream.
|
||||
git remote add upstream https://github.com/moodle/moodle.git;
|
||||
|
||||
# Checkout 27 STABLE branch.
|
||||
git fetch upstream MOODLE_27_STABLE;
|
||||
git checkout MOODLE_27_STABLE;
|
||||
|
||||
# Perform the upgrade
|
||||
php admin/cli/install_database.php --agree-license --adminpass=Password --adminemail=admin@example.com --fullname="Upgrade test" --shortname=Upgrade;
|
||||
|
||||
# Return to the previous commit
|
||||
git checkout -;
|
||||
|
||||
# Perform the upgrade
|
||||
php admin/cli/upgrade.php --non-interactive --allow-unstable ;
|
||||
|
||||
# The local_ci repository can be used to check upgrade savepoints.
|
||||
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci ;
|
||||
fi
|
||||
|
||||
script:
|
||||
- >
|
||||
if [ "$TASK" = 'PHPUNIT' ];
|
||||
then
|
||||
vendor/bin/phpunit;
|
||||
fi
|
||||
|
||||
- >
|
||||
if [ "$TASK" = 'CITEST' ];
|
||||
if [ "$CITEST" = 'true' ];
|
||||
then
|
||||
bash local/ci/php_lint/php_lint.sh;
|
||||
fi
|
||||
|
||||
- >
|
||||
if [ "$TASK" = 'GRUNT' ];
|
||||
then
|
||||
grunt ;
|
||||
# Add all files to the git index and then run diff --cached to see all changes.
|
||||
# This ensures that we get the status of all files, including new files.
|
||||
git add . ;
|
||||
git diff --cached --exit-code ;
|
||||
fi
|
||||
|
||||
########################################################################
|
||||
# Upgrade test
|
||||
########################################################################
|
||||
- >
|
||||
if [ "$TASK" = 'UPGRADE' ];
|
||||
then
|
||||
cp local/ci/check_upgrade_savepoints/check_upgrade_savepoints.php ./check_upgrade_savepoints.php
|
||||
result=`php check_upgrade_savepoints.php`;
|
||||
# Check if there are problems
|
||||
count=`echo "$result" | grep -P "ERROR|WARN" | wc -l` ;
|
||||
if (($count > 0));
|
||||
then
|
||||
echo "$result"
|
||||
exit 1 ;
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
CONTRIBUTING TO MOODLE
|
||||
======================
|
||||
|
||||
Moodle is made by people like you. We are members of a big worldwide community
|
||||
of developers, designers, teachers, testers, translators and other users. We
|
||||
work in universities, schools, companies and other places. You are very welcome
|
||||
to join us and contribute to the project.
|
||||
|
||||
See <https://docs.moodle.org/dev/Contributing_to_Moodle> for the many ways you
|
||||
can help, not only with coding.
|
||||
|
||||
Moodle is open to community contributions to core, though all code must go
|
||||
through peer-review, automated behaviour testing, continuous integration and
|
||||
human post-integration checks.
|
||||
|
||||
Pull requests
|
||||
-------------
|
||||
|
||||
Please do not open pull requests via Github. The repository there is just a
|
||||
mirror of the official repository at <https://git.moodle.org>. Issues are
|
||||
reported and patches provided via <https://tracker.moodle.org>. See below for
|
||||
more information.
|
||||
|
||||
Moodle core bug fixes and new features
|
||||
--------------------------------------
|
||||
|
||||
During the years of intensive development, a mature process of including
|
||||
submitted patches has evolved.
|
||||
|
||||
* Every bug fix or new feature must have a tracker issue.
|
||||
* You publish the branch implementing the fix or new feature in your public
|
||||
clone of the moodle.git repository (typically on Github).
|
||||
* Your patch is peer-reviewed, discussed, integrated, tested and then released
|
||||
as a part of moodle.git.
|
||||
* New features are developed on the master branch. Bug fixes are also
|
||||
backported to currently supported maintenance (stable) branches.
|
||||
|
||||
For further details, see <https://docs.moodle.org/dev/Process>.
|
||||
|
||||
Moodle plugins
|
||||
--------------
|
||||
|
||||
Moodle has a framework for additional plugins to extend its functionality. We
|
||||
have a Moodle plugins directory <https://moodle.org/plugins/> where you can
|
||||
register and maintain your plugin. Plugins hosted in the plugins directory can
|
||||
be easily installed and updated via the Moodle administration interface.
|
||||
|
||||
* You are expected to have a public source code repository with your plugin
|
||||
code.
|
||||
* After registering your plugin in the plugins directory it is reviewed before
|
||||
being published.
|
||||
* You are expected to continuously release updated versions of the plugin via
|
||||
the plugins directory. We do not pull from your code repository; you must do
|
||||
it explicitly.
|
||||
|
||||
For further details, see <https://docs.moodle.org/dev/Plugin_contribution>.
|
||||
@@ -12,7 +12,6 @@
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* jshint node: true, browser: false */
|
||||
|
||||
/**
|
||||
* @copyright 2014 Andrew Nicols
|
||||
@@ -25,56 +24,31 @@
|
||||
|
||||
module.exports = function(grunt) {
|
||||
var path = require('path'),
|
||||
fs = require('fs'),
|
||||
tasks = {},
|
||||
cwd = process.env.PWD || process.cwd();
|
||||
|
||||
// Windows users can't run grunt in a subdirectory, so allow them to set
|
||||
// the root by passing --root=path/to/dir.
|
||||
if (grunt.option('root')) {
|
||||
var root = grunt.option('root');
|
||||
if (grunt.file.exists(__dirname, root)) {
|
||||
cwd = path.join(__dirname, root);
|
||||
grunt.log.ok('Setting root to '+cwd);
|
||||
} else {
|
||||
grunt.fail.fatal('Setting root to '+root+' failed - path does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
var inAMD = path.basename(cwd) == 'amd';
|
||||
|
||||
// Globbing pattern for matching all AMD JS source files.
|
||||
var amdSrc = [inAMD ? cwd + '/src/*.js' : '**/amd/src/*.js'];
|
||||
|
||||
/**
|
||||
* Function to generate the destination for the uglify task
|
||||
* (e.g. build/file.min.js). This function will be passed to
|
||||
* the rename property of files array when building dynamically:
|
||||
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
|
||||
*
|
||||
* @param {String} destPath the current destination
|
||||
* @param {String} srcPath the matched src path
|
||||
* @return {String} The rewritten destination path.
|
||||
*/
|
||||
var uglify_rename = function (destPath, srcPath) {
|
||||
destPath = srcPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
destPath = path.resolve(cwd, destPath);
|
||||
return destPath;
|
||||
};
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
jshint: {
|
||||
options: {jshintrc: '.jshintrc'},
|
||||
amd: { src: amdSrc }
|
||||
files: ['**/amd/src/*.js']
|
||||
},
|
||||
uglify: {
|
||||
amd: {
|
||||
files: [{
|
||||
expand: true,
|
||||
src: amdSrc,
|
||||
rename: uglify_rename
|
||||
}]
|
||||
dynamic_mappings: {
|
||||
files: grunt.file.expandMapping(
|
||||
['**/src/*.js', '!**/node_modules/**'],
|
||||
'',
|
||||
{
|
||||
cwd: cwd,
|
||||
rename: function(destBase, destPath) {
|
||||
destPath = destPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
destPath = path.resolve(cwd, destPath);
|
||||
return destPath;
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
},
|
||||
less: {
|
||||
@@ -87,79 +61,54 @@ module.exports = function(grunt) {
|
||||
compress: true
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
options: {
|
||||
nospawn: true // We need not to spawn so config can be changed dynamically.
|
||||
},
|
||||
amd: {
|
||||
files: ['**/amd/src/**/*.js'],
|
||||
tasks: ['amd']
|
||||
},
|
||||
bootstrapbase: {
|
||||
files: ["theme/bootstrapbase/less/**/*.less"],
|
||||
tasks: ["less:bootstrapbase"]
|
||||
},
|
||||
yui: {
|
||||
files: ['**/yui/src/**/*.js'],
|
||||
tasks: ['shifter']
|
||||
},
|
||||
},
|
||||
shifter: {
|
||||
options: {
|
||||
recursive: true,
|
||||
paths: [cwd]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Shifter task. Is configured with a path to a specific file or a directory,
|
||||
* in the case of a specific file it will work out the right module to be built.
|
||||
*
|
||||
* Note that this task runs the invidiaul shifter jobs async (becase it spawns
|
||||
* so be careful to to call done().
|
||||
*/
|
||||
tasks.shifter = function() {
|
||||
var async = require('async'),
|
||||
var exec = require('child_process').spawn,
|
||||
done = this.async(),
|
||||
options = grunt.config('shifter.options');
|
||||
args = [],
|
||||
options = {
|
||||
recursive: true,
|
||||
watch: false,
|
||||
walk: false,
|
||||
module: false
|
||||
},
|
||||
shifter;
|
||||
|
||||
// Run the shifter processes one at a time to avoid confusing output.
|
||||
async.eachSeries(options.paths, function (src, filedone) {
|
||||
var args = [];
|
||||
args.push( path.normalize(__dirname + '/node_modules/shifter/bin/shifter'));
|
||||
|
||||
// Always ignore the node_modules directory.
|
||||
args.push('--excludes', 'node_modules');
|
||||
|
||||
// Determine the most appropriate options to run with based upon the current location.
|
||||
if (grunt.file.isMatch('**/yui/**/*.js', src)) {
|
||||
// When passed a JS file, build our containing module (this happen with
|
||||
// watch).
|
||||
grunt.log.debug('Shifter passed a specific JS file');
|
||||
src = path.dirname(path.dirname(src));
|
||||
options.recursive = false;
|
||||
} else if (grunt.file.isMatch('**/yui/src', src)) {
|
||||
// When in a src directory --walk all modules.
|
||||
if (path.basename(cwd) === 'src') {
|
||||
// Detect whether we're in a src directory.
|
||||
grunt.log.debug('In a src directory');
|
||||
args.push('--walk');
|
||||
options.recursive = false;
|
||||
} else if (grunt.file.isMatch('**/yui/src/*', src)) {
|
||||
// When in module, only build our module.
|
||||
options.walk = true;
|
||||
} else if (path.basename(path.dirname(cwd)) === 'src') {
|
||||
// Detect whether we're in a module directory.
|
||||
grunt.log.debug('In a module directory');
|
||||
options.recursive = false;
|
||||
} else if (grunt.file.isMatch('**/yui/src/*/js', src)) {
|
||||
// When in module src, only build our module.
|
||||
grunt.log.debug('In a source directory');
|
||||
src = path.dirname(src);
|
||||
options.recursive = false;
|
||||
options.module = true;
|
||||
}
|
||||
|
||||
if (grunt.option('watch')) {
|
||||
grunt.fail.fatal('The --watch option has been removed, please use `grunt watch` instead');
|
||||
if (!options.walk && !options.module) {
|
||||
grunt.fail.fatal('Unable to watch unless in a src or module directory');
|
||||
}
|
||||
|
||||
// It is not advisable to run with recursivity and watch - this
|
||||
// leads to building the build directory in a race-like fashion.
|
||||
grunt.log.debug('Detected a watch - disabling recursivity');
|
||||
options.recursive = false;
|
||||
args.push('--watch');
|
||||
}
|
||||
|
||||
if (options.recursive) {
|
||||
args.push('--recursive');
|
||||
}
|
||||
|
||||
// Always ignore the node_modules directory.
|
||||
args.push('--excludes', 'node_modules');
|
||||
|
||||
// Add the stderr option if appropriate
|
||||
if (grunt.option('verbose')) {
|
||||
args.push('--lint-stderr');
|
||||
@@ -171,17 +120,19 @@ module.exports = function(grunt) {
|
||||
|
||||
var execShifter = function() {
|
||||
|
||||
grunt.log.ok("Running shifter on " + src);
|
||||
grunt.util.spawn({
|
||||
cmd: "node",
|
||||
args: args,
|
||||
opts: {cwd: src, stdio: 'inherit', env: process.env}
|
||||
}, function (error, result, code) {
|
||||
shifter = exec("node", args, {
|
||||
cwd: cwd,
|
||||
stdio: 'inherit',
|
||||
env: process.env
|
||||
});
|
||||
|
||||
// Tidy up after exec.
|
||||
shifter.on('exit', function (code) {
|
||||
if (code) {
|
||||
grunt.fail.fatal('Shifter failed with code: ' + code);
|
||||
} else {
|
||||
grunt.log.ok('Shifter build complete.');
|
||||
filedone();
|
||||
done();
|
||||
}
|
||||
});
|
||||
};
|
||||
@@ -191,15 +142,79 @@ module.exports = function(grunt) {
|
||||
execShifter();
|
||||
} else {
|
||||
// Check that there are yui modules otherwise shifter ends with exit code 1.
|
||||
if (grunt.file.expand({cwd: src}, '**/yui/src/**/*.js').length > 0) {
|
||||
args.push('--recursive');
|
||||
execShifter();
|
||||
} else {
|
||||
grunt.log.ok('No YUI modules to build.');
|
||||
filedone();
|
||||
}
|
||||
var found = false;
|
||||
var hasYuiModules = function(directory, callback) {
|
||||
fs.readdir(directory, function(err, files) {
|
||||
if (err) {
|
||||
return callback(err, null);
|
||||
}
|
||||
|
||||
// If we already found a match there is no need to continue scanning.
|
||||
if (found === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to track the number of files to know when we return a result.
|
||||
var pending = files.length;
|
||||
|
||||
// We first check files, so if there is a match we don't need further
|
||||
// async calls and we just return a true.
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
if (files[i] === 'yui') {
|
||||
return callback(null, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate through subdirs if there were no matches.
|
||||
files.forEach(function (file) {
|
||||
|
||||
var p = path.join(directory, file);
|
||||
stat = fs.statSync(p);
|
||||
if (!stat.isDirectory()) {
|
||||
pending--;
|
||||
} else {
|
||||
|
||||
// We defer the pending-1 until we scan the whole dir and subdirs.
|
||||
hasYuiModules(p, function(err, result) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
// Once we get a true we notify the caller.
|
||||
found = true;
|
||||
return callback(null, true);
|
||||
}
|
||||
|
||||
pending--;
|
||||
if (pending === 0) {
|
||||
// Notify the caller that the whole dir has been scaned and there are no matches.
|
||||
return callback(null, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// No subdirs here, otherwise the return would be deferred until all subdirs are scanned.
|
||||
if (pending === 0) {
|
||||
return callback(null, false);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
hasYuiModules(cwd, function(err, result) {
|
||||
if (err) {
|
||||
grunt.fail.fatal(err.message);
|
||||
}
|
||||
|
||||
if (result === true) {
|
||||
execShifter();
|
||||
} else {
|
||||
grunt.log.ok('No YUI modules to build.');
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, done);
|
||||
};
|
||||
|
||||
tasks.startup = function() {
|
||||
@@ -207,7 +222,7 @@ module.exports = function(grunt) {
|
||||
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
|
||||
grunt.task.run('shifter');
|
||||
// Are we in an AMD directory?
|
||||
} else if (inAMD) {
|
||||
} else if (path.basename(cwd) == 'amd') {
|
||||
grunt.task.run('amd');
|
||||
} else {
|
||||
// Run them all!.
|
||||
@@ -216,28 +231,11 @@ module.exports = function(grunt) {
|
||||
}
|
||||
};
|
||||
|
||||
// On watch, we dynamically modify config to build only affected files. This
|
||||
// method is slightly complicated to deal with multiple changed files at once (copied
|
||||
// from the grunt-contrib-watch readme).
|
||||
var changedFiles = Object.create(null);
|
||||
var onChange = grunt.util._.debounce(function() {
|
||||
var files = Object.keys(changedFiles);
|
||||
grunt.config('jshint.amd.src', files);
|
||||
grunt.config('uglify.amd.files', [{ expand: true, src: files, rename: uglify_rename }]);
|
||||
grunt.config('shifter.options.paths', files);
|
||||
changedFiles = Object.create(null);
|
||||
}, 200);
|
||||
|
||||
grunt.event.on('watch', function(action, filepath) {
|
||||
changedFiles[filepath] = action;
|
||||
onChange();
|
||||
});
|
||||
|
||||
// Register NPM tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
grunt.loadNpmTasks('grunt-contrib-less');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
MOODLE INSTALLATION
|
||||
===================
|
||||
|
||||
Here is a short summary of the installation process (which can take just a few
|
||||
minutes):
|
||||
|
||||
1. Move the Moodle files into your web directory.
|
||||
|
||||
2. Create a single database for Moodle to store all its tables in (or choose an
|
||||
existing database).
|
||||
|
||||
3. Visit your Moodle site with a browser. You should be taken to the
|
||||
install.php script, which will lead you through creating a config.php file
|
||||
and then setting up Moodle, creating an admin account etc.
|
||||
|
||||
4. Set up a cron task to call the file admin/cron.php every minute.
|
||||
|
||||
For more information, see <https://docs.moodle.org/en/Installing_Moodle>.
|
||||
|
||||
Good luck and have fun!
|
||||
@@ -1,7 +0,0 @@
|
||||
*** PLEASE DO NOT OPEN PULL REQUESTS VIA GITHUB ***
|
||||
|
||||
The moodle.git repository at Github is just a mirror of the official repository. We do not accept pull requests at Github.
|
||||
|
||||
See CONTRIBUTING.txt guidelines for how to contribute patches for Moodle. Thank you.
|
||||
|
||||
--
|
||||
@@ -1,28 +1,29 @@
|
||||
.-..-.
|
||||
_____ | || |
|
||||
/____/-.---_ .---. .---. .-.| || | .---.
|
||||
| | _ _ |/ _ \/ _ \/ _ || |/ __ \
|
||||
* | | | | | || |_| || |_| || |_| || || |___/
|
||||
|_| |_| |_|\_____/\_____/\_____||_|\_____)
|
||||
QUICK INSTALL
|
||||
=============
|
||||
|
||||
Moodle - the world's open source learning platform
|
||||
For the impatient, here is a basic outline of the
|
||||
installation process, which normally takes me only
|
||||
a few minutes:
|
||||
|
||||
Moodle <https://moodle.org> is a learning platform designed to provide
|
||||
educators, administrators and learners with a single robust, secure and
|
||||
integrated system to create personalised learning environments.
|
||||
1) Move the Moodle files into your web directory.
|
||||
|
||||
You can download Moodle <https://download.moodle.org> and run it on your own
|
||||
web server, ask one of our Moodle Partners <https://moodle.com/partners/> to
|
||||
assist you, or have a MoodleCloud site <https://moodle.com/cloud/> set up for
|
||||
you.
|
||||
2) Create a single database for Moodle to store all
|
||||
its tables in (or choose an existing database).
|
||||
|
||||
Moodle is widely used around the world by universities, schools, companies and
|
||||
all manner of organisations and individuals.
|
||||
3) Visit your Moodle site with a browser, you should
|
||||
be taken to the install.php script, which will lead
|
||||
you through creating a config.php file and then
|
||||
setting up Moodle, creating an admin account etc.
|
||||
|
||||
Moodle is provided freely as open source software, under the GNU General Public
|
||||
License <https://docs.moodle.org/dev/License>.
|
||||
4) Set up a cron task to call the file admin/cron.php
|
||||
every five minutes or so.
|
||||
|
||||
Moodle is written in PHP and JavaScript and uses an SQL database for storing
|
||||
the data.
|
||||
|
||||
See <https://docs.moodle.org> for details of Moodle's many features.
|
||||
For more information, see the INSTALL DOCUMENTATION:
|
||||
|
||||
http://docs.moodle.org/en/Installing_Moodle
|
||||
|
||||
|
||||
Good luck and have fun!
|
||||
Martin Dougiamas, Lead Developer
|
||||
|
||||
|
||||
@@ -1,48 +1,34 @@
|
||||
MOODLE TRADEMARKS POLICY
|
||||
========================
|
||||
------------------------
|
||||
Moodle Trademark License
|
||||
------------------------
|
||||
|
||||
The word "Moodle" is trademarked in many countries around the world. The word
|
||||
was originally an acronym: Modular Object-Oriented Dynamic Learning
|
||||
Environment. The trademark is owned by Martin Dougiamas, Founder and Director
|
||||
of Moodle.
|
||||
The name Moodle™ is a registered trademark of the Moodle Trust.
|
||||
|
||||
The law obligates trademark owners to police their marks and prevent the use of
|
||||
confusingly similar names by third parties. Through this policy we’d like to
|
||||
make it clear how Moodle-related projects, organisations, and people can use
|
||||
the Moodle trademark. We’d also like to be clear about how use of the word is
|
||||
restricted when used to promote commercial Moodle services. We do this to
|
||||
protect the very business model that allows us to continue developing Moodle
|
||||
for you.
|
||||
A key part of the business model that allows us to produce and
|
||||
distribute Moodle as completely Free open source software is that
|
||||
we restrict the commercial use of the Moodle trademark to those
|
||||
who have contracted to support Moodle development (Moodle Partners).
|
||||
|
||||
Allowed uses
|
||||
------------
|
||||
If you are intending to use the name (and/or logo) to advertise
|
||||
generic Moodle™ services (eg Moodle Hosting, Moodle Support,
|
||||
Moodle Certification, Moodle Training, Moodle Consulting,
|
||||
Moodle Customisation, Moodle Courseware Development, Moodle
|
||||
Theme design, Moodle Integrations, Moodle Installations, etc)
|
||||
or as the name of a software package, then you must seek
|
||||
direct permission in writing from the Moodle Trust via the
|
||||
moodle.com helpdesk, in accordance with normal trademark
|
||||
restrictions.
|
||||
|
||||
The following uses don’t require any permission at all:
|
||||
There are no restrictions on how you use the name in other
|
||||
contexts (for example, if you use Moodle just to provide
|
||||
courses then you can use the name freely to refer to it.)
|
||||
|
||||
* Referring to the software or the Moodle project.
|
||||
* Describing your own Moodle implementation (including within corporate
|
||||
settings).
|
||||
* Describing a Moodle-based community hub.
|
||||
* Describing some software you’ve made that integrates with Moodle
|
||||
(eg a Moodle integration feature on another system).
|
||||
If you aren't sure of a particular case, please ask us via
|
||||
http://moodle.com/helpdesk: we'll be happy to either provide
|
||||
you with official permission in writing or help you fix
|
||||
your wording.
|
||||
|
||||
Restricted uses
|
||||
---------------
|
||||
|
||||
The following uses are generally prohibited without explicit and direct
|
||||
permission being granted to you by Moodle Pty Ltd. We do this to protect the
|
||||
Moodle project from software and sites which could confuse people. Please
|
||||
contact us to ask for permission in writing.
|
||||
|
||||
* You can’t use "Moodle" in the name of your software (including Mobile apps)
|
||||
* You can’t use "Moodle" in your company name
|
||||
* You can’t use "Moodle" in your domain name
|
||||
* You can’t use "Moodle" in advertising-related keywords (such as Adsense)
|
||||
* You can’t use "Moodle" to describe services around Moodle (such as hosting,
|
||||
training, support, consulting, course creation services, theme development,
|
||||
customisation, installation, integration and certification). This applies
|
||||
even if you do not charge for the services. Note that usually only Moodle
|
||||
Partners have this permission.
|
||||
|
||||
For information about the Moodle Partner Certification Mark as well as for how
|
||||
to contact us, please see <https://moodle.com/trademarks/>.
|
||||
Martin Dougiamas
|
||||
Executive Director
|
||||
Moodle Trust
|
||||
http://moodle.com
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Allows admin to configure antiviruses.
|
||||
*
|
||||
* @package core_antivirus
|
||||
* @copyright 2015 Ruslan Kabalin, Lancaster University.
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$action = required_param('action', PARAM_ALPHANUMEXT);
|
||||
$antivirus = required_param('antivirus', PARAM_PLUGIN);
|
||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
||||
|
||||
$PAGE->set_url('/admin/antiviruses.php', array('action' => $action, 'antivirus' => $antivirus));
|
||||
$PAGE->set_context(context_system::instance());
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', context_system::instance());
|
||||
|
||||
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageantiviruses";
|
||||
|
||||
// Get currently installed and enabled antivirus plugins.
|
||||
$availableantiviruses = \core\antivirus\manager::get_available();
|
||||
if (!empty($antivirus) and empty($availableantiviruses[$antivirus])) {
|
||||
redirect ($returnurl);
|
||||
}
|
||||
|
||||
$activeantiviruses = explode(',', $CFG->antiviruses);
|
||||
foreach ($activeantiviruses as $key => $active) {
|
||||
if (empty($availableantiviruses[$active])) {
|
||||
unset($activeantiviruses[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!confirm_sesskey()) {
|
||||
redirect($returnurl);
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'disable':
|
||||
// Remove from enabled list.
|
||||
$key = array_search($antivirus, $activeantiviruses);
|
||||
unset($activeantiviruses[$key]);
|
||||
break;
|
||||
|
||||
case 'enable':
|
||||
// Add to enabled list.
|
||||
if (!in_array($antivirus, $activeantiviruses)) {
|
||||
$activeantiviruses[] = $antivirus;
|
||||
$activeantiviruses = array_unique($activeantiviruses);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'down':
|
||||
$key = array_search($antivirus, $activeantiviruses);
|
||||
// Check auth plugin is valid.
|
||||
if ($key !== false) {
|
||||
// Move down the list.
|
||||
if ($key < (count($activeantiviruses) - 1)) {
|
||||
$fsave = $activeantiviruses[$key];
|
||||
$activeantiviruses[$key] = $activeantiviruses[$key + 1];
|
||||
$activeantiviruses[$key + 1] = $fsave;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'up':
|
||||
$key = array_search($antivirus, $activeantiviruses);
|
||||
// Check auth is valid.
|
||||
if ($key !== false) {
|
||||
// Move up the list.
|
||||
if ($key >= 1) {
|
||||
$fsave = $activeantiviruses[$key];
|
||||
$activeantiviruses[$key] = $activeantiviruses[$key - 1];
|
||||
$activeantiviruses[$key - 1] = $fsave;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
set_config('antiviruses', implode(',', $activeantiviruses));
|
||||
core_plugin_manager::reset_caches();
|
||||
|
||||
redirect ($returnurl);
|
||||
@@ -36,7 +36,6 @@
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
$DB->set_field('block', 'visible', '0', array('id'=>$block->id)); // Hide block
|
||||
add_to_config_log('block_visibility', $block->visible, '0', $block->name);
|
||||
core_plugin_manager::reset_caches();
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
@@ -46,7 +45,6 @@
|
||||
print_error('blockdoesnotexist', 'error');
|
||||
}
|
||||
$DB->set_field('block', 'visible', '1', array('id'=>$block->id)); // Show block
|
||||
add_to_config_log('block_visibility', $block->visible, '1', $block->name);
|
||||
core_plugin_manager::reset_caches();
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
@@ -66,7 +64,6 @@
|
||||
if (!in_array($block->name, $undeletableblocktypes)) {
|
||||
$undeletableblocktypes[] = $block->name;
|
||||
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
|
||||
add_to_config_log('block_protect', $unprotect, $protect, $block->name);
|
||||
}
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
@@ -78,7 +75,6 @@
|
||||
if (in_array($block->name, $undeletableblocktypes)) {
|
||||
$undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
|
||||
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
|
||||
add_to_config_log('block_protect', $unprotect, $protect, $block->name);
|
||||
}
|
||||
admin_get_root(true, false); // settings not required - only pages
|
||||
}
|
||||
@@ -158,10 +154,7 @@
|
||||
$settings = '<a href="' . $blocksettings->url . '">' . get_string('settings') . '</a>';
|
||||
} else if ($blocksettings instanceof admin_settingpage) {
|
||||
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
|
||||
} else if (!file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
|
||||
// If the block's settings node was not found, we check that the block really provides the settings.php file.
|
||||
// Note that blocks can inject their settings to other nodes in the admin tree without using the default locations.
|
||||
// This can be done by assigning null to $setting in settings.php and it is a valid case.
|
||||
} else {
|
||||
debugging('Warning: block_'.$block->name.' returns true in has_config() but does not provide a settings.php file',
|
||||
DEBUG_DEVELOPER);
|
||||
}
|
||||
|
||||
@@ -64,71 +64,6 @@ if (!empty($options['collation'])) {
|
||||
cli_error("Error: collation '$collation' is not available on this server!");
|
||||
}
|
||||
|
||||
$collationinfo = explode('_', $collation);
|
||||
$charset = reset($collationinfo);
|
||||
|
||||
$engine = strtolower($DB->get_dbengine());
|
||||
|
||||
// Do checks for utf8mb4.
|
||||
if (strpos($collation, 'utf8mb4') === 0) {
|
||||
// Do we have the right engine?
|
||||
if ($engine !== 'innodb' && $engine !== 'xtradb') {
|
||||
cli_error("Error: '$collation' requires InnoDB or XtraDB set as the engine.");
|
||||
}
|
||||
// Are we using Barracuda?
|
||||
if ($DB->get_row_format() != 'Barracuda') {
|
||||
// Try setting it here.
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_file_format=Barracuda");
|
||||
} catch (dml_exception $e) {
|
||||
cli_error("Error: '$collation' requires the file format to be set to Barracuda.
|
||||
An attempt was made to change the format, but it failed. Please try doing this manually.");
|
||||
}
|
||||
echo "GLOBAL SETTING: innodb_file_format changed to Barracuda\n";
|
||||
}
|
||||
// Is one file per table being used?
|
||||
if (!$DB->is_file_per_table_enabled()) {
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_file_per_table=1");
|
||||
} catch (dml_exception $e) {
|
||||
cli_error("Error: '$collation' requires the setting 'innodb_file_per_table' be set to 'ON'.
|
||||
An attempt was made to change the format, but it failed. Please try doing this manually.");
|
||||
}
|
||||
echo "GLOBAL SETTING: innodb_file_per_table changed to 1\n";
|
||||
}
|
||||
// Is large prefix set?
|
||||
if (!$DB->is_large_prefix_enabled()) {
|
||||
try {
|
||||
$DB->execute("SET GLOBAL innodb_large_prefix=1");
|
||||
} catch (dml_exception $e) {
|
||||
cli_error("Error: '$collation' requires the setting 'innodb_large_prefix' be set to 'ON'.
|
||||
An attempt was made to change the format, but it failed. Please try doing this manually.");
|
||||
}
|
||||
echo "GLOBAL SETTING: innodb_large_prefix changed to 1\n";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SHOW VARIABLES LIKE 'collation_database'";
|
||||
if (!$dbcollation = $DB->get_record_sql($sql)) {
|
||||
cli_error("Error: Could not access collation information on the database.");
|
||||
}
|
||||
$sql = "SHOW VARIABLES LIKE 'character_set_database'";
|
||||
if (!$dbcharset = $DB->get_record_sql($sql)) {
|
||||
cli_error("Error: Could not access character set information on the database.");
|
||||
}
|
||||
if ($dbcollation->value !== $collation || $dbcharset->value !== $charset) {
|
||||
// Try to convert the DB.
|
||||
echo "Converting database to '$collation' for $CFG->wwwroot:\n";
|
||||
$sql = "ALTER DATABASE $CFG->dbname DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
|
||||
try {
|
||||
$DB->change_database_structure($sql);
|
||||
} catch (exception $e) {
|
||||
cli_error("Error: Tried to alter the database with no success. Please try manually changing the database
|
||||
to the new collation and character set and then run this script again.");
|
||||
}
|
||||
echo "DATABASE CONVERTED\n";
|
||||
}
|
||||
|
||||
echo "Converting tables and columns to '$collation' for $CFG->wwwroot:\n";
|
||||
$prefix = $DB->get_prefix();
|
||||
$prefix = str_replace('_', '\\_', $prefix);
|
||||
@@ -145,7 +80,7 @@ if (!empty($options['collation'])) {
|
||||
$skipped++;
|
||||
|
||||
} else {
|
||||
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
|
||||
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT COLLATE = $collation");
|
||||
echo "CONVERTED\n";
|
||||
$converted++;
|
||||
}
|
||||
@@ -161,32 +96,18 @@ if (!empty($options['collation'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for utf8mb4 collation.
|
||||
$rowformat = $DB->get_row_format_sql($engine, $collation);
|
||||
|
||||
if ($column->type === 'tinytext' or $column->type === 'mediumtext' or $column->type === 'text' or $column->type === 'longtext') {
|
||||
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
|
||||
$default = (!is_null($column->default) and $column->default !== '') ? "DEFAULT '$column->default'" : '';
|
||||
// primary, unique and inc are not supported for texts
|
||||
$sql = "ALTER TABLE $table->name
|
||||
MODIFY COLUMN $column->field $column->type
|
||||
CHARACTER SET $charset
|
||||
COLLATE $collation $notnull $default";
|
||||
$sql = "ALTER TABLE $table->name MODIFY COLUMN $column->field $column->type COLLATE $collation $notnull $default";
|
||||
$DB->change_database_structure($sql);
|
||||
|
||||
} else if (strpos($column->type, 'varchar') === 0) {
|
||||
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
|
||||
$default = !is_null($column->default) ? "DEFAULT '$column->default'" : '';
|
||||
|
||||
if ($rowformat != '') {
|
||||
$sql = "ALTER TABLE $table->name $rowformat";
|
||||
$DB->change_database_structure($sql);
|
||||
}
|
||||
|
||||
$sql = "ALTER TABLE $table->name
|
||||
MODIFY COLUMN $column->field $column->type
|
||||
CHARACTER SET $charset
|
||||
COLLATE $collation $notnull $default";
|
||||
// primary, unique and inc are not supported for texts
|
||||
$sql = "ALTER TABLE $table->name MODIFY COLUMN $column->field $column->type COLLATE $collation $notnull $default";
|
||||
$DB->change_database_structure($sql);
|
||||
} else {
|
||||
echo "ERROR (unknown column type: $column->type)\n";
|
||||
@@ -259,9 +180,7 @@ function mysql_get_collations() {
|
||||
global $DB;
|
||||
|
||||
$collations = array();
|
||||
$sql = "SHOW COLLATION
|
||||
WHERE Collation LIKE 'utf8\_%' AND Charset = 'utf8'
|
||||
OR Collation LIKE 'utf8mb4\_%' AND Charset = 'utf8mb4'";
|
||||
$sql = "SHOW COLLATION WHERE Collation LIKE 'utf8\_%' AND Charset = 'utf8'";
|
||||
$rs = $DB->get_recordset_sql($sql);
|
||||
foreach ($rs as $collation) {
|
||||
$collations[$collation->collation] = $collation->collation;
|
||||
|
||||
@@ -51,25 +51,25 @@ Options:
|
||||
|
||||
Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php
|
||||
";
|
||||
"; //TODO: localize - to be translated later when everything is finished
|
||||
|
||||
echo $help;
|
||||
die;
|
||||
}
|
||||
cli_heading('Password reset');
|
||||
$prompt = "Enter username (manual authentication only)";
|
||||
cli_heading('Password reset'); // TODO: localize
|
||||
$prompt = "enter username (manual authentication only)"; // TODO: localize
|
||||
$username = cli_input($prompt);
|
||||
|
||||
if (!$user = $DB->get_record('user', array('auth'=>'manual', 'username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
|
||||
cli_error("Can not find user '$username'");
|
||||
}
|
||||
|
||||
$prompt = "Enter new password";
|
||||
$prompt = "Enter new password"; // TODO: localize
|
||||
$password = cli_input($prompt);
|
||||
|
||||
$errmsg = '';//prevent eclipse warning
|
||||
if (!check_password_policy($password, $errmsg)) {
|
||||
cli_error(html_to_text($errmsg, 0));
|
||||
cli_error($errmsg);
|
||||
}
|
||||
|
||||
$hashedpassword = hash_internal_user_password($password);
|
||||
@@ -78,4 +78,4 @@ $DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
|
||||
|
||||
echo "Password changed\n";
|
||||
|
||||
exit(0); // 0 means success.
|
||||
exit(0); // 0 means success
|
||||
@@ -45,23 +45,17 @@ require_once($CFG->libdir.'/clilib.php'); // cli only functions
|
||||
require_once($CFG->libdir.'/environmentlib.php');
|
||||
|
||||
// now get cli options
|
||||
$lang = isset($SESSION->lang) ? $SESSION->lang : $CFG->lang;
|
||||
list($options, $unrecognized) = cli_get_params(
|
||||
array(
|
||||
'non-interactive' => false,
|
||||
'allow-unstable' => false,
|
||||
'help' => false,
|
||||
'lang' => $lang
|
||||
'help' => false
|
||||
),
|
||||
array(
|
||||
'h' => 'help'
|
||||
)
|
||||
);
|
||||
|
||||
if ($options['lang']) {
|
||||
$SESSION->lang = $options['lang'];
|
||||
}
|
||||
|
||||
$interactive = empty($options['non-interactive']);
|
||||
|
||||
if ($unrecognized) {
|
||||
@@ -80,10 +74,6 @@ Options:
|
||||
--non-interactive No interactive questions or confirmations
|
||||
--allow-unstable Upgrade even if the version is not marked as stable yet,
|
||||
required in non-interactive mode.
|
||||
--lang=CODE Set preferred language for CLI output. Defaults to the
|
||||
site language if not set. Defaults to 'en' if the lang
|
||||
parameter is invalid or if the language pack is not
|
||||
installed.
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Lets users manage data formats
|
||||
*
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
* @copyright 2016 Brendan Heywood (brendan@catalyst-au.net)
|
||||
* @package core
|
||||
* @subpackage dataformat
|
||||
*/
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$action = required_param('action', PARAM_ALPHANUMEXT);
|
||||
$name = required_param('name', PARAM_PLUGIN);
|
||||
|
||||
$syscontext = context_system::instance();
|
||||
$PAGE->set_url('/admin/dataformats.php');
|
||||
$PAGE->set_context($syscontext);
|
||||
|
||||
require_login();
|
||||
require_capability('moodle/site:config', $syscontext);
|
||||
require_sesskey();
|
||||
|
||||
$return = new moodle_url('/admin/settings.php', array('section' => 'managedataformats'));
|
||||
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('dataformat');
|
||||
$sortorder = array_flip(array_keys($plugins));
|
||||
|
||||
if (!isset($plugins[$name])) {
|
||||
print_error('courseformatnotfound', 'error', $return, $name);
|
||||
}
|
||||
|
||||
switch ($action) {
|
||||
case 'disable':
|
||||
if ($plugins[$name]->is_enabled()) {
|
||||
set_config('disabled', 1, 'dataformat_'. $name);
|
||||
core_plugin_manager::reset_caches();
|
||||
}
|
||||
break;
|
||||
case 'enable':
|
||||
if (!$plugins[$name]->is_enabled()) {
|
||||
unset_config('disabled', 'dataformat_'. $name);
|
||||
core_plugin_manager::reset_caches();
|
||||
}
|
||||
break;
|
||||
case 'up':
|
||||
if ($sortorder[$name]) {
|
||||
$currentindex = $sortorder[$name];
|
||||
$seq = array_keys($plugins);
|
||||
$seq[$currentindex] = $seq[$currentindex - 1];
|
||||
$seq[$currentindex - 1] = $name;
|
||||
set_config('dataformat_plugins_sortorder', implode(',', $seq));
|
||||
}
|
||||
break;
|
||||
case 'down':
|
||||
if ($sortorder[$name] < count($sortorder) - 1) {
|
||||
$currentindex = $sortorder[$name];
|
||||
$seq = array_keys($plugins);
|
||||
$seq[$currentindex] = $seq[$currentindex + 1];
|
||||
$seq[$currentindex + 1] = $name;
|
||||
set_config('dataformat_plugins_sortorder', implode(',', $seq));
|
||||
}
|
||||
break;
|
||||
}
|
||||
redirect($return);
|
||||
|
||||
@@ -1145,11 +1145,6 @@
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.8" requires="2.2">
|
||||
@@ -1423,11 +1418,6 @@
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.0" requires="2.2">
|
||||
@@ -1444,7 +1434,6 @@
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_71" message="unsupportedphpversion71" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -1567,342 +1556,6 @@
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.1" requires="2.7">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.1" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_71" message="unsupportedphpversion71" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.2" requires="2.7">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="5.5.31" />
|
||||
<VENDOR name="mysql" version="5.5.31" />
|
||||
<VENDOR name="postgres" version="9.1" />
|
||||
<VENDOR name="mssql" version="10.0" />
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.6.5" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="mbstringrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opensslrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlrpc" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="xmlrpcrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="intlrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -52,12 +52,6 @@ if (!function_exists('json_encode') || !function_exists('json_decode')) {
|
||||
die();
|
||||
}
|
||||
|
||||
// Make sure xml extension is available.
|
||||
if (!extension_loaded('xml')) {
|
||||
echo 'Moodle requires the xml PHP extension. Please install or enable the xml extension.';
|
||||
die();
|
||||
}
|
||||
|
||||
define('NO_OUTPUT_BUFFERING', true);
|
||||
|
||||
if (isset($_POST['upgradekey'])) {
|
||||
@@ -849,8 +843,6 @@ $buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', '
|
||||
$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
|
||||
// Check if there are any cache warnings.
|
||||
$cachewarnings = cache_helper::warnings();
|
||||
// Check if there are events 1 API handlers.
|
||||
$eventshandlers = $DB->get_records_sql('SELECT DISTINCT component FROM {events_handlers}');
|
||||
|
||||
admin_externalpage_setup('adminnotifications');
|
||||
|
||||
@@ -858,4 +850,4 @@ $output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
|
||||
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
|
||||
$registered, $cachewarnings, $eventshandlers);
|
||||
$registered, $cachewarnings);
|
||||
|
||||
@@ -60,8 +60,7 @@ class mnet_simple_host_form extends moodleform {
|
||||
}
|
||||
if ($host = $DB->get_record('mnet_host', array('wwwroot' => $wwwroot))) {
|
||||
global $CFG;
|
||||
return array('wwwroot' => get_string('hostexists', 'mnet',
|
||||
new moodle_url('/admin/mnet/peers.php', array('hostid' => $host->id))));
|
||||
return array('wwwroot' => get_string('hostexists', 'mnet', $CFG->wwwroot . '/admin/mnet/peers.php?hostid=' . $host->id));
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ if (!empty($hostid)) {
|
||||
$mnet_peer->set_id($hostid);
|
||||
echo $OUTPUT->header();
|
||||
$currenttab = 'mnetdetails';
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
|
||||
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
|
||||
|
||||
if ($hostid != $CFG->mnet_all_hosts_id) {
|
||||
$mnet_peer->currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
|
||||
@@ -144,7 +144,7 @@ if (empty($noreviewform) && $id = optional_param('id', 0, PARAM_INT)) {
|
||||
// we're editing an existing one, so set up the tabs
|
||||
$currenttab = 'mnetdetails';
|
||||
$mnet_peer->set_id($id);
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
|
||||
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
|
||||
} else if (empty($noreviewform) && ($wwwroot = optional_param('wwwroot', '', PARAM_URL)) && ($applicationid = optional_param('applicationid', 0, PARAM_INT))) {
|
||||
$application = $DB->get_field('mnet_application', 'name', array('id'=>$applicationid));
|
||||
$mnet_peer->bootstrap($wwwroot, null, $application);
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
require(dirname(dirname(dirname(__FILE__))).'/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin .'/mnet/profilefields_form.php');
|
||||
require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php');
|
||||
$mnet = get_mnet_environment();
|
||||
|
||||
require_login();
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/services_form.php');
|
||||
require_once($CFG->dirroot . '/admin/mnet/services_form.php');
|
||||
$mnet = get_mnet_environment();
|
||||
|
||||
require_login();
|
||||
@@ -82,7 +82,7 @@ if ($formdata = $mform->get_data()) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$currenttab = 'mnetservices';
|
||||
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
|
||||
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
|
||||
echo $OUTPUT->box_start();
|
||||
$s = mnet_get_service_info($mnet_peer, false); // basic data only
|
||||
$mform->set_data($s);
|
||||
|
||||
@@ -275,19 +275,17 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
* @param array|null $availableupdates array of \core\update\info objects or null
|
||||
* @param int|null $availableupdatesfetch timestamp of the most recent updates fetch or null (unknown)
|
||||
* @param string[] $cachewarnings An array containing warnings from the Cache API.
|
||||
* @param array $eventshandlers Events 1 API handlers.
|
||||
*
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
|
||||
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
|
||||
$buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0) {
|
||||
$buggyiconvnomb, $registered, array $cachewarnings = array()) {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
|
||||
$output .= $this->header();
|
||||
$output .= $this->maturity_info($maturity);
|
||||
$output .= $this->legacy_log_store_writing_error();
|
||||
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
|
||||
$output .= $this->insecure_dataroot_warning($insecuredataroot);
|
||||
$output .= $this->display_errors_warning($errorsdisplayed);
|
||||
@@ -296,7 +294,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$output .= $this->db_problems($dbproblems);
|
||||
$output .= $this->maintenance_mode_warning($maintenancemode);
|
||||
$output .= $this->cache_warnings($cachewarnings);
|
||||
$output .= $this->events_handlers($eventshandlers);
|
||||
$output .= $this->registration_warning($registered);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -597,23 +594,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return join("\n", array_map(array($this, 'warning'), $cachewarnings));
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders events 1 API handlers warning.
|
||||
*
|
||||
* @param array $eventshandlers
|
||||
* @return string
|
||||
*/
|
||||
public function events_handlers($eventshandlers) {
|
||||
if ($eventshandlers) {
|
||||
$components = '';
|
||||
foreach ($eventshandlers as $eventhandler) {
|
||||
$components .= $eventhandler->component . ', ';
|
||||
}
|
||||
$components = rtrim($components, ', ');
|
||||
return $this->warning(get_string('eventshandlersinuse', 'admin', $components));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render an appropriate message if the site in in maintenance mode.
|
||||
* @param bool $maintenancemode
|
||||
@@ -1955,19 +1935,4 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check to see if writing to the deprecated legacy log store is enabled.
|
||||
*
|
||||
* @return string An error message if writing to the legacy log store is enabled.
|
||||
*/
|
||||
protected function legacy_log_store_writing_error() {
|
||||
$enabled = get_config('logstore_legacy', 'loglegacy');
|
||||
$plugins = explode(',', get_config('tool_log', 'enabled_stores'));
|
||||
$enabled = $enabled && in_array('logstore_legacy', $plugins);
|
||||
|
||||
if ($enabled) {
|
||||
return $this->warning(get_string('legacylogginginuse'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,14 +32,10 @@ $getroles = optional_param('getroles', 0, PARAM_BOOL);
|
||||
|
||||
list($context, $course, $cm) = get_context_info_array($contextid);
|
||||
|
||||
$PAGE->set_context($context);
|
||||
|
||||
require_login($course, false, $cm);
|
||||
require_capability('moodle/role:review', $context);
|
||||
require_sesskey();
|
||||
|
||||
$OUTPUT->header();
|
||||
|
||||
list($overridableroles, $overridecounts, $nameswithcounts) = get_overridable_roles($context,
|
||||
ROLENAME_BOTH, true);
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ abstract class core_role_capability_table_with_risks extends core_role_capabilit
|
||||
protected $allpermissions; // We don't need perms ourselves, but all our subclasses do.
|
||||
protected $strperms; // Language string cache.
|
||||
protected $risksurl; // URL in moodledocs about risks.
|
||||
protected $riskicons = array(); // Cache to avoid regenerating the HTML for each risk icon.
|
||||
/** @var array The capabilities to highlight as default/inherited. */
|
||||
protected $parentpermissions;
|
||||
protected $displaypermissions;
|
||||
@@ -182,12 +183,12 @@ abstract class core_role_capability_table_with_risks extends core_role_capabilit
|
||||
*/
|
||||
public function get_risk_icon($type) {
|
||||
global $OUTPUT;
|
||||
|
||||
$iconurl = $OUTPUT->pix_url('i/' . str_replace('risk', 'risk_', $type));
|
||||
$text = '<img src="' . $iconurl . '" alt="' . get_string($type . 'short', 'admin') . '" />';
|
||||
$action = new popup_action('click', $this->risksurl, 'docspopup');
|
||||
$riskicon = $OUTPUT->action_link($this->risksurl, $text, $action, array('title'=>get_string($type, 'admin')));
|
||||
|
||||
return $riskicon;
|
||||
if (!isset($this->riskicons[$type])) {
|
||||
$iconurl = $OUTPUT->pix_url('i/' . str_replace('risk', 'risk_', $type));
|
||||
$text = '<img src="' . $iconurl . '" alt="' . get_string($type . 'short', 'admin') . '" />';
|
||||
$action = new popup_action('click', $this->risksurl, 'docspopup');
|
||||
$this->riskicons[$type] = $OUTPUT->action_link($this->risksurl, $text, $action, array('title'=>get_string($type, 'admin')));
|
||||
}
|
||||
return $this->riskicons[$type];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +413,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
}
|
||||
|
||||
public function save_changes() {
|
||||
global $DB, $CFG;
|
||||
global $DB;
|
||||
|
||||
if (!$this->roleid) {
|
||||
// Creating role.
|
||||
@@ -427,7 +427,6 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
// the UI. It would be better to do this only when we know that fields affected are
|
||||
// updated. But thats getting into the weeds of the coursecat cache and role edits
|
||||
// should not be that frequent, so here is the ugly brutal approach.
|
||||
require_once($CFG->libdir . '/coursecatlib.php');
|
||||
coursecat::role_assignment_changed($this->role->id, context_system::instance());
|
||||
}
|
||||
|
||||
|
||||
@@ -71,9 +71,8 @@ class core_role_preset {
|
||||
$dom->appendChild($top);
|
||||
|
||||
$top->appendChild($dom->createElement('shortname', $role->shortname));
|
||||
$top->appendChild($dom->createElement('name', htmlspecialchars($role->name, ENT_COMPAT | ENT_HTML401, 'UTF-8')));
|
||||
$top->appendChild($dom->createElement('description', htmlspecialchars($role->description, ENT_COMPAT | ENT_HTML401,
|
||||
'UTF-8')));
|
||||
$top->appendChild($dom->createElement('name', $role->name));
|
||||
$top->appendChild($dom->createElement('description', $role->description));
|
||||
$top->appendChild($dom->createElement('archetype', $role->archetype));
|
||||
|
||||
$contextlevels = $dom->createElement('contextlevels');
|
||||
|
||||
@@ -201,7 +201,7 @@ if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey() && $de
|
||||
$event = \core\event\role_capabilities_updated::create(
|
||||
array(
|
||||
'context' => $systemcontext,
|
||||
'objectid' => $tableroleid
|
||||
'objectid' => $roleid
|
||||
)
|
||||
);
|
||||
$event->set_legacy_logdata(array(SITEID, 'role', $action, 'admin/roles/define.php?action=view&roleid=' . $tableroleid,
|
||||
|
||||
@@ -20,15 +20,13 @@ $focus = '';
|
||||
// now we'll deal with the case that the admin has submitted the form with changed settings
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
|
||||
if (!empty($adminroot->errors)) {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
$focus = $firsterror->id;
|
||||
} else {
|
||||
redirect($PAGE->url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,7 @@ $adminroot = admin_get_root(); // need all settings
|
||||
$settingspage = $adminroot->locate($section, true);
|
||||
|
||||
if (empty($settingspage) or !($settingspage instanceof admin_settingpage)) {
|
||||
if (moodle_needs_upgrading()) {
|
||||
redirect(new moodle_url('/admin/index.php'));
|
||||
} else {
|
||||
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
|
||||
}
|
||||
print_error('sectionerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
|
||||
die;
|
||||
}
|
||||
|
||||
@@ -40,7 +36,7 @@ $errormsg = '';
|
||||
|
||||
if ($data = data_submitted() and confirm_sesskey()) {
|
||||
if (admin_write_settings($data)) {
|
||||
redirect($PAGE->url, get_string('changessaved'), null, \core\output\notification::NOTIFY_SUCCESS);
|
||||
$statusmsg = get_string('changessaved');
|
||||
}
|
||||
|
||||
if (empty($adminroot->errors)) {
|
||||
@@ -48,7 +44,6 @@ if ($data = data_submitted() and confirm_sesskey()) {
|
||||
case 'site': redirect("$CFG->wwwroot/");
|
||||
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
|
||||
}
|
||||
redirect($PAGE->url);
|
||||
} else {
|
||||
$errormsg = get_string('errorwithsettings', 'admin');
|
||||
$firsterror = reset($adminroot->errors);
|
||||
@@ -77,7 +72,7 @@ if (empty($SITE->fullname)) {
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="' . $PAGE->url . '" method="post" id="adminsettings">';
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
echo html_writer::input_hidden_params($PAGE->url);
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
@@ -121,7 +116,7 @@ if (empty($SITE->fullname)) {
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
echo '<form action="' . $PAGE->url . '" method="post" id="adminsettings">';
|
||||
echo '<form action="settings.php" method="post" id="adminsettings">';
|
||||
echo '<div class="settingsform clearfix">';
|
||||
echo html_writer::input_hidden_params($PAGE->url);
|
||||
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
|
||||
|
||||
@@ -258,11 +258,8 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
$temp->add(new admin_setting_configcheckbox('blockeditingmenu', new lang_string('blockeditingmenu', 'admin'), new lang_string('blockeditingmenu_desc', 'admin'), 1));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// Link to tag management interface.
|
||||
$url = new moodle_url('/tag/manage.php');
|
||||
$hidden = empty($CFG->usetags);
|
||||
$page = new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $url, 'moodle/tag:manage', $hidden);
|
||||
$ADMIN->add('appearance', $page);
|
||||
// link to tag management interface
|
||||
$ADMIN->add('appearance', new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $CFG->wwwroot.'/tag/manage.php', 'moodle/tag:manage'));
|
||||
|
||||
$temp = new admin_settingpage('additionalhtml', new lang_string('additionalhtml', 'admin'));
|
||||
$temp->add(new admin_setting_heading('additionalhtml_heading', new lang_string('additionalhtml_heading', 'admin'), new lang_string('additionalhtml_desc', 'admin')));
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* File.
|
||||
*
|
||||
* @package core_competency
|
||||
* @copyright 2016 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
// Save processing when the user will not be able to access anything.
|
||||
if (has_capability('moodle/site:config', $systemcontext)) {
|
||||
|
||||
$parentname = 'competencies';
|
||||
|
||||
// Settings page.
|
||||
$settings = new admin_settingpage('competencysettings', new lang_string('competenciessettings', 'core_competency'),
|
||||
'moodle/site:config', false);
|
||||
$ADMIN->add($parentname, $settings);
|
||||
|
||||
// Load the full tree of settings.
|
||||
if ($ADMIN->fulltree) {
|
||||
$setting = new admin_setting_configcheckbox('core_competency/enabled',
|
||||
new lang_string('enablecompetencies', 'core_competency'),
|
||||
new lang_string('enablecompetencies_desc', 'core_competency'), 1);
|
||||
$settings->add($setting);
|
||||
|
||||
$setting = new admin_setting_configcheckbox('core_competency/pushcourseratingstouserplans',
|
||||
new lang_string('pushcourseratingstouserplans', 'core_competency'),
|
||||
new lang_string('pushcourseratingstouserplans_desc', 'core_competency'), 1);
|
||||
$settings->add($setting);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -205,9 +205,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
// Create a page for general import configuration and defaults.
|
||||
$temp = new admin_settingpage('importgeneralsettings', new lang_string('importgeneralsettings', 'backup'), 'moodle/backup:backupcourse');
|
||||
$temp->add(new admin_setting_configtext('backup/import_general_maxresults', new lang_string('importgeneralmaxresults', 'backup'), new lang_string('importgeneralmaxresults_desc', 'backup'), 10));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/import_general_duplicate_admin_allowed',
|
||||
new lang_string('importgeneralduplicateadminallowed', 'backup'),
|
||||
new lang_string('importgeneralduplicateadminallowed_desc', 'backup'), 0));
|
||||
$ADMIN->add('backups', $temp);
|
||||
|
||||
// Create a page for automated backups configuration and defaults.
|
||||
|
||||
@@ -32,7 +32,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$ADMIN->add('development', $temp);
|
||||
|
||||
// "Profiling" settingpage (conditionally if the 'xhprof' extension is available only).
|
||||
$xhprofenabled = extension_loaded('xhprof') || extension_loaded('tideways');
|
||||
$xhprofenabled = extension_loaded('xhprof') && function_exists('xhprof_enable');
|
||||
$temp = new admin_settingpage('profiling', new lang_string('profiling', 'admin'), 'moodle/site:config', !$xhprofenabled);
|
||||
// Main profiling switch.
|
||||
$temp->add(new admin_setting_configcheckbox('profilingenabled', new lang_string('profilingenabled', 'admin'), new lang_string('profilingenabled_help', 'admin'), false));
|
||||
|
||||
@@ -138,16 +138,6 @@ if ($hassiteconfig) {
|
||||
$plugin->load_settings($ADMIN, 'editorsettings', $hassiteconfig);
|
||||
}
|
||||
|
||||
// Antivirus plugins.
|
||||
$ADMIN->add('modules', new admin_category('antivirussettings', new lang_string('antiviruses', 'antivirus')));
|
||||
$temp = new admin_settingpage('manageantiviruses', new lang_string('antivirussettings', 'antivirus'));
|
||||
$temp->add(new admin_setting_manageantiviruses());
|
||||
$ADMIN->add('antivirussettings', $temp);
|
||||
foreach (core_plugin_manager::instance()->get_plugins_of_type('antivirus') as $plugin) {
|
||||
/* @var \core\plugininfo\antivirus $plugin */
|
||||
$plugin->load_settings($ADMIN, 'antivirussettings', $hassiteconfig);
|
||||
}
|
||||
|
||||
/// License types
|
||||
$ADMIN->add('modules', new admin_category('licensesettings', new lang_string('licenses')));
|
||||
$temp = new admin_settingpage('managelicenses', new lang_string('managelicenses', 'admin'));
|
||||
@@ -187,11 +177,6 @@ if ($hassiteconfig) {
|
||||
$plugin->load_settings($ADMIN, 'filtersettings', $hassiteconfig);
|
||||
}
|
||||
|
||||
// Data format settings.
|
||||
$ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats')));
|
||||
$temp = new admin_settingpage('managedataformats', new lang_string('managedataformats'));
|
||||
$temp->add(new admin_setting_managedataformats());
|
||||
$ADMIN->add('dataformatsettings', $temp);
|
||||
|
||||
//== Portfolio settings ==
|
||||
require_once($CFG->libdir. '/portfoliolib.php');
|
||||
@@ -472,49 +457,6 @@ foreach ($pages as $page) {
|
||||
$ADMIN->add('reportplugins', $page);
|
||||
}
|
||||
|
||||
if ($hassiteconfig) {
|
||||
// Global Search engine plugins.
|
||||
$ADMIN->add('modules', new admin_category('searchplugins', new lang_string('search', 'admin')));
|
||||
$temp = new admin_settingpage('manageglobalsearch', new lang_string('globalsearchmanage', 'admin'));
|
||||
|
||||
$pages = array();
|
||||
$engines = array();
|
||||
foreach (core_component::get_plugin_list('search') as $engine => $plugindir) {
|
||||
$engines[$engine] = new lang_string('pluginname', 'search_' . $engine);
|
||||
$settingspath = "$plugindir/settings.php";
|
||||
if (file_exists($settingspath)) {
|
||||
$settings = new admin_settingpage('search' . $engine,
|
||||
new lang_string('pluginname', 'search_' . $engine), 'moodle/site:config');
|
||||
include($settingspath);
|
||||
if ($settings) {
|
||||
$pages[] = $settings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Setup status.
|
||||
$temp->add(new admin_setting_searchsetupinfo());
|
||||
|
||||
// Search engine selection.
|
||||
$temp->add(new admin_setting_heading('searchengineheading', new lang_string('searchengine', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('searchengine',
|
||||
new lang_string('selectsearchengine', 'admin'), '', 'solr', $engines));
|
||||
|
||||
// Enable search areas.
|
||||
$temp->add(new admin_setting_heading('searchareasheading', new lang_string('availablesearchareas', 'admin'), ''));
|
||||
$searchareas = \core_search\manager::get_search_areas_list();
|
||||
foreach ($searchareas as $areaid => $searcharea) {
|
||||
list($componentname, $varname) = $searcharea->get_config_var_name();
|
||||
$temp->add(new admin_setting_configcheckbox($componentname . '/' . $varname . '_enabled', $searcharea->get_visible_name(true),
|
||||
'', 1, 1, 0));
|
||||
}
|
||||
$ADMIN->add('searchplugins', $temp);
|
||||
|
||||
foreach ($pages as $page) {
|
||||
$ADMIN->add('searchplugins', $page);
|
||||
}
|
||||
}
|
||||
|
||||
/// Add all admin tools
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
|
||||
@@ -547,9 +489,10 @@ if ($hassiteconfig) {
|
||||
// Add Calendar type settings.
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar')));
|
||||
foreach (core_plugin_manager::instance()->get_plugins_of_type('calendartype') as $plugin) {
|
||||
/** @var \core\plugininfo\calendartype $plugin */
|
||||
$plugin->load_settings($ADMIN, 'calendartype', $hassiteconfig);
|
||||
foreach (core_component::get_plugin_list_with_file('calendartype', 'settings.php') as $plugin => $settingspath) {
|
||||
$settings = new admin_settingpage('calendartype_' . $plugin . '_settings', new lang_string('pluginname', 'calendartype_' . $plugin), 'moodle/site:config');
|
||||
include($settingspath);
|
||||
$ADMIN->add('calendartype', $settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
// "httpsecurity" settingpage
|
||||
$temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('loginhttps', new lang_string('loginhttps', 'admin'), new lang_string('configloginhttps', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', new lang_string('cookiehttponly', 'admin'), new lang_string('configcookiehttponly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', new lang_string('loginpasswordautocomplete', 'admin'), new lang_string('loginpasswordautocomplete_help', 'admin'), 0));
|
||||
@@ -127,4 +127,19 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
}
|
||||
$temp->add(new admin_setting_configselect('notifyloginthreshold', new lang_string('notifyloginthreshold', 'admin'), new lang_string('confignotifyloginthreshold', 'admin'), '10', $options));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// "antivirus" settingpage
|
||||
$temp = new admin_settingpage('antivirus', new lang_string('antivirus', 'admin'));
|
||||
$temp->add(new admin_setting_configcheckbox('runclamonupload', new lang_string('runclamavonupload', 'admin'), new lang_string('configrunclamavonupload', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configexecutable('pathtoclam', new lang_string('pathtoclam', 'admin'), new lang_string('configpathtoclam', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configdirectory('quarantinedir', new lang_string('quarantinedir', 'admin'), new lang_string('configquarantinedir', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configselect('clamfailureonupload', new lang_string('clamfailureonupload', 'admin'), new lang_string('configclamfailureonupload', 'admin'), 'donothing', array('donothing' => new lang_string('configclamdonothing', 'admin'),
|
||||
'actlikevirus' => new lang_string('configclamactlikevirus', 'admin'))));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
} // end of speedup
|
||||
|
||||
@@ -12,28 +12,25 @@ $temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('patht
|
||||
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'), new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
|
||||
$temp->add(new admin_setting_configexecutable('pathtounoconv', new lang_string('pathtounoconv', 'admin'), new lang_string('pathtounoconv_help', 'admin'), '/usr/bin/unoconv'));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
|
||||
// "supportcontact" settingpage
|
||||
$temp = new admin_settingpage('supportcontact', new lang_string('supportcontact','admin'));
|
||||
$primaryadmin = get_admin();
|
||||
if ($primaryadmin) {
|
||||
$primaryadminemail = $primaryadmin->email;
|
||||
$primaryadminname = fullname($primaryadmin, true);
|
||||
if (isloggedin()) {
|
||||
global $USER;
|
||||
$primaryadminemail = $USER->email;
|
||||
$primaryadminname = fullname($USER, true);
|
||||
|
||||
} else {
|
||||
// no defaults during installation - admin user must be created first
|
||||
$primaryadminemail = NULL;
|
||||
$primaryadminname = NULL;
|
||||
}
|
||||
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
|
||||
new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
|
||||
new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL));
|
||||
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'),
|
||||
new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
|
||||
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'), new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'), new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'), new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -82,6 +79,7 @@ $temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('st
|
||||
60*60*7 => '7 '.new lang_string('hours'),
|
||||
60*60*8 => '8 '.new lang_string('hours') )));
|
||||
$temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'), new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
|
||||
$temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', new lang_string('statsruntimestart', 'admin'), new lang_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
|
||||
$temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'), new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
// Conditional activities: completion and availability
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enablecompletion',
|
||||
new lang_string('enablecompletion','completion'),
|
||||
new lang_string('configenablecompletion', 'completion'), 1));
|
||||
new lang_string('configenablecompletion','completion'), 0));
|
||||
|
||||
$options = array(
|
||||
1 => get_string('completionactivitydefault', 'completion'),
|
||||
@@ -45,13 +45,10 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$optionalsubsystems->add($checkbox = new admin_setting_configcheckbox('enableavailability',
|
||||
new lang_string('enableavailability', 'availability'),
|
||||
new lang_string('enableavailability_desc', 'availability'), 1));
|
||||
new lang_string('enableavailability_desc', 'availability'), 0));
|
||||
$checkbox->set_affects_modinfo(true);
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enableplagiarism', new lang_string('enableplagiarism','plagiarism'), new lang_string('configenableplagiarism','plagiarism'), 0));
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enablebadges', new lang_string('enablebadges', 'badges'), new lang_string('configenablebadges', 'badges'), 1));
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enableglobalsearch', new lang_string('enableglobalsearch', 'admin'),
|
||||
new lang_string('enableglobalsearch_desc', 'admin'), 0, 1, 0));
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('root', new admin_category('users', new lang_string('users','admin')));
|
||||
$ADMIN->add('root', new admin_category('courses', new lang_string('courses','admin')));
|
||||
$ADMIN->add('root', new admin_category('grades', new lang_string('grades')));
|
||||
$ADMIN->add('root', new admin_category('competencies', new lang_string('competencies', 'core_competency')));
|
||||
$ADMIN->add('root', new admin_category('badges', new lang_string('badges'), empty($CFG->enablebadges)));
|
||||
$ADMIN->add('root', new admin_category('location', new lang_string('location','admin')));
|
||||
$ADMIN->add('root', new admin_category('language', new lang_string('language')));
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
|
||||
require_once(__DIR__ . '/../../../lib/behat/behat_field_manager.php');
|
||||
|
||||
use Behat\Gherkin\Node\TableNode as TableNode,
|
||||
use Behat\Behat\Context\Step\Given as Given,
|
||||
Behat\Gherkin\Node\TableNode as TableNode,
|
||||
Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException;
|
||||
|
||||
/**
|
||||
@@ -74,7 +75,7 @@ class behat_admin extends behat_base {
|
||||
$exception = new ElementNotFoundException($this->getSession(), '"' . $label . '" administration setting ');
|
||||
|
||||
// The argument should be converted to an xpath literal.
|
||||
$label = behat_context_helper::escape($label);
|
||||
$label = $this->getSession()->getSelectorsHandler()->xpathLiteral($label);
|
||||
|
||||
// Single element settings.
|
||||
try {
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
@core @core_admin
|
||||
Feature: Enable multiple accounts to have the same email address
|
||||
In order to have multiple accounts registerd on the system with the same email address
|
||||
As an admin
|
||||
I need to enable multiple accounts to be registered with the same email address and verify it is applied
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
|
||||
Scenario: Enable registration of multiple accounts with the same email address
|
||||
Given the following config values are set as admin:
|
||||
| allowaccountssameemail | 1 |
|
||||
When I navigate to "Add a new user" node in "Site administration>Users>Accounts"
|
||||
And I set the following fields to these values:
|
||||
| Username | testmultiemailuser1 |
|
||||
| Choose an authentication method | Manual accounts |
|
||||
| New password | test@User1 |
|
||||
| First name | Test |
|
||||
| Surname | Multi1 |
|
||||
| Email address | testmultiemailuser@example.com |
|
||||
And I press "Create user"
|
||||
And I should see "Test Multi1"
|
||||
And I press "Add a new user"
|
||||
And I set the following fields to these values:
|
||||
| Username | testmultiemailuser2 |
|
||||
| Choose an authentication method | Manual accounts |
|
||||
| New password | test@User2 |
|
||||
| First name | Test |
|
||||
| Surname | Multi2 |
|
||||
| Email address | testmultiemailuser@example.com |
|
||||
And I press "Create user"
|
||||
Then I should see "Test Multi2"
|
||||
And I should not see "This email address is already registered"
|
||||
|
||||
Scenario: Disable registration of multiple accounts with the same email address
|
||||
Given the following config values are set as admin:
|
||||
| allowaccountssameemail | 0 |
|
||||
When I navigate to "Add a new user" node in "Site administration>Users>Accounts"
|
||||
And I set the following fields to these values:
|
||||
| Username | testmultiemailuser1 |
|
||||
| Choose an authentication method | Manual accounts |
|
||||
| New password | test@User1 |
|
||||
| First name | Test |
|
||||
| Surname | Multi1 |
|
||||
| Email address | testmultiemailuser@example.com |
|
||||
And I press "Create user"
|
||||
And I should see "Test Multi1"
|
||||
And I press "Add a new user"
|
||||
And I set the following fields to these values:
|
||||
| Username | testmultiemailuser2 |
|
||||
| Choose an authentication method | Manual accounts |
|
||||
| New password | test@User2 |
|
||||
| First name | Test |
|
||||
| Surname | Multi2 |
|
||||
| Email address | testmultiemailuser@example.com |
|
||||
And I press "Create user"
|
||||
Then I should see "This email address is already registered"
|
||||
@@ -27,6 +27,7 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
And I add "User Three (three@example.com)" user to "CH1" cohort members
|
||||
And I follow "Browse list of users"
|
||||
|
||||
@javascript
|
||||
Scenario: Filter user accounts by role and cohort
|
||||
When I set the following fields to these values:
|
||||
| courserole_rl | Student |
|
||||
@@ -50,6 +51,7 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
And I should see "User Three"
|
||||
And I should see "User Four"
|
||||
|
||||
@javascript
|
||||
Scenario: Filter user accounts by confirm and authentication method
|
||||
When I set the following fields to these values:
|
||||
| Confirmed | No |
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->requires = 2016051900;
|
||||
$plugin->version = 2015111600;
|
||||
$plugin->requires = 2015111000;
|
||||
$plugin->component = 'tool_assignmentupgrade';
|
||||
$plugin->dependencies = array('mod_assign' => 2016051900);
|
||||
$plugin->dependencies = array('mod_assign' => 2015111000);
|
||||
|
||||
@@ -8,8 +8,6 @@ Feature: Manage availability conditions
|
||||
Scenario: Display list of availability conditions
|
||||
# Check the report doesn't show when not enabled.
|
||||
Given I log in as "admin"
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 0 |
|
||||
And I expand "Site administration" node
|
||||
When I expand "Plugins" node
|
||||
Then I should not see "Availability restrictions"
|
||||
@@ -30,6 +28,8 @@ Feature: Manage availability conditions
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following config values are set as admin:
|
||||
| enableavailability | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->requires = 2016051900;
|
||||
$plugin->version = 2015111600;
|
||||
$plugin->requires = 2015111000;
|
||||
$plugin->component = 'tool_availabilityconditions';
|
||||
|
||||
@@ -26,6 +26,7 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
die(); // No access from web!
|
||||
}
|
||||
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
define('CACHE_DISABLE_ALL', true);
|
||||
@@ -100,9 +101,6 @@ if (empty($options['torun'])) {
|
||||
if (extension_loaded('pcntl')) {
|
||||
$disabled = explode(',', ini_get('disable_functions'));
|
||||
if (!in_array('pcntl_signal', $disabled)) {
|
||||
// Handle interrupts on PHP7.
|
||||
declare(ticks = 1);
|
||||
|
||||
pcntl_signal(SIGTERM, "signal_handler");
|
||||
pcntl_signal(SIGINT, "signal_handler");
|
||||
}
|
||||
@@ -122,14 +120,10 @@ $tags = '';
|
||||
|
||||
if ($options['profile']) {
|
||||
$profile = $options['profile'];
|
||||
|
||||
// If profile passed is not set, then exit.
|
||||
if (!isset($CFG->behat_config[$profile]) && !isset($CFG->behat_profiles[$profile]) &&
|
||||
!(isset($options['replace']) && (strpos($options['profile'], $options['replace']) >= 0 ))) {
|
||||
echo "Invalid profile passed: " . $profile . PHP_EOL;
|
||||
if (!isset($CFG->behat_config[$profile])) {
|
||||
echo "Invalid profile passed: " . $profile;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$extraopts[] = '--profile="' . $profile . '"';
|
||||
// By default, profile tags will be used.
|
||||
if (!empty($CFG->behat_config[$profile]['filters']['tags'])) {
|
||||
@@ -232,27 +226,22 @@ $exitcodes = print_combined_run_output($processes, $stoponfail);
|
||||
$time = round(microtime(true) - $time, 1);
|
||||
echo "Finished in " . gmdate("G\h i\m s\s", $time) . PHP_EOL . PHP_EOL;
|
||||
|
||||
ksort($exitcodes);
|
||||
|
||||
// Print exit info from each run.
|
||||
// Status bits contains pass/fail status of parallel runs.
|
||||
$status = 0;
|
||||
$processcounter = 0;
|
||||
$status = false;
|
||||
foreach ($exitcodes as $exitcode) {
|
||||
if ($exitcode) {
|
||||
$status |= (1 << $processcounter);
|
||||
}
|
||||
$processcounter++;
|
||||
$status = (bool)$status || (bool)$exitcode;
|
||||
}
|
||||
|
||||
// Run finished. Show exit code and output from individual process.
|
||||
$verbose = empty($options['verbose']) ? false : true;
|
||||
$verbose = $verbose || !empty($status);
|
||||
$verbose = $verbose || $status;
|
||||
|
||||
// Show exit code from each process, if any process failed.
|
||||
if ($verbose) {
|
||||
// Echo exit codes.
|
||||
echo "Exit codes for each behat run: " . PHP_EOL;
|
||||
ksort($exitcodes);
|
||||
foreach ($exitcodes as $run => $exitcode) {
|
||||
echo $run . ": " . $exitcode . PHP_EOL;
|
||||
}
|
||||
@@ -274,7 +263,7 @@ print_each_process_info($processes, $verbose);
|
||||
// Remove site symlink if necessary.
|
||||
behat_config_manager::drop_parallel_site_links();
|
||||
|
||||
exit($status);
|
||||
exit((int) $status);
|
||||
|
||||
/**
|
||||
* Signal handler for terminal exit.
|
||||
|
||||
@@ -173,11 +173,6 @@ if ($options['install']) {
|
||||
|
||||
// This is only displayed once for parallel install.
|
||||
if (empty($options['run'])) {
|
||||
// Notify user that 2.5 profile has been converted to 3.5.
|
||||
if (behat_config_manager::$autoprofileconversion) {
|
||||
mtrace("2.5 behat profile detected, automatically converted to current 3.x format");
|
||||
}
|
||||
|
||||
$runtestscommand = behat_command::get_behat_command(true, !empty($options['run']));
|
||||
|
||||
$runtestscommand .= ' --config ' . behat_config_manager::get_behat_cli_config_filepath();
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Display environment used for running behat.
|
||||
*
|
||||
* This file is used for behat testing to ensure cli and apache
|
||||
* version of environment is same.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2016 onwards Rajesh Taneja
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(__DIR__.'/../../../../../../config.php');
|
||||
|
||||
// Only continue for behat site.
|
||||
defined('BEHAT_SITE_RUNNING') || die();
|
||||
|
||||
require_once($CFG->libdir.'/behat/classes/util.php');
|
||||
echo json_encode(behat_util::get_environment(), true);
|
||||
@@ -7,10 +7,12 @@ Feature: Forms manipulation
|
||||
@javascript
|
||||
Scenario: Basic forms manipulation
|
||||
Given I log in as "admin"
|
||||
And I open my profile in edit mode
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
When I set the field "First name" to "Field value"
|
||||
And I set the field "Select a country" to "Japan"
|
||||
And I set the field "Unmask" to "1"
|
||||
And I expand all fieldsets
|
||||
Then the field "First name" matches value "Field value"
|
||||
And the "Select a country" select box should contain "Japan"
|
||||
And the field "Unmask" matches value "1"
|
||||
|
||||
@@ -10,7 +10,8 @@ Feature: Transform steps arguments
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I open my profile in edit mode
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
|
||||
Scenario: Use nasty strings on steps arguments
|
||||
When I set the field "Surname" to "$NASTYSTRING1"
|
||||
|
||||
@@ -142,10 +142,11 @@ class tool_behat_manager_testcase extends advanced_testcase {
|
||||
// YAML decides when is is necessary to wrap strings between single quotes, so not controlled
|
||||
// values like paths should not be asserted including the key name as they would depend on the
|
||||
// directories values.
|
||||
$this->assertContains($CFG->dirroot, $contents);
|
||||
$this->assertContains($CFG->dirroot . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . 'features', $contents);
|
||||
|
||||
// Not quoted strings.
|
||||
$this->assertContains('micarro: /me/lo/robaron', $contents);
|
||||
$this->assertContains('class: behat_init_context', $contents);
|
||||
|
||||
// YAML uses single quotes to wrap URL strings.
|
||||
$this->assertContains("base_url: '" . $CFG->behat_wwwroot . "'", $contents);
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version
|
||||
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
.path-admin-tool-capability .comparisontable tbody th span {display:block;color:#666;font-size:80%;}
|
||||
.path-admin-tool-capability .comparisontable tbody td {border:1px solid #DFDFDF;}
|
||||
|
||||
.path-admin-tool-capability .comparisontable .inherit {color:#666}
|
||||
.path-admin-tool-capability .comparisontable .allow {background-color:#006600;font-weight:bold;color:white;}
|
||||
.path-admin-tool-capability .comparisontable .prevent {background-color:#ad6704;font-weight:bold;color:white;}
|
||||
.path-admin-tool-capability .comparisontable .prohibit {background-color:#880000;font-weight:bold;color:white;}
|
||||
.path-admin-tool-capability .comparisontable .inherit {color:#666;}
|
||||
.path-admin-tool-capability .comparisontable .allow {color:#006600;font-weight:bold;}
|
||||
.path-admin-tool-capability .comparisontable .prevent {color:#ad6704;font-weight:bold;}
|
||||
.path-admin-tool-capability .comparisontable .prohibit {color:#880000;font-weight:bold;}
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Class exposing the api for the cohortroles tool.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_cohortroles;
|
||||
|
||||
use stdClass;
|
||||
use context_system;
|
||||
use core_competency\invalid_persistent_exception;
|
||||
|
||||
/**
|
||||
* Class for doing things with cohort roles.
|
||||
*
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class api {
|
||||
|
||||
/**
|
||||
* Create a cohort role assignment from a record containing all the data for the class.
|
||||
*
|
||||
* Requires moodle/role:manage capability at the system context.
|
||||
*
|
||||
* @param stdClass $record Record containing all the data for an instance of the class.
|
||||
* @return competency
|
||||
*/
|
||||
public static function create_cohort_role_assignment(stdClass $record) {
|
||||
$cohortroleassignment = new cohort_role_assignment(0, $record);
|
||||
$context = context_system::instance();
|
||||
|
||||
// First we do a permissions check.
|
||||
require_capability('moodle/role:manage', $context);
|
||||
|
||||
// Validate before we check for existing records.
|
||||
if (!$cohortroleassignment->is_valid()) {
|
||||
throw new invalid_persistent_exception($cohortroleassignment->get_errors());
|
||||
}
|
||||
|
||||
$existing = cohort_role_assignment::get_record((array) $record);
|
||||
if (!empty($existing)) {
|
||||
return false;
|
||||
} else {
|
||||
// OK - all set.
|
||||
$cohortroleassignment->create();
|
||||
}
|
||||
return $cohortroleassignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cohort role assignment by id.
|
||||
*
|
||||
* Requires moodle/role:manage capability at the system context.
|
||||
*
|
||||
* @param int $id The record to delete. This will also remove this role from the user for all users in the system.
|
||||
* @return boolean
|
||||
*/
|
||||
public static function delete_cohort_role_assignment($id) {
|
||||
$cohortroleassignment = new cohort_role_assignment($id);
|
||||
$context = context_system::instance();
|
||||
|
||||
// First we do a permissions check.
|
||||
require_capability('moodle/role:manage', $context);
|
||||
|
||||
// OK - all set.
|
||||
return $cohortroleassignment->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a search based on the provided filters and return a paginated list of records.
|
||||
*
|
||||
* Requires moodle/role:manage capability at the system context.
|
||||
*
|
||||
* @param string $sort The column to sort on
|
||||
* @param string $order ('ASC' or 'DESC')
|
||||
* @param int $skip Number of records to skip (pagination)
|
||||
* @param int $limit Max of records to return (pagination)
|
||||
* @return array of cohort_role_assignment
|
||||
*/
|
||||
public static function list_cohort_role_assignments($sort = '', $order = 'ASC', $skip = 0, $limit = 0) {
|
||||
$context = context_system::instance();
|
||||
|
||||
// First we do a permissions check.
|
||||
require_capability('moodle/role:manage', $context);
|
||||
|
||||
// OK - all set.
|
||||
return cohort_role_assignment::get_records(array(), $sort, $order, $skip, $limit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a search based on the provided filters and return a paginated list of records.
|
||||
*
|
||||
* Requires moodle/role:manage capability at system context.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public static function count_cohort_role_assignments() {
|
||||
$context = context_system::instance();
|
||||
|
||||
// First we do a permissions check.
|
||||
require_capability('moodle/role:manage', $context);
|
||||
|
||||
// OK - all set.
|
||||
return cohort_role_assignment::count_records();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync all roles - adding and deleting role assignments as required.
|
||||
*
|
||||
* Slow. Should only be called from a background task.
|
||||
*
|
||||
* Requires moodle/role:manage capability at the system context.
|
||||
*
|
||||
* @return array('rolesadded' => array of (useridassignedto, useridassignedover, roleid),
|
||||
* 'rolesremoved' => array of (useridassignedto, useridassignedover, roleid))
|
||||
*/
|
||||
public static function sync_all_cohort_roles() {
|
||||
global $DB;
|
||||
|
||||
$context = context_system::instance();
|
||||
|
||||
// First we do a permissions check.
|
||||
require_capability('moodle/role:manage', $context);
|
||||
|
||||
// Ok ready to go.
|
||||
$rolesadded = array();
|
||||
$rolesremoved = array();
|
||||
|
||||
// Get all cohort role assignments and group them by user and role.
|
||||
$all = cohort_role_assignment::get_records(array(), 'userid, roleid');
|
||||
// We build an better structure to loop on.
|
||||
$info = array();
|
||||
foreach ($all as $cra) {
|
||||
if (!isset($info[$cra->get_userid()])) {
|
||||
$info[$cra->get_userid()] = array();
|
||||
}
|
||||
if (!isset($info[$cra->get_userid()][$cra->get_roleid()])) {
|
||||
$info[$cra->get_userid()][$cra->get_roleid()] = array();
|
||||
}
|
||||
array_push($info[$cra->get_userid()][$cra->get_roleid()], $cra->get_cohortid());
|
||||
}
|
||||
// Then for each user+role combo - find user context in the cohort without a role assigned.
|
||||
|
||||
foreach ($info as $userid => $roles) {
|
||||
foreach ($roles as $roleid => $cohorts) {
|
||||
list($cohortsql, $params) = $DB->get_in_or_equal($cohorts, SQL_PARAMS_NAMED);
|
||||
|
||||
$params['usercontext'] = CONTEXT_USER;
|
||||
$params['roleid'] = $roleid;
|
||||
$params['userid'] = $userid;
|
||||
|
||||
$sql = 'SELECT u.id AS userid, ra.id, ctx.id AS contextid
|
||||
FROM {user} u
|
||||
JOIN {cohort_members} cm ON u.id = cm.userid
|
||||
JOIN {context} ctx ON u.id = ctx.instanceid AND ctx.contextlevel = :usercontext
|
||||
LEFT JOIN {role_assignments} ra ON ra.contextid = ctx.id
|
||||
AND ra.roleid = :roleid
|
||||
AND ra.userid = :userid
|
||||
WHERE cm.cohortid ' . $cohortsql . '
|
||||
AND ra.id IS NULL';
|
||||
|
||||
$toadd = $DB->get_records_sql($sql, $params);
|
||||
|
||||
foreach ($toadd as $add) {
|
||||
role_assign($roleid, $userid, $add->contextid, 'tool_cohortroles');
|
||||
$rolesadded[] = array(
|
||||
'useridassignedto' => $userid,
|
||||
'useridassignedover' => $add->userid,
|
||||
'roleid' => $roleid
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// And for each user+role combo - find user context not in the cohort with a role assigned.
|
||||
// If the role was assigned by this component, unassign the role.
|
||||
foreach ($info as $userid => $roles) {
|
||||
foreach ($roles as $roleid => $cohorts) {
|
||||
// Now we are looking for entries NOT in the cohort.
|
||||
list($cohortsql, $params) = $DB->get_in_or_equal($cohorts, SQL_PARAMS_NAMED);
|
||||
|
||||
$params['usercontext'] = CONTEXT_USER;
|
||||
$params['roleid'] = $roleid;
|
||||
$params['userid'] = $userid;
|
||||
$params['component'] = 'tool_cohortroles';
|
||||
|
||||
$sql = 'SELECT u.id as userid, ra.id, ctx.id AS contextid
|
||||
FROM {user} u
|
||||
JOIN {context} ctx ON u.id = ctx.instanceid AND ctx.contextlevel = :usercontext
|
||||
JOIN {role_assignments} ra ON ra.contextid = ctx.id AND ra.roleid = :roleid AND ra.userid = :userid
|
||||
LEFT JOIN {cohort_members} cm ON u.id = cm.userid
|
||||
AND cm.cohortid ' . $cohortsql . '
|
||||
WHERE ra.component = :component AND cm.cohortid IS NULL';
|
||||
|
||||
$toremove = $DB->get_records_sql($sql, $params);
|
||||
foreach ($toremove as $remove) {
|
||||
role_unassign($roleid, $userid, $remove->contextid, 'tool_cohortroles');
|
||||
$rolesremoved[] = array(
|
||||
'useridassignedto' => $userid,
|
||||
'useridassignedover' => $remove->userid,
|
||||
'roleid' => $roleid
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array('rolesadded' => $rolesadded, 'rolesremoved' => $rolesremoved);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Class for cohort_role_assignment persistence.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_cohortroles;
|
||||
|
||||
use lang_string;
|
||||
use core_competency\persistent;
|
||||
|
||||
/**
|
||||
* Class for loading/storing cohort_role_assignments from the DB.
|
||||
*
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class cohort_role_assignment extends persistent {
|
||||
|
||||
/** Table name for user_competency persistency */
|
||||
const TABLE = 'tool_cohortroles';
|
||||
|
||||
/**
|
||||
* Return the definition of the properties of this model.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected static function define_properties() {
|
||||
return array(
|
||||
'userid' => array(
|
||||
'type' => PARAM_INT,
|
||||
),
|
||||
'roleid' => array(
|
||||
'type' => PARAM_INT,
|
||||
),
|
||||
'cohortid' => array(
|
||||
'type' => PARAM_INT,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the user ID.
|
||||
*
|
||||
* @param int $value The value.
|
||||
* @return true|lang_string
|
||||
*/
|
||||
protected function validate_userid($value) {
|
||||
global $DB;
|
||||
|
||||
if (!$DB->record_exists('user', array('id' => $value))) {
|
||||
return new lang_string('invaliduserid', 'error');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the role ID.
|
||||
*
|
||||
* @param int $value The value.
|
||||
* @return true|lang_string
|
||||
*/
|
||||
protected function validate_roleid($value) {
|
||||
global $DB;
|
||||
|
||||
if (!$DB->record_exists('role', array('id' => $value))) {
|
||||
return new lang_string('invalidroleid', 'error');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate the cohort ID.
|
||||
*
|
||||
* @param int $value The value.
|
||||
* @return true|lang_string
|
||||
*/
|
||||
protected function validate_cohortid($value) {
|
||||
global $DB;
|
||||
|
||||
if (!$DB->record_exists('cohort', array('id' => $value))) {
|
||||
return new lang_string('invalidcohortid', 'error');
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Assign role to cohort form.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_cohortroles\form;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use moodleform;
|
||||
use context_system;
|
||||
|
||||
require_once($CFG->libdir . '/formslib.php');
|
||||
|
||||
/**
|
||||
* Assign role to cohort form.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class assign_role_cohort extends moodleform {
|
||||
|
||||
/**
|
||||
* Form definition.
|
||||
*/
|
||||
public function definition() {
|
||||
global $PAGE;
|
||||
|
||||
$mform = $this->_form;
|
||||
$roles = get_roles_for_contextlevels(CONTEXT_USER);
|
||||
|
||||
if (empty($roles)) {
|
||||
$output = $PAGE->get_renderer('tool_cohortroles');
|
||||
$warning = $output->notify_problem(get_string('noassignableroles', 'tool_cohortroles'));
|
||||
$mform->addElement('html', $warning);
|
||||
return;
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'ajax' => 'tool_lp/form-user-selector',
|
||||
'multiple' => true
|
||||
);
|
||||
$mform->addElement('autocomplete', 'userids', get_string('selectusers', 'tool_cohortroles'), array(), $options);
|
||||
$mform->addRule('userids', null, 'required');
|
||||
|
||||
$names = role_get_names();
|
||||
$options = array();
|
||||
foreach ($roles as $idx => $roleid) {
|
||||
$options[$roleid] = $names[$roleid]->localname;
|
||||
}
|
||||
|
||||
$mform->addElement('select', 'roleid', get_string('selectrole', 'tool_cohortroles'), $options);
|
||||
$mform->addRule('roleid', null, 'required');
|
||||
|
||||
$context = context_system::instance();
|
||||
$options = array(
|
||||
'ajax' => 'tool_lp/form-cohort-selector',
|
||||
'multiple' => true,
|
||||
'data-contextid' => $context->id,
|
||||
'data-includes' => 'all'
|
||||
);
|
||||
$mform->addElement('autocomplete', 'cohortids', get_string('selectcohorts', 'tool_cohortroles'), array(), $options);
|
||||
$mform->addRule('cohortids', null, 'required');
|
||||
$mform->addElement('submit', 'submit', get_string('assign', 'tool_cohortroles'));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Cohort role assignments table
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_cohortroles\output;
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/tablelib.php');
|
||||
|
||||
use context_helper;
|
||||
use context_system;
|
||||
use html_writer;
|
||||
use moodle_url;
|
||||
use table_sql;
|
||||
|
||||
/**
|
||||
* Cohort role assignments table.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class cohort_role_assignments_table extends table_sql {
|
||||
|
||||
/**
|
||||
* Sets up the table.
|
||||
*
|
||||
* @param string $uniqueid Unique id of table.
|
||||
* @param moodle_url $url The base URL.
|
||||
*/
|
||||
public function __construct($uniqueid, $url) {
|
||||
global $CFG;
|
||||
parent::__construct($uniqueid);
|
||||
$context = context_system::instance();
|
||||
|
||||
$this->context = $context;
|
||||
|
||||
$this->rolenames = role_get_names();
|
||||
|
||||
// This object should not be used without the right permissions.
|
||||
require_capability('moodle/role:manage', $context);
|
||||
|
||||
$this->useridfield = 'userid';
|
||||
|
||||
// Define columns in the table.
|
||||
$this->define_table_columns();
|
||||
|
||||
$this->define_baseurl($url);
|
||||
// Define configs.
|
||||
$this->define_table_configs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Role name column.
|
||||
*
|
||||
* @param array $data Row data.
|
||||
* @return string
|
||||
*/
|
||||
protected function col_rolename($data) {
|
||||
return $this->rolenames[$data->roleid]->localname;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cohort name column.
|
||||
*
|
||||
* @param array $data Row data.
|
||||
* @return string
|
||||
*/
|
||||
protected function col_cohortname($data) {
|
||||
global $OUTPUT;
|
||||
|
||||
$record = (object) array(
|
||||
'id' => $data->cohortid,
|
||||
'idnumber' => $data->cohortidnumber,
|
||||
'description' => $data->cohortdescription,
|
||||
'visible' => $data->cohortvisible,
|
||||
'name' => $data->cohortname
|
||||
);
|
||||
$context = context_helper::instance_by_id($data->cohortcontextid);
|
||||
|
||||
$exporter = new \tool_lp\external\cohort_summary_exporter($record, array('context' => $context));
|
||||
$cohort = $exporter->export($OUTPUT);
|
||||
|
||||
$html = $OUTPUT->render_from_template('tool_cohortroles/cohort-in-list', $cohort);
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions column.
|
||||
*
|
||||
* @param array $data Row data.
|
||||
* @return string
|
||||
*/
|
||||
protected function col_actions($data) {
|
||||
global $OUTPUT;
|
||||
|
||||
$action = new \confirm_action(get_string('removecohortroleassignmentconfirm', 'tool_cohortroles'));
|
||||
$url = new moodle_url($this->baseurl);
|
||||
$url->params(array('removecohortroleassignment' => $data->id, 'sesskey' => sesskey()));
|
||||
$pix = new \pix_icon('t/delete', get_string('removecohortroleassignment', 'tool_cohortroles'));
|
||||
return $OUTPUT->action_link($url, '', $action, null, $pix);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the headers for the table.
|
||||
*/
|
||||
protected function define_table_columns() {
|
||||
$extrafields = get_extra_user_fields($this->context);
|
||||
|
||||
// Define headers and columns.
|
||||
$cols = array(
|
||||
'cohortname' => get_string('cohort', 'cohort'),
|
||||
'rolename' => get_string('role'),
|
||||
'fullname' => get_string('name'),
|
||||
);
|
||||
|
||||
// Add headers for extra user fields.
|
||||
foreach ($extrafields as $field) {
|
||||
if (get_string_manager()->string_exists($field, 'moodle')) {
|
||||
$cols[$field] = get_string($field);
|
||||
} else {
|
||||
$cols[$field] = $field;
|
||||
}
|
||||
}
|
||||
|
||||
// Add remaining headers.
|
||||
$cols = array_merge($cols, array('actions' => get_string('actions')));
|
||||
|
||||
$this->define_columns(array_keys($cols));
|
||||
$this->define_headers(array_values($cols));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define table configs.
|
||||
*/
|
||||
protected function define_table_configs() {
|
||||
$this->collapsible(false);
|
||||
$this->sortable(true, 'lastname', SORT_ASC);
|
||||
$this->pageable(true);
|
||||
$this->no_sorting('actions');
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the SQL query.
|
||||
*
|
||||
* @param bool $count When true, return the count SQL.
|
||||
* @return array containing sql to use and an array of params.
|
||||
*/
|
||||
protected function get_sql_and_params($count = false) {
|
||||
$fields = 'uca.id, uca.cohortid, uca.userid, uca.roleid, ';
|
||||
$fields .= 'c.name as cohortname, c.idnumber as cohortidnumber, c.contextid as cohortcontextid, ';
|
||||
$fields .= 'c.visible as cohortvisible, c.description as cohortdescription, ';
|
||||
|
||||
// Add extra user fields that we need for the graded user.
|
||||
$extrafields = get_extra_user_fields($this->context);
|
||||
foreach ($extrafields as $field) {
|
||||
$fields .= 'u.' . $field . ', ';
|
||||
}
|
||||
$fields .= get_all_user_name_fields(true, 'u');
|
||||
|
||||
if ($count) {
|
||||
$select = "COUNT(1)";
|
||||
} else {
|
||||
$select = "$fields";
|
||||
}
|
||||
|
||||
$sql = "SELECT $select
|
||||
FROM {tool_cohortroles} uca
|
||||
JOIN {user} u ON u.id = uca.userid
|
||||
JOIN {cohort} c ON c.id = uca.cohortid";
|
||||
$params = array();
|
||||
|
||||
// Add order by if needed.
|
||||
if (!$count && $sqlsort = $this->get_sql_sort()) {
|
||||
$sql .= " ORDER BY " . $sqlsort;
|
||||
}
|
||||
|
||||
return array($sql, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the default implementation to set a decent heading level.
|
||||
*/
|
||||
public function print_nothing_to_display() {
|
||||
global $OUTPUT;
|
||||
echo $this->render_reset_button();
|
||||
$this->print_initials_bar();
|
||||
echo $OUTPUT->heading(get_string('nothingtodisplay'), 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the DB.
|
||||
*
|
||||
* @param int $pagesize size of page for paginated displayed table.
|
||||
* @param bool $useinitialsbar do you want to use the initials bar.
|
||||
*/
|
||||
public function query_db($pagesize, $useinitialsbar = true) {
|
||||
global $DB;
|
||||
|
||||
list($countsql, $countparams) = $this->get_sql_and_params(true);
|
||||
list($sql, $params) = $this->get_sql_and_params();
|
||||
$total = $DB->count_records_sql($countsql, $countparams);
|
||||
$this->pagesize($pagesize, $total);
|
||||
$this->rawdata = $DB->get_records_sql($sql, $params, $this->get_page_start(), $this->get_page_size());
|
||||
|
||||
// Set initial bars.
|
||||
if ($useinitialsbar) {
|
||||
$this->initialbars($total > $pagesize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Renderer class for cohort roles
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_cohortroles\output;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use plugin_renderer_base;
|
||||
use renderable;
|
||||
|
||||
/**
|
||||
* Renderer class for cohort roles
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Output a nofication.
|
||||
*
|
||||
* @param string $message the message to print out
|
||||
* @return string HTML fragment.
|
||||
* @see \core\output\notification
|
||||
*/
|
||||
public function notify_message($message) {
|
||||
$n = new \core\output\notification($message, \core\output\notification::NOTIFY_INFO);
|
||||
return $this->render($n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output an error notification.
|
||||
*
|
||||
* @param string $message the message to print out
|
||||
* @return string HTML fragment.
|
||||
* @see \core\output\notification
|
||||
*/
|
||||
public function notify_problem($message) {
|
||||
$n = new \core\output\notification($message, \core\output\notification::NOTIFY_ERROR);
|
||||
return $this->render($n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Output a success notification.
|
||||
*
|
||||
* @param string $message the message to print out
|
||||
* @return string HTML fragment.
|
||||
* @see \core\output\notification
|
||||
*/
|
||||
public function notify_success($message) {
|
||||
$n = new \core\output\notification($message, \core\output\notification::NOTIFY_SUCCESS);
|
||||
return $this->render($n);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Scheduled task for syncing cohort roles.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_cohortroles\task;
|
||||
|
||||
use core\task\scheduled_task;
|
||||
use tool_cohortroles\api;
|
||||
|
||||
/**
|
||||
* Scheduled task for syncing cohort roles.
|
||||
*
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class cohort_role_sync extends scheduled_task {
|
||||
|
||||
/**
|
||||
* Get name.
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
// Shown in admin screens.
|
||||
return get_string('taskname', 'tool_cohortroles');
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute.
|
||||
*/
|
||||
public function execute() {
|
||||
mtrace('Sync cohort roles...');
|
||||
$result = api::sync_all_cohort_roles();
|
||||
|
||||
mtrace('Added ' . count($result['rolesadded']));
|
||||
mtrace('Removed ' . count($result['rolesremoved']));
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="admin/tool/cohortroles/db" VERSION="20151201" COMMENT="XMLDB file for Moodle admin/tool/cohortroles"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="tool_cohortroles" COMMENT="Mapping of users to cohort role assignments.">
|
||||
<FIELDS>
|
||||
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
||||
<FIELD NAME="cohortid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The cohort to sync"/>
|
||||
<FIELD NAME="roleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The role to assign"/>
|
||||
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The user to sync"/>
|
||||
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was created"/>
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The time this record was modified."/>
|
||||
<FIELD NAME="usermodified" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Who last modified this record?"/>
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="cohortuserrole" UNIQUE="true" FIELDS="cohortid, roleid, userid"/>
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
@@ -1,37 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tasks definitions.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$tasks = array(
|
||||
array(
|
||||
'classname' => 'tool_cohortroles\task\cohort_role_sync',
|
||||
'blocking' => 0,
|
||||
'minute' => 'R',
|
||||
'hour' => '*',
|
||||
'day' => '*',
|
||||
'dayofweek' => '*',
|
||||
'month' => '*'
|
||||
),
|
||||
);
|
||||
@@ -1,98 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Assign roles for a user.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(dirname(__FILE__) . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->libdir.'/tablelib.php');
|
||||
|
||||
$removeid = optional_param('removecohortroleassignment', 0, PARAM_INT);
|
||||
|
||||
admin_externalpage_setup('toolcohortroles');
|
||||
$context = context_system::instance();
|
||||
|
||||
$pageurl = new moodle_url('/admin/tool/cohortroles/index.php');
|
||||
|
||||
$output = $PAGE->get_renderer('tool_cohortroles');
|
||||
|
||||
echo $output->header();
|
||||
$title = get_string('assignroletocohort', 'tool_cohortroles');
|
||||
echo $output->heading($title);
|
||||
|
||||
$form = new tool_cohortroles\form\assign_role_cohort();
|
||||
|
||||
if ($removeid) {
|
||||
require_sesskey();
|
||||
|
||||
$result = \tool_cohortroles\api::delete_cohort_role_assignment($removeid);
|
||||
if ($result) {
|
||||
$notification = get_string('cohortroleassignmentremoved', 'tool_cohortroles');
|
||||
echo $output->notify_success($notification);
|
||||
} else {
|
||||
$notification = get_string('cohortroleassignmentnotremoved', 'tool_cohortroles');
|
||||
echo $output->notify_problem($notification);
|
||||
}
|
||||
echo $output->continue_button(new moodle_url($pageurl));
|
||||
} else if ($data = $form->get_data()) {
|
||||
require_sesskey();
|
||||
// We must create them all or none.
|
||||
$saved = 0;
|
||||
// Loop through userids and cohortids only if both of them are not empty.
|
||||
if (!empty($data->userids) && !empty($data->cohortids)) {
|
||||
foreach ($data->userids as $userid) {
|
||||
foreach ($data->cohortids as $cohortid) {
|
||||
$params = (object) array('userid' => $userid, 'cohortid' => $cohortid, 'roleid' => $data->roleid);
|
||||
$result = \tool_cohortroles\api::create_cohort_role_assignment($params);
|
||||
if ($result) {
|
||||
$saved++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($saved == 0) {
|
||||
$notification = get_string('nocohortroleassignmentssaved', 'tool_cohortroles');
|
||||
echo $output->notify_problem($notification);
|
||||
} else if ($saved == 1) {
|
||||
$notification = get_string('onecohortroleassignmentsaved', 'tool_cohortroles');
|
||||
echo $output->notify_success($notification);
|
||||
} else {
|
||||
$notification = get_string('acohortroleassignmentssaved', 'tool_cohortroles', $saved);
|
||||
echo $output->notify_success($notification);
|
||||
}
|
||||
|
||||
echo $output->continue_button(new moodle_url($pageurl));
|
||||
} else {
|
||||
$form->display();
|
||||
|
||||
$title = get_string('existingcohortroles', 'tool_cohortroles');
|
||||
echo $output->heading($title);
|
||||
$url = new moodle_url('/admin/tool/cohortroles/index.php');
|
||||
$table = new tool_cohortroles\output\cohort_role_assignments_table(uniqid(), $url);
|
||||
echo $table->out(50, true);
|
||||
|
||||
echo $output->spacer();
|
||||
echo $output->notify_message(get_string('backgroundsync', 'tool_cohortroles'));
|
||||
}
|
||||
|
||||
echo $output->footer();
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'tool_userroles', language 'en'
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['acohortroleassignmentssaved'] = '{$a} cohort role assignments were saved.';
|
||||
$string['assign'] = 'Assign';
|
||||
$string['assignroletocohort'] = 'Assign user-context roles to all cohort members';
|
||||
$string['backgroundsync'] = 'Note: New cohort role assignments will not take effect immediately. Role assignment changes will be made by a scheduled task.';
|
||||
$string['cohortroleassignmentremoved'] = 'The cohort role assignment was removed.';
|
||||
$string['cohortroleassignmentnotremoved'] = 'The cohort role assignment was not removed.';
|
||||
$string['cohortroles'] = 'Cohort roles';
|
||||
$string['existingcohortroles'] = 'Existing cohort role assignments';
|
||||
$string['managecohortroles'] = 'Assign user roles to cohort';
|
||||
$string['noassignableroles'] = 'There are currently no roles that can be assigned in the user context. <a href="../../roles/manage.php">Manage roles</a>';
|
||||
$string['nocohortroleassignmentssaved'] = 'No cohort role assignments were saved.';
|
||||
$string['onecohortroleassignmentsaved'] = 'One cohort role assignment was saved.';
|
||||
$string['pluginname'] = 'Cohort roles management';
|
||||
$string['removecohortroleassignment'] = 'Remove cohort role assignment';
|
||||
$string['removecohortroleassignmentconfirm'] = 'Are you sure you want to remove this cohort role assignment? This role will be removed for this user in all other user contexts.';
|
||||
$string['selectcohorts'] = 'Select cohorts';
|
||||
$string['selectrole'] = 'Select role';
|
||||
$string['selectusers'] = 'Select users to assign role';
|
||||
$string['taskname'] = 'Sync cohort role assignments';
|
||||
$string['thisuserroles'] = 'Roles assigned relative to this user';
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Link to user roles management.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
// This tool's required capabilities.
|
||||
$capabilities = [
|
||||
'moodle/cohort:view',
|
||||
'moodle/role:manage'
|
||||
];
|
||||
|
||||
// Check if the user has all of the required capabilities.
|
||||
$context = context_system::instance();
|
||||
$hasaccess = has_all_capabilities($capabilities, $context);
|
||||
|
||||
// Add this admin page only if the user has all of the required capabilities.
|
||||
if ($hasaccess) {
|
||||
$str = get_string('managecohortroles', 'tool_cohortroles');
|
||||
$url = new moodle_url('/admin/tool/cohortroles/index.php');
|
||||
$ADMIN->add('roles', new admin_externalpage('toolcohortroles', $str, $url, $capabilities));
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template tool_cohortroles/cohort-in-list
|
||||
|
||||
Moodle template for displaying a cohort in a list.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* id cohort id field
|
||||
* name cohort name field
|
||||
* idnumber cohort idnumber field
|
||||
* description cohort description field
|
||||
* visible cohort visible field
|
||||
|
||||
Example context (json):
|
||||
{ "id": "1",
|
||||
"name": "Cohort 1",
|
||||
"visible": true,
|
||||
"idnumber": "014",
|
||||
"description": "Some users"
|
||||
}
|
||||
}}
|
||||
{{> tool_lp/form-cohort-selector-suggestion }}
|
||||
@@ -1,243 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_cohortroles\api;
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
/** @var stdClass $cohort */
|
||||
protected $cohort = null;
|
||||
|
||||
/** @var stdClass $userassignto */
|
||||
protected $userassignto = null;
|
||||
|
||||
/** @var stdClass $userassignover */
|
||||
protected $userassignover = null;
|
||||
|
||||
/** @var stdClass $role */
|
||||
protected $role = null;
|
||||
|
||||
/**
|
||||
* Setup function- we will create a course and add an assign instance to it.
|
||||
*/
|
||||
protected function setUp() {
|
||||
global $DB;
|
||||
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
// Create some users.
|
||||
$this->cohort = $this->getDataGenerator()->create_cohort();
|
||||
$this->userassignto = $this->getDataGenerator()->create_user();
|
||||
$this->userassignover = $this->getDataGenerator()->create_user();
|
||||
$this->roleid = create_role('Sausage Roll', 'sausageroll', 'mmmm');
|
||||
cohort_add_member($this->cohort->id, $this->userassignover->id);
|
||||
}
|
||||
|
||||
|
||||
public function test_create_cohort_role_assignment_without_permission() {
|
||||
$this->setExpectedException('required_capability_exception');
|
||||
$this->setUser($this->userassignto);
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
public function test_create_cohort_role_assignment_with_invalid_data() {
|
||||
$this->setExpectedException('core_competency\invalid_persistent_exception');
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => -8,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
public function test_create_cohort_role_assignment() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->assertNotEmpty($result->get_id());
|
||||
$this->assertEquals($result->get_userid(), $this->userassignto->id);
|
||||
$this->assertEquals($result->get_roleid(), $this->roleid);
|
||||
$this->assertEquals($result->get_cohortid(), $this->cohort->id);
|
||||
}
|
||||
|
||||
public function test_delete_cohort_role_assignment_without_permission() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->setExpectedException('required_capability_exception');
|
||||
$this->setUser($this->userassignto);
|
||||
api::delete_cohort_role_assignment($result->get_id());
|
||||
}
|
||||
|
||||
public function test_delete_cohort_role_assignment_with_invalid_data() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->setExpectedException('dml_missing_record_exception');
|
||||
api::delete_cohort_role_assignment($result->get_id() + 1);
|
||||
}
|
||||
|
||||
public function test_delete_cohort_role_assignment() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$worked = api::delete_cohort_role_assignment($result->get_id());
|
||||
$this->assertTrue($worked);
|
||||
}
|
||||
|
||||
public function test_list_cohort_role_assignments() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
|
||||
$list = api::list_cohort_role_assignments();
|
||||
$list[0]->is_valid();
|
||||
$this->assertEquals($list[0], $result);
|
||||
}
|
||||
|
||||
public function test_count_cohort_role_assignments() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
|
||||
$count = api::count_cohort_role_assignments();
|
||||
$this->assertEquals($count, 1);
|
||||
}
|
||||
|
||||
public function test_sync_all_cohort_roles() {
|
||||
$this->setAdminUser();
|
||||
$params = (object) array(
|
||||
'userid' => $this->userassignto->id,
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
|
||||
// Verify roles are assigned when users enter the cohort.
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
|
||||
$rolesadded = array(array(
|
||||
'useridassignedto' => $this->userassignto->id,
|
||||
'useridassignedover' => $this->userassignover->id,
|
||||
'roleid' => $this->roleid
|
||||
));
|
||||
$rolesremoved = array();
|
||||
$expected = array('rolesadded' => $rolesadded,
|
||||
'rolesremoved' => $rolesremoved);
|
||||
$this->assertEquals($sync, $expected);
|
||||
|
||||
// Verify roles are removed when users leave the cohort.
|
||||
cohort_remove_member($this->cohort->id, $this->userassignover->id);
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
|
||||
$rolesadded = array();
|
||||
$rolesremoved = array(array(
|
||||
'useridassignedto' => $this->userassignto->id,
|
||||
'useridassignedover' => $this->userassignover->id,
|
||||
'roleid' => $this->roleid
|
||||
));
|
||||
$expected = array('rolesadded' => $rolesadded,
|
||||
'rolesremoved' => $rolesremoved);
|
||||
$this->assertEquals($sync, $expected);
|
||||
|
||||
// Verify roles assigned by any other component are not removed.
|
||||
$usercontext = context_user::instance($this->userassignover->id);
|
||||
role_assign($this->roleid, $this->userassignto->id, $usercontext->id);
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
|
||||
$rolesadded = array();
|
||||
$rolesremoved = array();
|
||||
$expected = array('rolesadded' => $rolesadded,
|
||||
'rolesremoved' => $rolesremoved);
|
||||
$this->assertEquals($sync, $expected);
|
||||
|
||||
// Remove manual role assignment.
|
||||
role_unassign($this->roleid, $this->userassignto->id, $usercontext->id);
|
||||
// Add someone to the cohort again...
|
||||
cohort_add_member($this->cohort->id, $this->userassignover->id);
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
$rolesadded = array(array(
|
||||
'useridassignedto' => $this->userassignto->id,
|
||||
'useridassignedover' => $this->userassignover->id,
|
||||
'roleid' => $this->roleid
|
||||
));
|
||||
$rolesremoved = array();
|
||||
$expected = array('rolesadded' => $rolesadded,
|
||||
'rolesremoved' => $rolesremoved);
|
||||
$this->assertEquals($sync, $expected);
|
||||
|
||||
// Verify no fatal errors when a cohort is deleted.
|
||||
cohort_delete_cohort($this->cohort);
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
|
||||
$rolesadded = array();
|
||||
$rolesremoved = array(array(
|
||||
'useridassignedto' => $this->userassignto->id,
|
||||
'useridassignedover' => $this->userassignover->id,
|
||||
'roleid' => $this->roleid
|
||||
));
|
||||
$expected = array('rolesadded' => $rolesadded,
|
||||
'rolesremoved' => $rolesremoved);
|
||||
$this->assertEquals($sync, $expected);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Plugin version info
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_cohortroles'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
$plugin->dependencies = array(
|
||||
'tool_lp' => ANY_VERSION
|
||||
);
|
||||
@@ -24,10 +24,29 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
|
||||
// Moodle v2.3.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this
|
||||
|
||||
|
||||
// Moodle v2.5.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
// Moodle v2.6.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@@ -38,8 +57,5 @@ function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->requires = 2016051900;
|
||||
$plugin->version = 2015111600;
|
||||
$plugin->requires = 2015111000;
|
||||
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
|
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 67 B |
|
Before Width: | Height: | Size: 67 B After Width: | Height: | Size: 67 B |
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->requires = 2016051900;
|
||||
$plugin->version = 2015111600;
|
||||
$plugin->requires = 2015111000;
|
||||
$plugin->component = 'tool_filetypes';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->requires = 2016051900;
|
||||
$plugin->version = 2015111600;
|
||||
$plugin->requires = 2015111000;
|
||||
$plugin->component = 'tool_generator';
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version
|
||||
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version
|
||||
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 266 B |
@@ -1,3 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 15.1.0, SVG Export Plug-In -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
|
||||
<!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
|
||||
]><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" preserveAspectRatio="xMinYMid meet" overflow="visible"><path d="M16 9v6c0 .5-.5 1-1 1H1c-.5 0-1-.5-1-1V9c0-.5.5-1 1-1h1c.5 0 1 .5 1 1v4h10V9c0-.5.5-1 1-1h1c.5 0 1 .5 1 1zm-3.6-3.9l-.7-.7c-.4-.4-1-.4-1.4 0l-.8.8V1c0-.5-.4-1-1-1h-1c-.5 0-1 .5-1 1v4.2l-.8-.8c-.4-.4-1-.4-1.4 0l-.7.7c-.4.4-.4 1 0 1.4l3.7 3.7c.2.2.5.3.7.3.3 0 .5-.1.7-.3l3.7-3.7c.4-.3.4-1 0-1.4z" fill="#999"/></svg>
|
||||
]>
|
||||
<svg version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
|
||||
x="0px" y="0px" width="16px" height="16px" viewBox="0 0 16 16" style="overflow:visible;enable-background:new 0 0 16 16;"
|
||||
xml:space="preserve" preserveAspectRatio="xMinYMid meet">
|
||||
<defs>
|
||||
</defs>
|
||||
<path style="fill:#999999;" d="M16,9v6c0,0.5-0.5,1-1,1h-1H2H1c-0.5,0-1-0.5-1-1V9c0-0.5,0.5-1,1-1h1c0.5,0,1,0.5,1,1v4h10V9
|
||||
c0-0.5,0.5-1,1-1h1C15.5,8,16,8.5,16,9z M12.4,5.1l-0.7-0.7c-0.4-0.4-1-0.4-1.4,0L9.5,5.2V1c0-0.5-0.4-1-1-1h-1c-0.5,0-1,0.5-1,1
|
||||
v4.2L5.7,4.4C5.3,4,4.7,4,4.3,4.4L3.6,5.1c-0.4,0.4-0.4,1,0,1.4l3.7,3.7c0.2,0.2,0.5,0.3,0.7,0.3c0.3,0,0.5-0.1,0.7-0.3l3.7-3.7
|
||||
C12.8,6.2,12.8,5.5,12.4,5.1z"/>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 618 B After Width: | Height: | Size: 1.0 KiB |
@@ -24,6 +24,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'tool_installaddon';
|
||||
$plugin->version = 2016052300;
|
||||
$plugin->requires = 2016051900;
|
||||
$plugin->version = 2015111600;
|
||||
$plugin->requires = 2015111000;
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
|
||||
@@ -184,8 +184,6 @@ class controller {
|
||||
|
||||
if ($updated) {
|
||||
$this->info[] = get_string('langupdatecomplete', 'tool_langimport');
|
||||
// The strings have been changed so we need to purge their cache to ensure users see the changes.
|
||||
get_string_manager()->reset_caches();
|
||||
} else {
|
||||
$this->info[] = get_string('nolangupdateneeded', 'tool_langimport');
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ echo html_writer::end_tag('td');
|
||||
$options = array();
|
||||
foreach ($availablelangs as $alang) {
|
||||
if (!empty($alang[0]) and trim($alang[0]) !== 'en' and !$controller->is_installed_lang($alang[0], $alang[1])) {
|
||||
$options[$alang[0]] = $alang[2].' ‎('.$alang[0].')‎';
|
||||
$options[$alang[0]] = $alang[2].' ('.$alang[0].')';
|
||||
}
|
||||
}
|
||||
if (!empty($options)) {
|
||||
|
||||
@@ -13,10 +13,10 @@ Feature: Manage language packs
|
||||
Scenario: Install language pack
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Language packs" node in "Site administration > Language"
|
||||
When I set the field "Available language packs" to "en_ar"
|
||||
When I set the field "Available language packs" to "English - Pirate (en_ar)"
|
||||
And I press "Install selected language pack(s)"
|
||||
Then I should see "Language pack 'en_ar' was successfully installed"
|
||||
And the "Installed language packs" select box should contain "en_ar"
|
||||
And the "Installed language packs" select box should contain "English - Pirate (en_ar)"
|
||||
And I navigate to "Live logs" node in "Site administration > Reports"
|
||||
And I should see "The language pack 'en_ar' was installed."
|
||||
And I log out
|
||||
@@ -35,14 +35,14 @@ Feature: Manage language packs
|
||||
Scenario: Try to uninstall language pack
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Language packs" node in "Site administration > Language"
|
||||
And I set the field "Available language packs" to "en_ar"
|
||||
And I set the field "Available language packs" to "English - Pirate (en_ar)"
|
||||
And I press "Install selected language pack(s)"
|
||||
When I set the field "Installed language packs" to "en_ar"
|
||||
When I set the field "Installed language packs" to "English - Pirate (en_ar)"
|
||||
And I press "Uninstall selected language pack(s)"
|
||||
And I press "Continue"
|
||||
Then I should see "Language pack 'en_ar' was uninstalled"
|
||||
And the "Installed language packs" select box should not contain "en_ar"
|
||||
And the "Available language packs" select box should contain "en_ar"
|
||||
And the "Installed language packs" select box should not contain "English - Pirate (en_ar)"
|
||||
And the "Available language packs" select box should contain "English - Pirate (en_ar)"
|
||||
And I navigate to "Live logs" node in "Site administration > Reports"
|
||||
And I should see "The language pack 'en_ar' was removed."
|
||||
And I should see "Language pack uninstalled"
|
||||
@@ -51,7 +51,7 @@ Feature: Manage language packs
|
||||
Scenario: Try to uninstall English language pack
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Language packs" node in "Site administration > Language"
|
||||
When I set the field "Installed language packs" to "en"
|
||||
When I set the field "Installed language packs" to "English (en)"
|
||||
And I press "Uninstall selected language pack(s)"
|
||||
Then I should see "The English language pack cannot be uninstalled."
|
||||
And I navigate to "Live logs" node in "Site administration > Reports"
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version
|
||||
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -106,6 +106,38 @@ class manager implements \core\log\manager {
|
||||
if (empty($interface) || ($reader instanceof $interface)) {
|
||||
$return[$plugin] = $reader;
|
||||
}
|
||||
// TODO MDL-49291 These conditions should be removed as part of the 2nd stage deprecation.
|
||||
if ($reader instanceof \core\log\sql_internal_reader) {
|
||||
debugging('\core\log\sql_internal_reader has been deprecated in favour of \core\log\sql_internal_table_reader.' .
|
||||
' Update ' . get_class($reader) . ' to use the new interface.', DEBUG_DEVELOPER);
|
||||
} else if ($reader instanceof \core\log\sql_select_reader) {
|
||||
debugging('\core\log\sql_select_reader has been deprecated in favour of \core\log\sql_reader. Update ' .
|
||||
get_class($reader) . ' to use the new interface.', DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO MDL-49291 This section below (until the final return) should be removed as part of the 2nd stage deprecation.
|
||||
$isselectreader = (ltrim($interface, '\\') === 'core\log\sql_select_reader');
|
||||
$isinternalreader = (ltrim($interface, '\\') === 'core\log\sql_internal_reader');
|
||||
if ($isselectreader || $isinternalreader) {
|
||||
|
||||
if ($isselectreader) {
|
||||
$alternative = '\core\log\sql_reader';
|
||||
} else {
|
||||
$alternative = '\core\log\sql_internal_table_reader';
|
||||
}
|
||||
|
||||
if (count($return) === 0) {
|
||||
// If there are no classes implementing the provided interface and the provided interface is one of
|
||||
// the deprecated ones, we return the non-deprecated alternatives. It should be safe as the new interface
|
||||
// is adding a new method but not changing the existing ones.
|
||||
debugging($interface . ' has been deprecated in favour of ' . $alternative . '. Returning ' . $alternative .
|
||||
' instances instead. Please call get_readers() using the new interface.', DEBUG_DEVELOPER);
|
||||
$return = $this->get_readers($alternative);
|
||||
} else {
|
||||
debugging($interface . ' has been deprecated in favour of ' . $alternative .
|
||||
'. Please call get_readers() using the new interface.', DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
||||
@@ -31,7 +31,20 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_log_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014040600) {
|
||||
// Reset logging defaults in dev branches,
|
||||
// in production upgrade the install.php is executed instead.
|
||||
require_once(__DIR__ . '/install.php');
|
||||
xmldb_tool_log_install();
|
||||
upgrade_plugin_savepoint(true, 2014040600, 'tool', 'log');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@@ -42,8 +55,5 @@ function xmldb_tool_log_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,10 +22,19 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_logstore_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
if ($oldversion < 2014041700) {
|
||||
// Clean up old config.
|
||||
unset_config('excludelevels', 'logstore_database');
|
||||
unset_config('excludeactions', 'logstore_database');
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014041700, 'logstore', 'database');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@@ -36,8 +45,5 @@ function xmldb_logstore_database_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
$this->assertCount(0, $stores);
|
||||
|
||||
// Fake the settings, we will abuse the standard plugin table here...
|
||||
set_config('dbdriver', $CFG->dblibrary . '/' . $CFG->dbtype, 'logstore_database');
|
||||
$parts = explode('_', get_class($DB));
|
||||
set_config('dbdriver', $parts[1] . '/' . $parts[0], 'logstore_database');
|
||||
set_config('dbhost', $CFG->dbhost, 'logstore_database');
|
||||
set_config('dbuser', $CFG->dbuser, 'logstore_database');
|
||||
set_config('dbpass', $CFG->dbpass, 'logstore_database');
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -182,8 +182,6 @@ class store implements \tool_log\log\store, \core\log\sql_reader {
|
||||
|
||||
/**
|
||||
* Legacy add_to_log() code.
|
||||
* @deprecated since Moodle 3.1 MDL-45104 - Please use supported log stores such as "standard" or "external" instead.
|
||||
* @todo MDL-52805 This will be removed in Moodle 3.3
|
||||
*
|
||||
* @param int $courseid The course id
|
||||
* @param string $module The module name e.g. forum, journal, resource, course, user etc
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
</FIELDS>
|
||||
<KEYS>
|
||||
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
||||
<KEY NAME="contextid" TYPE="foreign" FIELDS="contextid" REFTABLE="context" REFFIELDS="id"/>
|
||||
</KEYS>
|
||||
<INDEXES>
|
||||
<INDEX NAME="timecreated" UNIQUE="false" FIELDS="timecreated"/>
|
||||
|
||||
@@ -22,13 +22,98 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014032000) {
|
||||
|
||||
// Define field anonymous to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$field = new xmldb_field('anonymous', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'relateduserid');
|
||||
|
||||
// Conditionally launch add field anonymous.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Standard savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014032000, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014041500) {
|
||||
|
||||
// Define index contextid-component (not unique) to be dropped form logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('contextid-component', XMLDB_INDEX_NOTUNIQUE, array('contextid', 'component'));
|
||||
|
||||
// Conditionally launch drop index contextid-component.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index courseid (not unique) to be dropped form logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('courseid', XMLDB_INDEX_NOTUNIQUE, array('courseid'));
|
||||
|
||||
// Conditionally launch drop index courseid.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index eventname (not unique) to be dropped form logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('eventname', XMLDB_INDEX_NOTUNIQUE, array('eventname'));
|
||||
|
||||
// Conditionally launch drop index eventname.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index crud (not unique) to be dropped form logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('crud', XMLDB_INDEX_NOTUNIQUE, array('crud'));
|
||||
|
||||
// Conditionally launch drop index crud.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index edulevel (not unique) to be dropped form logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('edulevel', XMLDB_INDEX_NOTUNIQUE, array('edulevel'));
|
||||
|
||||
// Conditionally launch drop index edulevel.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index course-time (not unique) to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('course-time', XMLDB_INDEX_NOTUNIQUE, array('courseid', 'anonymous', 'timecreated'));
|
||||
|
||||
// Conditionally launch add index course-time.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index user-module (not unique) to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$index = new xmldb_index('user-module', XMLDB_INDEX_NOTUNIQUE, array('userid', 'contextlevel', 'contextinstanceid', 'crud', 'edulevel', 'timecreated'));
|
||||
|
||||
// Conditionally launch add index user-module.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Standard savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014041500, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
// Moodle v2.7.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -38,23 +123,5 @@ function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016041200) {
|
||||
// This could take a long time. Unfortunately, no way to know how long, and no way to do progress, so setting for 1 hour.
|
||||
upgrade_set_timeout(3600);
|
||||
|
||||
// Define key contextid (foreign) to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
|
||||
|
||||
// Launch add key contextid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Standard savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2016041200, 'logstore', 'standard');
|
||||
}
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2016051900; // Requires this Moodle version.
|
||||
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015111000; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
define(["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","tool_lp/event_base"],function(a,b,c,d,e,f){var g=function(a,b,c,d,e){var g=this;f.prototype.constructor.apply(this,[]),g._title=a,g._message=b,g._actions=c,g._confirm=d,g._cancel=e,g._selectedValue=null,g._reset()};return g.prototype=Object.create(f.prototype),g.prototype._selectedValue=null,g.prototype._popup=null,g.prototype._title=null,g.prototype._message=null,g.prototype._actions=null,g.prototype._confirm=null,g.prototype._cancel=null,g.prototype._afterRender=function(){var b=this;b._find('[data-action="action-selector-confirm"]').attr("disabled","disabled"),b._find('[data-region="action-selector-radio-buttons"]').change(function(){b._selectedValue=a("input[type='radio']:checked").val(),b._find('[data-action="action-selector-confirm"]').removeAttr("disabled"),b._refresh.bind(b)}.bind(b)),b._find('[data-action="action-selector-cancel"]').click(function(a){a.preventDefault(),b.close()}.bind(b)),b._find('[data-action="action-selector-confirm"]').click(function(a){a.preventDefault(),b._selectedValue.length&&(b._trigger("save",{action:b._selectedValue}),b.close())}.bind(b))},g.prototype.close=function(){var a=this;a._popup.close(),a._reset()},g.prototype.display=function(){var a=this;return a._render().then(function(b){a._popup=new e(a._title,b,a._afterRender.bind(a))}.bind(a)).fail(b.exception)},g.prototype._find=function(b){return a(this._popup.getContent()).find(b)},g.prototype._refresh=function(){var a=this;return a._render().then(function(b){a._find('[data-region="action-selector"]').replaceWith(b),a._afterRender()}.bind(a))},g.prototype._render=function(){var a=this,b=[];for(var c in a._actions)b.push(a._actions[c]);var e={message:a._message,choices:b,confirm:a._confirm,cancel:a._cancel};return d.render("tool_lp/action_selector",e)},g.prototype._reset=function(){this._popup=null,this._selectedValue=""},g});
|
||||
@@ -1 +0,0 @@
|
||||
define(["jquery","core/str"],function(a,b){var c=0,d=1,e=2,f=3;return{NONE:c,EVIDENCE:d,COMPLETE:e,RECOMMEND:f,getAll:function(){var a=this;return b.get_strings([{key:"competencyoutcome_none",component:"tool_lp"},{key:"competencyoutcome_evidence",component:"tool_lp"},{key:"competencyoutcome_recommend",component:"tool_lp"},{key:"competencyoutcome_complete",component:"tool_lp"}]).then(function(b){var c={};return c[a.NONE]={code:a.NONE,name:b[0]},c[a.EVIDENCE]={code:a.EVIDENCE,name:b[1]},c[a.RECOMMEND]={code:a.RECOMMEND,name:b[2]},c[a.COMPLETE]={code:a.COMPLETE,name:b[3]},c})},getString:function(b){var c=this,d=c.getAll();return d.then(function(c){return"undefined"==typeof c[b]?a.Deferred().reject().promise():c[b].name})}}});
|
||||
@@ -1 +0,0 @@
|
||||
define(["jquery"],function(a){var b=function(b,c,d,e,f){this._baseUrl=c,this._userId=d+"",this._competencyId=e+"",this._planId=f,this._ignoreFirstCompetency=!0,a(b).on("change",this._competencyChanged.bind(this))};return b.prototype._competencyChanged=function(b){if(this._ignoreFirstCompetency)return void(this._ignoreFirstCompetency=!1);var c=a(b.target).val(),d="?userid="+this._userId+"&planid="+this._planId+"&competencyid="+c;document.location=this._baseUrl+d},b.prototype._competencyId=null,b.prototype._userId=null,b.prototype._planId=null,b.prototype._baseUrl=null,b.prototype._ignoreFirstCompetency=null,b});
|
||||
@@ -1 +0,0 @@
|
||||
define(["jquery"],function(a){var b=function(b){this._eventNode=a("<div>"),this._ready=a.Deferred(),this._tree=b};return b.prototype._competency=null,b.prototype._eventNode=null,b.prototype._ready=null,b.prototype._tree=null,b.prototype.canConfig=function(){return this._tree.hasChildren(this._competency.id)},b.prototype.getConfig=function(){return null},b.prototype.getType=function(){throw new Error("Not implemented")},b.prototype.init=function(){return this._load()},b.prototype.injectTemplate=function(){return a.Deferred().reject().promise()},b.prototype.isValid=function(){return!1},b.prototype._load=function(){return a.when()},b.prototype.on=function(a,b){this._eventNode.on(a,b)},b.prototype.setTargetCompetency=function(a){this._competency=a},b.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])},b.prototype._triggerChange=function(){this._trigger("change",this)},b});
|
||||