Compare commits
255 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4bd3217ce8 | |||
| 3a71764572 | |||
| 15d05e6d76 | |||
| 96579b1904 | |||
| b5600c2b56 | |||
| 5b374f607a | |||
| f0f81cbddf | |||
| 9141121f01 | |||
| 588f9efe8c | |||
| 6e9de0d56b | |||
| 5f96398a90 | |||
| ea3bba0ac8 | |||
| fd1b952e3e | |||
| 00253d140c | |||
| ade9ea1b64 | |||
| 175e553143 | |||
| ccaa6daf95 | |||
| f3a96eb019 | |||
| f68fc730f4 | |||
| c44cd5ce91 | |||
| 65acecced1 | |||
| 3f8502225e | |||
| a7f0516ae9 | |||
| 10fef0df99 | |||
| f6f8ec2291 | |||
| 065fdf4b2d | |||
| 1ab447455b | |||
| bf301a5e81 | |||
| bbd8a07f68 | |||
| 8b2638fd56 | |||
| 97414ca1cb | |||
| a11e396945 | |||
| c13aac05cc | |||
| a4e26132e0 | |||
| 1b6873b44a | |||
| 9b0645fc15 | |||
| 2db344ac25 | |||
| 3be068cc72 | |||
| e33213647c | |||
| 289056c576 | |||
| 1e6e11d8d3 | |||
| 94a7dbf7f4 | |||
| 70d07c5947 | |||
| 8a31a02cce | |||
| a8b2acd35c | |||
| cd2a074cc2 | |||
| 660d38be15 | |||
| a87bb9848f | |||
| 376411566a | |||
| 85f4603014 | |||
| 1ae32381c5 | |||
| 966ac4af8f | |||
| 9a20fcd261 | |||
| d0931fd7d4 | |||
| d3f2f141a5 | |||
| 6f59fe694b | |||
| 2cc40431cb | |||
| cdbc789fd8 | |||
| 3e45d0801e | |||
| 348c37c98d | |||
| 57b5c36320 | |||
| cd0b2c6624 | |||
| 2ba08bbda2 | |||
| e7e806e5f9 | |||
| 9aa4e03b03 | |||
| e8e20f996d | |||
| 46861f51b7 | |||
| 6e98de58b4 | |||
| 445f79f464 | |||
| 491356530e | |||
| 943ad5a1fc | |||
| 88763543f8 | |||
| 47e3c9ad06 | |||
| 5ac62e7763 | |||
| 7eba1d5996 | |||
| 5c1dd89dd3 | |||
| fa5a4b9612 | |||
| 2da1a26439 | |||
| 88ef13a747 | |||
| ab60333d45 | |||
| 485130d7c5 | |||
| f83ab42515 | |||
| eb19752b9a | |||
| 3bb4b79a15 | |||
| 671514c6c2 | |||
| 1113c4c5b1 | |||
| 2b50abb97b | |||
| 4a844708e6 | |||
| 36f946b5db | |||
| 39def1c571 | |||
| df4c1d94f0 | |||
| 1f60d5198d | |||
| a93ceeef99 | |||
| 1be54667d6 | |||
| 5ae0bf0a12 | |||
| 8dd0ea96e5 | |||
| 42b0a371bf | |||
| 796dd551f7 | |||
| 8d8b9b7268 | |||
| cb041849a3 | |||
| e764df0dbb | |||
| a817a54e90 | |||
| 176558d2ce | |||
| f7931a5580 | |||
| d12989b797 | |||
| 1262e4539e | |||
| eb7e4a9b65 | |||
| 26e68178a8 | |||
| b1d7ea12cd | |||
| c370c0cc5e | |||
| e1d05182a6 | |||
| 2b6424c59d | |||
| 8270af1bf0 | |||
| 88e82bb634 | |||
| 5a189106ad | |||
| 6a107256e3 | |||
| 521a83352d | |||
| 66183e5320 | |||
| 5ebabad505 | |||
| 9fe9652c16 | |||
| e5b715291d | |||
| 50a7bad23e | |||
| cfcfa4b1cd | |||
| 5ec8651d54 | |||
| ff08b12ce1 | |||
| 762681f5c4 | |||
| 4d40958181 | |||
| 7f3f962c3f | |||
| aab9e18b6d | |||
| cd5c991ede | |||
| 1c70185782 | |||
| cf431667e9 | |||
| 598b4743cc | |||
| a35b341ce7 | |||
| 66f4852bff | |||
| aeace8ee75 | |||
| 38f99a1e60 | |||
| 7547dec095 | |||
| d4564b876e | |||
| 0f5cb9dbd5 | |||
| 1ecc215b3a | |||
| ecc8edd917 | |||
| 8bcec8ba5f | |||
| b26192f62f | |||
| 82c915dbc3 | |||
| 50ab3f94d5 | |||
| 5b282947d7 | |||
| 24dc478086 | |||
| 2562bbfd1b | |||
| 1716e2f2cd | |||
| acff633e39 | |||
| 65ceca6092 | |||
| c21b1143a4 | |||
| 0cd7aaebcd | |||
| 2e8b980985 | |||
| 01aa6fa7d2 | |||
| 6290196cde | |||
| ffa8c930f0 | |||
| 8679f4afdf | |||
| 1afeadb4f4 | |||
| 3fc2111a4b | |||
| d731f7e01e | |||
| 49fbe6d614 | |||
| 9ece615f6c | |||
| 42052386d1 | |||
| 0d02ded10f | |||
| aaf5c3f8b7 | |||
| 11c941f404 | |||
| 87d0aae1fb | |||
| 3e0c2a45fb | |||
| a3b84f77c7 | |||
| 149a477903 | |||
| 47cd445f67 | |||
| 5524686f71 | |||
| 20d4962c33 | |||
| 1b93c2781e | |||
| 39658c5b3a | |||
| e271f67942 | |||
| 1aef5337bd | |||
| 3ef3a9b1bc | |||
| 80c7a3a847 | |||
| c5b16d9afb | |||
| 4fb2a4dd60 | |||
| 5ab2997d89 | |||
| 16efbcaa01 | |||
| 3f020e662d | |||
| ef01def984 | |||
| ce1ef8bda0 | |||
| 8adf0918ce | |||
| 86e830eac4 | |||
| 60fb2c1232 | |||
| 605a610702 | |||
| 55e6c1b588 | |||
| e792dbbe0b | |||
| 09880d7d78 | |||
| 426e34af13 | |||
| 161d14cd92 | |||
| 204da574bd | |||
| a7f0f4af47 | |||
| cec04e64a1 | |||
| 371c836be1 | |||
| 97f35300f7 | |||
| 2870ea8556 | |||
| 1c2e8c3abb | |||
| 125ff0d462 | |||
| 23bde28300 | |||
| f5aa88ec02 | |||
| 9f9fa01a91 | |||
| 5bf6da6331 | |||
| 69751fcd69 | |||
| 5c969d2370 | |||
| 7c959f479b | |||
| d43cec5bb3 | |||
| a47729dc17 | |||
| 8ffd4c4bb1 | |||
| a3ab626df1 | |||
| fd103caa83 | |||
| 12d87a9b65 | |||
| cd54f46df1 | |||
| 49e66dfc5d | |||
| c36c98448d | |||
| 5e7d431426 | |||
| 3b4b95d431 | |||
| 42079bb48d | |||
| c294a22dae | |||
| bde5487a56 | |||
| c0b2343245 | |||
| ae500b5728 | |||
| b311baf0bd | |||
| d1c223071a | |||
| 14f9c08355 | |||
| 9ec7e01527 | |||
| ce20b2f255 | |||
| 85bd222b2f | |||
| cf3d932d74 | |||
| 0b47dfec7c | |||
| 8036733091 | |||
| a74e15c66b | |||
| b7e1d77184 | |||
| 5379d34827 | |||
| 50e813478a | |||
| 4f699801b9 | |||
| 7beb6d7e82 | |||
| 1f1406d68c | |||
| 17924add45 | |||
| 56293e0de4 | |||
| 653c0937c6 | |||
| 9fcb0eca01 | |||
| ff87bb5101 | |||
| a271d9efc9 | |||
| 3e18e85dce | |||
| 92fdfe834f | |||
| f7c18e4e4b | |||
| 2698647bcd | |||
| 803c3d8977 |
+1
-3
@@ -1,5 +1,3 @@
|
||||
**/yui/build/** -diff
|
||||
**/amd/build/** -diff
|
||||
**.js.map -diff
|
||||
**-min.js -diff
|
||||
**.min.js -diff
|
||||
lib/dml/oci_native_moodle_package.sql text eol=lf
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
# Primary donations pages.
|
||||
custom: ["https://moodle.com/donations/", "https://fund.moodle.org"]
|
||||
custom: ["https://moodle.com/donations/", moodle.org]
|
||||
|
||||
@@ -45,7 +45,7 @@ $CFG->admin = 'admin';
|
||||
$CFG->directorypermissions = 0777;
|
||||
|
||||
// Debug options - possible to be controlled by flag in future.
|
||||
$CFG->debug = (E_ALL); // DEBUG_DEVELOPER.
|
||||
$CFG->debug = (E_ALL | E_STRICT); // DEBUG_DEVELOPER.
|
||||
$CFG->debugdisplay = 1;
|
||||
$CFG->debugstringids = 1; // Add strings=1 to url to get string ids.
|
||||
$CFG->perfdebug = 15;
|
||||
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
- name: Setting up DB pgsql
|
||||
uses: m4nu56/postgresql-action@v1
|
||||
with:
|
||||
postgresql version: 14
|
||||
postgresql version: 13
|
||||
postgresql db: test
|
||||
postgresql user: test
|
||||
postgresql password: test
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
- name: Setting up PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: 8.4
|
||||
php-version: 8.3
|
||||
ini-values: max_input_vars=5000
|
||||
coverage: none
|
||||
|
||||
|
||||
@@ -15,11 +15,11 @@ on:
|
||||
default: ''
|
||||
|
||||
env:
|
||||
php: 8.4
|
||||
php: 8.3
|
||||
|
||||
jobs:
|
||||
Grunt:
|
||||
runs-on: ubuntu-24.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checking out code
|
||||
@@ -61,13 +61,13 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
# MySQL builds always run with the lowest PHP supported version.
|
||||
- os: ubuntu-24.04
|
||||
php: 8.2
|
||||
- os: ubuntu-22.04
|
||||
php: 8.1
|
||||
extensions:
|
||||
db: mysqli
|
||||
# PostgreSQL builds always run with the highest PHP supported version.
|
||||
- os: ubuntu-24.04
|
||||
php: 8.4
|
||||
- os: ubuntu-22.04
|
||||
php: 8.3
|
||||
db: pgsql
|
||||
|
||||
steps:
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
uses: moodlehq/mysql-action@v1
|
||||
with:
|
||||
collation server: utf8mb4_bin
|
||||
mysql version: 8.4
|
||||
mysql version: 8.0
|
||||
mysql database: test
|
||||
mysql user: test
|
||||
mysql password: test
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
if: ${{ matrix.db == 'pgsql' }}
|
||||
uses: m4nu56/postgresql-action@v1
|
||||
with:
|
||||
postgresql version: 14
|
||||
postgresql version: 13
|
||||
postgresql db: test
|
||||
postgresql user: test
|
||||
postgresql password: test
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
php: [8.2, 8.4]
|
||||
php: [8.1, 8.3]
|
||||
steps:
|
||||
- name: Construct repository URL
|
||||
run: echo "REPOSITORY_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> $GITHUB_ENV
|
||||
|
||||
@@ -8,7 +8,7 @@ on:
|
||||
required: false
|
||||
default: ''
|
||||
env:
|
||||
php: 8.4
|
||||
php: 8.3
|
||||
|
||||
jobs:
|
||||
Grunt:
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-latest
|
||||
php: 8.4
|
||||
php: 8.3
|
||||
# Ideally we should use mysql/mariadb, but they are 4x slower without tweaks and configuration
|
||||
# so let's run only postgres (1.5h vs 6h) only, If some day we want to improve the mysql runs,
|
||||
# this is the place to enable them.
|
||||
@@ -59,16 +59,16 @@ jobs:
|
||||
db: pgsql
|
||||
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
|
||||
- os: windows-latest
|
||||
php: 8.2
|
||||
php: 8.1
|
||||
db: pgsql
|
||||
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
|
||||
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium
|
||||
|
||||
steps:
|
||||
- name: Setting up DB mysql
|
||||
if: ${{ matrix.db == 'mysqli' }}
|
||||
uses: shogo82148/actions-setup-mysql@v1
|
||||
with:
|
||||
mysql-version: 8.4
|
||||
mysql-version: 8.0
|
||||
user: test
|
||||
password: test
|
||||
|
||||
|
||||
@@ -59,4 +59,3 @@ moodle-plugin-ci.phar
|
||||
phpcs.xml
|
||||
jsconfig.json
|
||||
UPGRADING-CURRENT.md
|
||||
.phpunit.cache
|
||||
|
||||
+9
-22
@@ -69,17 +69,6 @@ const fetchComponentData = () => {
|
||||
// The list of components includes the list of subsystems.
|
||||
componentData.components = {...componentData.subsystems};
|
||||
|
||||
const subpluginAdder = (subpluginType, subpluginTypePath) => {
|
||||
glob.sync(`${subpluginTypePath}/*/version.php`).forEach(versionPath => {
|
||||
const componentPath = fs.realpathSync(path.dirname(versionPath));
|
||||
const componentName = path.basename(componentPath);
|
||||
const frankenstyleName = `${subpluginType}_${componentName}`;
|
||||
|
||||
componentData.components[`${subpluginTypePath}/${componentName}`] = frankenstyleName;
|
||||
componentData.pathList.push(componentPath);
|
||||
});
|
||||
};
|
||||
|
||||
// Go through each of the plugintypes.
|
||||
Object.entries(components.plugintypes).forEach(([pluginType, pluginTypePath]) => {
|
||||
// We don't allow any code in this place..?
|
||||
@@ -95,18 +84,16 @@ const fetchComponentData = () => {
|
||||
if (fs.existsSync(subPluginConfigurationFile)) {
|
||||
const subpluginList = JSON.parse(fs.readFileSync(fs.realpathSync(subPluginConfigurationFile)));
|
||||
|
||||
if (subpluginList.subplugintypes) {
|
||||
Object.entries(subpluginList.subplugintypes).forEach(([subpluginType, subpluginTypePath]) => {
|
||||
subpluginAdder(
|
||||
subpluginType,
|
||||
`${pluginTypePath}/${componentName}/${subpluginTypePath}`
|
||||
);
|
||||
Object.entries(subpluginList.plugintypes).forEach(([subpluginType, subpluginTypePath]) => {
|
||||
glob.sync(`${subpluginTypePath}/*/version.php`).forEach(versionPath => {
|
||||
const componentPath = fs.realpathSync(path.dirname(versionPath));
|
||||
const componentName = path.basename(componentPath);
|
||||
const frankenstyleName = `${subpluginType}_${componentName}`;
|
||||
|
||||
componentData.components[`${subpluginTypePath}/${componentName}`] = frankenstyleName;
|
||||
componentData.pathList.push(componentPath);
|
||||
});
|
||||
} else if (subpluginList.plugintypes) {
|
||||
Object.entries(subpluginList.plugintypes).forEach(([subpluginType, subpluginTypePath]) => {
|
||||
subpluginAdder(subpluginType, subpluginTypePath);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1317
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -7,6 +7,6 @@ define("core_admin/expand_hash",["exports"],(function(_exports){Object.definePro
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 4.5
|
||||
*/
|
||||
const SELECTORS_COLLAPSE_ELEMENTS='[data-bs-toggle="collapse"]',SELECTORS_FOCUSTHENEXPAND_ELEMENTS=".focus-expand";_exports.init=()=>{const focusexpand=document.querySelector(SELECTORS_FOCUSTHENEXPAND_ELEMENTS);null==focusexpand||focusexpand.addEventListener("click",(()=>{expandSection("".concat(focusexpand.getAttribute("href")))}))};const expandSection=hash=>{const container=document.querySelector(hash),targetContainer=null==container?void 0:container.querySelector(SELECTORS_COLLAPSE_ELEMENTS);if("false"===(null==targetContainer?void 0:targetContainer.getAttribute("aria-expanded"))){const collapseId=targetContainer.getAttribute("aria-controls"),collapseContainer=document.getElementById(collapseId);collapseContainer.classList.remove("collapse"),collapseContainer.classList.add("show"),targetContainer.setAttribute("aria-expanded","true"),targetContainer.classList.remove("collapsed");const collapseElement=document.querySelector(".collapseexpand.collapsemenu");collapseElement.setAttribute("aria-expanded","true"),collapseElement.classList.remove("collapsed")}};_exports.expandSection=expandSection}));
|
||||
const SELECTORS_COLLAPSE_ELEMENTS='[data-toggle="collapse"]',SELECTORS_FOCUSTHENEXPAND_ELEMENTS=".focus-expand";_exports.init=()=>{const focusexpand=document.querySelector(SELECTORS_FOCUSTHENEXPAND_ELEMENTS);null==focusexpand||focusexpand.addEventListener("click",(()=>{expandSection("".concat(focusexpand.getAttribute("href")))}))};const expandSection=hash=>{const container=document.querySelector(hash),targetContainer=null==container?void 0:container.querySelector(SELECTORS_COLLAPSE_ELEMENTS);if("false"===(null==targetContainer?void 0:targetContainer.getAttribute("aria-expanded"))){const collapseId=targetContainer.getAttribute("aria-controls"),collapseContainer=document.getElementById(collapseId);collapseContainer.classList.remove("collapse"),collapseContainer.classList.add("show"),targetContainer.setAttribute("aria-expanded","true"),targetContainer.classList.remove("collapsed");const collapseElement=document.querySelector(".collapseexpand.collapsemenu");collapseElement.setAttribute("aria-expanded","true"),collapseElement.classList.remove("collapsed")}};_exports.expandSection=expandSection}));
|
||||
|
||||
//# sourceMappingURL=expand_hash.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"expand_hash.min.js","sources":["../src/expand_hash.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Expand the collapse section element.\n *\n * @module core_admin/expand_hash\n * @copyright Meirza <meirza.arson@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.5\n */\n\nconst SELECTORS = {\n COLLAPSE_ELEMENTS: '[data-bs-toggle=\"collapse\"]',\n FOCUSTHENEXPAND_ELEMENTS: '.focus-expand',\n};\n\n/**\n * Initializes the focus and expand functionality.\n */\nexport const init = () => {\n // Select all collapsible elements only.\n const focusexpand = document.querySelector(SELECTORS.FOCUSTHENEXPAND_ELEMENTS);\n\n // Add click event listener to the anchor element\n focusexpand?.addEventListener('click', () => {\n expandSection(`${focusexpand.getAttribute('href')}`);\n });\n};\n\n/**\n * Expands a section based on the provided URL hash.\n *\n * This function takes a hash string, finds the corresponding element in the DOM,\n * and expands it if it is currently collapsed. It updates the necessary ARIA\n * attributes and classes to reflect the expanded state.\n *\n * @param {string} hash - The hash (e.g., '#elementId') of the element to expand.\n */\nexport const expandSection = (hash) => {\n const container = document.querySelector(hash);\n const targetContainer = container?.querySelector(SELECTORS.COLLAPSE_ELEMENTS);\n\n if (targetContainer?.getAttribute('aria-expanded') === 'false') {\n const collapseId = targetContainer.getAttribute('aria-controls');\n const collapseContainer = document.getElementById(collapseId);\n\n // Show the content.\n collapseContainer.classList.remove('collapse');\n collapseContainer.classList.add('show');\n\n // Update aria-expanded attribute to reflect the new state.\n targetContainer.setAttribute('aria-expanded', 'true');\n targetContainer.classList.remove('collapsed');\n\n // Get collapse expand menu element.\n const collapseElement = document.querySelector('.collapseexpand.collapsemenu');\n // Ensure it gets noticed to make it work.\n collapseElement.setAttribute('aria-expanded', 'true');\n collapseElement.classList.remove('collapsed');\n }\n};\n"],"names":["SELECTORS","focusexpand","document","querySelector","addEventListener","expandSection","getAttribute","hash","container","targetContainer","collapseId","collapseContainer","getElementById","classList","remove","add","setAttribute","collapseElement"],"mappings":";;;;;;;;;MAwBMA,4BACiB,8BADjBA,mCAEwB,8BAMV,WAEVC,YAAcC,SAASC,cAAcH,oCAG3CC,MAAAA,aAAAA,YAAaG,iBAAiB,SAAS,KACnCC,wBAAiBJ,YAAYK,aAAa,oBAarCD,cAAiBE,aACpBC,UAAYN,SAASC,cAAcI,MACnCE,gBAAkBD,MAAAA,iBAAAA,UAAWL,cAAcH,gCAEM,WAAnDS,MAAAA,uBAAAA,gBAAiBH,aAAa,kBAA8B,OACtDI,WAAaD,gBAAgBH,aAAa,iBAC1CK,kBAAoBT,SAASU,eAAeF,YAGlDC,kBAAkBE,UAAUC,OAAO,YACnCH,kBAAkBE,UAAUE,IAAI,QAGhCN,gBAAgBO,aAAa,gBAAiB,QAC9CP,gBAAgBI,UAAUC,OAAO,mBAG3BG,gBAAkBf,SAASC,cAAc,gCAE/Cc,gBAAgBD,aAAa,gBAAiB,QAC9CC,gBAAgBJ,UAAUC,OAAO"}
|
||||
{"version":3,"file":"expand_hash.min.js","sources":["../src/expand_hash.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Expand the collapse section element.\n *\n * @module core_admin/expand_hash\n * @copyright Meirza <meirza.arson@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.5\n */\n\nconst SELECTORS = {\n COLLAPSE_ELEMENTS: '[data-toggle=\"collapse\"]',\n FOCUSTHENEXPAND_ELEMENTS: '.focus-expand',\n};\n\n/**\n * Initializes the focus and expand functionality.\n */\nexport const init = () => {\n // Select all collapsible elements only.\n const focusexpand = document.querySelector(SELECTORS.FOCUSTHENEXPAND_ELEMENTS);\n\n // Add click event listener to the anchor element\n focusexpand?.addEventListener('click', () => {\n expandSection(`${focusexpand.getAttribute('href')}`);\n });\n};\n\n/**\n * Expands a section based on the provided URL hash.\n *\n * This function takes a hash string, finds the corresponding element in the DOM,\n * and expands it if it is currently collapsed. It updates the necessary ARIA\n * attributes and classes to reflect the expanded state.\n *\n * @param {string} hash - The hash (e.g., '#elementId') of the element to expand.\n */\nexport const expandSection = (hash) => {\n const container = document.querySelector(hash);\n const targetContainer = container?.querySelector(SELECTORS.COLLAPSE_ELEMENTS);\n\n if (targetContainer?.getAttribute('aria-expanded') === 'false') {\n const collapseId = targetContainer.getAttribute('aria-controls');\n const collapseContainer = document.getElementById(collapseId);\n\n // Show the content.\n collapseContainer.classList.remove('collapse');\n collapseContainer.classList.add('show');\n\n // Update aria-expanded attribute to reflect the new state.\n targetContainer.setAttribute('aria-expanded', 'true');\n targetContainer.classList.remove('collapsed');\n\n // Get collapse expand menu element.\n const collapseElement = document.querySelector('.collapseexpand.collapsemenu');\n // Ensure it gets noticed to make it work.\n collapseElement.setAttribute('aria-expanded', 'true');\n collapseElement.classList.remove('collapsed');\n }\n};\n"],"names":["SELECTORS","focusexpand","document","querySelector","addEventListener","expandSection","getAttribute","hash","container","targetContainer","collapseId","collapseContainer","getElementById","classList","remove","add","setAttribute","collapseElement"],"mappings":";;;;;;;;;MAwBMA,4BACiB,2BADjBA,mCAEwB,8BAMV,WAEVC,YAAcC,SAASC,cAAcH,oCAG3CC,MAAAA,aAAAA,YAAaG,iBAAiB,SAAS,KACnCC,wBAAiBJ,YAAYK,aAAa,oBAarCD,cAAiBE,aACpBC,UAAYN,SAASC,cAAcI,MACnCE,gBAAkBD,MAAAA,iBAAAA,UAAWL,cAAcH,gCAEM,WAAnDS,MAAAA,uBAAAA,gBAAiBH,aAAa,kBAA8B,OACtDI,WAAaD,gBAAgBH,aAAa,iBAC1CK,kBAAoBT,SAASU,eAAeF,YAGlDC,kBAAkBE,UAAUC,OAAO,YACnCH,kBAAkBE,UAAUE,IAAI,QAGhCN,gBAAgBO,aAAa,gBAAiB,QAC9CP,gBAAgBI,UAAUC,OAAO,mBAG3BG,gBAAkBf,SAASC,cAAc,gCAE/Cc,gBAAgBD,aAAa,gBAAiB,QAC9CC,gBAAgBJ,UAAUC,OAAO"}
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
const SELECTORS = {
|
||||
COLLAPSE_ELEMENTS: '[data-bs-toggle="collapse"]',
|
||||
COLLAPSE_ELEMENTS: '[data-toggle="collapse"]',
|
||||
FOCUSTHENEXPAND_ELEMENTS: '.focus-expand',
|
||||
};
|
||||
|
||||
|
||||
@@ -118,10 +118,6 @@ foreach ($settingspage->children as $childpage) {
|
||||
}
|
||||
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
|
||||
$outputhtml .= $setting->output_html($data);
|
||||
if ($childpage->has_dependencies()) {
|
||||
$opts = ['dependencies' => $childpage->get_dependencies_for_javascript()];
|
||||
$PAGE->requires->js_call_amd('core/showhidesettings', 'init', [$opts]);
|
||||
}
|
||||
}
|
||||
$outputhtml .= html_writer::end_tag('fieldset');
|
||||
}
|
||||
|
||||
@@ -1,73 +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/>.
|
||||
|
||||
namespace core_admin\admin;
|
||||
|
||||
use admin_setting;
|
||||
|
||||
/**
|
||||
* Render a template as part of other admin settings.
|
||||
* Use for rendering additional html in settings.
|
||||
*
|
||||
* @package core_admin
|
||||
* @subpackage admin
|
||||
* @copyright 2024 Matt Porritt <matt.porritt@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class admin_setting_template_render extends admin_setting {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name The name of the setting.
|
||||
* @param string $templatename The name of the template to render.
|
||||
* @param array|\stdClass $context The context to pass to the template.
|
||||
*/
|
||||
public function __construct(
|
||||
string $name,
|
||||
/** @var string The name of the template to render. */
|
||||
protected string $templatename,
|
||||
/** @var array|\stdClass The context to pass to the template. */
|
||||
protected array|\stdClass $context
|
||||
) {
|
||||
$this->nosave = true;
|
||||
|
||||
parent::__construct($name, $templatename, '', '');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get_setting(): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function get_defaultsetting(): bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
|
||||
public function write_setting($data): string {
|
||||
// Do not write any setting.
|
||||
return '';
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function output_html($data, $query = ''): string {
|
||||
global $OUTPUT;
|
||||
|
||||
return $OUTPUT->render_from_template($this->templatename, $this->context);
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,6 @@ class purge_caches extends \moodleform {
|
||||
$mform->addElement('header', 'purgecacheheader', get_string('purgeselectedcaches', 'admin'));
|
||||
$checkboxes = [
|
||||
$mform->createElement('advcheckbox', 'theme', '', get_string('purgethemecache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'courses', '', get_string('purgecoursecache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'lang', '', get_string('purgelangcache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'js', '', get_string('purgejscache', 'admin')),
|
||||
$mform->createElement('advcheckbox', 'template', '', get_string('purgetemplates', 'admin')),
|
||||
|
||||
@@ -271,6 +271,8 @@ class task_log extends base {
|
||||
* @return filter[]
|
||||
*/
|
||||
protected function get_all_filters(): array {
|
||||
global $DB;
|
||||
|
||||
$tablealias = $this->get_table_alias('task_log');
|
||||
|
||||
// Name filter (Filter by classname).
|
||||
@@ -328,7 +330,7 @@ class task_log extends base {
|
||||
'output',
|
||||
new lang_string('task_logoutput', 'admin'),
|
||||
$this->get_entity_name(),
|
||||
"{$tablealias}.output"
|
||||
$DB->sql_cast_to_char("{$tablealias}.output")
|
||||
))
|
||||
->add_joins($this->get_joins());
|
||||
|
||||
|
||||
@@ -159,11 +159,11 @@ class users extends system_report {
|
||||
->add_callback(static function(string $fullname, \stdClass $row): string {
|
||||
if ($row->suspended) {
|
||||
$fullname .= ' ' . \html_writer::tag('span', get_string('suspended', 'moodle'),
|
||||
['class' => 'badge text-bg-secondary ms-1']);
|
||||
['class' => 'badge badge-secondary ms-1']);
|
||||
}
|
||||
if (!$row->confirmed) {
|
||||
$fullname .= ' ' . \html_writer::tag('span', get_string('confirmationpending', 'admin'),
|
||||
['class' => 'badge text-bg-danger ms-1']);
|
||||
['class' => 'badge badge-danger ms-1']);
|
||||
}
|
||||
return $fullname;
|
||||
});
|
||||
|
||||
@@ -232,7 +232,7 @@ class hook_list_table extends flexible_table {
|
||||
}
|
||||
|
||||
if ($tooltip) {
|
||||
$attributes['data-bs-toggle'] = 'tooltip';
|
||||
$attributes['data-toggle'] = 'tooltip';
|
||||
$attributes['title'] = $tooltip;
|
||||
}
|
||||
return html_writer::span($tag, "badge badge-{$type}", $attributes);
|
||||
|
||||
@@ -322,7 +322,7 @@ abstract class plugin_management_table extends flexible_table implements dynamic
|
||||
],
|
||||
'title' => $labelstr,
|
||||
'label' => $labelstr,
|
||||
'labelclasses' => 'visually-hidden',
|
||||
'labelclasses' => 'sr-only',
|
||||
];
|
||||
|
||||
return $OUTPUT->render_from_template('core_admin/setting_configtoggle', $params);
|
||||
|
||||
@@ -71,7 +71,7 @@ Example:
|
||||
exit(0);
|
||||
}
|
||||
|
||||
error_reporting(E_ALL);
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$content = core_component::get_cache_content();
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
define('NO_DEBUG_DISPLAY', false);
|
||||
|
||||
// extra execution prevention - we can not just require config.php here
|
||||
if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
@@ -166,7 +165,7 @@ $CFG->running_installer = true;
|
||||
$CFG->early_install_lang = true;
|
||||
$CFG->ostype = (stristr(PHP_OS, 'win') && !stristr(PHP_OS, 'darwin')) ? 'WINDOWS' : 'UNIX';
|
||||
$CFG->dboptions = array();
|
||||
$CFG->debug = (E_ALL);
|
||||
$CFG->debug = (E_ALL | E_STRICT);
|
||||
$CFG->debugdisplay = true;
|
||||
$CFG->debugdeveloper = true;
|
||||
|
||||
@@ -217,6 +216,7 @@ $databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'n
|
||||
'auroramysql' => moodle_database::get_driver_instance('auroramysql', 'native'),
|
||||
'mariadb'=> moodle_database::get_driver_instance('mariadb', 'native'),
|
||||
'pgsql' => moodle_database::get_driver_instance('pgsql', 'native'),
|
||||
'oci' => moodle_database::get_driver_instance('oci', 'native'),
|
||||
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
|
||||
);
|
||||
foreach ($databases as $type=>$database) {
|
||||
@@ -560,6 +560,7 @@ do {
|
||||
if ($interactive) {
|
||||
cli_separator();
|
||||
cli_heading(get_string('dbprefix', 'install'));
|
||||
//TODO: solve somehow the prefix trouble for oci.
|
||||
if ($options['prefix'] !== '') {
|
||||
$prompt = get_string('clitypevaluedefault', 'admin', $options['prefix']);
|
||||
} else {
|
||||
|
||||
@@ -50,6 +50,6 @@ Example:
|
||||
exit(0);
|
||||
}
|
||||
|
||||
\core\session\manager::destroy_all();
|
||||
\core\session\manager::kill_all_sessions();
|
||||
|
||||
exit(0);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
define('CLI_SCRIPT', true);
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
require(__DIR__.'/../../config.php');
|
||||
require_once($CFG->libdir.'/clilib.php');
|
||||
|
||||
@@ -55,14 +55,13 @@ If courseid is set, course module/s will be added into the course.
|
||||
|
||||
Options:
|
||||
-f, --file=STRING Path to the backup file.
|
||||
-c, --categoryid=INT ID of the course category to restore to. This option is ignored when restoring an activity and courseid is set.
|
||||
-C, --courseid=INT ID of the course to restore to. This option is ignored when restoring a course and the categoryid is set.
|
||||
-c, --categoryid=INT ID of the course category to restore to.
|
||||
-C, --courseid=INT ID of the course to restore to. This option is ignored if categoryid is set.
|
||||
-s, --showdebugging Show developer level debugging information
|
||||
-h, --help Print out this help.
|
||||
|
||||
Example:
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/restore_backup.php --file=/path/to/backup/coursebackup.mbz --categoryid=1\n
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/restore_backup.php --file=/path/to/backup/activitybackup.mbz --courseid=1\n
|
||||
\$sudo -u www-data /usr/bin/php admin/cli/restore_backup.php --file=/path/to/backup/file.mbz --categoryid=1\n
|
||||
EOL;
|
||||
|
||||
echo $help;
|
||||
@@ -85,15 +84,11 @@ if ($options['categoryid']) {
|
||||
if (!$category = $DB->get_record('course_categories', ['id' => $options['categoryid']], 'id')) {
|
||||
throw new \moodle_exception('invalidcategoryid');
|
||||
}
|
||||
}
|
||||
|
||||
if ($options['courseid']) {
|
||||
} else if ($options['courseid']) {
|
||||
if (!$course = $DB->get_record('course', ['id' => $options['courseid']], 'id')) {
|
||||
throw new \moodle_exception('invalidcourseid');
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($category) && empty($course)) {
|
||||
} else {
|
||||
throw new \moodle_exception('invalidoption');
|
||||
}
|
||||
|
||||
@@ -105,46 +100,28 @@ $fp = get_file_packer('application/vnd.moodle.backup');
|
||||
$fp->extract_to_pathname($options['file'], $path);
|
||||
|
||||
cli_heading(get_string('preprocessingbackupfile'));
|
||||
|
||||
try {
|
||||
// Create a temporary restore controller to determine the restore type.
|
||||
$tmprc = new restore_controller($backupdir, SITEID, backup::INTERACTIVE_NO,
|
||||
backup::MODE_GENERAL, $admin->id, backup::TARGET_EXISTING_ADDING);
|
||||
// Restore the backup into a new course if:
|
||||
// - It is a course backup and the category is set.
|
||||
// - It is an activity backup and the course is not set.
|
||||
$restoreasnewcourse = ($tmprc->get_type() === backup::TYPE_1COURSE && !empty($category)) ||
|
||||
($tmprc->get_type() !== backup::TYPE_1COURSE && empty($course));
|
||||
// Make sure to clean up the temporary restore controller.
|
||||
$tmprc->destroy();
|
||||
list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoringcourse', 'backup'),
|
||||
get_string('restoringcourseshortname', 'backup'));
|
||||
|
||||
if ($restoreasnewcourse) {
|
||||
list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoringcourse', 'backup'),
|
||||
get_string('restoringcourseshortname', 'backup'));
|
||||
$courseid = restore_dbops::create_new_course($fullname, $shortname, $category->id);
|
||||
$rc = new restore_controller($backupdir, $courseid, backup::INTERACTIVE_NO,
|
||||
backup::MODE_GENERAL, $admin->id, backup::TARGET_NEW_COURSE);
|
||||
} else {
|
||||
if (!empty($course)) {
|
||||
$courseid = $course->id;
|
||||
$rc = new restore_controller($backupdir, $courseid, backup::INTERACTIVE_NO,
|
||||
backup::MODE_GENERAL, $admin->id, backup::TARGET_EXISTING_ADDING);
|
||||
} else {
|
||||
$courseid = restore_dbops::create_new_course($fullname, $shortname, $category->id);
|
||||
$rc = new restore_controller($backupdir, $courseid, backup::INTERACTIVE_NO,
|
||||
backup::MODE_GENERAL, $admin->id, backup::TARGET_NEW_COURSE);
|
||||
}
|
||||
$rc->execute_precheck();
|
||||
$rc->execute_plan();
|
||||
$rc->destroy();
|
||||
|
||||
// Rename the course's full and short names with the backup file's original names if the backup file is an activity backup
|
||||
// that is restored to a new course.
|
||||
if ($restoreasnewcourse && $rc->get_type() !== backup::TYPE_1COURSE) {
|
||||
// Rename course name if the backup is from course module and restore to category.
|
||||
if (empty($course)) {
|
||||
$course = get_course($courseid);
|
||||
$backupinfo = $rc->get_info();
|
||||
$tmpfullname = $backupinfo->original_course_fullname ?? get_string('restoretonewcourse', 'backup');
|
||||
$tmpshortname = $backupinfo->original_course_shortname ?? get_string('newcourse');
|
||||
list($fullname, $shortname) = restore_dbops::calculate_course_names(
|
||||
courseid: 0,
|
||||
fullname: $tmpfullname,
|
||||
shortname: $tmpshortname,
|
||||
);
|
||||
list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoretonewcourse', 'backup'),
|
||||
get_string('newcourse'));
|
||||
$course->fullname = $fullname;
|
||||
$course->shortname = $shortname;
|
||||
$course->visible = 1;
|
||||
|
||||
+2
-204
@@ -4327,7 +4327,6 @@
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="8.1.0" level="required">
|
||||
<RESTRICT function="restrict_php_version_84" message="unsupportedphpversion84" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -4523,7 +4522,6 @@
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="8.1.0" level="required">
|
||||
<RESTRICT function="restrict_php_version_84" message="unsupportedphpversion84" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -4716,7 +4714,7 @@
|
||||
<VENDOR name="mysql" version="8.4" />
|
||||
<VENDOR name="postgres" version="14" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="auroramysql" version="8.0" />
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="8.2.0" level="required">
|
||||
</PHP>
|
||||
@@ -4894,210 +4892,10 @@
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_aurora_version" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="5.1" requires="4.2.3">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.11.0" />
|
||||
<VENDOR name="mysql" version="8.4" />
|
||||
<VENDOR name="postgres" version="15" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="auroramysql" version="8.0" />
|
||||
</DATABASE>
|
||||
<PHP version="8.2.0" 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="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mbstringrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</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="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
<PHP_EXTENSION name="sodium" level="required"/>
|
||||
<PHP_EXTENSION name="exif" level="optional"/>
|
||||
</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_SETTING name="zend.exception_ignore_args" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingzendexceptionignoreargs" />
|
||||
</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_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="sixtyfourbitsrequired" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_db_prefix_length" level="required">
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_oracle_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_async_backup" level="recommended">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_aurora_version" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
+69
-1
@@ -43,6 +43,61 @@ $providers = get_message_providers();
|
||||
$preferences = get_message_output_default_preferences();
|
||||
|
||||
if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$newpreferences = array();
|
||||
// Prepare default message outputs settings.
|
||||
foreach ($providers as $provider) {
|
||||
$componentproviderbase = $provider->component.'_'.$provider->name;
|
||||
$disableprovidersetting = $componentproviderbase.'_disable';
|
||||
if (!isset($form->$disableprovidersetting)) {
|
||||
$newpreferences[$disableprovidersetting] = 1;
|
||||
} else {
|
||||
$newpreferences[$disableprovidersetting] = 0;
|
||||
}
|
||||
|
||||
$componentprovidersetting = $componentproviderbase.'_locked';
|
||||
foreach ($processors as $processor) {
|
||||
$value = 0;
|
||||
if (isset($form->{$componentprovidersetting}[$processor->name])) {
|
||||
$value = $form->{$componentprovidersetting}[$processor->name];
|
||||
if ($value == 'on') {
|
||||
$value = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Record the site preference.
|
||||
$newpreferences[$processor->name.'_provider_'.$componentprovidersetting] = $value;
|
||||
}
|
||||
|
||||
$componentprovidersetting = $componentproviderbase.'_enabled';
|
||||
$newsettings = [];
|
||||
if (isset($form->$componentprovidersetting)) {
|
||||
// Store defined comma-separated processors as setting value.
|
||||
// Using array_filter eliminates elements set to 0 above.
|
||||
$newsettings = array_keys(array_filter($form->{$componentprovidersetting}));
|
||||
}
|
||||
|
||||
// Let's join existing setting values for disabled processors.
|
||||
$property = 'message_provider_'.$componentprovidersetting;
|
||||
if (property_exists($preferences, $property)) {
|
||||
$existingsetting = $preferences->$property;
|
||||
foreach ($disabledprocessors as $disable) {
|
||||
if (strpos($existingsetting, $disable->name) > -1) {
|
||||
$newsettings[] = $disable->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$value = join(',', $newsettings);
|
||||
if (empty($value)) {
|
||||
$value = null;
|
||||
}
|
||||
|
||||
// Record the site preference.
|
||||
$newpreferences['message_provider_'.$componentprovidersetting] = $value;
|
||||
}
|
||||
|
||||
// Update database.
|
||||
$transaction = $DB->start_delegated_transaction();
|
||||
|
||||
// Save processors enabled/disabled status.
|
||||
foreach ($allprocessors as $processor) {
|
||||
@@ -51,11 +106,24 @@ if (($form = data_submitted()) && confirm_sesskey()) {
|
||||
$class::enable_plugin($processor->name, $enabled);
|
||||
}
|
||||
|
||||
foreach ($newpreferences as $name => $value) {
|
||||
$old = isset($preferences->$name) ? $preferences->$name : '';
|
||||
|
||||
if ($old != $value) {
|
||||
add_to_config_log($name, $old, $value, 'core');
|
||||
}
|
||||
|
||||
set_config($name, $value, 'message');
|
||||
}
|
||||
$transaction->allow_commit();
|
||||
|
||||
core_plugin_manager::reset_caches();
|
||||
|
||||
$url = new moodle_url('message.php');
|
||||
redirect($url);
|
||||
}
|
||||
|
||||
// Page settings.
|
||||
// Page settings
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$renderer = $PAGE->get_renderer('core', 'message');
|
||||
|
||||
|
||||
@@ -91,8 +91,7 @@ if (!empty($hostid) && array_key_exists($hostid, $hosts)) {
|
||||
// this query is horrible and has to be remapped afterwards, because of the non-uniqueness
|
||||
// of the remoterep service (it has two plugins so far that use it)
|
||||
// it's possible to get a unique list back using a subquery with LIMIT but that would break oracle
|
||||
// so it's best to just do this small query and then remap the results afterwards.
|
||||
// TODO: Optimise the query, as Oracle-specific constraints no longer apply.
|
||||
// so it's best to just do this small query and then remap the results afterwards
|
||||
$sql = '
|
||||
SELECT DISTINCT
|
||||
' . $DB->sql_concat('r.plugintype', "'_'", 'r.pluginname', "'_'", 's.name') . ' AS uniqueid,
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# core_adminpresets (subsystem) Upgrade notes
|
||||
|
||||
## 5.0
|
||||
|
||||
### Removed
|
||||
|
||||
- Remove chat and survey from Adminpresets.
|
||||
|
||||
For more information see [MDL-82457](https://tracker.moodle.org/browse/MDL-82457)
|
||||
- Removed block_mnet_hosts from admin presets
|
||||
|
||||
For more information see [MDL-84309](https://tracker.moodle.org/browse/MDL-84309)
|
||||
@@ -193,12 +193,14 @@ class helper {
|
||||
// Set Activity chooser tabs to "Starred, Recommended, All".
|
||||
static::add_item($presetid, 'activitychoosertabmode', '4');
|
||||
|
||||
// Modules: Hide database, external tool (lti), IMS content package (imscp), lesson, SCORM, wiki, workshop.
|
||||
// Modules: Hide chat, database, external tool (lti), IMS content package (imscp), lesson, SCORM, survey, wiki, workshop.
|
||||
static::add_plugin($presetid, 'mod', 'chat', false);
|
||||
static::add_plugin($presetid, 'mod', 'data', false);
|
||||
static::add_plugin($presetid, 'mod', 'lti', false);
|
||||
static::add_plugin($presetid, 'mod', 'imscp', false);
|
||||
static::add_plugin($presetid, 'mod', 'lesson', false);
|
||||
static::add_plugin($presetid, 'mod', 'scorm', false);
|
||||
static::add_plugin($presetid, 'mod', 'survey', false);
|
||||
static::add_plugin($presetid, 'mod', 'wiki', false);
|
||||
static::add_plugin($presetid, 'mod', 'workshop', false);
|
||||
|
||||
@@ -207,7 +209,7 @@ class helper {
|
||||
static::add_plugin($presetid, 'availability', 'profile', false);
|
||||
|
||||
// Blocks: Hide Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
|
||||
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Online users,
|
||||
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Online users,
|
||||
// Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities,
|
||||
// Starred courses, Tags, YouTube.
|
||||
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
|
||||
@@ -226,6 +228,7 @@ class helper {
|
||||
static::add_plugin($presetid, 'block', 'login', false);
|
||||
static::add_plugin($presetid, 'block', 'site_main_menu', false);
|
||||
static::add_plugin($presetid, 'block', 'mentees', false);
|
||||
static::add_plugin($presetid, 'block', 'mnet_hosts', false);
|
||||
static::add_plugin($presetid, 'block', 'private_files', false);
|
||||
static::add_plugin($presetid, 'block', 'blog_recent', false);
|
||||
static::add_plugin($presetid, 'block', 'rss_client', false);
|
||||
@@ -289,7 +292,7 @@ class helper {
|
||||
static::add_item($presetid, 'enablenotes', '1');
|
||||
static::add_item($presetid, 'enableblogs', '1');
|
||||
static::add_item($presetid, 'enablebadges', '1');
|
||||
static::add_item($presetid, 'enableanalytics', '0');
|
||||
static::add_item($presetid, 'enableanalytics', '1');
|
||||
static::add_item($presetid, 'enabled', '1', 'core_competency');
|
||||
static::add_item($presetid, 'pushcourseratingstouserplans', '1', 'core_competency');
|
||||
static::add_item($presetid, 'showdataretentionsummary', '1', 'tool_dataprivacy');
|
||||
@@ -312,7 +315,7 @@ class helper {
|
||||
static::add_plugin($presetid, 'availability', 'profile', true);
|
||||
|
||||
// Blocks: Enable Activities, Blog menu, Blog tags, Comments, Course completion status, Courses, Flickr,
|
||||
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Online users,
|
||||
// Global search, Latest badges, Learning plans, Logged in user, Login, Main menu, Mentees, Network servers, Online users,
|
||||
// Private files, Recent blog entries, Recently accessed courses, Search forums, Section links, Social activities,
|
||||
// Starred courses, Tags, YouTube.
|
||||
// Hidden by default: Course/site summary, RSS feeds, Self completion, Feedback.
|
||||
@@ -330,6 +333,7 @@ class helper {
|
||||
static::add_plugin($presetid, 'block', 'login', true);
|
||||
static::add_plugin($presetid, 'block', 'site_main_menu', true);
|
||||
static::add_plugin($presetid, 'block', 'mentees', true);
|
||||
static::add_plugin($presetid, 'block', 'mnet_hosts', true);
|
||||
static::add_plugin($presetid, 'block', 'private_files', true);
|
||||
static::add_plugin($presetid, 'block', 'blog_recent', true);
|
||||
static::add_plugin($presetid, 'block', 'search_forums', true);
|
||||
|
||||
@@ -1133,11 +1133,6 @@ class manager {
|
||||
'visiblevalue' => $visiblevalue,
|
||||
];
|
||||
|
||||
if ($plugininfo && $plugininfo->is_deprecated()) {
|
||||
$skipped[] = $data;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($pluginclass == '\core\plugininfo\orphaned') {
|
||||
$skipped[] = $data;
|
||||
continue;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PRESET>
|
||||
<NAME>Imported preset</NAME>
|
||||
<COMMENTS><p dir="ltr" style="text-align:left;">Porfolios enabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_page plugins and enabled atto_html, block_activity_modules and mod_lesson.</p></COMMENTS>
|
||||
<COMMENTS><p dir="ltr" style="text-align:left;">Porfolios enabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_chat plugins and enabled atto_html, block_activity_modules and mod_lesson.</p></COMMENTS>
|
||||
<PRESET_DATE>1631615985</PRESET_DATE>
|
||||
<SITE_URL>http://demo.moodle</SITE_URL>
|
||||
<AUTHOR>Ada Lovelace</AUTHOR>
|
||||
@@ -30,7 +30,7 @@
|
||||
<ACTIVITY_MODULES>1</ACTIVITY_MODULES>
|
||||
</BLOCK>
|
||||
<MOD>
|
||||
<PAGE>0</PAGE>
|
||||
<CHAT>0</CHAT>
|
||||
<DATA>0</DATA>
|
||||
<LESSON>1</LESSON>
|
||||
</MOD>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PRESET>
|
||||
<NAME>Starter</NAME>
|
||||
<COMMENTS><p dir="ltr" style="text-align:left;">Badges disabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_page plugins and enabled atto_html and block_activity_modules.</p></COMMENTS>
|
||||
<COMMENTS><p dir="ltr" style="text-align:left;">Badges disabled, Emojipicker enabled, Lesson media width set to 900 and maxanswers set to 2 and disabled advanced. Plugins: disabled block_html, mod_database and mod_chat plugins and enabled atto_html and block_activity_modules.</p></COMMENTS>
|
||||
<PRESET_DATE>1631615985</PRESET_DATE>
|
||||
<SITE_URL>http://demo.moodle</SITE_URL>
|
||||
<AUTHOR>Ada Lovelace</AUTHOR>
|
||||
@@ -30,7 +30,7 @@
|
||||
<ACTIVITY_MODULES>1</ACTIVITY_MODULES>
|
||||
</BLOCK>
|
||||
<MOD>
|
||||
<PAGE>0</PAGE>
|
||||
<CHAT>0</CHAT>
|
||||
<DATA>0</DATA>
|
||||
<LESSON>1</LESSON>
|
||||
</MOD>
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace core_adminpresets;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass core_adminpresets_generator
|
||||
*/
|
||||
final class generator_test extends \advanced_testcase {
|
||||
class generator_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test the behaviour of create_preset() method.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace core_adminpresets;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_adminpresets\helper
|
||||
*/
|
||||
final class helper_test extends \advanced_testcase {
|
||||
class helper_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test the behaviour of create_preset() method.
|
||||
@@ -285,15 +285,12 @@ final class helper_test extends \advanced_testcase {
|
||||
|
||||
// We need to change some of the default values; otherwise, the full preset won't be applied, because all the settings
|
||||
// and plugins are the same.
|
||||
set_config('enableanalytics', '1');
|
||||
set_config('enableanalytics', '0');
|
||||
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_adminpresets');
|
||||
$generator->create_preset(['name' => 'Preset 1']);
|
||||
|
||||
$invokable = self::get_invokable();
|
||||
set_error_handler($invokable, E_WARNING);
|
||||
$presetid = helper::change_default_preset($preset);
|
||||
restore_error_handler();
|
||||
|
||||
if (empty($settings) && empty($plugins)) {
|
||||
// The preset hasn't been applied.
|
||||
@@ -334,7 +331,7 @@ final class helper_test extends \advanced_testcase {
|
||||
],
|
||||
'plugins' => [
|
||||
'assign' => 1,
|
||||
'wiki' => 0,
|
||||
'chat' => 0,
|
||||
'data' => 0,
|
||||
'lesson' => 0,
|
||||
],
|
||||
@@ -374,7 +371,7 @@ final class helper_test extends \advanced_testcase {
|
||||
],
|
||||
'plugins' => [
|
||||
'assign' => 1,
|
||||
'page' => 0,
|
||||
'chat' => 0,
|
||||
'data' => 0,
|
||||
'lesson' => 1,
|
||||
],
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace core_adminpresets\local\setting;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_adminpresets\local\setting\adminpresets_admin_setting_bloglevel
|
||||
*/
|
||||
final class adminpresets_admin_setting_bloglevel_test extends \advanced_testcase {
|
||||
class adminpresets_admin_setting_bloglevel_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test the behaviour of save_value() method.
|
||||
@@ -75,15 +75,15 @@ final class adminpresets_admin_setting_bloglevel_test extends \advanced_testcase
|
||||
public static function save_value_provider(): array {
|
||||
return [
|
||||
'Save the bloglevel and set blog_menu block visibility to true' => [
|
||||
'settingvalue' => BLOG_USER_LEVEL,
|
||||
'setttingvalue' => BLOG_USER_LEVEL,
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
'Same value to bloglevel, so it will not be saved' => [
|
||||
'settingvalue' => BLOG_SITE_LEVEL,
|
||||
'setttingvalue' => BLOG_SITE_LEVEL,
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
'Save the bloglevel and set blog_menu block visibility to false' => [
|
||||
'settingvalue' => 0,
|
||||
'setttingvalue' => 0,
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace core_adminpresets\local\setting;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_adminpresets\local\setting\adminpresets_admin_setting_sitesettext
|
||||
*/
|
||||
final class adminpresets_admin_setting_sitesettext_test extends \advanced_testcase {
|
||||
class adminpresets_admin_setting_sitesettext_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test the behaviour of save_value() method.
|
||||
@@ -70,22 +70,22 @@ final class adminpresets_admin_setting_sitesettext_test extends \advanced_testca
|
||||
return [
|
||||
'Fullname: different value' => [
|
||||
'settingname' => 'fullname',
|
||||
'settingvalue' => 'New site fullname',
|
||||
'setttingvalue' => 'New site fullname',
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
'Fullname: same value' => [
|
||||
'settingname' => 'fullname',
|
||||
'settingvalue' => 'PHPUnit test site',
|
||||
'setttingvalue' => 'PHPUnit test site',
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
'Summary: different value' => [
|
||||
'settingname' => 'summary',
|
||||
'settingvalue' => 'This is a new site summary.',
|
||||
'setttingvalue' => 'This is a new site summary.',
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
'Summary: same value' => [
|
||||
'settingname' => 'summary',
|
||||
'settingvalue' => '',
|
||||
'setttingvalue' => '',
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace core_adminpresets\local\setting;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_adminpresets\local\setting\adminpresets_setting
|
||||
*/
|
||||
final class adminpresets_setting_test extends \advanced_testcase {
|
||||
class adminpresets_setting_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test the behaviour of save_value() method.
|
||||
@@ -83,28 +83,28 @@ final class adminpresets_setting_test extends \advanced_testcase {
|
||||
'category' => 'optionalsubsystems',
|
||||
'settingplugin' => 'core',
|
||||
'settingname' => 'enablebadges',
|
||||
'settingvalue' => '1',
|
||||
'setttingvalue' => '1',
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
'Core setting with a different value is saved' => [
|
||||
'category' => 'optionalsubsystems',
|
||||
'settingplugin' => 'core',
|
||||
'settingname' => 'enablebadges',
|
||||
'settingvalue' => '0',
|
||||
'setttingvalue' => '0',
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
'Plugin setting with the same value is not saved' => [
|
||||
'category' => 'modsettinglesson',
|
||||
'settingplugin' => 'mod_lesson',
|
||||
'settingname' => 'mediawidth',
|
||||
'settingvalue' => '640',
|
||||
'setttingvalue' => '640',
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
'Plugin setting with different value is saved' => [
|
||||
'category' => 'modsettinglesson',
|
||||
'settingplugin' => 'mod_lesson',
|
||||
'settingname' => 'mediawidth',
|
||||
'settingvalue' => '900',
|
||||
'setttingvalue' => '900',
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
];
|
||||
@@ -174,7 +174,7 @@ final class adminpresets_setting_test extends \advanced_testcase {
|
||||
'settingplugin' => 'mod_lesson',
|
||||
'settingname' => 'maxanswers',
|
||||
'advsettingname' => 'maxanswers_adv',
|
||||
'advsettingvalue' => '1',
|
||||
'advsetttingvalue' => '1',
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
'Plugin setting with different value is saved' => [
|
||||
@@ -182,7 +182,7 @@ final class adminpresets_setting_test extends \advanced_testcase {
|
||||
'settingplugin' => 'mod_lesson',
|
||||
'settingname' => 'maxanswers',
|
||||
'advsettingname' => 'maxanswers_adv',
|
||||
'advsettingvalue' => '0',
|
||||
'advsetttingvalue' => '0',
|
||||
'expectedsaved' => true,
|
||||
],
|
||||
'Plugin setting without advanced attributes are not saved' => [
|
||||
@@ -190,7 +190,7 @@ final class adminpresets_setting_test extends \advanced_testcase {
|
||||
'settingplugin' => 'mod_lesson',
|
||||
'settingname' => 'maxanswers',
|
||||
'advsettingname' => null,
|
||||
'advsettingvalue' => '0',
|
||||
'advsetttingvalue' => '0',
|
||||
'expectedsaved' => false,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -28,7 +28,7 @@ use stdClass;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_adminpresets\manager
|
||||
*/
|
||||
final class manager_test extends \advanced_testcase {
|
||||
class manager_test extends \advanced_testcase {
|
||||
/**
|
||||
* Include required libraries.
|
||||
*/
|
||||
@@ -438,10 +438,7 @@ final class manager_test extends \advanced_testcase {
|
||||
// Call the method to be tested.
|
||||
$manager = new manager();
|
||||
try {
|
||||
$invokable = self::get_invokable();
|
||||
set_error_handler($invokable, E_WARNING);
|
||||
list($xml, $preset, $settingsfound, $pluginsfound) = $manager->import_preset($filecontents);
|
||||
restore_error_handler();
|
||||
} catch (\exception $e) {
|
||||
if ($expectedexception) {
|
||||
$this->assertInstanceOf($expectedexception, $e);
|
||||
@@ -509,7 +506,7 @@ final class manager_test extends \advanced_testcase {
|
||||
'activity_modules' => 1,
|
||||
],
|
||||
'mod' => [
|
||||
'page' => 0,
|
||||
'chat' => 0,
|
||||
'data' => 0,
|
||||
'lesson' => 1,
|
||||
],
|
||||
@@ -812,41 +809,4 @@ final class manager_test extends \advanced_testcase {
|
||||
$enabledplugins = \core\plugininfo\qtype::get_enabled_plugins();
|
||||
$this->assertArrayHasKey('truefalse', $enabledplugins);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test apply_preset for a deprecated plugin type.
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @covers ::apply_preset
|
||||
* @return void
|
||||
*/
|
||||
public function test_apply_preset_deprecated_plugintype(): void {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create a preset.
|
||||
$generator = $this->getDataGenerator()->get_plugin_generator('core_adminpresets');
|
||||
$presetid = $generator->create_preset();
|
||||
|
||||
// Add a mock plugin into the preset. This plugin will be mocked and deprecated below.
|
||||
helper::add_plugin($presetid, 'fake', 'fullfeatured', true);
|
||||
|
||||
// Inject the mock plugin type + plugin, and deprecate it.
|
||||
$this->add_mocked_plugintype('fake', "$CFG->libdir/tests/fixtures/fakeplugins/fake", true);
|
||||
$this->add_mocked_plugin('fake', 'fullfeatured', $CFG->libdir . '/tests/fixtures/fakeplugins/fake/fullfeatured');
|
||||
|
||||
// Pre-flight check to ensure that the plugin is deprecated.
|
||||
$pluginman = \core\plugin_manager::instance();
|
||||
$plugininfo = $pluginman->get_plugin_info('fake_fullfeatured');
|
||||
// Expected, unit-test-only debugging, since \core\plugin_manager isn't aware of the mock plugininfo class for this type.
|
||||
$this->assertDebuggingCalled();
|
||||
$this->assertTrue($plugininfo->is_deprecated());
|
||||
|
||||
// Finally, check apply_preset method, verifying the deprecated plugin is skipped.
|
||||
$manager = new manager();
|
||||
[$applied, $skipped] = $manager->apply_preset($presetid);
|
||||
$this->assertdebuggingcalledcount(2); // Expected unit-test-only debugging, as above.
|
||||
$this->assertContains('fake', array_column($skipped, 'plugin'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use core_privacy\tests\provider_testcase;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @coversDefaultClass \core_adminpresets\privacy\provider
|
||||
*/
|
||||
final class privacy_provider_test extends provider_testcase {
|
||||
class privacy_provider_test extends provider_testcase {
|
||||
|
||||
/**
|
||||
* Test for provider::get_metadata().
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/php -f
|
||||
<?php
|
||||
|
||||
//error_reporting(0);
|
||||
//ini_set('display_errors',0);
|
||||
require_once(__DIR__ . '/../config.php');
|
||||
$tmp = explode('@',$_ENV['RECIPIENT']);
|
||||
$address = $tmp[0];
|
||||
|
||||
// BOUNCE EMAILS TO NOREPLY
|
||||
if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
|
||||
$user = new stdClass();
|
||||
$user->email = $_ENV['SENDER'];
|
||||
|
||||
if (!validate_email($user->email)) {
|
||||
die();
|
||||
}
|
||||
|
||||
$site = get_site();
|
||||
$subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname));
|
||||
$body = get_string('noreplybouncemessage','moodle',format_string($site->fullname))."\n\n";
|
||||
|
||||
$fd = fopen('php://stdin','r');
|
||||
if ($fd) {
|
||||
while(!feof($fd)) {
|
||||
$body .= fgets($fd);
|
||||
}
|
||||
fclose($fd);
|
||||
}
|
||||
|
||||
$user->id = 0; // to prevent anything annoying happening
|
||||
|
||||
$from->firstname = null;
|
||||
$from->lastname = null;
|
||||
$from->email = '<>';
|
||||
$from->maildisplay = true;
|
||||
|
||||
email_to_user($user,$from,$subject,$body);
|
||||
die ();
|
||||
}
|
||||
/// ALL OTHER PROCESSING
|
||||
// we need to split up the address
|
||||
$prefix = substr($address,0,4);
|
||||
$mod = substr($address,4,2);
|
||||
$modargs = substr($address,6,-16);
|
||||
$hash = substr($address,-16);
|
||||
|
||||
if (substr(md5($prefix.$mod.$modargs.$CFG->siteidentifier),0,16) != $hash) {
|
||||
die("HASH DIDN'T MATCH!\n");
|
||||
}
|
||||
list(,$modid) = unpack('C',base64_decode($mod.'=='));
|
||||
|
||||
if ($modid == '0') { // special
|
||||
$modname = 'moodle';
|
||||
}
|
||||
else {
|
||||
$modname = $DB->get_field("modules", "name", array("id"=>$modid));
|
||||
include_once('mod/'.$modname.'/lib.php');
|
||||
}
|
||||
$function = $modname.'_process_email';
|
||||
|
||||
if (!function_exists($function)) {
|
||||
die();
|
||||
}
|
||||
$fd = fopen('php://stdin','r');
|
||||
if (!$fd) {
|
||||
exit();
|
||||
}
|
||||
|
||||
while(!feof($fd)) {
|
||||
$body .= fgets($fd);
|
||||
}
|
||||
|
||||
$function($modargs,$body);
|
||||
|
||||
fclose($fd);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
define('IGNORE_COMPONENT_CACHE', true);
|
||||
|
||||
require_once('../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
@@ -44,11 +42,7 @@ if ($data = $form->get_data()) {
|
||||
purge_caches();
|
||||
$message = get_string('purgecachesfinished', 'admin');
|
||||
} else {
|
||||
// When passing selected options, ensure each is cast to boolean for strict comparison.
|
||||
purge_caches(array_map(
|
||||
fn($option) => (bool) $option,
|
||||
$data->purgeselectedoptions,
|
||||
));
|
||||
purge_caches($data->purgeselectedoptions);
|
||||
$message = get_string('purgeselectedcachesfinished', 'admin');
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,8 @@ admin_externalpage_setup('registrationmoodleorg');
|
||||
|
||||
$unregistration = optional_param('unregistration', false, PARAM_BOOL);
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
// Consider the site 'registered' if records exist locally and at the hub.
|
||||
$siteisregistered = \core\hub\registration::is_registered() && core\hub\api::is_site_registered_in_hub();
|
||||
|
||||
if ($unregistration && $siteisregistered) {
|
||||
if ($unregistration && \core\hub\registration::is_registered()) {
|
||||
if ($confirm) {
|
||||
require_sesskey();
|
||||
\core\hub\registration::unregister(false, false);
|
||||
@@ -62,7 +60,7 @@ if (!$returnurl = optional_param('returnurl', null, PARAM_LOCALURL)) {
|
||||
$returnurl = $isinitialregistration ? '/admin/index.php' : '/admin/registration/index.php';
|
||||
}
|
||||
|
||||
$siteregistrationform = new \core\hub\site_registration_form(null, ['registered' => $siteisregistered]);
|
||||
$siteregistrationform = new \core\hub\site_registration_form();
|
||||
$siteregistrationform->set_data(['returnurl' => $returnurl]);
|
||||
if ($fromform = $siteregistrationform->get_data()) {
|
||||
|
||||
@@ -88,7 +86,7 @@ echo $OUTPUT->header();
|
||||
// Current status of registration.
|
||||
|
||||
$notificationtype = \core\output\notification::NOTIFY_ERROR;
|
||||
if ($siteisregistered) {
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
$lastupdated = \core\hub\registration::get_last_updated();
|
||||
if ($lastupdated == 0) {
|
||||
$registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
|
||||
@@ -106,7 +104,7 @@ if ($siteisregistered) {
|
||||
}
|
||||
|
||||
// Heading.
|
||||
if ($siteisregistered) {
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorgupdate', 'core_hub'));
|
||||
} else if ($isinitialregistration) {
|
||||
echo $OUTPUT->heading(get_string('registerwithmoodleorgcomplete', 'core_hub'));
|
||||
@@ -119,7 +117,7 @@ echo $renderer->moodleorg_registration_message();
|
||||
|
||||
$siteregistrationform->display();
|
||||
|
||||
if ($siteisregistered) {
|
||||
if (\core\hub\registration::is_registered()) {
|
||||
// Unregister link.
|
||||
$unregisterhuburl = new moodle_url("/admin/registration/index.php", ['unregistration' => 1]);
|
||||
echo html_writer::div(html_writer::link($unregisterhuburl, get_string('unregister', 'hub')), 'unregister mt-2');
|
||||
|
||||
+37
-96
@@ -295,6 +295,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$output .= $this->header();
|
||||
$output .= $this->output->heading(get_string('notifications', 'admin'));
|
||||
$output .= $this->upgrade_news_message();
|
||||
$output .= $this->maturity_info($maturity);
|
||||
$output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
|
||||
$output .= $this->insecure_dataroot_warning($insecuredataroot);
|
||||
@@ -754,6 +755,22 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
return $this->box($copyrighttext, 'copyright');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a transient notification for important upgrades messages for
|
||||
* specific releases.
|
||||
*
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
protected function upgrade_news_message() {
|
||||
return $this->notification(
|
||||
get_string('importantupdates_content', 'admin'),
|
||||
'info',
|
||||
false,
|
||||
get_string('importantupdates_title', 'admin'),
|
||||
'i/circleinfo, core'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a warning about installing development code if necesary.
|
||||
* @param int $maturity
|
||||
@@ -1024,7 +1041,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function plugins_check_table(core_plugin_manager $pluginman, $version, array $options = array()) {
|
||||
global $CFG;
|
||||
$plugininfo = $pluginman->get_plugins(true);
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
@@ -1059,20 +1076,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$upgradeabortable = $pluginman->list_restorable_archives();
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
// Skip deleted plugin types.
|
||||
if (\core_component::is_deleted_plugin_type($type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip deprecated plugintypes having no installed plugins, in which case there is nothing to report.
|
||||
if (\core_component::is_deprecated_plugin_type($type)) {
|
||||
$reportableplugins = array_filter($plugins, function($plugininfo) {
|
||||
return $plugininfo->versiondb != null;
|
||||
});
|
||||
if (empty($reportableplugins)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$header = new html_table_cell($pluginman->plugintype_name_plural($type));
|
||||
$header->header = true;
|
||||
@@ -1121,7 +1124,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
);
|
||||
|
||||
$versiondb = new html_table_cell($plugin->versiondb);
|
||||
$versiondisk = $plugin->is_deprecated() ? new html_table_cell() : new html_table_cell($plugin->versiondisk);
|
||||
$versiondisk = new html_table_cell($plugin->versiondisk);
|
||||
|
||||
if ($isstandard = $plugin->is_standard()) {
|
||||
$row->attributes['class'] .= ' standard';
|
||||
@@ -1140,9 +1143,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$statuscode = $plugin->get_status();
|
||||
$row->attributes['class'] .= ' status-' . $statuscode;
|
||||
if ($plugin->is_deprecated()) {
|
||||
$row->attributes['class'] .= ' deprecatedtype';
|
||||
}
|
||||
$statusclass = 'statustext badge ';
|
||||
switch ($statuscode) {
|
||||
case core_plugin_manager::PLUGIN_STATUS_NEW:
|
||||
@@ -1163,18 +1163,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$status = html_writer::span(get_string('status_' . $statuscode, 'core_plugin'), $statusclass);
|
||||
|
||||
$deprecatedstatus = '';
|
||||
if ($plugin->is_deprecated()) {
|
||||
// During upgrade, omit the status for deprecated plugin types, unless it's 'missing from disk'.
|
||||
// Deprecated plugins cannot be installed, upgraded, downgraded, and won't be automatically deleted.
|
||||
$status = in_array($statuscode,
|
||||
[core_plugin_manager::PLUGIN_STATUS_MISSING, core_plugin_manager::PLUGIN_STATUS_DELETE]) ? $status : '';
|
||||
$deprecatedstatus = html_writer::span(
|
||||
get_string('deprecated_type', 'core_plugin'),
|
||||
'statustext badge bg-danger text-white'
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($installabortable[$plugin->component])) {
|
||||
$status .= $this->output->single_button(
|
||||
new moodle_url($this->page->url, array('abortinstall' => $plugin->component, 'confirmplugincheck' => 0)),
|
||||
@@ -1200,7 +1188,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
}
|
||||
|
||||
$status = new html_table_cell($sourcelabel.' '.$status.' '.$deprecatedstatus);
|
||||
$status = new html_table_cell($sourcelabel.' '.$status);
|
||||
if ($plugin->pluginsupported != null) {
|
||||
$requires = new html_table_cell($this->required_column($plugin, $pluginman, $version, $CFG->branch));
|
||||
} else {
|
||||
@@ -1208,8 +1196,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
$statusisboring = in_array($statuscode, array(
|
||||
core_plugin_manager::PLUGIN_STATUS_NODB, core_plugin_manager::PLUGIN_STATUS_UPTODATE))
|
||||
&& !$plugin->is_deprecated();
|
||||
core_plugin_manager::PLUGIN_STATUS_NODB, core_plugin_manager::PLUGIN_STATUS_UPTODATE));
|
||||
|
||||
if ($options['xdep']) {
|
||||
// we want to see only plugins with failed dependencies
|
||||
@@ -1685,26 +1672,12 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function plugins_overview_panel(core_plugin_manager $pluginman, array $options = array()) {
|
||||
|
||||
$plugininfo = $pluginman->get_plugins(true);
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
$this->page->requires->js_call_amd('core_admin/plugins_overview', 'init');
|
||||
|
||||
$numtotal = $numextension = $numupdatable = $numinstallable = $nummissing = $numnew = 0;
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
if (\core_component::is_deleted_plugin_type($type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip deprecated plugintypes having no installed plugins, in which case there is nothing to report.
|
||||
if (\core_component::is_deprecated_plugin_type($type)) {
|
||||
$reportableplugins = array_filter($plugins, function($plugininfo) {
|
||||
return $plugininfo->versiondb != null;
|
||||
});
|
||||
if (empty($reportableplugins)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
if ($res = $plugin->available_updates()) {
|
||||
$numupdatable++;
|
||||
@@ -1733,13 +1706,13 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$this->page->url,
|
||||
get_string('overviewall', 'core_plugin'),
|
||||
['title' => get_string('filterall', 'core_plugin'), 'data-filterby' => 'all', 'class' => 'active']
|
||||
).' '.html_writer::span($numtotal, 'badge text-dark number number-all');
|
||||
).' '.html_writer::span($numtotal, 'badge number number-all');
|
||||
|
||||
$infoext = html_writer::link(
|
||||
new moodle_url($this->page->url, [], 'additional'),
|
||||
get_string('overviewext', 'core_plugin'),
|
||||
['title' => get_string('filtercontribonly', 'core_plugin'), 'data-filterby' => 'additional']
|
||||
).' '.html_writer::span($numextension, 'badge text-dark number number-additional');
|
||||
).' '.html_writer::span($numextension, 'badge number number-additional');
|
||||
|
||||
if ($numupdatable) {
|
||||
$infoupdatable = html_writer::link(
|
||||
@@ -1805,7 +1778,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
*/
|
||||
public function plugins_control_panel(core_plugin_manager $pluginman, array $options = array()) {
|
||||
|
||||
$plugininfo = $pluginman->get_plugins(true);
|
||||
$plugininfo = $pluginman->get_plugins();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-control-panel';
|
||||
@@ -1822,20 +1795,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
);
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
if (\core_component::is_deleted_plugin_type($type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip deprecated plugintypes having no installed plugins, in which case there is nothing to report.
|
||||
if (\core_component::is_deprecated_plugin_type($type)) {
|
||||
$reportableplugins = array_filter($plugins, function($plugininfo) {
|
||||
return $plugininfo->versiondb != null;
|
||||
});
|
||||
if (empty($reportableplugins)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$heading = $pluginman->plugintype_name_plural($type);
|
||||
$pluginclass = core_plugin_manager::resolve_plugininfo_class($type);
|
||||
if ($manageurl = $pluginclass::get_manage_url()) {
|
||||
@@ -1878,9 +1837,6 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
$status = $plugin->get_status();
|
||||
$row->attributes['class'] .= ' status-'.$status;
|
||||
if ($plugin->is_deprecated()) {
|
||||
$row->attributes['class'] .= ' deprecatedtype';
|
||||
}
|
||||
$pluginname = html_writer::tag('div', $icon.$plugin->displayname, array('class' => 'displayname')).
|
||||
html_writer::tag('div', $plugin->component, array('class' => 'componentname'));
|
||||
$pluginname = new html_table_cell($pluginname);
|
||||
@@ -1922,29 +1878,19 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
$source = '';
|
||||
} else {
|
||||
$row->attributes['class'] .= ' additional';
|
||||
$source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge me-1 text-bg-info');
|
||||
$source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge mr-1 bg-info text-white');
|
||||
}
|
||||
|
||||
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
|
||||
$row->attributes['class'] .= ' missing';
|
||||
$msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge text-bg-danger');
|
||||
$msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge bg-danger text-white');
|
||||
} else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
|
||||
$row->attributes['class'] .= ' newplugin';
|
||||
$msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge text-bg-success');
|
||||
$msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge bg-success text-white');
|
||||
} else {
|
||||
$msg = '';
|
||||
}
|
||||
|
||||
$deprecatedmsg = '';
|
||||
if ($plugin->is_deprecated()) {
|
||||
// Omit the status for deprecated plugin types, unless it's 'missing from disk'.
|
||||
$msg = $status == core_plugin_manager::PLUGIN_STATUS_MISSING ? $msg : '';
|
||||
$deprecatedmsg = html_writer::div(
|
||||
get_string('deprecated_type', 'core_plugin'),
|
||||
'statusmsg badge bg-danger text-white'
|
||||
);
|
||||
}
|
||||
|
||||
$requriedby = $pluginman->other_plugins_that_require($plugin->component);
|
||||
if ($requriedby) {
|
||||
$requiredby = html_writer::tag('div', get_string('requiredby', 'core_plugin', implode(', ', $requriedby)),
|
||||
@@ -1961,7 +1907,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
}
|
||||
}
|
||||
|
||||
$notes = new html_table_cell($source.' '.$msg.' '.$deprecatedmsg.$requiredby.$updateinfo);
|
||||
$notes = new html_table_cell($source.$msg.$requiredby.$updateinfo);
|
||||
|
||||
$row->cells = array(
|
||||
$pluginname, $version, $availability, $settings, $uninstall, $notes
|
||||
@@ -2063,7 +2009,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
get_string('status'),
|
||||
);
|
||||
$servertable->colclasses = array('centeralign name', 'centeralign info', 'leftalign report', 'leftalign plugin', 'centeralign status');
|
||||
$servertable->attributes['class'] = 'table table-striped admintable environmenttable generaltable table-sm';
|
||||
$servertable->attributes['class'] = 'admintable environmenttable generaltable table-sm';
|
||||
$servertable->id = 'serverstatus';
|
||||
|
||||
$serverdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
|
||||
@@ -2076,7 +2022,7 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
get_string('status'),
|
||||
);
|
||||
$othertable->colclasses = array('aligncenter info', 'alignleft report', 'alignleft plugin', 'aligncenter status');
|
||||
$othertable->attributes['class'] = 'table table-striped admintable environmenttable generaltable table-sm';
|
||||
$othertable->attributes['class'] = 'admintable environmenttable generaltable table-sm';
|
||||
$othertable->id = 'otherserverstatus';
|
||||
|
||||
$otherdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
|
||||
@@ -2177,33 +2123,29 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
} else {
|
||||
$report = $this->doc_link(join('/', $linkparts), get_string($stringtouse, 'admin', $rec), true);
|
||||
}
|
||||
// Enclose report text in div so feedback text will be displayed underneath it.
|
||||
$report = html_writer::div($report);
|
||||
|
||||
// Format error or warning line
|
||||
if ($errorline) {
|
||||
$messagetype = 'error';
|
||||
$statusclass = 'bg-danger text-white';
|
||||
$feedbackclass = 'alert-danger';
|
||||
} else if ($warningline) {
|
||||
$messagetype = 'warn';
|
||||
$statusclass = 'bg-warning text-dark';
|
||||
$feedbackclass = 'alert-warning';
|
||||
} else {
|
||||
$messagetype = 'ok';
|
||||
$statusclass = 'bg-success text-white';
|
||||
$feedbackclass = 'alert-success';
|
||||
}
|
||||
$status = html_writer::span($status, 'badge ' . $statusclass);
|
||||
// Here we'll store all the feedback found
|
||||
$feedbacktext = '';
|
||||
// Append the feedback if there is some
|
||||
$feedbacktext .= $environment_result->strToReport($environment_result->getFeedbackStr(),
|
||||
"alert {$feedbackclass} px-2 py-1 m-1");
|
||||
$feedbacktext .= $environment_result->strToReport($environment_result->getFeedbackStr(), $messagetype);
|
||||
//Append the bypass if there is some
|
||||
$feedbacktext .= $environment_result->strToReport($environment_result->getBypassStr(),
|
||||
'alert alert-warning px-2 py-1 m-1');
|
||||
$feedbacktext .= $environment_result->strToReport($environment_result->getBypassStr(), 'warn');
|
||||
//Append the restrict if there is some
|
||||
$feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(),
|
||||
'alert alert-danger px-2 py-1 m-1');
|
||||
$feedbacktext .= $environment_result->strToReport($environment_result->getRestrictStr(), 'error');
|
||||
|
||||
$report .= $feedbacktext;
|
||||
|
||||
@@ -2247,11 +2189,10 @@ class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
$output = '';
|
||||
$output .= $this->header();
|
||||
$output .= $this->container_start('upgradekeyreq');
|
||||
$output .= $this->heading(get_string('upgradekeyreq', 'core_admin'));
|
||||
$output .= $this->container_start('upgradekeyreq w-25');
|
||||
$output .= html_writer::start_tag('form', array('method' => 'POST', 'action' => $url));
|
||||
$output .= html_writer::empty_tag('input', [
|
||||
'id' => 'upgradekey',
|
||||
'name' => 'upgradekey',
|
||||
'type' => 'password',
|
||||
'class' => 'form-control w-auto',
|
||||
|
||||
@@ -43,7 +43,7 @@ abstract class core_role_capability_table_base {
|
||||
protected $id;
|
||||
|
||||
/** Added to the class="" attribute on output. */
|
||||
protected $classes = ['rolecap table w-auto table-hover'];
|
||||
protected $classes = array('rolecap table-hover');
|
||||
|
||||
/** Default number of capabilities in the table for the search UI to be shown. */
|
||||
const NUM_CAPS_FOR_SEARCH = 12;
|
||||
|
||||
@@ -544,7 +544,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
$options[$type] = get_string('archetype'.$type, 'role');
|
||||
}
|
||||
return html_writer::select($options, 'archetype', $this->role->archetype, false,
|
||||
['class' => 'form-select']);
|
||||
array('class' => 'custom-select'));
|
||||
}
|
||||
|
||||
protected function get_assignable_levels_control() {
|
||||
|
||||
@@ -83,6 +83,8 @@ class role extends base {
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
global $DB;
|
||||
|
||||
$contextalias = $this->get_table_alias('context');
|
||||
$rolealias = $this->get_table_alias('role');
|
||||
|
||||
@@ -95,9 +97,9 @@ class role extends base {
|
||||
->add_joins($this->get_joins())
|
||||
->add_fields("{$rolealias}.name, {$rolealias}.shortname, {$rolealias}.id, {$contextalias}.id AS contextid")
|
||||
->add_fields(context_helper::get_preload_record_columns_sql($contextalias))
|
||||
// The sorting is on name, unless empty then we use shortname.
|
||||
// The sorting is on name, unless empty (determined by single space - thanks Oracle) then we use shortname.
|
||||
->set_is_sortable(true, [
|
||||
"CASE WHEN COALESCE({$rolealias}.name, '') = ''
|
||||
"CASE WHEN " . $DB->sql_concat("{$rolealias}.name", "' '") . " = ' '
|
||||
THEN {$rolealias}.shortname
|
||||
ELSE {$rolealias}.name
|
||||
END",
|
||||
@@ -121,9 +123,9 @@ class role extends base {
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
->add_fields("{$rolealias}.name, {$rolealias}.shortname")
|
||||
// The sorting is on name, unless empty then we use shortname.
|
||||
// The sorting is on name, unless empty (determined by single space - thanks Oracle) then we use shortname.
|
||||
->set_is_sortable(true, [
|
||||
"CASE WHEN COALESCE({$rolealias}.name, '') = ''
|
||||
"CASE WHEN " . $DB->sql_concat("{$rolealias}.name", "' '") . " = ' '
|
||||
THEN {$rolealias}.shortname
|
||||
ELSE {$rolealias}.name
|
||||
END",
|
||||
@@ -159,6 +161,10 @@ class role extends base {
|
||||
->set_is_sortable(true);
|
||||
|
||||
// Description column.
|
||||
$descriptionfieldsql = "{$rolealias}.description";
|
||||
if ($DB->get_dbfamily() === 'oracle') {
|
||||
$descriptionfieldsql = $DB->sql_order_by_text($descriptionfieldsql, 1024);
|
||||
}
|
||||
$columns[] = (new column(
|
||||
'description',
|
||||
new lang_string('description'),
|
||||
@@ -166,8 +172,8 @@ class role extends base {
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
->set_type(column::TYPE_LONGTEXT)
|
||||
->add_fields("{$rolealias}.description, {$rolealias}.shortname")
|
||||
->set_is_sortable(true)
|
||||
->add_field($descriptionfieldsql, 'description')
|
||||
->add_field("{$rolealias}.shortname")
|
||||
->add_callback(fn(?string $description, stdClass $role) => match ($description) {
|
||||
null => '',
|
||||
default => role_get_description($role),
|
||||
|
||||
@@ -26,7 +26,7 @@ use core_role_preset;
|
||||
* @copyright 2013 Petr Skoda {@link http://skodak.org}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class preset_test extends \advanced_testcase {
|
||||
class preset_test extends \advanced_testcase {
|
||||
public function test_xml(): void {
|
||||
global $DB;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ use core_privacy\local\request\approved_userlist;
|
||||
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class provider_test extends provider_testcase {
|
||||
class provider_test extends provider_testcase {
|
||||
/**
|
||||
* Test to check export_user_preferences.
|
||||
* returns user preferences data.
|
||||
@@ -77,7 +77,7 @@ final class provider_test extends provider_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
|
||||
$cmcontext2 = \context_module::instance($page->cmid);
|
||||
@@ -125,7 +125,7 @@ final class provider_test extends provider_testcase {
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$course2 = $this->getDataGenerator()->create_course();
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$page = $this->getDataGenerator()->create_module('page', array('course' => $course->id));
|
||||
$cmcontext2 = \context_module::instance($page->cmid);
|
||||
@@ -257,7 +257,7 @@ final class provider_test extends provider_testcase {
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$student = $DB->get_record('role', array('shortname' => 'student'), '*', MUST_EXIST);
|
||||
$manager = $DB->get_record('role', array('shortname' => 'manager'), '*', MUST_EXIST);
|
||||
@@ -348,7 +348,7 @@ final class provider_test extends provider_testcase {
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course->id]);
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
$student = $DB->get_record('role', array('shortname' => 'student'), '*', MUST_EXIST);
|
||||
$manager = $DB->get_record('role', array('shortname' => 'manager'), '*', MUST_EXIST);
|
||||
@@ -499,8 +499,8 @@ final class provider_test extends provider_testcase {
|
||||
// Create course category.
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
// Create assignment module.
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id]);
|
||||
// Create chat module.
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course1->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
@@ -619,8 +619,8 @@ final class provider_test extends provider_testcase {
|
||||
// Create course category.
|
||||
$coursecat = $this->getDataGenerator()->create_category();
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
// Create assignment module.
|
||||
$cm = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id]);
|
||||
// Create chat module.
|
||||
$cm = $this->getDataGenerator()->create_module('chat', ['course' => $course1->id]);
|
||||
$cmcontext = \context_module::instance($cm->cmid);
|
||||
|
||||
$systemcontext = \context_system::instance();
|
||||
|
||||
@@ -20,8 +20,13 @@ namespace core_role\reportbuilder\datasource;
|
||||
|
||||
use core\context\course;
|
||||
use core_reportbuilder_generator;
|
||||
use core_reportbuilder_testcase;
|
||||
use core_reportbuilder\local\filters\{date, select, text};
|
||||
use core_reportbuilder\tests\core_reportbuilder_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once("{$CFG->dirroot}/reportbuilder/tests/helpers.php");
|
||||
|
||||
/**
|
||||
* Unit tests for roles datasource
|
||||
@@ -149,7 +154,7 @@ final class roles_test extends core_reportbuilder_testcase {
|
||||
], true],
|
||||
'Filter role name (no match)' => ['role:name', [
|
||||
'role:name_operator' => select::EQUAL_TO,
|
||||
'role:name_value' => $DB->get_field('role', 'id', ['shortname' => 'teacher']),
|
||||
'role:name_value' => -1,
|
||||
], false],
|
||||
'Filter role archetype' => ['role:archetype', [
|
||||
'role:archetype_operator' => select::EQUAL_TO,
|
||||
|
||||
+10
-29
@@ -30,16 +30,9 @@ if ($hassiteconfig) {
|
||||
// Add settings page for AI provider settings.
|
||||
$providers = new admin_settingpage('aiprovider', new lang_string('aiproviders', 'ai'));
|
||||
$providers->add(new admin_setting_heading('availableproviders',
|
||||
get_string('availableproviders', 'core_ai'),
|
||||
get_string('availableproviders_desc', 'core_ai')));
|
||||
// Add call to action to add a new provider.
|
||||
$providers->add(new \core_admin\admin\admin_setting_template_render(
|
||||
name: 'addnewprovider',
|
||||
templatename: 'core_ai/admin_add_provider',
|
||||
context: ['addnewproviderurl' => new moodle_url('/ai/configure.php')]
|
||||
));
|
||||
|
||||
$providers->add(new \core_ai\admin\admin_setting_provider_manager(
|
||||
get_string('availableproviders', 'core_ai'),
|
||||
get_string('availableproviders_desc', 'core_ai')));
|
||||
$providers->add(new \core_admin\admin\admin_setting_plugin_manager(
|
||||
'aiprovider',
|
||||
\core_ai\table\aiprovider_management_table::class,
|
||||
'manageaiproviders',
|
||||
@@ -47,6 +40,13 @@ if ($hassiteconfig) {
|
||||
));
|
||||
$ADMIN->add('ai', $providers);
|
||||
|
||||
// Load settings for all AI providers.
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('aiprovider');
|
||||
foreach ($plugins as $plugin) {
|
||||
/** @var \core\plugininfo\aiprovider $plugin */
|
||||
$plugin->load_settings($ADMIN, 'ai', $hassiteconfig);
|
||||
}
|
||||
|
||||
// Add settings page for AI placement settings.
|
||||
$placements = new admin_settingpage('aiplacement', new lang_string('aiplacements', 'ai'));
|
||||
$placements->add(new admin_setting_heading('availableplacements',
|
||||
@@ -67,22 +67,3 @@ if ($hassiteconfig) {
|
||||
$plugin->load_settings($ADMIN, 'ai', $hassiteconfig);
|
||||
}
|
||||
}
|
||||
|
||||
// AI reports category.
|
||||
$ADMIN->add('reports', new admin_category('aireports', get_string('aireports', 'core_ai')));
|
||||
// Add AI policy acceptance report.
|
||||
$aipolicyacceptance = new admin_externalpage(
|
||||
'aipolicyacceptancereport',
|
||||
get_string('aipolicyacceptance', 'core_ai'),
|
||||
new moodle_url('/ai/policy_acceptance_report.php'),
|
||||
'moodle/ai:viewaipolicyacceptancereport'
|
||||
);
|
||||
$ADMIN->add('aireports', $aipolicyacceptance);
|
||||
// Add AI usage report.
|
||||
$aiusage = new admin_externalpage(
|
||||
'aiusagereport',
|
||||
get_string('aiusage', 'core_ai'),
|
||||
new moodle_url('/ai/usage_report.php'),
|
||||
'moodle/ai:viewaiusagereport',
|
||||
);
|
||||
$ADMIN->add('aireports', $aiusage);
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "appearance" category
|
||||
|
||||
$ADMIN->add('appearance', new admin_category('themes', new lang_string('themesettingscustom', 'admin')));
|
||||
|
||||
$capabilities = array(
|
||||
'moodle/my:configsyspages',
|
||||
'moodle/tag:manage'
|
||||
@@ -332,10 +330,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
$temp->add(new admin_setting_configcheckbox('logininfoinsecurelayout',
|
||||
new lang_string('logininfoinsecurelayout', 'admin'),
|
||||
new lang_string('logininfoinsecurelayout_desc', 'admin'), 0));
|
||||
// Process primary navigation (custom menu) through Moodle filters.
|
||||
$temp->add(new admin_setting_configcheckbox('navfilter',
|
||||
new lang_string('navfilter', 'admin'),
|
||||
new lang_string('navfilter_desc', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'),
|
||||
new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
|
||||
$defaultsettingcustomusermenuitems = [
|
||||
@@ -361,6 +355,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
new lang_string('themeselector', 'admin'), $CFG->wwwroot . '/admin/themeselector.php'));
|
||||
|
||||
// Settings page for each theme.
|
||||
$ADMIN->add('appearance', new admin_category('themes', new lang_string('themesettingscustom', 'admin')));
|
||||
foreach (core_component::get_plugin_list('theme') as $theme => $themedir) {
|
||||
$settingspath = "$themedir/settings.php";
|
||||
if (file_exists($settingspath)) {
|
||||
|
||||
+13
-21
@@ -28,22 +28,13 @@ require_once($CFG->libdir . '/pdflib.php');
|
||||
|
||||
use core_admin\local\settings\filesize;
|
||||
|
||||
$ADMIN->add('courses', new admin_category('coursedefaultsettings', new lang_string('defaultsettingscategory', 'course')));
|
||||
$ADMIN->add('courses', new admin_category('groups', new lang_string('groups')));
|
||||
$ADMIN->add('courses', new admin_category('activitychooser', new lang_string('activitychoosercategory', 'course')));
|
||||
$ADMIN->add('courses', new admin_category('backups', new lang_string('backups', 'admin')));
|
||||
|
||||
$capabilities = [
|
||||
$capabilities = array(
|
||||
'moodle/backup:backupcourse',
|
||||
'moodle/category:manage',
|
||||
'moodle/course:create',
|
||||
'moodle/site:approvecourse',
|
||||
'moodle/restore:restorecourse',
|
||||
'moodle/course:manageactivities',
|
||||
'moodle/course:configurecustomfields',
|
||||
'moodle/group:configurecustomfields',
|
||||
'moodle/course:recommendactivity',
|
||||
];
|
||||
'moodle/restore:restorecourse'
|
||||
);
|
||||
if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
// Speedup for non-admins, add all caps used on this page.
|
||||
$ADMIN->add('courses',
|
||||
@@ -113,6 +104,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
}
|
||||
|
||||
// Add a category for the course Default settings.
|
||||
$ADMIN->add('courses', new admin_category('coursedefaultsettings', new lang_string('defaultsettingscategory', 'course')));
|
||||
// Course Default Settings Page.
|
||||
// NOTE: these settings must be applied after all other settings because they depend on them.
|
||||
|
||||
@@ -306,7 +298,8 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
)
|
||||
);
|
||||
|
||||
// Add to the 'Groups' category.
|
||||
// Add a category for the Groups.
|
||||
$ADMIN->add('courses', new admin_category('groups', new lang_string('groups')));
|
||||
$ADMIN->add(
|
||||
'groups',
|
||||
new admin_externalpage(
|
||||
@@ -326,7 +319,8 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
)
|
||||
);
|
||||
|
||||
// Add to the 'Activity Chooser' category.
|
||||
// Add a category for the Activity Chooser.
|
||||
$ADMIN->add('courses', new admin_category('activitychooser', new lang_string('activitychoosercategory', 'course')));
|
||||
$temp = new admin_settingpage('activitychoosersettings', new lang_string('activitychoosersettings', 'course'));
|
||||
// Tab mode for the activity chooser.
|
||||
$temp->add(
|
||||
@@ -378,7 +372,8 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
)
|
||||
);
|
||||
|
||||
// Add to the 'Backups' category.
|
||||
// Add a category for backups.
|
||||
$ADMIN->add('courses', new admin_category('backups', new lang_string('backups','admin')));
|
||||
|
||||
// Create a page for general backups configuration and defaults.
|
||||
$temp = new admin_settingpage('backupgeneralsettings', new lang_string('generalbackdefaults', 'backup'), 'moodle/backup:backupcourse');
|
||||
@@ -420,6 +415,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_userscompletion', new lang_string('generaluserscompletion','backup'), new lang_string('configgeneraluserscompletion','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_logs', new lang_string('generallogs','backup'), new lang_string('configgenerallogs','backup'), array('value'=>0, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), array('value'=>0, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_groups',
|
||||
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
|
||||
array('value' => 1, 'locked' => 0)));
|
||||
@@ -463,13 +459,8 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock(
|
||||
'backup/backup_import_badges',
|
||||
new lang_string('generalbadges', 'backup'),
|
||||
new lang_string('configgeneralbadges', 'backup'),
|
||||
['value' => 0, 'locked' => 0],
|
||||
));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_calendarevents', new lang_string('generalcalendarevents','backup'), new lang_string('configgeneralcalendarevents','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), array('value'=>1, 'locked'=>0)));
|
||||
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_groups',
|
||||
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
|
||||
array('value' => 1, 'locked' => 0)));
|
||||
@@ -605,6 +596,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_userscompletion', new lang_string('generaluserscompletion','backup'), new lang_string('configgeneraluserscompletion','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_logs', new lang_string('generallogs', 'backup'), new lang_string('configgenerallogs', 'backup'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_histories', new lang_string('generalhistories','backup'), new lang_string('configgeneralhistories','backup'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_questionbank', new lang_string('generalquestionbank','backup'), new lang_string('configgeneralquestionbank','backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_groups', new lang_string('generalgroups', 'backup'),
|
||||
new lang_string('configgeneralgroups', 'backup'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_competencies', new lang_string('generalcompetencies','backup'), new lang_string('configgeneralcompetencies','backup'), 1));
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
// * Miscellaneous settings
|
||||
|
||||
// Experimental settings page.
|
||||
$ADMIN->add('development', new admin_category('experimental', new lang_string('experimental', 'admin')));
|
||||
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
if ($hassiteconfig) { // Speedup for non-admins, add all caps used on this page.
|
||||
// Experimental settings page
|
||||
$ADMIN->add('development', new admin_category('experimental', new lang_string('experimental','admin')));
|
||||
|
||||
$temp = new admin_settingpage('experimentalsettings', new lang_string('experimentalsettings', 'admin'));
|
||||
//TODO: Re-enable cc-import once re-implemented in 2.0.x
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if (!$ADMIN->locate('file_redactor')) {
|
||||
$ADMIN->add('server', new admin_category('file_redactor', get_string('redactor', 'core_files')));
|
||||
}
|
||||
if ($hassiteconfig) {
|
||||
if (!$ADMIN->locate('file_redactor')) {
|
||||
$ADMIN->add('server', new admin_category('file_redactor', get_string('redactor', 'core_files')));
|
||||
}
|
||||
|
||||
$manager = \core\di::get(\core_files\redactor\manager::class);
|
||||
|
||||
|
||||
@@ -2,13 +2,6 @@
|
||||
|
||||
// This file defines settingpages and externalpages under the "grades" section
|
||||
|
||||
use core\plugininfo\gradepenalty;
|
||||
|
||||
$ADMIN->add('grades', new admin_category('gradereports', new lang_string('reportsettings', 'grades')));
|
||||
$ADMIN->add('grades', new admin_category('gradeimports', new lang_string('importsettings', 'grades')));
|
||||
$ADMIN->add('grades', new admin_category('gradeexports', new lang_string('exportsettings', 'grades')));
|
||||
$ADMIN->add('grades', new admin_category('gradepenalty', new lang_string('gradepenalty', 'grades')));
|
||||
|
||||
if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
or has_capability('moodle/grade:manageletters', $systemcontext)) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
@@ -98,7 +91,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
$temp->add(new admin_setting_my_grades_report());
|
||||
|
||||
$temp->add(new admin_setting_configtext('gradereport_mygradeurl', new lang_string('externalurl', 'grades'),
|
||||
new lang_string('externalurl_desc', 'grades'), ''));
|
||||
new lang_string('externalurl_desc', 'grades'), ''));
|
||||
}
|
||||
$ADMIN->add('grades', $temp);
|
||||
|
||||
@@ -188,6 +181,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
// The plugins must implement a settings.php file that adds their admin settings to the $settings object
|
||||
|
||||
// Reports
|
||||
$ADMIN->add('grades', new admin_category('gradereports', new lang_string('reportsettings', 'grades')));
|
||||
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($plugindir.'/settings.php')) {
|
||||
@@ -200,6 +194,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
}
|
||||
|
||||
// Imports
|
||||
$ADMIN->add('grades', new admin_category('gradeimports', new lang_string('importsettings', 'grades')));
|
||||
foreach (core_component::get_plugin_list('gradeimport') as $plugin => $plugindir) {
|
||||
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
@@ -214,6 +209,7 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
|
||||
|
||||
// Exports
|
||||
$ADMIN->add('grades', new admin_category('gradeexports', new lang_string('exportsettings', 'grades')));
|
||||
foreach (core_component::get_plugin_list('gradeexport') as $plugin => $plugindir) {
|
||||
// Include all the settings commands for this plugin if there are any
|
||||
if (file_exists($plugindir.'/settings.php')) {
|
||||
@@ -225,42 +221,5 @@ if (has_capability('moodle/grade:manage', $systemcontext)
|
||||
}
|
||||
}
|
||||
|
||||
// Penalty.
|
||||
|
||||
// Supported modules.
|
||||
$modules = core_grades\penalty_manager::get_supported_modules();
|
||||
if (!empty($modules)) {
|
||||
$temp = new admin_settingpage('supportedplugins', new lang_string('gradepenalty_supportedplugins', 'grades'),
|
||||
'moodle/grade:manage');
|
||||
|
||||
$options = [];
|
||||
foreach ($modules as $module) {
|
||||
$options[$module] = new lang_string('modulename', $module);
|
||||
}
|
||||
$temp->add(new admin_setting_configmultiselect('gradepenalty_enabledmodules',
|
||||
new lang_string('gradepenalty_enabledmodules', 'grades'),
|
||||
new lang_string('gradepenalty_enabledmodules_help', 'grades'), [], $options));
|
||||
|
||||
$ADMIN->add('gradepenalty', $temp);
|
||||
}
|
||||
|
||||
// External page to manage the penalty plugins.
|
||||
$temp = new admin_externalpage(
|
||||
'managepenaltyplugins',
|
||||
get_string('managepenaltyplugins', 'grades'),
|
||||
new moodle_url('/grade/penalty/manage_penalty_plugins.php'),
|
||||
'moodle/grade:manage'
|
||||
);
|
||||
$ADMIN->add('gradepenalty', $temp);
|
||||
|
||||
// Settings from each penalty plugin.
|
||||
foreach (core_component::get_plugin_list('gradepenalty') as $plugin => $plugindir) {
|
||||
// Check if the plugin is enabled.
|
||||
if (gradepenalty::is_plugin_enabled($plugin)) {
|
||||
// Include all the settings commands for this plugin if there are any.
|
||||
if (file_exists($plugindir . '/settings.php')) {
|
||||
include($plugindir . '/settings.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end of speedup
|
||||
|
||||
|
||||
@@ -39,6 +39,9 @@ if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off')
|
||||
$ADMIN->add('mnet', new admin_externalpage('ssoaccesscontrol', new lang_string('ssoaccesscontrol', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/access_control.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('mnetenrol', new lang_string('clientname', 'mnetservice_enrol'),
|
||||
"$CFG->wwwroot/mnet/service/enrol/index.php",
|
||||
'moodle/site:config'));
|
||||
$ADMIN->add('mnet', new admin_externalpage('trustedhosts', new lang_string('trustedhosts', 'mnet'),
|
||||
"$CFG->wwwroot/$CFG->admin/mnet/trustedhosts.php",
|
||||
'moodle/site:config'));
|
||||
|
||||
+42
-34
@@ -24,40 +24,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules')));
|
||||
$ADMIN->add('modules', new admin_category('formatsettings', new lang_string('courseformats')));
|
||||
$ADMIN->add('modules', new admin_category('customfieldsettings', new lang_string('customfields', 'core_customfield')));
|
||||
$ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks')));
|
||||
$ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin')));
|
||||
$ADMIN->add('modules', new admin_category('enrolments', new lang_string('enrolments', 'enrol')));
|
||||
$ADMIN->add('modules', new admin_category('editorsettings', new lang_string('editors', 'editor')));
|
||||
$ADMIN->add('modules', new admin_category('antivirussettings', new lang_string('antiviruses', 'antivirus')));
|
||||
$ADMIN->add('modules', new admin_category('mlbackendsettings', new lang_string('mlbackendsettings', 'admin')));
|
||||
$ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters')));
|
||||
$ADMIN->add('modules', new admin_category('mediaplayers', new lang_string('type_media_plural', 'plugin')));
|
||||
$ADMIN->add('modules', new admin_category('fileconverterplugins', new lang_string('type_fileconverter_plural', 'plugin')));
|
||||
$ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin')));
|
||||
$ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats')));
|
||||
$ADMIN->add('modules', new admin_category('portfoliosettings', new lang_string('portfolios', 'portfolio'),
|
||||
empty($CFG->enableportfolios)));
|
||||
$ADMIN->add('modules', new admin_category('repositorysettings', new lang_string('repositories', 'repository')));
|
||||
$ADMIN->add('modules', new admin_category('qbanksettings', new lang_string('type_qbank_plural', 'plugin')));
|
||||
$ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin')));
|
||||
$ADMIN->add('modules', new admin_category('qtypesettings', new lang_string('questiontypes', 'admin')));
|
||||
$ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism')));
|
||||
$ADMIN->add('modules', new admin_category('coursereports', new lang_string('coursereports')));
|
||||
$ADMIN->add('modules', new admin_category('reportplugins', new lang_string('reports')));
|
||||
$ADMIN->add('modules', new admin_category('searchplugins', new lang_string('search', 'admin')));
|
||||
$ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
|
||||
$ADMIN->add('modules', new admin_category('cache', new lang_string('caching', 'cache')));
|
||||
$ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache')));
|
||||
$ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar')));
|
||||
$ADMIN->add('modules', new admin_category('communicationsettings', new lang_string('communication', 'core_communication')));
|
||||
$ADMIN->add('modules', new admin_category('sms', new lang_string('sms', 'core_sms')));
|
||||
$ADMIN->add('modules', new admin_category('contentbanksettings', new lang_string('contentbank')));
|
||||
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
|
||||
|
||||
|
||||
if ($hassiteconfig) {
|
||||
/* @var admin_root $ADMIN */
|
||||
$ADMIN->locate('modules')->set_sorting(true);
|
||||
@@ -65,6 +31,7 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_page_pluginsoverview());
|
||||
|
||||
// activity modules
|
||||
$ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules')));
|
||||
|
||||
$ADMIN->add('modsettings', new admin_page_managemods());
|
||||
|
||||
@@ -81,6 +48,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// course formats
|
||||
$ADMIN->add('modules', new admin_category('formatsettings', new lang_string('courseformats')));
|
||||
$temp = new admin_settingpage('manageformats', new lang_string('manageformats', 'core_admin'));
|
||||
$temp->add(new admin_setting_manageformats());
|
||||
$ADMIN->add('formatsettings', $temp);
|
||||
@@ -92,6 +60,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Custom fields.
|
||||
$ADMIN->add('modules', new admin_category('customfieldsettings', new lang_string('customfields', 'core_customfield')));
|
||||
$temp = new admin_settingpage('managecustomfields', new lang_string('managecustomfields', 'core_admin'));
|
||||
$temp->add(new admin_setting_managecustomfields());
|
||||
$ADMIN->add('customfieldsettings', $temp);
|
||||
@@ -103,6 +72,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// blocks
|
||||
$ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks')));
|
||||
$ADMIN->add('blocksettings', new admin_page_manageblocks());
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('block');
|
||||
core_collator::asort_objects_by_property($plugins, 'displayname');
|
||||
@@ -112,6 +82,8 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// authentication plugins
|
||||
$ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin')));
|
||||
|
||||
$temp = new admin_settingpage('manageauths', new lang_string('authsettings', 'admin'));
|
||||
$temp->add(new admin_setting_manageauths());
|
||||
$temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), ''));
|
||||
@@ -188,6 +160,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Enrolment plugins
|
||||
$ADMIN->add('modules', new admin_category('enrolments', new lang_string('enrolments', 'enrol')));
|
||||
$temp = new admin_settingpage('manageenrols', new lang_string('manageenrols', 'enrol'));
|
||||
$temp->add(new admin_setting_manageenrols());
|
||||
$ADMIN->add('enrolments', $temp);
|
||||
@@ -204,6 +177,7 @@ if ($hassiteconfig) {
|
||||
|
||||
|
||||
/// Editor plugins
|
||||
$ADMIN->add('modules', new admin_category('editorsettings', new lang_string('editors', 'editor')));
|
||||
$temp = new admin_settingpage('manageeditors', new lang_string('editorsettings', 'editor'));
|
||||
$temp->add(new \core_admin\admin\admin_setting_plugin_manager(
|
||||
'editor',
|
||||
@@ -220,6 +194,7 @@ if ($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());
|
||||
|
||||
@@ -291,12 +266,14 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Machine learning backend plugins.
|
||||
$ADMIN->add('modules', new admin_category('mlbackendsettings', new lang_string('mlbackendsettings', 'admin')));
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('mlbackend');
|
||||
foreach ($plugins as $plugin) {
|
||||
$plugin->load_settings($ADMIN, 'mlbackendsettings', $hassiteconfig);
|
||||
}
|
||||
|
||||
/// Filter plugins
|
||||
$ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters')));
|
||||
|
||||
$ADMIN->add('filtersettings', new admin_page_managefilters());
|
||||
|
||||
@@ -326,6 +303,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Media players.
|
||||
$ADMIN->add('modules', new admin_category('mediaplayers', new lang_string('type_media_plural', 'plugin')));
|
||||
$temp = new admin_settingpage('managemediaplayers', new lang_string('managemediaplayers', 'media'));
|
||||
$temp->add(new admin_setting_heading('mediaformats', get_string('mediaformats', 'core_media'),
|
||||
format_text(get_string('mediaformats_desc', 'core_media'), FORMAT_MARKDOWN)));
|
||||
@@ -345,6 +323,7 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('mediaplayers', $temp);
|
||||
|
||||
// Convert plugins.
|
||||
$ADMIN->add('modules', new admin_category('fileconverterplugins', new lang_string('type_fileconverter_plural', 'plugin')));
|
||||
$temp = new admin_settingpage('managefileconverterplugins', new lang_string('type_fileconvertermanage', 'plugin'));
|
||||
$temp->add(new admin_setting_manage_fileconverter_plugins());
|
||||
$ADMIN->add('fileconverterplugins', $temp);
|
||||
@@ -364,6 +343,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Payment gateway plugins.
|
||||
$ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin')));
|
||||
$temp = new admin_settingpage('managepaymentgateways', new lang_string('type_paygwmanage', 'plugin'));
|
||||
$temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins());
|
||||
$temp->add(new admin_setting_description(
|
||||
@@ -382,6 +362,7 @@ if ($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);
|
||||
@@ -395,9 +376,12 @@ if ($hassiteconfig) {
|
||||
|
||||
//== Portfolio settings ==
|
||||
require_once($CFG->libdir. '/portfoliolib.php');
|
||||
$catname = new lang_string('portfolios', 'portfolio');
|
||||
$manage = new lang_string('manageportfolios', 'portfolio');
|
||||
$url = "$CFG->wwwroot/$CFG->admin/portfolio.php";
|
||||
|
||||
$ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios)));
|
||||
|
||||
// Add manage page (with table)
|
||||
$temp = new admin_page_manageportfolios();
|
||||
$ADMIN->add('portfoliosettings', $temp);
|
||||
@@ -451,8 +435,10 @@ if ($hassiteconfig) {
|
||||
|
||||
// repository setting
|
||||
require_once("$CFG->dirroot/repository/lib.php");
|
||||
$catname =new lang_string('repositories', 'repository');
|
||||
$managerepo = new lang_string('manage', 'repository');
|
||||
$url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php';
|
||||
$ADMIN->add('modules', new admin_category('repositorysettings', $catname));
|
||||
|
||||
// Add main page (with table)
|
||||
$temp = new admin_page_managerepositories();
|
||||
@@ -488,6 +474,8 @@ if ($hassiteconfig) {
|
||||
|
||||
// Question bank settings.
|
||||
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
|
||||
$ADMIN->add('modules', new admin_category('qbanksettings',
|
||||
new lang_string('type_qbank_plural', 'plugin')));
|
||||
$temp = new admin_settingpage('manageqbanks', new lang_string('manageqbanks', 'admin'));
|
||||
$temp->add(new \core_question\admin\manage_qbank_plugins_page());
|
||||
$ADMIN->add('qbanksettings', $temp);
|
||||
@@ -503,9 +491,11 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
|
||||
if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) {
|
||||
|
||||
// Question behaviour settings.
|
||||
$ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin')));
|
||||
$ADMIN->add('qbehavioursettings', new admin_page_manageqbehaviours());
|
||||
|
||||
// Question type settings.
|
||||
$ADMIN->add('modules', new admin_category('qtypesettings', new lang_string('questiontypes', 'admin')));
|
||||
$ADMIN->add('qtypesettings', new admin_page_manageqtypes());
|
||||
|
||||
// Question preview defaults.
|
||||
@@ -577,6 +567,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
|
||||
|
||||
// Plagiarism plugin settings
|
||||
if ($hassiteconfig && !empty($CFG->enableplagiarism)) {
|
||||
$ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism')));
|
||||
$ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'),
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/plagiarism.php'));
|
||||
|
||||
@@ -608,6 +599,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
}
|
||||
if (!empty($pages)) {
|
||||
$ADMIN->add('modules', new admin_category('coursereports', new lang_string('coursereports')));
|
||||
core_collator::asort_objects_by_property($pages, 'visiblename');
|
||||
foreach ($pages as $page) {
|
||||
$ADMIN->add('coursereports', $page);
|
||||
@@ -629,6 +621,7 @@ foreach (core_component::get_plugin_list('report') as $report => $plugindir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
$ADMIN->add('modules', new admin_category('reportplugins', new lang_string('reports')));
|
||||
$ADMIN->add('reportplugins', new admin_externalpage('managereports', new lang_string('reportsmanage', 'admin'),
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/reports.php'));
|
||||
core_collator::asort_objects_by_property($pages, 'visiblename');
|
||||
@@ -638,6 +631,7 @@ foreach ($pages as $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();
|
||||
@@ -779,6 +773,7 @@ if ($hassiteconfig) {
|
||||
|
||||
/// Add all admin tools
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
|
||||
$settingspage = new admin_settingpage('toolsmanagement', new lang_string('toolsmanage', 'admin'));
|
||||
$ADMIN->add('tools', $settingspage);
|
||||
$settingspage->add(new \core_admin\admin\admin_setting_plugin_manager(
|
||||
@@ -799,10 +794,12 @@ foreach ($plugins as $plugin) {
|
||||
|
||||
// Now add the Cache plugins
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('cache', new lang_string('caching', 'cache')));
|
||||
$ADMIN->add('cache', new admin_externalpage('cacheconfig', new lang_string('cacheconfig', 'cache'), $CFG->wwwroot .'/cache/admin.php'));
|
||||
$ADMIN->add('cache', new admin_externalpage('cachetestperformance', new lang_string('testperformance', 'cache'), $CFG->wwwroot . '/cache/testperformance.php'));
|
||||
$ADMIN->add('cache', new admin_externalpage('cacheusage',
|
||||
new lang_string('cacheusage', 'cache'), $CFG->wwwroot . '/cache/usage.php'));
|
||||
$ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache')));
|
||||
$ADMIN->locate('cachestores')->set_sorting(true);
|
||||
foreach (core_component::get_plugin_list('cachestore') as $plugin => $path) {
|
||||
$settingspath = $path.'/settings.php';
|
||||
@@ -816,6 +813,7 @@ if ($hassiteconfig) {
|
||||
|
||||
// Add Calendar type settings.
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar')));
|
||||
$plugins = core_plugin_manager::instance()->get_plugins_of_type('calendartype');
|
||||
core_collator::asort_objects_by_property($plugins, 'displayname');
|
||||
foreach ($plugins as $plugin) {
|
||||
@@ -826,6 +824,7 @@ if ($hassiteconfig) {
|
||||
|
||||
// Communication plugins.
|
||||
if ($hassiteconfig && core_communication\api::is_available()) {
|
||||
$ADMIN->add('modules', new admin_category('communicationsettings', new lang_string('communication', 'core_communication')));
|
||||
$temp = new admin_settingpage('managecommunicationproviders',
|
||||
new lang_string('managecommunicationproviders', 'core_communication'));
|
||||
$temp->add(new \core_communication\admin\manage_communication_providers_page());
|
||||
@@ -839,6 +838,13 @@ if ($hassiteconfig && core_communication\api::is_available()) {
|
||||
|
||||
// SMS plugins.
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add(
|
||||
'modules',
|
||||
new admin_category(
|
||||
'sms',
|
||||
new lang_string('sms', 'core_sms'),
|
||||
),
|
||||
);
|
||||
$ADMIN->add(
|
||||
'sms',
|
||||
new admin_externalpage(
|
||||
@@ -863,6 +869,7 @@ if ($hassiteconfig) {
|
||||
|
||||
// Content bank content types.
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('contentbanksettings', new lang_string('contentbank')));
|
||||
$temp = new admin_settingpage('managecontentbanktypes', new lang_string('managecontentbanktypes'));
|
||||
$temp->add(new admin_setting_managecontentbankcontenttypes());
|
||||
$ADMIN->add('contentbanksettings', $temp);
|
||||
@@ -881,6 +888,7 @@ if ($hassiteconfig) {
|
||||
|
||||
/// Add all local plugins - must be always last!
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
|
||||
$ADMIN->add('localplugins', new admin_externalpage('managelocalplugins', new lang_string('localpluginsmanage'),
|
||||
$CFG->wwwroot . '/' . $CFG->admin . '/localplugins.php'));
|
||||
}
|
||||
|
||||
@@ -64,15 +64,3 @@ $settings->add(new admin_setting_configcheckbox(
|
||||
new lang_string('customreportsliveediting_desc', 'core_reportbuilder'), 1));
|
||||
|
||||
$ADMIN->add('reportbuilder', $settings);
|
||||
|
||||
$ADMIN->add(
|
||||
'reportbuilder', new accesscallback(
|
||||
'reportbuildercustomfields',
|
||||
get_string('reportbuildercustomfields', 'core_reportbuilder'),
|
||||
(new moodle_url('/reportbuilder/customfield.php'))->out(),
|
||||
static function(): bool {
|
||||
return has_capability('moodle/reportbuilder:configurecustomfields', context_system::instance());
|
||||
},
|
||||
empty($CFG->enablecustomreports)
|
||||
)
|
||||
);
|
||||
|
||||
@@ -147,7 +147,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$sensiblesettingsdefault .= 'secretphrase@@url, cronremotepassword@@none, smtpuser@@none, ';
|
||||
$sensiblesettingsdefault .= 'smtppass@@none, proxypassword@@none, quizpassword@@quiz, allowedip@@none, blockedip@@none, ';
|
||||
$sensiblesettingsdefault .= 'dbpass@@logstore_database, messageinbound_hostpass@@none, ';
|
||||
$sensiblesettingsdefault .= 'pass@@auth_db, bind_pw@@auth_ldap, ';
|
||||
$sensiblesettingsdefault .= 'bind_pw@@auth_cas, pass@@auth_db, bind_pw@@auth_ldap, ';
|
||||
$sensiblesettingsdefault .= 'dbpass@@enrol_database, bind_pw@@enrol_ldap, ';
|
||||
$sensiblesettingsdefault .= 'server_password@@search_solr, ssl_keypassword@@search_solr, ';
|
||||
$sensiblesettingsdefault .= 'alternateserver_password@@search_solr, alternatessl_keypassword@@search_solr, ';
|
||||
|
||||
@@ -25,10 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
|
||||
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
|
||||
$ADMIN->add('server', new admin_category('webservicesettings', new lang_string('webservices', 'webservice')));
|
||||
|
||||
if ($hassiteconfig) {
|
||||
// System paths.
|
||||
$temp = new admin_settingpage('systempaths', new lang_string('systempaths', 'admin'));
|
||||
@@ -185,16 +181,8 @@ if ($hassiteconfig) {
|
||||
new lang_string('configproxyuser', 'admin'), ''));
|
||||
$temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'),
|
||||
new lang_string('configproxypassword', 'admin'), ''));
|
||||
|
||||
$setting = new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'),
|
||||
new lang_string('configproxybypass', 'admin'), 'localhost,127.0.0.1');
|
||||
$setting->set_updatedcallback(function() {
|
||||
// Normalize $CFG->proxybypass value.
|
||||
$normalizedvalue = \core\ip_utils::normalize_internet_address_list(get_config('core', 'proxybypass'));
|
||||
set_config('proxybypass', $normalizedvalue);
|
||||
});
|
||||
$temp->add($setting);
|
||||
|
||||
$temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'),
|
||||
new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
|
||||
$temp->add(new admin_setting_configcheckbox('proxylogunsafe', new lang_string('proxylogunsafe', 'admin'),
|
||||
new lang_string('configproxylogunsafe_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('proxyfixunsafe', new lang_string('proxyfixunsafe', 'admin'),
|
||||
@@ -337,6 +325,7 @@ if ($hassiteconfig) {
|
||||
$ADMIN->add('server', $temp);
|
||||
|
||||
// Tasks.
|
||||
$ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
|
||||
|
||||
// Task processing.
|
||||
$temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing', 'admin'));
|
||||
@@ -470,6 +459,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Email.
|
||||
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
|
||||
|
||||
// Outgoing mail configuration.
|
||||
$temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
|
||||
@@ -641,6 +631,7 @@ if ($hassiteconfig) {
|
||||
}
|
||||
|
||||
// Web services.
|
||||
$ADMIN->add('server', new admin_category('webservicesettings', new lang_string('webservices', 'webservice')));
|
||||
|
||||
// Web services > Overview.
|
||||
$temp = new admin_settingpage('webservicesoverview', new lang_string('webservicesoverview', 'webservice'));
|
||||
|
||||
@@ -46,9 +46,9 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('allowstealth', new lang_string('allowstealthmodules'),
|
||||
new lang_string('allowstealthmodules_help'), 0, 1, 0));
|
||||
// TODO: Analytics is now disable on new installs until MDL-84481 overcomes the config of mlbackend_python.
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('enableanalytics', new lang_string('enableanalytics', 'admin'),
|
||||
new lang_string('configenableanalytics', 'admin'), 0, 1, 0));
|
||||
new lang_string('configenableanalytics', 'admin'), 1, 1, 0));
|
||||
|
||||
$optionalsubsystems->add(new admin_setting_configcheckbox('core_competency/enabled',
|
||||
new lang_string('enablecompetencies', 'core_competency'),
|
||||
|
||||
@@ -6,20 +6,14 @@ $ADMIN->add('users', new admin_category('accounts', new lang_string('accounts',
|
||||
$ADMIN->add('users', new admin_category('roles', new lang_string('permissions', 'role')));
|
||||
$ADMIN->add('users', new admin_category('privacy', new lang_string('privacyandpolicies', 'admin')));
|
||||
|
||||
$capabilities = [
|
||||
'moodle/user:create',
|
||||
'moodle/user:update',
|
||||
'moodle/user:delete',
|
||||
'moodle/role:manage',
|
||||
'moodle/role:assign',
|
||||
'moodle/cohort:manage',
|
||||
'moodle/cohort:view',
|
||||
'moodle/cohort:configurecustomfields',
|
||||
'moodle/role:safeoverride',
|
||||
'moodle/role:override',
|
||||
];
|
||||
|
||||
if ($hassiteconfig || has_any_capability($capabilities, $systemcontext)) { // Speedup for non-admins, all caps used on this page.
|
||||
if ($hassiteconfig
|
||||
or has_capability('moodle/user:create', $systemcontext)
|
||||
or has_capability('moodle/user:update', $systemcontext)
|
||||
or has_capability('moodle/user:delete', $systemcontext)
|
||||
or has_capability('moodle/role:manage', $systemcontext)
|
||||
or has_capability('moodle/role:assign', $systemcontext)
|
||||
or has_capability('moodle/cohort:manage', $systemcontext)
|
||||
or has_capability('moodle/cohort:view', $systemcontext)) { // Speedup for non-admins, add all caps used on this page.
|
||||
|
||||
|
||||
// Stuff under the "accounts" subcategory.
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
<div class="simplesearchform d-flex justify-content-end">
|
||||
<form autocomplete="off" action="{{action}}" method="get" accept-charset="utf-8" class="mform d-flex flex-wrap align-items-center simplesearchform">
|
||||
<div class="input-group">
|
||||
<label for="searchinput-{{uniqid}}">
|
||||
<span class="sr-only">{{#str}} search, core {{/str}}</span>
|
||||
</label>
|
||||
<input type="text"
|
||||
id="searchinput-{{uniqid}}"
|
||||
class="form-control"
|
||||
@@ -38,13 +41,12 @@
|
||||
autocomplete="off"
|
||||
{{#query}}value="{{.}}"{{/query}}
|
||||
>
|
||||
<label for="searchinput-{{uniqid}}">
|
||||
<span class="visually-hidden">{{#str}} search, core {{/str}}</span>
|
||||
</label>
|
||||
<button type="submit" class="btn btn-primary search-icon">
|
||||
{{#pix}} a/search, core {{/pix}}
|
||||
<span class="visually-hidden">{{#str}} search, core {{/str}}</span>
|
||||
</button>
|
||||
<div class="input-group-append">
|
||||
<button type="submit" class="btn btn-primary search-icon">
|
||||
{{#pix}} a/search, core {{/pix}}
|
||||
<span class="sr-only">{{#str}} search, core {{/str}}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
Setting autocomplete.
|
||||
}}
|
||||
|
||||
<div class="defaultsnext">
|
||||
<div class="form-select defaultsnext">
|
||||
<input type="hidden" name="{{name}}[xxxxx]" value="_qf__force_multiselect_submission">
|
||||
<select class="form-select" name="{{name}}[]"
|
||||
<select class="custom-select" name="{{name}}[]"
|
||||
id="{{id}}"
|
||||
{{#multiple}}multiple{{/multiple}}>
|
||||
{{#options}}
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
{{#default}}
|
||||
<div class="form-defaultinfo text-muted {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
|
||||
{{/default}}
|
||||
<div class="form-text mt-2">{{{description}}}</div>
|
||||
<div class="form-description mt-3">{{{description}}}</div>
|
||||
{{#dependenton}}<div class="form-dependenton mb-4 text-muted">{{{.}}}</div>{{/dependenton}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<div class="form-duration defaultsnext">
|
||||
<div class="d-flex flex-wrap align-items-center">
|
||||
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
|
||||
<label class="visually-hidden" for="{{id}}u">{{#str}}durationunits, admin{{/str}}</label>
|
||||
<select id="{{id}}u" name="{{name}}[u]" class="form-control form-select" {{#readonly}}disabled{{/readonly}}>
|
||||
<label class="sr-only" for="{{id}}u">{{#str}}durationunits, admin{{/str}}</label>
|
||||
<select id="{{id}}u" name="{{name}}[u]" class="form-control custom-select" {{#readonly}}disabled{{/readonly}}>
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
|
||||
@@ -41,8 +41,8 @@
|
||||
<div class="form-filesize defaultsnext">
|
||||
<div class="d-flex flex-wrap align-items-center">
|
||||
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
|
||||
<label class="visually-hidden" for="{{id}}u">{{#str}}filesizeunits, admin{{/str}}</label>
|
||||
<select id="{{id}}u" name="{{name}}[u]" class="form-control form-select" {{#readonly}}disabled{{/readonly}}>
|
||||
<label class="sr-only" for="{{id}}u">{{#str}}filesizeunits, admin{{/str}}</label>
|
||||
<select id="{{id}}u" name="{{name}}[u]" class="form-control custom-select" {{#readonly}}disabled{{/readonly}}>
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
{{!
|
||||
Setting configmultiselect.
|
||||
}}
|
||||
<div>
|
||||
<div class="form-select">
|
||||
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
|
||||
{{#options}}
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
{{!
|
||||
Setting configmultiselect with optgroup support.
|
||||
}}
|
||||
<div>
|
||||
<div class="form-select">
|
||||
{{^readonly}}<input type="hidden" name="{{name}}[xxxxx]" value="1">{{/readonly}}
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
|
||||
{{#options}}
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
{{!
|
||||
Setting configselect.
|
||||
}}
|
||||
<div class="defaultsnext">
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}" class="form-select">
|
||||
<div class="form-select defaultsnext">
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}" class="custom-select">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
{{!
|
||||
Setting configselect with optgroup support.
|
||||
}}
|
||||
<div class="defaultsnext">
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}" class="form-select">
|
||||
<div class="form-select defaultsnext">
|
||||
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}" class="custom-select">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
|
||||
@@ -46,14 +46,14 @@
|
||||
}}
|
||||
<div class="form-time defaultsnext">
|
||||
<div class="d-flex flex-wrap align-items-center text-ltr">
|
||||
<label class="visually-hidden" for="{{id}}h">{{#str}}hours{{/str}}</label>
|
||||
<select id="{{id}}h" name="{{name}}[h]" class="form-select" {{#readonly}}disabled{{/readonly}}>
|
||||
<label class="sr-only" for="{{id}}h">{{#str}}hours{{/str}}</label>
|
||||
<select id="{{id}}h" name="{{name}}[h]" class="custom-select" {{#readonly}}disabled{{/readonly}}>
|
||||
{{#hours}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/hours}}
|
||||
</select>:
|
||||
<label class="visually-hidden" for="{{id}}m">{{#str}}minutes{{/str}}</label>
|
||||
<select id="{{id}}m" name="{{name}}[m]" class="form-select" {{#readonly}}disabled{{/readonly}}>
|
||||
<label class="sr-only" for="{{id}}m">{{#str}}minutes{{/str}}</label>
|
||||
<select id="{{id}}m" name="{{name}}[m]" class="custom-select" {{#readonly}}disabled{{/readonly}}>
|
||||
{{#minutes}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/minutes}}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* state - state of the toggle
|
||||
* title - title of the toggle tooltip
|
||||
* label - label of the toggle
|
||||
* labelclasses - classes for the label (visually-hidden for screen readers)
|
||||
* labelclasses - classes for the label (sr-only for screen readers)
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
@@ -44,7 +44,7 @@
|
||||
}],
|
||||
"title": "Title example",
|
||||
"label": "Enable/disable reality",
|
||||
"labelclasses": "visually-hidden"
|
||||
"labelclasses": "sr-only"
|
||||
}
|
||||
}}
|
||||
<div id="container-{{id}}"
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
}}
|
||||
<div class="mb-3">
|
||||
{{#selects}}
|
||||
<select id="{{id}}{{key}}" name="{{name}}[]" class="form-select mb-1">
|
||||
<select id="{{id}}{{key}}" name="{{name}}[]" class="custom-select mb-1">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
|
||||
@@ -41,6 +41,6 @@
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-setting col-sm-9">
|
||||
<div class="form-text">{{{description}}}</div>
|
||||
<div class="form-description">{{{description}}}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
Setting configselect.
|
||||
}}
|
||||
<div class="mb-3">
|
||||
<select id="{{id}}" name="{{name}}[value]" class="form-select">
|
||||
<select id="{{id}}" name="{{name}}[value]" class="form-select custom-select">
|
||||
{{#options}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
||||
{{/options}}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
data-choose="{{choose}}"
|
||||
data-sesskey="{{sesskey}}">
|
||||
<i class="icon fa fa-info-circle m-0" aria-hidden="true"></i>
|
||||
<span class="visually-hidden">{{#str}}previewthemename, moodle, {{name}}{{/str}}</span>
|
||||
<span class="sr-only">{{#str}}previewthemename, moodle, {{name}}{{/str}}</span>
|
||||
</button>
|
||||
{{#reporturl}}
|
||||
<a
|
||||
@@ -61,7 +61,7 @@
|
||||
class="btn btn-link p-0 ms-2"
|
||||
title="{{#str}}themeusagereportname, admin, {{name}}{{/str}}">
|
||||
<i class="icon fa fa-area-chart m-0" aria-hidden="true"></i>
|
||||
<span class="visually-hidden">{{#str}}themeusagereportname, admin, {{name}}{{/str}}</span>
|
||||
<span class="sr-only">{{#str}}themeusagereportname, admin, {{name}}{{/str}}</span>
|
||||
</a>
|
||||
{{/reporturl}}
|
||||
{{#settingsurl}}
|
||||
@@ -71,7 +71,7 @@
|
||||
class="btn btn-link p-0 ms-2"
|
||||
title="{{#str}}themeeditsettingsname, admin, {{name}}{{/str}}">
|
||||
<i class="icon fa fa-cog m-0" aria-hidden="true"></i>
|
||||
<span class="visually-hidden">{{#str}}themeeditsettingsname, admin, {{name}}{{/str}}</span>
|
||||
<span class="sr-only">{{#str}}themeeditsettingsname, admin, {{name}}{{/str}}</span>
|
||||
</a>
|
||||
{{/settingsurl}}
|
||||
</div>
|
||||
@@ -91,7 +91,7 @@
|
||||
<input type="hidden" name="choose" value="{{choose}}">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<span aria-hidden="true">{{#str}}selecttheme, moodle{{/str}}</span>
|
||||
<span class="visually-hidden">{{#str}}selectthemename, moodle, {{name}}{{/str}}</span>
|
||||
<span class="sr-only">{{#str}}selectthemename, moodle, {{name}}{{/str}}</span>
|
||||
</button>
|
||||
</form>
|
||||
{{/actionurl}}
|
||||
|
||||
@@ -81,8 +81,6 @@ class behat_admin extends behat_base {
|
||||
|
||||
$this->execute('behat_forms::i_set_the_field_with_xpath_to', [$fieldxpath, $value]);
|
||||
$this->execute("behat_general::i_click_on", [get_string('savechanges'), 'button']);
|
||||
// Wait for the page to be redirected.
|
||||
$this->execute("behat_general::i_wait_to_be_redirected");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,9 @@ Feature: An administrator can browse user accounts
|
||||
| User Two | two@example.com |
|
||||
| User Three | three@example.com |
|
||||
And I click on "Filters" "button"
|
||||
And I set the field "System role value" in the "System role" "core_reportbuilder > Filter" to "Course creator"
|
||||
And I set the following fields in the "System role" "core_reportbuilder > Filter" to these values:
|
||||
| System role operator | Is equal to |
|
||||
| System role value | Course creator |
|
||||
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I click on "Filters" "button"
|
||||
And I should see "User One" in the "reportbuilder-table" "table"
|
||||
@@ -179,7 +181,8 @@ Feature: An administrator can browse user accounts
|
||||
And I should not see "User Three" in the "reportbuilder-table" "table"
|
||||
And I click on "Filters" "button"
|
||||
And I click on "Reset all" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I set the field "Role name" in the "Course role" "core_reportbuilder > Filter" to "Teacher"
|
||||
And I set the following fields in the "Course role" "core_reportbuilder > Filter" to these values:
|
||||
| Role name | Teacher |
|
||||
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
|
||||
And I click on "Filters" "button"
|
||||
And I should not see "User One" in the "reportbuilder-table" "table"
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
@core @core_admin
|
||||
Feature: Plugins overview page
|
||||
In order to manage plugin and settings
|
||||
As an admin
|
||||
I can access the plugins overview page
|
||||
|
||||
Background:
|
||||
Given I am logged in as "admin"
|
||||
And I navigate to "Plugins > Plugins overview" in site administration
|
||||
|
||||
Scenario: An administrator can view plugins overview page
|
||||
Then "Plugins overview" "text" should exist
|
||||
And "Check for available updates" "button" should exist
|
||||
And "All plugins" "link" should exist
|
||||
And "Additional plugins" "link" should exist
|
||||
|
||||
Scenario: An administrator can access list of activities when activity modules cog icon is pressed
|
||||
When I click on "Settings" "link" in the "Activity modules" "table_row"
|
||||
Then "Activities" "text" should exist
|
||||
And "Manage activities" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
|
||||
|
||||
Scenario: An administrator can access plugin settings
|
||||
When I click on "Settings" "link" in the "Assignment" "table_row"
|
||||
Then "Assignment settings" "text" should exist
|
||||
And "Assignment settings" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And "Assignment" "link" should exist in the ".breadcrumb" "css_element"
|
||||
And "Activity modules" "link" should exist in the ".breadcrumb" "css_element"
|
||||
|
||||
Scenario: Plugins with dependencies cannot be uninstalled
|
||||
When I navigate to "Plugins > Plugins overview" in site administration
|
||||
Then "Uninstall" "link" should not exist in the "Database" "table_row"
|
||||
And "Required by: filter_data" "text" should exist in the "Database" "table_row"
|
||||
|
||||
Scenario: Cancelling plugin uninstall does not uninstall the selected plugin
|
||||
When I click on "Uninstall" "link" in the "Assignment" "table_row"
|
||||
Then "Uninstalling Assignment" "text" should exist
|
||||
And "You are about to uninstall the plugin Assignment. This will completely delete everything in the database associated with this plugin, including its configuration, log records, user files managed by the plugin etc. There is no way back and Moodle itself does not create any recovery backup. Are you SURE you want to continue?" "text" should exist
|
||||
And I click on "Cancel" "button"
|
||||
And "Uninstall" "link" should exist in the "Assignment" "table_row"
|
||||
+1
-1
@@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class set_block_protection_test extends \externallib_advanced_testcase {
|
||||
class set_block_protection_test extends \externallib_advanced_testcase {
|
||||
/**
|
||||
* Test execute method with no login.
|
||||
*/
|
||||
|
||||
+13
-33
@@ -33,7 +33,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class set_plugin_order_test extends \externallib_advanced_testcase {
|
||||
class set_plugin_order_test extends \externallib_advanced_testcase {
|
||||
/**
|
||||
* Text execute method for editor plugins, which support ordering.
|
||||
*
|
||||
@@ -86,69 +86,49 @@ final class set_plugin_order_test extends \externallib_advanced_testcase {
|
||||
return [
|
||||
[
|
||||
'initialstate' => 'textarea,tiny',
|
||||
'plugin' => 'editor_textarea',
|
||||
'pluginname' => 'editor_textarea',
|
||||
'direction' => 1, // DOWN.
|
||||
'neworder' => $getorder([
|
||||
'expected' => $getorder([
|
||||
'tiny',
|
||||
'textarea',
|
||||
]),
|
||||
'newstate' => 'tiny,textarea',
|
||||
'newtexteditors' => 'tiny,textarea',
|
||||
],
|
||||
[
|
||||
'initialstate' => 'textarea,tiny',
|
||||
'plugin' => 'editor_textarea',
|
||||
'pluginname' => 'editor_textarea',
|
||||
'direction' => -1, // UP.
|
||||
'neworder' => $getorder([
|
||||
'expected' => $getorder([
|
||||
'textarea',
|
||||
'tiny',
|
||||
]),
|
||||
'newstate' => 'textarea,tiny',
|
||||
'newtexteditors' => 'textarea,tiny',
|
||||
],
|
||||
[
|
||||
'initialstate' => 'textarea,tiny',
|
||||
'plugin' => 'editor_tiny',
|
||||
'pluginname' => 'editor_tiny',
|
||||
'direction' => 1, // DOWN.
|
||||
// Tiny is already at the bottom of the list of enabled plugins.
|
||||
'neworder' => $getorder([
|
||||
'expected' => $getorder([
|
||||
'textarea',
|
||||
'tiny',
|
||||
]),
|
||||
'newstate' => 'textarea,tiny',
|
||||
'newtexteditors' => 'textarea,tiny',
|
||||
],
|
||||
[
|
||||
'initialstate' => 'textarea,tiny',
|
||||
'plugin' => 'editor_atto',
|
||||
'pluginname' => 'editor_atto',
|
||||
'direction' => 1, // DOWN.
|
||||
// Atto is not enabled. Disabled editors are listed lexically after enabled editors.
|
||||
'neworder' => $getorder([
|
||||
'expected' => $getorder([
|
||||
'textarea',
|
||||
'tiny',
|
||||
]),
|
||||
'newstate' => 'textarea,tiny',
|
||||
'newtexteditors' => 'textarea,tiny',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test re-ordering plugins where one plugin is not enabled.
|
||||
*
|
||||
* Media plugins are ordered by rank, with enabled plugins first.
|
||||
* This is similar to the editors test but covers a scenario that cannot be covered by the editors test due to
|
||||
* not having enough plugins.
|
||||
*/
|
||||
public function test_execute_media_including_disabled(): void {
|
||||
global $CFG;
|
||||
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
|
||||
$CFG->media_plugins_sortorder = 'videojs,vimeo,html5video';
|
||||
|
||||
set_plugin_order::execute('youtube', -1);
|
||||
|
||||
$this->assertSame('videojs,vimeo,html5video', $CFG->media_plugins_sortorder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Text execute method for plugins which do not support ordering.
|
||||
*
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class set_plugin_state_test extends \externallib_advanced_testcase {
|
||||
class set_plugin_state_test extends \externallib_advanced_testcase {
|
||||
/**
|
||||
* Text execute method.
|
||||
*
|
||||
|
||||
@@ -20,9 +20,14 @@ namespace core_admin\reportbuilder\datasource;
|
||||
|
||||
use core\task\database_logger;
|
||||
use core_reportbuilder_generator;
|
||||
use core_reportbuilder\local\filters\{date, duration, number, select, text};
|
||||
use core_reportbuilder_testcase;
|
||||
use core_reportbuilder\local\filters\{boolean_select, date, duration, number, select, text};
|
||||
use core_reportbuilder\task\send_schedules;
|
||||
use core_reportbuilder\tests\core_reportbuilder_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
require_once("{$CFG->dirroot}/reportbuilder/tests/helpers.php");
|
||||
|
||||
/**
|
||||
* Unit tests for task logs datasource
|
||||
@@ -32,7 +37,7 @@ use core_reportbuilder\tests\core_reportbuilder_testcase;
|
||||
* @copyright 2022 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class task_logs_test extends core_reportbuilder_testcase {
|
||||
class task_logs_test extends core_reportbuilder_testcase {
|
||||
|
||||
/**
|
||||
* Test default datasource
|
||||
@@ -136,12 +141,10 @@ final class task_logs_test extends core_reportbuilder_testcase {
|
||||
'task_log:output_operator' => text::IS_EMPTY,
|
||||
], false],
|
||||
'Filter result' => ['task_log:result', [
|
||||
'task_log:result_operator' => select::EQUAL_TO,
|
||||
'task_log:result_value' => 0,
|
||||
'task_log:result_operator' => boolean_select::CHECKED,
|
||||
], true],
|
||||
'Filter result (no match)' => ['task_log:result', [
|
||||
'task_log:result_operator' => select::EQUAL_TO,
|
||||
'task_log:result_value' => 1,
|
||||
'task_log:result_operator' => boolean_select::NOT_CHECKED,
|
||||
], false],
|
||||
'Filter time start' => ['task_log:timestart', [
|
||||
'task_log:timestart_operator' => date::DATE_RANGE,
|
||||
|
||||
@@ -30,7 +30,7 @@ use core_reportbuilder\local\report\filter;
|
||||
* @copyright 2023 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
final class courserole_test extends advanced_testcase {
|
||||
class courserole_test extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Data provider for {@see test_get_sql_filter}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# tool_admin_presets Upgrade notes
|
||||
|
||||
## 5.0
|
||||
|
||||
### Deprecated
|
||||
|
||||
- behat_admin_presets::following_in_the_should_download_between_and_bytes is deprecated. Use: the following element should download a file that:
|
||||
|
||||
For more information see [MDL-83035](https://tracker.moodle.org/browse/MDL-83035)
|
||||
@@ -81,6 +81,7 @@ class admin_preset extends base {
|
||||
* @return column[]
|
||||
*/
|
||||
protected function get_all_columns(): array {
|
||||
global $DB;
|
||||
$apalias = $this->get_table_alias('adminpresets');
|
||||
|
||||
// Name.
|
||||
@@ -105,6 +106,10 @@ class admin_preset extends base {
|
||||
});
|
||||
|
||||
// Description.
|
||||
$descriptionfieldsql = "{$apalias}.comments";
|
||||
if ($DB->get_dbfamily() === 'oracle') {
|
||||
$descriptionfieldsql = $DB->sql_order_by_text($descriptionfieldsql, 1024);
|
||||
}
|
||||
$columns[] = (new column(
|
||||
'description',
|
||||
new lang_string('description'),
|
||||
@@ -112,9 +117,9 @@ class admin_preset extends base {
|
||||
))
|
||||
->add_joins($this->get_joins())
|
||||
->set_type(column::TYPE_LONGTEXT)
|
||||
->add_field("{$apalias}.comments")
|
||||
->add_field($descriptionfieldsql, 'description')
|
||||
->set_is_sortable(true)
|
||||
->set_callback(static function(?string $description): string {
|
||||
->set_callback(static function(?string $description, \stdClass $row): string {
|
||||
return format_text($description, FORMAT_HTML, ['context' => \context_system::instance()]);
|
||||
});
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
{{#skippedchanges.show}}
|
||||
{{#skippedchanges.heading}}
|
||||
<h3>
|
||||
<a data-bs-toggle="collapse" href="#collapseSkippedChanges" role="button" aria-expanded="false" aria-controls="collapseSkippedChanges">
|
||||
<a data-toggle="collapse" href="#collapseSkippedChanges" role="button" aria-expanded="false" aria-controls="collapseSkippedChanges">
|
||||
{{{.}}}
|
||||
</a>
|
||||
</h3>
|
||||
|
||||
@@ -30,6 +30,7 @@ Feature: I can apply presets
|
||||
And I should see "Activities" in the "Setting changes" "table"
|
||||
And I should see "Activity chooser tabs" in the "Setting changes" "table"
|
||||
And I should see "Adaptive mode (no penalties)" in the "Setting changes" "table"
|
||||
And I should see "Analytics" in the "Setting changes" "table"
|
||||
And I should see "Blog menu" in the "Setting changes" "table"
|
||||
And I should see "Blog tags" in the "Setting changes" "table"
|
||||
And I should see "Calculated" in the "Setting changes" "table"
|
||||
@@ -72,6 +73,7 @@ Feature: I can apply presets
|
||||
And "Maximum number of attachments" row "Current value" column of "Setting changes" table should contain "9"
|
||||
And "Maximum number of attachments" row "New value" column of "Setting changes" table should contain "3"
|
||||
And I should see "Mentees" in the "Setting changes" "table"
|
||||
And I should see "Network servers" in the "Setting changes" "table"
|
||||
And I should see "Numerical" in the "Setting changes" "table"
|
||||
And I should see "Online users" in the "Setting changes" "table"
|
||||
And I should see "Private files" in the "Setting changes" "table"
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Steps definitions related with admin presets.
|
||||
*
|
||||
* @package tool_admin_presets
|
||||
* @category test
|
||||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com>
|
||||
* @author Sylvain Revenu | Pimenko
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
|
||||
require_once(__DIR__ . '/../../../../../lib/behat/behat_field_manager.php');
|
||||
|
||||
use Behat\Mink\Exception\ExpectationException as ExpectationException;
|
||||
|
||||
/**
|
||||
* Steps definitions related with admin presets.
|
||||
*
|
||||
* @package tool_admin_presets
|
||||
* @category test
|
||||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com>
|
||||
* @author Sylvain Revenu | Pimenko
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_admin_presets extends behat_base {
|
||||
|
||||
/**
|
||||
* Downloads the file from a specific link on the page and checks the size is in a given range.
|
||||
*
|
||||
* Only works if the link has an href attribute. Javascript downloads are
|
||||
* not supported. Currently, the href must be an absolute URL.
|
||||
*
|
||||
* The range includes the endpoints. That is, a 10 byte file in considered to
|
||||
* be between "5" and "10" bytes, and between "10" and "20" bytes.
|
||||
*
|
||||
* @Then /^following "(?P<link_string>[^"]*)" "(?P<selector_string>[^"]*)" in the "(?P<element_container_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)" should download between "(?P<min_bytes>\d+)" and "(?P<max_bytes>\d+)" bytes$/
|
||||
* @param string $link the text of the link.
|
||||
* @param string $selectortype The type of what we look for
|
||||
* @param string $nodeelement Element we look in
|
||||
* @param string $nodeselectortype The type of selector where we look in
|
||||
* @param int $minexpectedsize the minimum expected file size in bytes.
|
||||
* @param int $maxexpectedsize the maximum expected file size in bytes.
|
||||
* @return void
|
||||
* @throws ExpectationException
|
||||
*/
|
||||
final public function following_in_the_should_download_between_and_bytes(string $link, string $selectortype,
|
||||
string $nodeelement, string $nodeselectortype, int $minexpectedsize, int $maxexpectedsize): void {
|
||||
// If the minimum is greater than the maximum then swap the values.
|
||||
if ((int) $minexpectedsize > (int) $maxexpectedsize) {
|
||||
list($minexpectedsize, $maxexpectedsize) = [$maxexpectedsize, $minexpectedsize];
|
||||
}
|
||||
|
||||
$exception = new ExpectationException('Error while downloading data from ' . $link, $this->getSession());
|
||||
|
||||
// It will stop spinning once file is downloaded or time out.
|
||||
$result = $this->spin(
|
||||
function($context, $args) {
|
||||
return $this->download_file_from_link_within_node($args['selectortype'], $args['link'],
|
||||
$args['nodeselectortype'], $args['nodeelement']);
|
||||
},
|
||||
[
|
||||
'selectortype' => $selectortype,
|
||||
'link' => $link,
|
||||
'nodeselectortype' => $nodeselectortype,
|
||||
'nodeelement' => $nodeelement
|
||||
],
|
||||
behat_base::get_extended_timeout(),
|
||||
$exception
|
||||
);
|
||||
|
||||
// Check download size.
|
||||
$actualsize = (int) strlen($result);
|
||||
if ($actualsize < $minexpectedsize || $actualsize > $maxexpectedsize) {
|
||||
throw new ExpectationException('Downloaded data was ' . $actualsize .
|
||||
' bytes, expecting between ' . $minexpectedsize . ' and ' .
|
||||
$maxexpectedsize, $this->getSession());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the text of a link, download the linked file and return the contents.
|
||||
*
|
||||
* This is a helper method used by {@see following_in_the_should_download_between_and_bytes()}
|
||||
*
|
||||
* @param string $selectortype The type of what we look for
|
||||
* @param string $link the text of the link.
|
||||
* @param string $nodeselectortype The type of selector where we look in
|
||||
* @param string $nodeelement Element we look in
|
||||
* @return string the content of the downloaded file.
|
||||
*/
|
||||
final public function download_file_from_link_within_node(string $selectortype, string $link,
|
||||
string $nodeselectortype, string $nodeelement): string {
|
||||
// Find the link from ur specific node.
|
||||
$linknode = $this->get_node_in_container($selectortype, $link, $nodeselectortype, $nodeelement);
|
||||
$this->ensure_node_is_visible($linknode);
|
||||
|
||||
// Get the href and check it.
|
||||
$url = $linknode->getAttribute('href');
|
||||
if (!$url) {
|
||||
throw new ExpectationException('Download link does not have href attribute',
|
||||
$this->getSession());
|
||||
}
|
||||
if (!preg_match('~^https?://~', $url)) {
|
||||
throw new ExpectationException('Download link not an absolute URL: ' . $url,
|
||||
$this->getSession());
|
||||
}
|
||||
|
||||
// Download the URL and check the size.
|
||||
$session = $this->getSession()->getCookie('MoodleSession');
|
||||
return download_file_content($url, ['Cookie' => 'MoodleSession=' . $session]);
|
||||
}
|
||||
}
|
||||
@@ -1,138 +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/>.
|
||||
|
||||
/**
|
||||
* Steps definitions related with admin presets.
|
||||
*
|
||||
* @package tool_admin_presets
|
||||
* @category test
|
||||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com>
|
||||
* @author Sylvain Revenu | Pimenko
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/../../../../../lib/behat/behat_deprecated_base.php');
|
||||
require_once(__DIR__ . '/../../../../../lib/behat/behat_field_manager.php');
|
||||
|
||||
use Behat\Mink\Exception\ExpectationException as ExpectationException;
|
||||
|
||||
/**
|
||||
* Steps definitions that are now deprecated and will be removed in the next releases.
|
||||
*
|
||||
* @package tool_admin_presets
|
||||
* @category test
|
||||
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com>
|
||||
* @author Sylvain Revenu | Pimenko
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @todo MDL-78077 This will be deleted in Moodle 6.0.
|
||||
*/
|
||||
class behat_admin_presets_deprecated extends behat_deprecated_base {
|
||||
|
||||
/**
|
||||
* Downloads the file from a specific link on the page and checks the size is in a given range.
|
||||
*
|
||||
* Only works if the link has an href attribute. Javascript downloads are
|
||||
* not supported. Currently, the href must be an absolute URL.
|
||||
*
|
||||
* The range includes the endpoints. That is, a 10 byte file in considered to
|
||||
* be between "5" and "10" bytes, and between "10" and "20" bytes.
|
||||
*
|
||||
* @deprecated since 5.0
|
||||
*
|
||||
* @Then /^following "(?P<link_string>[^"]*)" "(?P<selector_string>[^"]*)" in the "(?P<element_container_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)" should download between "(?P<min_bytes>\d+)" and "(?P<max_bytes>\d+)" bytes$/
|
||||
* @param string $link the text of the link.
|
||||
* @param string $selectortype The type of what we look for
|
||||
* @param string $nodeelement Element we look in
|
||||
* @param string $nodeselectortype The type of selector where we look in
|
||||
* @param int $minexpectedsize the minimum expected file size in bytes.
|
||||
* @param int $maxexpectedsize the maximum expected file size in bytes.
|
||||
* @return void
|
||||
* @throws ExpectationException
|
||||
*/
|
||||
#[\core\attribute\deprecated('behat_admin_presets::following_in_the_should_download_between_and_bytes', since: '5.0')]
|
||||
final public function following_in_the_should_download_between_and_bytes(string $link, string $selectortype,
|
||||
string $nodeelement, string $nodeselectortype, int $minexpectedsize, int $maxexpectedsize): void {
|
||||
|
||||
$this->deprecated_message("behat_admin_presets::following_in_the_should_download_between_and_bytes
|
||||
is deprecated. Use: the following element should download a file that:");
|
||||
|
||||
// If the minimum is greater than the maximum then swap the values.
|
||||
if ((int) $minexpectedsize > (int) $maxexpectedsize) {
|
||||
list($minexpectedsize, $maxexpectedsize) = [$maxexpectedsize, $minexpectedsize];
|
||||
}
|
||||
|
||||
$exception = new ExpectationException('Error while downloading data from ' . $link, $this->getSession());
|
||||
|
||||
// It will stop spinning once file is downloaded or time out.
|
||||
$result = $this->spin(
|
||||
function($context, $args) {
|
||||
return $this->download_file_from_link_within_node($args['selectortype'], $args['link'],
|
||||
$args['nodeselectortype'], $args['nodeelement']);
|
||||
},
|
||||
[
|
||||
'selectortype' => $selectortype,
|
||||
'link' => $link,
|
||||
'nodeselectortype' => $nodeselectortype,
|
||||
'nodeelement' => $nodeelement
|
||||
],
|
||||
behat_base::get_extended_timeout(),
|
||||
$exception
|
||||
);
|
||||
|
||||
// Check download size.
|
||||
$actualsize = (int) strlen($result);
|
||||
if ($actualsize < $minexpectedsize || $actualsize > $maxexpectedsize) {
|
||||
throw new ExpectationException('Downloaded data was ' . $actualsize .
|
||||
' bytes, expecting between ' . $minexpectedsize . ' and ' .
|
||||
$maxexpectedsize, $this->getSession());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given the text of a link, download the linked file and return the contents.
|
||||
*
|
||||
* This is a helper method used by {@see following_in_the_should_download_between_and_bytes()}
|
||||
*
|
||||
* @param string $selectortype The type of what we look for
|
||||
* @param string $link the text of the link.
|
||||
* @param string $nodeselectortype The type of selector where we look in
|
||||
* @param string $nodeelement Element we look in
|
||||
* @return string the content of the downloaded file.
|
||||
*/
|
||||
final public function download_file_from_link_within_node(string $selectortype, string $link,
|
||||
string $nodeselectortype, string $nodeelement): string {
|
||||
// Find the link from ur specific node.
|
||||
$linknode = $this->get_node_in_container($selectortype, $link, $nodeselectortype, $nodeelement);
|
||||
$this->ensure_node_is_visible($linknode);
|
||||
|
||||
// Get the href and check it.
|
||||
$url = $linknode->getAttribute('href');
|
||||
if (!$url) {
|
||||
throw new ExpectationException('Download link does not have href attribute',
|
||||
$this->getSession());
|
||||
}
|
||||
if (!preg_match('~^https?://~', $url)) {
|
||||
throw new ExpectationException('Download link not an absolute URL: ' . $url,
|
||||
$this->getSession());
|
||||
}
|
||||
|
||||
// Download the URL and check the size.
|
||||
$session = $this->getSession()->getCookie('MoodleSession');
|
||||
return download_file_content($url, ['Cookie' => 'MoodleSession=' . $session]);
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_deleted
|
||||
*/
|
||||
final class preset_deleted_test extends \advanced_testcase {
|
||||
class preset_deleted_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_deleted event.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_downloaded
|
||||
*/
|
||||
final class preset_downloaded_test extends \advanced_testcase {
|
||||
class preset_downloaded_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_downloaded event.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_exported
|
||||
*/
|
||||
final class preset_exported_test extends \advanced_testcase {
|
||||
class preset_exported_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_exported event.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_imported
|
||||
*/
|
||||
final class preset_imported_test extends \advanced_testcase {
|
||||
class preset_imported_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_imported event.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_loaded
|
||||
*/
|
||||
final class preset_loaded_test extends \advanced_testcase {
|
||||
class preset_loaded_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_loaded event.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_previewed
|
||||
*/
|
||||
final class preset_previewed_test extends \advanced_testcase {
|
||||
class preset_previewed_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_previewed event.
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace tool_admin_presets\event;
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @covers \tool_admin_presets\event\preset_reverted
|
||||
*/
|
||||
final class preset_reverted_test extends \advanced_testcase {
|
||||
class preset_reverted_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test preset_reverted event.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user