Compare commits

..

519 Commits

Author SHA1 Message Date
Sara Arjona 4d3a32dde9 Moodle release 3.6.3 2019-03-08 11:03:15 +01:00
AMOS bot bba5a34bc2 Automatically generated installer lang files 2019-03-08 00:15:20 +00:00
Eloy Lafuente (stronk7) 5c592fcf75 weekly release 3.6.2+ 2019-03-07 16:42:00 +01:00
Eloy Lafuente (stronk7) 763f673820 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-03-07 16:41:57 +01:00
Adrian Greeve 09f9f81835 Merge branch 'MDL-63905_36' of git://github.com/jmvedrine/moodle into MOODLE_36_STABLE 2019-03-07 09:13:00 +08:00
Andrew Nicols 5ee3cbc624 MDL-64410 access: Unit tests for context locking SQL 2019-03-06 12:36:26 +01:00
Andrew Nicols 90c2e5e707 MDL-64410 access: Check for context locking in cap functions 2019-03-06 12:36:26 +01:00
Jun Pataleta f33bc18d2d Merge branch 'MDL-64333_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-03-06 17:34:02 +08:00
Mark Nelson 00ee6158fc MDL-64333 core_message: add migration message to new UI 2019-03-06 17:26:24 +08:00
Andrew Nicols da40ba154c Merge branch 'MDL-64774-36' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-03-06 15:46:33 +08:00
Jean-Michel Vedrine 5f9d6e34a3 MDL-63905 qtype_multianswer: validate imported questions 2019-03-06 08:38:21 +01:00
Andrew Nicols 552877454c Merge branch 'MDL-64950-36-2' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-03-06 13:47:54 +08:00
Jun Pataleta 732698302e MDL-64950 core: Handle username in a case-insensitive fashion 2019-03-06 12:46:01 +08:00
Jun Pataleta c4d39ba7d7 MDL-64950 core: Unit tests for get_complete_user_data() 2019-03-06 12:46:01 +08:00
Jun Pataleta 3ca7a701a6 MDL-64950 login: core_login_validate_forgot_password_data() unit tests 2019-03-06 12:46:01 +08:00
Andrew Nicols e389c5cd31 MDL-64971 access: Ensure that the capability exists when fetching 2019-03-06 10:15:55 +08:00
Jun Pataleta 7766baeb63 MDL-64774 user: Make email query case-insensitive 2019-03-06 09:00:18 +08:00
Jun Pataleta 5f779f05e8 MDL-64774 user: Better unit tests for updating users with similar emails 2019-03-06 09:00:18 +08:00
AMOS bot be998e5e63 Automatically generated installer lang files 2019-03-06 00:09:32 +00:00
Eloy Lafuente (stronk7) 8971a35e38 Merge branch 'MDL-64943_36' of git://github.com/stronk7/moodle into MOODLE_36_STABLE 2019-03-05 22:49:43 +01:00
Eloy Lafuente (stronk7) f6d98c3c8d MDL-64943 behat: fix some remaining uses of old strings 2019-03-05 17:02:08 +01:00
Eloy Lafuente (stronk7) 70602491f6 Merge branch 'MDL-64943-36-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_36_STABLE 2019-03-05 11:09:27 +01:00
Jun Pataleta b6f517c251 Merge branch 'MDL-62465-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-03-05 15:30:17 +08:00
Adrian Greeve 7ea5221a52 Merge branch 'MDL-64342-36' of git://github.com/cescobedo/moodle into MOODLE_36_STABLE 2019-03-05 15:02:00 +08:00
Damyon Wiese 7dac132efc MDL-62465 assign: Remove behat step
We don't need to open the menu to choose the "Grade" item, we can just click the button.
2019-03-05 14:49:02 +08:00
Adrian Greeve d9bb99f336 Merge branch 'MDL-64864-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-03-05 14:26:16 +08:00
Adrian Greeve 248639d3ae Merge branch 'MDL-64678-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-03-05 13:52:53 +08:00
Andrew Nicols 45f4d171d4 Merge branch 'MDL-64961-m36' of https://github.com/sammarshallou/moodle into MOODLE_36_STABLE 2019-03-05 13:24:47 +08:00
Andrew Nicols fdb8f40617 Merge branch 'MDL-64981_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-03-05 13:22:35 +08:00
Shamim Rezaie 5226cc8a50 MDL-64830 core_calendar: Do cap check on event edit form 2019-03-05 04:16:40 +01:00
Damyon Wiese 1fc481dd7b MDL-64651 comments: Do not send referrer
Use blanktarget option on all comments to prevent malicious links.
2019-03-05 04:16:40 +01:00
Viktor cd3060d941 MDL-62702 core_lib: fix broken verification signature 2019-03-05 04:16:40 +01:00
Mark Nelson 868a80972c MDL-62702 core_lib: updated the 'ltiprovider' readme_moodle.txt 2019-03-05 04:16:40 +01:00
Brendan Cox 430f685834 MDL-62702 core_lib: parameters in POST override other LTI values
This fixes an exploit where you could alter the 'Content-Type' of the
request and bypass the case-sensitive check 'strstr'. For example,
setting it to 'application/x-www-FORM-urlencoded'. However, changing
this to use 'stristr' was also not an acceptable approach as you
could also bypass it by setting the value to 'multipart/form-data'.
2019-03-05 04:16:40 +01:00
Ryan Wyllie a37e26d2ef MDL-63786 core: set $CFG->forceclean for logged in as sessions
Turn on the forceclean config setting when a user is logged in as a
different user. This is a precautionary measure, which forces all
user submitted content to be cleaned of JavaScript before rendering
it to the logged in as user.
2019-03-05 04:16:40 +01:00
Luca Bösch 7f22b14efb MDL-64706 theme_boost: Remove logo link in secure template 2019-03-05 04:16:40 +01:00
Jun Pataleta 78fa8d7e8e Merge branch 'MDL-64652-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-03-05 11:13:40 +08:00
Adrian Greeve c355be438d Merge branch 'MDL-64941-36' of https://github.com/MartinGauk/moodle into MOODLE_36_STABLE 2019-03-05 11:10:27 +08:00
Andrew Nicols c2a6c7c134 MDL-64652 mod_data: Break LEFT JOINs to multiple INNER 2019-03-05 10:14:15 +08:00
Andrew Nicols 309931c876 MDL-64652 glossary: Break LEFT JOINs to multiple INNER 2019-03-05 10:14:15 +08:00
Andrew Nicols 445deddb96 MDL-64652 forum: Use an inner join when fetching ratings 2019-03-05 10:14:15 +08:00
Andrew Nicols 842723567c MDL-64652 rating: Add optional inner join option to sql 2019-03-05 10:14:12 +08:00
Andrew Nicols 28fc193cf6 MDL-64652 mod_forum: Performance improvement for provider
There are possibly some further improvements that can be made to:
- export_discussion_data
- export_all_posts
2019-03-05 10:13:16 +08:00
Adrian Greeve 650d667817 Merge branch 'MDL-64863-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-03-05 09:53:37 +08:00
Jun Pataleta 4dcbcc6f93 Merge branch 'MDL-62143-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-03-05 09:44:46 +08:00
Damyon Wiese 781b8153dd MDL-64864 core_competency: Include course category
These courses are passed through to the course_summary_exporter which
requires a category id in each course record.
2019-03-05 08:53:24 +08:00
Damyon Wiese 6cc9fd7dc1 MDL-64678 assign: More ios touch
Only disable touch scrolling when the touch event is within the drawing region of the canvas.
2019-03-05 08:47:04 +08:00
AMOS bot d1a13ec7ce Automatically generated installer lang files 2019-03-04 00:09:44 +00:00
cescobedo 9779a220fa MDL-64342 core_message: make ajax call when privacy setting is changed
Only fire ajax request when the privacy setting value is changed.
2019-03-03 23:35:38 +01:00
sam marshall 68157ec22f MDL-64961 REST web service: Fatal error in error handler 2019-03-01 11:57:33 +00:00
Tim Hunt 4ed6bb0c22 MDL-64981 dml tests: pgsql_native_recordset_testcase port number 2019-03-01 11:13:16 +00:00
Martin Gauk f484cf49c4 MDL-64941 qtype_multianswer: keep order of existing wrapped questions 2019-03-01 09:49:26 +00:00
AMOS bot fdd78199a2 Automatically generated installer lang files 2019-03-01 00:15:45 +00:00
David Mudrák 7be07980d9 MDL-64943 lang: Fix regression in the test caused by the reworded string 2019-02-28 19:58:41 +01:00
Eloy Lafuente (stronk7) b39b8eb2f5 weekly release 3.6.2+ 2019-02-28 18:51:48 +01:00
Eloy Lafuente (stronk7) 9d3bcd1abf Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-02-28 18:51:45 +01:00
David Mudrák d2a16b6e81 MDL-64943 lang: Fix regressions in Behat caused by reworded strings 2019-02-28 17:58:03 +01:00
Helen Foster 9fb3f4ca10 MDL-64943 lang: Import fixed English strings (en_fix)
Significant string changes:

* importgroups_help,core_group - Correcting optional fieldnames
  (removing picture, hidepicture and adding groupidnumber, groupingname
  and enablemessaging)

* penaltyforeachincorrecttry_help,core_question - additional paragraph
  about scoring logic

* resultdownloadready,tool_dataprivacy - wording corrected (no need to
  go to a download page)

* auth_dbfielduser,auth_db - varchar data type requirement
2019-02-28 17:55:05 +01:00
Eloy Lafuente (stronk7) 0130945cf5 Merge branch 'MDL-64444-36' of git://github.com/jleyva/moodle into MOODLE_36_STABLE 2019-02-28 01:21:10 +01:00
Eloy Lafuente (stronk7) e7bf9748c5 Merge branch 'MDL-64878-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-27 19:01:03 +01:00
Sara Arjona 2dd56328a7 Merge branch 'MDL-55135-36-competencies-manage-in-coursecontext' of https://github.com/wjroes/moodle into MOODLE_36_STABLE 2019-02-27 11:51:42 +01:00
Sara Arjona 352ed37ac4 Merge branch 'MDL-62454-36' of git://github.com/bmbrands/moodle into MOODLE_36_STABLE 2019-02-27 08:58:11 +01:00
Andrew Nicols c4edcf9960 Merge branch 'MDL-64889_36_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_36_STABLE 2019-02-27 14:43:54 +08:00
Andrew Nicols 7b0134f69d Merge branch 'wip-36-MDL-62345' of https://github.com/adpe/moodle into MOODLE_36_STABLE 2019-02-27 14:14:02 +08:00
Andrew Nicols a1eb4ad4d3 Merge branch 'MDL-63674-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-02-27 13:01:46 +08:00
Damyon Wiese 7cd7f20202 MDL-64878 grades: Update delete_instance
When grades are deleted, it needs to know the context so any files
in the gradebook can be deleted. This means module delete_instance
functions must delete the grade_item before they delete the module record.
2019-02-27 10:40:02 +08:00
Damyon Wiese 1a3faa11b7 MDL-64878 grades: Rebuild cache on import
When the course module cache is out of date during a gradebook re-calculcation it throws
throws exceptions because the module cannot be found. This prevents access to gradebook or
any type of grading functions until the cache is rebuilt.

When the cache still has no module record we log an error and return the course context.
2019-02-27 10:40:02 +08:00
Andrew Nicols 8152908f69 Merge branch 'MDL-64591_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-02-27 09:54:51 +08:00
AMOS bot aca4c2a49c Automatically generated installer lang files 2019-02-27 00:09:43 +00:00
Eloy Lafuente (stronk7) 24ffbc4e2b Merge branch 'MDL-63417-36' of git://github.com/mihailges/moodle into MOODLE_36_STABLE 2019-02-26 23:19:12 +01:00
Sara Arjona aa1279b7cf Merge branch 'MDL-43428-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-02-26 14:09:06 +01:00
Tim Hunt 2cbf3ea580 MDL-64591 User tours: don't show during redirects & other bad times 2019-02-26 13:05:51 +00:00
Shamim Rezaie 63559b4796 MDL-43428 accessrule_timelimit: timeclose can be ealier than timelimit 2019-02-26 14:45:24 +11:00
Andrew Nicols 39113784bc Merge branch 'MDL-64663_36' of git://github.com/aanabit/moodle into MOODLE_36_STABLE 2019-02-26 11:08:02 +08:00
Sara Arjona 71dc512e46 Merge branch 'MDL-64862-36-workshopgradepass' of git://github.com/mudrd8mz/moodle into MOODLE_36_STABLE 2019-02-25 18:31:26 +01:00
Sara Arjona fb62fb8e69 Merge branch 'MDL-64931_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-02-25 17:19:33 +01:00
Adrian Greeve fff6f3fa55 Merge branch 'MDL-64640-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-02-25 10:28:11 +01:00
Amaia Anabitarte ec32dbcd8c MDL-64663 core_message: Behat to test admin settings 2019-02-25 10:16:17 +01:00
Andrew Nicols fc13071f37 Merge branch 'MDL-64561-36-test' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-02-25 15:52:23 +08:00
Charles Fulton 7b37ec0381 MDL-64561 install: show help text before database check 2019-02-25 16:44:22 +11:00
Shamim Rezaie 1e2491b9ea MDL-63674 core_messaging: Fix message drawer's shadow in RTL 2019-02-25 14:41:07 +11:00
Shamim Rezaie 9e0958bb49 MDL-63674 core_messaging: Bidi text support 2019-02-25 14:41:07 +11:00
Mark Nelson 2c50550271 MDL-64931 core_message: fixed PHP error when users are deleted from DB 2019-02-25 07:49:39 +08:00
Adrian Perez ddce5a8d34 MDL-62345 navigation: Change data-key for dashboard rootnode 2019-02-22 16:57:43 +01:00
Andrew Nicols 289475f3da weekly release 3.6.2+ 2019-02-22 10:51:34 +08:00
Andrew Nicols 63c7118de6 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-02-22 10:51:30 +08:00
Bas Brands be1e22c5f0 MDL-62454 theme_boost: numerical qtype answer inline 2019-02-21 14:35:40 +01:00
Adrian Greeve 61451240d2 Merge branch 'MDL-64729-36' into MOODLE_36_STABLE 2019-02-21 12:33:07 +01:00
John Beedell 1d4da3c1b6 MDL-64729 mod_glossary: glossary_get_entries_search case sensitivity 2019-02-21 12:31:59 +01:00
Andrew Nicols a628bbe9f7 Merge branch 'MDL-64571-36' of git://github.com/cescobedo/moodle into MOODLE_36_STABLE 2019-02-21 08:38:29 +08:00
Adrian Greeve b406ced13c Merge branch 'MDL_64856_m36v1' of git://github.com/sbourget/moodle into MOODLE_36_STABLE 2019-02-20 18:04:44 +01:00
Adrian Greeve baa408f1af Merge branch 'MDL-64200-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-20 15:59:16 +01:00
Adrian Greeve c61a082515 Merge branch 'MDL-64450-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-02-20 11:37:45 +01:00
Matteo Scaramuccia 4945e2e146 MDL-64443 git: Excluded vim swap files
Vim swap filenames are deterministic someway.
Refs:
- http://vimdoc.sourceforge.net/htmldoc/recover.html#swap-file
- https://github.com/vim/vim/blob/4efe73b478d3ba689078da502fd96f45204ff1f5/src/memline.c#L4683
- https://unix.stackexchange.com/a/326737
- https://github.com/github/gitignore/blob/master/Global/Vim.gitignore
2019-02-20 10:22:34 +01:00
David Monllaó 5d25911f42 MDL-64500 tool_analytics: noanalysables negation better than analysables 2019-02-20 10:09:58 +01:00
Andrew Nicols 09ad6346b2 Merge branch 'MDL-64570-36-fix1' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-20 10:55:09 +08:00
Damyon Wiese 5c6553f4bb MDL-64570 user: input field purpose
Do not autocomplete the user fields when editing another user.
2019-02-20 09:49:29 +08:00
Eloy Lafuente (stronk7) 3909b0e461 Merge branch 'MDL-64679_36' of git://github.com/dmonllao/moodle into MOODLE_36_STABLE 2019-02-20 00:07:00 +01:00
Eloy Lafuente (stronk7) 0b4d0426ea Merge branch 'MDL-63134-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-02-20 00:01:01 +01:00
Eloy Lafuente (stronk7) 98c4307560 Merge branch 'MDL-64806-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-19 23:34:47 +01:00
Eloy Lafuente (stronk7) 7ce55f6f3e Merge branch 'MDL-64242_36' of git://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-02-19 23:23:00 +01:00
Eloy Lafuente (stronk7) 272004978a Merge branch 'MDL-64791-36' of git://github.com/jleyva/moodle into MOODLE_36_STABLE 2019-02-19 17:43:06 +01:00
Eloy Lafuente (stronk7) 8db7687f02 Merge branch 'MDL-62008-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-19 17:23:52 +01:00
Eloy Lafuente (stronk7) db75278d93 Merge branch 'MDL-64500_36' of git://github.com/dmonllao/moodle into MOODLE_36_STABLE 2019-02-19 17:10:47 +01:00
Damyon Wiese 2165cd3410 MDL-64540 assign: Backport of MDL-60008
This patch combines the following changes:

* Basically we should produce a combined PDF from all the files that it was possible to convert.
* If any one submission input file fails conversion, it should just be omitted in the result.
* When not all files are available in the online pdf, display a warning to graders
that some files must be downloaded.
* Better support for information messages from the conversion process.
* Remove the z-index values from the expand / collapse panels. They cause errors when mixed with dialogues.
* The edit pdf menus are all broken on small screen sizes. They consume 100% of the page with for no reason.
* The heights of the buttons to hide/show panels are arbitrarily big. There is not need to set them specifically.

Amended on integration to get rid if incorrect 'destroyed' block of
code. See the issue for more information.
2019-02-19 15:53:36 +01:00
Adrian Greeve 02bcf4644d Merge branch 'MDL-60459_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-02-19 11:49:45 +01:00
David Monllaó e0ca602e98 MDL-64570 user: Remove empty line 2019-02-19 09:27:13 +01:00
David Monllaó 1825a5a6dc Merge branch 'MDL-64570-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-19 09:26:20 +01:00
David Monllaó 7bab771a8b Merge branch 'MDL-45151-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-19 06:40:28 +01:00
Damyon Wiese f63afeb168 MDL-64570 user: coding style
Fix cibot warnings on line length.
2019-02-19 09:45:21 +08:00
Damyon Wiese fbf75a8605 MDL-64570 accessibility: autocomplete user profile fields
Only if editing your own user details and not logged in as someone else.
2019-02-19 09:45:21 +08:00
Damyon Wiese 633e97845f MDL-64570 accessibility: purpose login fields
Provide the autocomplete attribute and username / current-password values to username
and password fields in login forms.

https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose.html
2019-02-19 09:45:21 +08:00
David Mudrák 0488a0b30b MDL-64862 workshop: Fix grades to pass editing
There was a bug here that had not exposed until MDL-60820 introduced the
call $mform->setDefault() at the bottom of the definition_after_data()
method. That call triggers the 'updateValue' event on all form elements.
For input text elements, this effectively sets their value to the
default one, which was empty in this case due to the way how the value
had been set.

The solution here is to set the value via the same way like the normal
set_data() method does it.

The attached Behat test reproduces the problem and makes sure the patch
works.
2019-02-18 17:46:11 +01:00
Adrian Greeve b07174669f Merge branch 'MDL-64452-36-cachesession' of git://github.com/mudrd8mz/moodle into MOODLE_36_STABLE 2019-02-18 15:53:51 +01:00
Mark Johnson 0c81fe1f2e MDL-64889 completion: Fix performance of get_course_progress_percentage 2019-02-18 14:07:37 +00:00
willem bef3421021 MDL-55135 competencies: fix capabilities managing course competencies
Capability check in a course was using global competency capabilities 
moodle/competency:competencyview and  moodle/competency:competencymanage 
instead of the course equivalents. Users outside the course context 
could not manage course competencies.
2019-02-18 11:00:04 +01:00
AMOS bot e28cb2630d Automatically generated installer lang files 2019-02-16 00:13:48 +00:00
David Mudrák 9fb92df867 MDL-64452 cache: Add tests for key prefix based on session id
Unfortunately, we can't simply use session_id() to regenerate the
session id in unit tests. Starting from PHP 7.2, it would trigger
"session_id(): Cannot change session id when headers already sent",
refer to MDL-60978 and PHP bug #75628 for more details.

As a workaround, we use a static property allowing us to inject the
value that we then use as a session identifier. This is reasonably
enough to make sure that the identifier is used as a part of the key
prefix.
2019-02-15 09:37:51 +01:00
David Mudrák c2922fab27 MDL-64452 cache: Always use the current session id in the key prefix
The current logic in the cache_session::check_tracked_user() is not
right. We must always set the current session id. A typical use case is
when the cache instance is instantiated for a not logged in user. We
can't let the sessionid property null in that case as it forms an
important part of the parsed key.

Similarly, even if we have the same user currently loaded, we must still
set the sessionid to make sure the data will be associated with the
current PHP session. Same user (including visitors or guest users) can
access the site from different browsers and each must end up with its
own key prefix.
2019-02-15 09:37:51 +01:00
David Monllaó ce23f4f65c MDL-64679 tool_analytics: Allow trained models to be cleared 2019-02-15 08:43:24 +01:00
Damyon Wiese d531638e2d MDL-64863 tool_lp: Progress if needed
Do not immediately show progress bars since most operations work
in under a second. This will use the default timeout (5 seconds)
before showing progress bars.
2019-02-15 09:10:27 +08:00
Andrew Nicols 22430761b1 weekly release 3.6.2+ 2019-02-15 08:29:28 +08:00
Andrew Nicols b83543bb45 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-02-15 08:29:26 +08:00
Stephen Bourget d0aa6e157a MDL-64856 mod_glossary: Always show the settings cog on the view page. 2019-02-14 12:45:30 -05:00
Jun Pataleta 55d1f79921 Merge branch 'MDL-64736-36-2' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-02-14 15:00:48 +08:00
Andrew Nicols 3b0b9777be Merge branch 'MDL-64788_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-02-14 09:40:37 +08:00
Jun Pataleta 38a80c43db Merge branch 'MDL-63892-36-rework' of git://github.com/mickhawkins/moodle into MOODLE_36_STABLE 2019-02-13 21:01:05 +08:00
Michael Hawkins 1ddc6cc840 MDL-63892 mod_forum: Behat update for post order 2019-02-13 17:24:38 +08:00
Jun Pataleta 10ddb5d90c Merge branch 'MDL-64835-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-02-13 16:27:08 +08:00
Andrew Nicols 4ad618ec4d Merge branch 'MDL-64714-36' of git://github.com/cescobedo/moodle into MOODLE_36_STABLE 2019-02-13 11:24:26 +08:00
Andrew Nicols 8bc84e2fd9 Merge branch 'MDL-63892-36-rework' of git://github.com/mickhawkins/moodle into MOODLE_36_STABLE 2019-02-13 10:19:15 +08:00
Andrew Nicols e556c94666 MDL-64835 JS: Reduce cache invalidation checks
The cache invalidation check was previously occuring every time either
the `set` or `get` function was called on the cache. However, the cache
invalidation check is based on the jsrev which is static for the
lifetime of the page.

This change moved the invalidation to happen during the setup of the AMD
module such that it only happens one time per storage type (Local +
Session).
2019-02-13 10:13:43 +08:00
Andrew Nicols 44bc92dfdd MDL-64835 JS: Stop using the jsrev in the jsrevPrefix
We only use the jsrevPrefix to determine if the cache should be
invalidated, but the prefix that we were using is based on the new
jsrev.

For example, the jsrevPrefix will be:

    hash(wwwroot + '/ + config.jsrev) + '/jsrev'

Where config.jsrev is the _current_ (new) jsrev.

As a result when searching for the jsrev used to store the data which is
currently in the storage cache, no key is returned, and we instead set
an 'initial' value and the cache is not cleared

This patch changes the jsrevPrefix to be:

    hash(wwwroot) + '/jsrev'

Since the wwwroot does not change, the key remains static for the
current site. As a result, when the jsrev is bumped via a Moodle cache
purge, we are able to correctly fetch the old jsrev from the cache,
determine that the jsrev has changed, and purge the cache.
2019-02-13 10:13:43 +08:00
AMOS bot 519ce6aef9 Automatically generated installer lang files 2019-02-13 00:11:44 +00:00
Eloy Lafuente (stronk7) d64e812632 Merge branch 'MDL-64420-2_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-02-12 12:56:35 +01:00
David Monllaó 38ba693c91 Merge branch 'MDL-64590_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-02-12 12:46:57 +01:00
David Monllaó bb10d3523e Merge branch 'MDL-64730-lti-adv-0score-36' of https://github.com/CengageEng/moodle into MOODLE_36_STABLE 2019-02-12 12:33:44 +01:00
John Beedell fb77164490 MDL-64420 qtype: gapselect unit tests unsafe 2019-02-12 11:27:02 +00:00
David Monllaó 0b796573d4 Merge branch 'MDL-32096-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-02-12 09:41:41 +01:00
Andrew Nicols 51e5aebafc Merge branch 'MDL-64291_36' of https://github.com/KietChan/moodle into MOODLE_36_STABLE 2019-02-12 10:55:32 +08:00
Jun Pataleta 1385b3a3cb Merge branch 'MDL-64493-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-12 10:11:58 +08:00
cescobedo 1796fe1494 MDL-64571 core_message: Fix duplicate footer in msg notification email 2019-02-12 00:44:01 +01:00
Andrew Nicols f37e6ca42a MDL-64736 course: Rewrite behat step to avoid changing a checkbox 2019-02-12 07:43:37 +08:00
Eloy Lafuente (stronk7) 7005a8da73 Merge branch 'MDL-61326-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-02-12 00:20:29 +01:00
Peter 4a8d7f56cd MDL-61326 repository_equella: Pass proper labels for roles with no name 2019-02-12 07:11:31 +08:00
Eloy Lafuente (stronk7) 695b639f4b Merge branch 'MDL-64694_36' of git://github.com/dmonllao/moodle into MOODLE_36_STABLE 2019-02-12 00:10:26 +01:00
Eloy Lafuente (stronk7) 2af09bc931 Merge branch 'MDL-64606-36' of https://github.com/lucaboesch/moodle into MOODLE_36_STABLE 2019-02-12 00:02:32 +01:00
Eloy Lafuente (stronk7) e1c332acbb Merge branch 'MDL-64238-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-02-11 23:56:55 +01:00
Peter e7f53ec0c8 MDL-64238 mod_quiz: Check enrollment on calendar_action generator
* Updated unit tests to account for participants
2019-02-12 06:26:40 +08:00
Peter 0cf0c2f339 MDL-64238 mod_lesson: Check enrollment calendar_action generator
* Updated unit tests to account for participants
2019-02-12 06:26:40 +08:00
Eloy Lafuente (stronk7) 44e3097e3d Merge branch 'MDL-64725-36' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-02-11 17:04:45 +01:00
Eloy Lafuente (stronk7) 98e572b770 Merge branch 'M3.6-MDL-64599' of https://github.com/marcusboon/moodle into MOODLE_36_STABLE 2019-02-11 12:51:06 +01:00
Eloy Lafuente (stronk7) 152ec9fda2 Merge branch 'MDL-64385-36' of git://github.com/aanabit/moodle into MOODLE_36_STABLE 2019-02-11 12:35:34 +01:00
Sara Arjona 2b4b6c934e Merge branch 'MDL-64031-36' of https://github.com/lethevinh/moodle into MOODLE_36_STABLE 2019-02-11 12:33:13 +01:00
David Monllaó 0e3b2bab1b Merge branch 'MDL-64391_36' of git://github.com/vmdef/moodle into MOODLE_36_STABLE 2019-02-11 11:09:23 +01:00
Sara Arjona f87961e5ef Merge branch 'MDL-48338-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-02-11 10:41:15 +01:00
David Monllaó 188d64d2b0 Merge branch 'MDL-62666-36' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-02-11 09:49:05 +01:00
Tim Hunt f2d827461d MDL-64242 qtype_essay: more efficient query in restore code
Thanks to Juan Ibarra for the suggestion that lead to this fix.
2019-02-11 08:40:43 +00:00
Andrew Nicols 02606519d6 Merge branch 'MDL-64597-36' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-02-11 16:35:28 +08:00
Jun Pataleta 8729365749 Merge branch 'MDL-64488-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-11 16:05:45 +08:00
Jun Pataleta aecc41b81c Merge branch 'MDL-64644_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-02-11 15:28:55 +08:00
Andrew Nicols 29062ac7b6 Merge branch 'MDL-64393_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-02-11 15:11:38 +08:00
Shamim Rezaie 5848b3abf5 MDL-63134 mod_chat: Check if the module is visible to the user 2019-02-11 16:10:23 +11:00
Shamim Rezaie 659a617729 MDL-63134 mod_chat: Add userid param to mod_chat calendar callbacks 2019-02-11 16:10:23 +11:00
AMOS bot 20fd621fcb Automatically generated installer lang files 2019-02-10 00:10:16 +00:00
Luca Bösch e4f0b24b18 MDL-64606 templates: Show & instead of & in url-select. 2019-02-08 13:22:58 +01:00
Jun Pataleta bc41eabea5 weekly release 3.6.2+ 2019-02-08 14:54:37 +08:00
Damyon Wiese d050b00a71 MDL-64806 theme_boost: Do not label "More" icon
The icon is next to the text that says the same thing. Hide it from screenreaders.
2019-02-08 09:37:18 +08:00
Juan Leyva 181e04ce5d MDL-64791 messages: Bring back 'messagecontactrequests' message 2019-02-07 12:07:01 +01:00
Eloy Lafuente (stronk7) a28ffd62d9 Merge branch 'MDL-62680-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-07 10:22:53 +01:00
Anthony Ales 841709bbb5 MDL-48338 forum: Missing #unread in discussion post url
When a user user selects the unread messages link from the forum
discussion page, the link does not include '#unread' in the url.
This patch appends '#unread' to the url by changing the appropriate
value in the reference link assigned to $out within the function
forum_cm_info_view() of the 'lib.php'file.

A similar change is on the forum index.
2019-02-07 15:17:03 +08:00
Andrew Nicols 4f4d5af3ed Merge branch 'MDL-64633-36' of https://github.com/ewallah/moodle into MOODLE_36_STABLE 2019-02-07 14:54:26 +08:00
Andrew Nicols 6be3214047 Merge branch 'MDL-64577-36-fix' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-02-07 11:54:50 +08:00
Jun Pataleta 29c224ce81 MDL-64577 grade: Put back the accidentally deleted value attribute 2019-02-07 11:26:49 +08:00
Peter Eliyahu Kornfeld a5720360db MDL-60459 core_course: set default for 'visibleoncoursepage' 2019-02-07 10:54:09 +08:00
Damyon Wiese 6f70544c44 MDL-62680 output: Only hide icons with no label
For accessibility we don't want to read an icon with a label immediately next to the label,
but in this case it's clearer for the icon to have no alt text / title for both
screen readers and non-screen readers. Worse is not reading important information just
because it's displayed as an icon.
2019-02-07 10:12:08 +08:00
Eloy Lafuente (stronk7) 747db5e953 Merge branch 'MDL-64577-36' of https://github.com/lucaboesch/moodle into MOODLE_36_STABLE 2019-02-07 00:45:38 +01:00
Eloy Lafuente (stronk7) 574831353e Merge branch 'MDL-64551-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-02-06 23:44:43 +01:00
Eloy Lafuente (stronk7) 00e5454374 Merge branch 'MDL-64469-36' of https://github.com/lethevinh/moodle into MOODLE_36_STABLE 2019-02-06 22:55:11 +01:00
Eloy Lafuente (stronk7) fa10771730 Merge branch 'MDL-63148-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-02-06 13:28:30 +01:00
Eloy Lafuente (stronk7) 3fb2606779 Merge branch 'MDL-63614_M36v1' of https://github.com/sbourget/moodle into MOODLE_36_STABLE 2019-02-06 13:19:47 +01:00
Jun Pataleta c45f8a01bc Merge branch 'MDL-63967_36' of git://github.com/stronk7/moodle into MOODLE_36_STABLE 2019-02-06 16:58:28 +08:00
Mihail Geshoski 7cfe8b3567 MDL-63417 lesson: Re-apply class variable to the question response 2019-02-06 15:02:17 +08:00
Mark Nelson 85b4823199 MDL-64788 core_message: removed unused temporary page 2019-02-06 13:56:29 +08:00
Jun Pataleta 967fd3b748 Merge branch 'MDL-61405-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-06 13:12:42 +08:00
Damyon Wiese fc5d655fa4 MDL-61405 assign: Multiple pdfs are expected
In the same page it is normal (expected) to have multiple links to different annotated pdfs.

In the grading page, we also abort pending ajax progress when the current user is changed.
2019-02-06 09:36:27 +08:00
Eloy Lafuente (stronk7) d3d6bd7fbf Merge branch 'MDL-63516-MOODLE_36_STABLE' of https://github.com/dmitriim/moodle into MOODLE_36_STABLE 2019-02-06 00:16:37 +01:00
Dmitrii Metelkin bf2e077fc8 MDL-63516 groups: fix unexpected debugging message 2019-02-06 09:23:32 +11:00
Sara Arjona 3d0a5f7c54 Merge branch 'MDL-62893_36' of https://github.com/mfabriczy/moodle into MOODLE_36_STABLE 2019-02-05 20:06:41 +01:00
Eloy Lafuente (stronk7) be388ba917 Merge branch 'MDL-61441_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-02-05 16:11:46 +01:00
Jun Pataleta 795465cb0a Merge branch 'MDL-64632_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-02-05 22:40:51 +08:00
cescobedo 63b1eaf29c MDL-64714 core_auth: Fix early break foreach in delete_data_for_user 2019-02-05 12:52:02 +01:00
Marcus Fabriczy 3394af753d MDL-62893 mod: Grade visibility bug in the Outline/Complete reports
Grades that have been hidden will appear in the outline/complete
report - even if the user is a student.

The modules that have been fixed are:
* mod_assign
* mod_data
* mod_forum
* mod_glossary
* mod_lesson
* mod_scorm
* mod_workshop
2019-02-05 20:09:30 +10:30
Peter 6b5d5ce16f MDL-64450 mod_lesson: Update the css for lesson forms
* Reduce the width for the mediaplugin when displayed in forms
* Correct the css to exclude mediaplugin when applying styles
2019-02-05 12:55:37 +08:00
Olivier Piton 24eae720fa MDL-61535 report_security: SQL Perf improvement 2019-02-05 01:44:07 +01:00
Eloy Lafuente (stronk7) eb9f552ac9 Merge branch 'wip-MDL-64404-36' of https://github.com/Beedell/moodle into MOODLE_36_STABLE 2019-02-05 01:30:53 +01:00
Eloy Lafuente (stronk7) 0b0b26f356 Merge branch 'MDL-64649-36' of https://github.com/felicemcc/moodle into MOODLE_36_STABLE 2019-02-04 16:50:55 +01:00
Eloy Lafuente (stronk7) 3de8463fc1 Merge branch 'MDL-63975-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-02-04 13:21:50 +01:00
Damyon Wiese 361b66bdff MDL-62008 output: Help icon text is escaped
The argument to render the pix_icon template from the help_icon template should not
be escaped, they will be escaped by the pix_icon template when it generates the HTML.
2019-02-04 13:46:28 +08:00
Mark Nelson 9ee908f314 MDL-64632 core_message: fixed PHP error when users are deleted from DB 2019-02-04 13:07:11 +08:00
Damyon Wiese 9a4056cbc4 MDL-62465 assign: Allow grade scrolling
Remove the custom override that disables no-overflow in the grading table. This page is better to use
when the grading table is scrollable and the controls around it are not scrollable.
2019-02-04 11:40:31 +08:00
Damyon Wiese aa88adf108 MDL-62465 grade: scrolling CSS
Grading pages have their own special javascript to force "fixed" headers
when scrolling a large table. They rely on the entire page being scrolled,
not just the main region.
2019-02-04 11:40:31 +08:00
Damyon Wiese 534e9692c5 MDL-62465 CSS: scrolling tables
Tables displayed inside a flex box container need position:relative to
calculate their size or they cause incorrect scrollable regions to appear in the page.
2019-02-04 11:40:31 +08:00
Jun Pataleta 7493ad56cb MDL-64725 composer: Use lowercase for package name of dev dependencies 2019-02-04 09:37:53 +08:00
Eloy Lafuente (stronk7) 74647f9ca3 MDL-63967 libs: some filter_var() filters are deprecated with php73
The explicit usage of the constants FILTER_FLAG_SCHEME_REQUIRED and
FILTER_FLAG_HOST_REQUIRED is now deprecated; both are implied for
FILTER_VALIDATE_URL anyway.
2019-02-01 11:56:24 +01:00
David Monllaó 220c8920c9 MDL-64694 report_insights: Remove unnecessary cell classes 2019-02-01 09:10:01 +01:00
Luca Bösch b83af3894d MDL-64577 grade: style "Add ID numbers" button. 2019-02-01 07:09:15 +01:00
David Monllao e3d3ae2e18 MDL-64500 tool_analytics: No invalid analysables message 2019-02-01 06:59:14 +01:00
Damyon Wiese 3926512713 MDL-45151 assign: Add anonymous flag to events if blindmarking 2019-02-01 09:13:31 +08:00
Jun Pataleta 2188da9eed weekly release 3.6.2+ 2019-02-01 08:57:15 +08:00
Jun Pataleta ebd32e0241 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-02-01 08:57:14 +08:00
Eloy Lafuente (stronk7) c254bb8471 Merge branch 'MDL-64737-36-attoprivacysql' of git://github.com/mudrd8mz/moodle into MOODLE_36_STABLE 2019-01-31 22:46:24 +01:00
Sara Arjona 32117f2d12 MDL-62514 form: Add missing data-tags attribute
The data-tags=1 attribute was missing for the autocomplete forms
without suggestions.
2019-01-31 13:50:30 +01:00
David Mudrák 6a5f60d419 MDL-64737 editor_atto: Fix the privacy export_user_data() implementation
Multiple issues fixed:

* Fixed order of the statements to avoid access to undefined variables.
* Fixed population of the SQL query parameter to make sure they match
  the placeholder in the query.
* Fixed missing table aliases in the second query to make sure the query
  actually works as expected.
2019-01-31 12:51:18 +01:00
David Mudrák 1ac0d67ee8 MDL-64737 privacy: Fix privacy provider testsuite file names
Only files ending with "_test.php" suffix are implicit part of a
testsuite. So these two were not actually executed.
2019-01-31 12:51:17 +01:00
Felice Candilio 2c7a567491 MDL-64649 amd: Removing underscores from icons in [Roles/Groups] forms 2019-01-31 11:07:01 +01:00
Damyon Wiese 8027c1dd30 MDL-63975 assign: Fix error when there is no grader 2019-01-31 13:09:27 +08:00
Damyon Wiese 11f2f7efad MDL-64200 atto_media: Improve behat test
By setting the window size before the modal dialogs are opened, we will get
consistent behaviour when interacting with the modal.
2019-01-31 11:54:09 +08:00
Eloy Lafuente (stronk7) cb41802683 Merge branch 'MDL-64320_36' of git://github.com/dmonllao/moodle into MOODLE_36_STABLE 2019-01-31 00:29:34 +01:00
Eloy Lafuente (stronk7) 9666362605 Merge branch 'MDL-64521_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-01-30 23:48:57 +01:00
Eloy Lafuente (stronk7) e3c859bfb3 Merge branch 'MDL-62514-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-01-30 23:01:02 +01:00
Claude Vervoort 703d3f1a05 MDL-64730 LTI Adv: do not ignore 0 score 2019-01-30 16:13:03 -05:00
Eloy Lafuente (stronk7) bdecee10d6 MDL-64528 core_completion: new cap version bump 2019-01-30 21:25:58 +01:00
Charles Fulton f7afadd846 MDL-64528 core_completion: prevent toggling completion in frozen context 2019-01-30 21:25:09 +01:00
Sara Arjona a7e2a7fecf Merge branch 'MOODLE_36_STABLE' of https://github.com/kristian-94/moodle into MOODLE_36_STABLE 2019-01-30 19:09:11 +01:00
Juan Leyva ff28d273e0 MDL-64444 mod_assign: Use correct permissions for context locking
Some WebServices does not use the correct permissions.
This mean that when a context is locked, they don't behave as expected.
2019-01-30 15:27:49 +01:00
Sara Arjona 730b017a9c Merge branch 'MDL-47247-36' of git://github.com/mihailges/moodle into MOODLE_36_STABLE 2019-01-30 14:03:03 +01:00
David Monllao 4939925fd0 MDL-64320 analytics: Validate discrete indicators separately 2019-01-30 12:11:34 +01:00
Sara Arjona 4b07fd7203 Merge branch 'MDL-64566_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-01-30 09:32:08 +01:00
Sara Arjona e2ba0043cf Merge branch 'MDL-64143-36' of https://github.com/ryanwyllie/moodle into MOODLE_36_STABLE 2019-01-30 09:22:42 +01:00
Ryan Wyllie 4293c035a6 MDL-64143 message: make message drawer contacts bold 2019-01-30 09:02:41 +08:00
Andrew Nicols 977cfafd53 MDL-62514 behat: Inplace editable pendingjs wrapper 2019-01-30 08:26:18 +08:00
Andrew Nicols f24c46b406 MDL-62514 behat: Remove potentially conflicting names from description 2019-01-30 08:26:18 +08:00
Andrew Nicols e809dc3394 MDL-62514 behat: Add additional autocomplete validation 2019-01-30 08:26:18 +08:00
Andrew Nicols 55efc4667d MDL-62514 behat: Rewrite handling of autocomplete
This includes a minor restructure of the autocomplete JS to make use of
promises and improve tracking of pending JS.

In particular it improves the way in which throttled text input is
handled to ensure that the behat does not continue until:
- typing is fully complete; and
- all possible ajax requests have been sent; and
- all possible ajax requests complete; and
- the suggestions are updated.

A number of conditions existed where behat would move on to the next
step too early in a race condition effect between Behat and Autocomplete.
2019-01-30 08:26:18 +08:00
Andrew Nicols dd3fa5c531 MDL-62514 behat: Add a wait_for_pending_js to form field 2019-01-30 08:26:18 +08:00
AMOS bot 0ada596ccb Automatically generated installer lang files 2019-01-30 00:10:15 +00:00
Eloy Lafuente (stronk7) 2e65323d4f Merge branch 'MDL-64424-36-expiredfrontpage' of git://github.com/mudrd8mz/moodle into MOODLE_36_STABLE 2019-01-29 23:48:21 +01:00
Eloy Lafuente (stronk7) 4557f2c67b Merge branch 'MDL-64464_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-01-29 19:40:38 +01:00
Ryan Wyllie ffaa6c9f20 MDL-64144 message: show message date in message search results 2019-01-29 16:08:37 +01:00
Sara Arjona 7ab09d0dcc Merge branch 'MDL-63168_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2019-01-29 13:01:00 +01:00
Sara Arjona e14e6a434f Merge branch 'MDL-64313-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-29 12:35:40 +01:00
Sara Arjona de4e98c355 Merge branch 'MDL-61623-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-29 11:20:20 +01:00
Damyon Wiese 7f0ebd3510 MDL-61623 accessibility: Use role, not aria-role 2019-01-29 14:00:04 +08:00
Mihail Geshoski 0932a5b52e MDL-47247 mod_folder: Apply site config when showexpanded is not set 2019-01-29 08:58:38 +08:00
Sara Arjona f1a21cb9ce Merge branch 'MDL-62668-36' of git://github.com/jleyva/moodle into MOODLE_36_STABLE 2019-01-28 19:43:16 +01:00
Binh Thai be3cc9bed3 MDL-64291 GDPR export: Context paths can be very long, not unique 2019-01-28 20:01:54 +07:00
Sara Arjona cfe678062e Merge branch 'MDL-56604-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-28 13:32:49 +01:00
Sara Arjona 485fd16ae0 Merge branch 'MDL-63378-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-28 11:38:11 +01:00
Sara Arjona 7152b86394 Merge branch 'MDL-54804_36' of https://github.com/mfabriczy/moodle into MOODLE_36_STABLE 2019-01-28 10:21:41 +01:00
Garrett Boone bc3ba913e7 MDL-64640 feedback: Fix target link on deletion 2019-01-27 18:15:35 +08:00
Andrew Nicols 52804421a0 MDL-64640 usertours: Fix target link on deletion 2019-01-27 18:15:35 +08:00
Kristian Ringer 8237a017d0 MDL-64700 block_recentlyaccessedcourses: don't escape course names 2019-01-25 10:25:34 +11:00
Eloy Lafuente (stronk7) cc8d7ee698 weekly release 3.6.2+ 2019-01-24 15:12:36 +01:00
Eloy Lafuente (stronk7) 8339c17385 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-01-24 15:12:34 +01:00
Shamim Rezaie e02b7243e0 MDL-52132 qbehaviour_manualgraded: no change when comment is left blank 2019-01-24 16:20:10 +08:00
Damyon Wiese 1cf6ed5a17 MDL-56604 assign: Group submission status
On the page listing all assignments for the course,
show the status of the group submission if teamsubmissions is enabled
for the assignment.
2019-01-24 14:34:17 +08:00
Jun Pataleta a48bccf753 MDL-64597 behat: Properly import behat_util when dropping parallel sites 2019-01-24 12:52:03 +08:00
Damyon Wiese f30ed91534 MDL-64493 completion: Manual completion Ally
Do not use duplicate title attributes on buttons, use aria-live to force the correct state to be
read after clicking on a button.
2019-01-24 08:37:16 +08:00
Damyon Wiese 72ea6fc68e MDL-64488 output: User picture Ally
Do not include alt and title for a user picture if it is hidden from screen readers.

Use aria-hidden to properly hide the image from screen readers.
2019-01-24 08:32:13 +08:00
Eloy Lafuente (stronk7) 2ad0e72498 Merge branch 'MDL-64240-36' of git://github.com/mickhawkins/moodle into MOODLE_36_STABLE 2019-01-24 00:56:50 +01:00
Eloy Lafuente (stronk7) da13ccc61f Merge branch 'MDL-62963-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-24 00:38:28 +01:00
Juan Leyva e76b511228 MDL-62668 mod_workshop: Return feedback for reviewer in assessment phase
Teachers were not able to view the existing feedback.
2019-01-23 18:10:46 +01:00
Eloy Lafuente (stronk7) ff9ba586a1 Merge branch 'MDL-64609-36' of git://github.com/merrill-oakland/moodle into MOODLE_36_STABLE 2019-01-23 18:05:36 +01:00
Mark Sharp eafc25c718 MDL-64391 core_analytics: courseextendednamedisplay 2019-01-23 12:02:15 +00:00
David Mudrák 8bd88a1ecd MDL-64424 privacy: Use system context purpose on the front page, too
For activities on the site's front page, use the purpose and retention
periods as defined for the system context, not for the courses.
2019-01-23 11:12:25 +01:00
Mark Nelson 04ae9eeb9f MDL-64644 completion: fixed assertions in privacy test 2019-01-23 17:31:06 +08:00
Mark Nelson d7cc2c8444 MDL-64644 completion: set status correctly in provider 2019-01-23 17:31:06 +08:00
Mark Nelson dacceac522 MDL-64644 completion: ensure we return array for provider 2019-01-23 17:31:06 +08:00
Sara Arjona 663c66b8c0 Merge branch 'MDL-64107-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-23 10:19:07 +01:00
Sara Arjona 16d059cf92 Merge branch 'MDL-63628-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-23 08:24:34 +01:00
Mark Nelson a0c78cc672 MDL-63168 core_message: added unit test 2019-01-23 13:24:06 +08:00
eWallah 534b0b6147 MDL-63168 core_message: fix failures in migrate_message_data task. 2019-01-23 13:24:06 +08:00
Eric Merrill b2ac807c9f MDL-64609 gradebook: Prevent infinite loop in regrading 2019-01-22 21:40:52 -05:00
Jake Dallimore b92327307a Merge branch 'MDL-52132-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-01-23 09:21:17 +08:00
Eloy Lafuente (stronk7) 7832112121 Merge branch 'MDL-63870_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-01-23 00:09:37 +01:00
Eloy Lafuente (stronk7) 69e8445ac2 Merge branch 'MDL-64465_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-01-23 00:01:48 +01:00
Eloy Lafuente (stronk7) 613c607593 Merge branch 'MDL-64412-36' of https://github.com/snake/moodle into MOODLE_36_STABLE 2019-01-22 23:49:13 +01:00
Eloy Lafuente (stronk7) 56310c4e30 Merge branch 'MDL-64629-36' of git://github.com/sarjona/moodle into MOODLE_36_STABLE 2019-01-22 19:00:54 +01:00
Eloy Lafuente (stronk7) f6857e42fe Merge branch 'MDL-64441-36' of git://github.com/sarjona/moodle into MOODLE_36_STABLE 2019-01-22 18:49:17 +01:00
Shamim Rezaie 0e835752a3 MDL-64521 groups: add more unit tests
These tests were created for MDL-64526, just before MDL-64521 came along
and removed the buggy code. These are good tests, so they are being
kept.
2019-01-22 16:43:33 +00:00
Tim Hunt 186fa09d2b MDL-64521 grouplib: reduce memory use in groups_get_all_groups
This avoids loading multiple copies of g.* when $withmembers is true
2019-01-22 16:43:31 +00:00
Sara Arjona c5fcf18d69 Merge branch 'MDL-63480-36' of git://github.com/mihailges/moodle into MOODLE_36_STABLE 2019-01-22 15:19:02 +01:00
Justus Dieckmann d783d4759c MDL-58256 group: prevents users to be added to a group twice 2019-01-22 13:02:22 +01:00
eWallah d5e0ef78b1 MDL-64633 behat: fix FormatterNotFoundException when updating steps. 2019-01-22 11:39:36 +01:00
Sara Arjona 691da3a929 Merge branch 'MDL-64486-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-01-22 08:23:20 +01:00
Michael Hawkins 8c28651948 MDL-63892 mod_forum: Updating lib unit test 2019-01-22 13:54:54 +08:00
Michael Hawkins ecc36f6066 MDL-63892 mod_forum: Fix last post details in forum view 2019-01-22 13:54:54 +08:00
Michael Hawkins 7f166e30a7 MDL-63892 mod_forum: Correction to timestamp added to edit strings 2019-01-22 13:54:54 +08:00
Peter 86f1a6ba5f MDL-32096 core_report: Remove duplicate filters in reports
* Remove duplicate filters from activity completion and course completion report pages
2019-01-22 13:41:44 +08:00
Damyon Wiese bad1713693 MDL-63628 accessibility: Trigger file links with keyboard 2019-01-22 08:40:49 +08:00
AMOS bot 94ef41597a Automatically generated installer lang files 2019-01-22 00:09:58 +00:00
David Mudrák 9b90c17f74 MDL-64553 message: Add index for the notifications.useridfrom field
The useridfrom would normally be a foreign key to the users table. But
it can also contain some extra negative values with special semantics
(-10 or -20 for no-reply or support user). Therefore we can't make it a
foreign key and the index must be created explicitly.
2019-01-21 13:26:33 +01:00
Jake Dallimore 3741df64fe Merge branch 'MDL-28445-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2019-01-21 15:58:50 +08:00
Jun Pataleta 843e909b7f MDL-62666 course: Only set the groups setting to true when necessary
* Plus update the comment to be more descriptive.
2019-01-21 14:43:01 +08:00
Andrew Hancox 7ed127cfbb MDL-62666 course: Ignore restore_general_groups on activity duplication 2019-01-21 14:43:01 +08:00
Mihail Geshoski ee724278d3 MDL-63480 reports: Fix name filters in completion reports 2019-01-21 09:24:08 +08:00
Jake Dallimore cbd56f1537 Merge branch 'MDL-60972-36_delete_section_files' of https://github.com/awagner/moodle into MOODLE_36_STABLE 2019-01-21 09:04:40 +08:00
Tim Hunt aa8e765a5d MDL-64590 questions: wrong comments shown in the state history table 2019-01-18 18:06:50 +00:00
Sara Arjona ee59fe2276 MDL-64629 theme_clean: Remove underscore near the help icon 2019-01-18 14:32:53 +01:00
Sara Arjona c8ebfd55a2 Merge branch 'MDL-62968-36' of git://github.com/mickhawkins/moodle into MOODLE_36_STABLE 2019-01-18 12:39:56 +01:00
Amaia Anabitarte 2fcf9253b7 MDL-64385 user: Case insensitive comparison for email domains 2019-01-18 10:05:56 +01:00
Marcus Boon 2e7607d68c MDL-64599 phpunit: Fix typo in arraydataset 2019-01-18 07:09:06 +10:00
Tim Hunt a7428f69ad MDL-63870 quiz: new preview should abandon, not finish, current attempt 2019-01-17 17:55:39 +00:00
Eloy Lafuente (stronk7) 7412ad6141 weekly release 3.6.2+ 2019-01-17 17:48:02 +01:00
Andreas Wagner 1f7b1ad0f2 MDL-60972 core_course: delete section files, when section is deleted. 2019-01-17 08:22:32 +01:00
Peter 68e6a93c70 MDL-28445 mod_glossary: Use compound strings as opposed to anglicised
* Use compound strings on buttons to help with proper translations
* Updated behat tests
2019-01-17 10:59:30 +08:00
Eloy Lafuente (stronk7) 1732de328b Merge branch 'MDL-63103-m36' of https://github.com/NeillM/moodle into MOODLE_36_STABLE 2019-01-16 19:02:28 +01:00
Sara Arjona 1e559e85a8 Merge branch 'MDL-63916-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-16 15:33:23 +01:00
Ryan Wyllie 59305e78ed MDL-64134 message: hide empty sections in search results 2019-01-16 13:12:20 +01:00
Ryan Wyllie 63ab57ef42 MDL-64166 message: reduce size of conversation counts in overview 2019-01-16 08:50:41 +01:00
Eloy Lafuente (stronk7) 1f0f6452bb Merge branch 'MDL-63607-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-01-16 00:37:09 +01:00
Sara Arjona 41da53abe4 Merge branch 'MDL-64346-36' of git://github.com/abgreeve/moodle into MOODLE_36_STABLE 2019-01-15 15:38:28 +01:00
Adrian Greeve 793727d8f4 MDL-64346 mod_resource: Fix problems with # in file name. 2019-01-15 14:29:18 +01:00
Sara Arjona 1c8abf9e96 Merge branch 'MDL-64171-36' of git://github.com/bmbrands/moodle into MOODLE_36_STABLE 2019-01-15 13:55:04 +01:00
Sara Arjona 6a6d78107c Merge branch 'MDL-64425-36' of git://github.com/lameze/moodle into MOODLE_36_STABLE 2019-01-15 13:21:05 +01:00
Sara Arjona 4944798626 Merge branch 'MDL-64432_m36' of git://github.com/gjb2048/moodle into MOODLE_36_STABLE 2019-01-15 12:57:48 +01:00
Sara Arjona 33788a4b5f Merge branch 'MDL-62439-36' of https://github.com/lucaboesch/moodle into MOODLE_36_STABLE 2019-01-15 12:02:24 +01:00
Sara Arjona 356e345fb5 Merge branch 'MDL-63881-36' of https://github.com/lucaboesch/moodle into MOODLE_36_STABLE 2019-01-15 11:39:02 +01:00
Andrew Nicols 1ed1421f0f MDL-52132 core_question: Comment is different if format has changed 2019-01-15 18:57:16 +11:00
Shamim Rezaie 32636f9c2c MDL-52132 qbehaviour_manualgraded: unit test for changing comment format 2019-01-15 18:57:16 +11:00
Eloy Lafuente (stronk7) 0d3c7b21be Merge branch 'MDL-63677-36' of git://github.com/sarjona/moodle into MOODLE_36_STABLE 2019-01-14 23:03:59 +01:00
Mark Nelson 81eb28ab34 MDL-64519 core_message: add missing strings causing AMOS issues 2019-01-14 13:30:02 +01:00
Sara Arjona 64fd3da15d Merge branch 'MDL-60082-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-14 12:26:35 +01:00
Shamim Rezaie 5428bcca6c MDL-64551 core_question: Fix double ampersand escaping in tag button 2019-01-14 18:23:59 +11:00
Mark Nelson 624922d3d5 MDL-64566 core_message: removed unnecessary DB call 2019-01-14 09:46:19 +08:00
Eloy Lafuente (stronk7) 68b59f336b Moodle release 3.6.2 2019-01-12 13:26:00 +01:00
Tim Hunt 5361e60e93 MDL-64465 qtypes: fix incorrect context passed to format_string 2019-01-11 11:12:52 +00:00
Tim Hunt a747d9311a MDL-64464 drag-drop qtypes: allow <span lang=".."> id draggables
This is for accessibility, so that screen readers can read the drag
items with correct pronunciation.
2019-01-11 11:12:37 +00:00
Tim Hunt 814dee2184 MDL-64393 drag-drop qtypes: be more robust when page layout changes 2019-01-11 11:11:50 +00:00
Tim Hunt 7fbca34efb MDL-61441 accesslib: get_users_by_capability groups perf improvement 2019-01-11 10:55:31 +00:00
Sara Arjona 4be3c44a5b MDL-63677 core_user: Avoid redirection during signup
Purge cache just for the current user to avoid redirection when 2
simultaneous users try to sign up at the same time and some policy
has to be agreed.
The 'createduser' invalidation event has been removed also because
is not used any more.
Thanks John Azinheira for spotting it!
2019-01-11 10:23:04 +01:00
Neill Magill 3e14b40724 MDL-63103 filebrowser: Speed up finding activities with files
Before this change the query examined at every course_module record in
the context table.

With this change we use the course_modules table to more efficiently
find all the activities in the course, which means that many less
records in the context table need to be examined.
2019-01-11 09:03:58 +00:00
VinhLe 173d968f87 MDL-64031 enrol_manual: Fix hard-coded list of user fields.
Respect get_extra_user_fields() in PHP code
2019-01-11 11:37:05 +07:00
VinhLe 0b4bb56b4d MDL-64469 Question bank: Change link questions in category question.
Make it easier to navigate from the category list to the questions in a category.
2019-01-11 11:29:53 +07:00
Luca Bösch 18581165c5 MDL-63881 tool_dataprivacy: 'Contact the privacy officer' profile link. 2019-01-10 22:17:12 +01:00
Luca Bösch 6efd56e074 MDL-62439 output: Debugstringids in overlay windows. 2019-01-10 22:16:48 +01:00
Sara Arjona dfd605320e weekly release 3.6.1+ 2019-01-10 17:51:31 +01:00
Sara Arjona 8f6ba8afc4 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2019-01-10 17:51:30 +01:00
Jake Dallimore b41a94128a Merge branch 'MDL-64004-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-10 11:00:25 +08:00
AMOS bot 7365115cf3 Automatically generated installer lang files 2019-01-10 00:08:42 +00:00
Eloy Lafuente (stronk7) 5f85b35305 Merge branch 'MDL-64479_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2019-01-09 23:36:57 +01:00
Ryan Wyllie ea2f42bde4 MDL-64043 message: stop group conversation header re-rendering 2019-01-09 18:46:54 +01:00
Marcus Fabriczy c049e374c3 MDL-54804 templates: Prevent posting when no option is selected
When no value is set for an option element and a user selects it, a
POST request is made, which is incorrect. Usually that option is a
placeholder value, e.g., "Choose..." - the form expecting the end user
to choose an actual value.
2019-01-09 23:56:28 +10:30
Eloy Lafuente (stronk7) 3dd8792045 Merge branch 'MDL-63686-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-01-09 12:36:33 +01:00
Andrew Nicols a335f9c4c0 MDL-63686 core: recordset => records when fetching contexts 2019-01-09 19:08:08 +08:00
Tim Hunt 6873ac11a0 MDL-64479 dd-qtypes: fix questions with non-consecutive groups 2019-01-09 10:20:01 +00:00
Jake Dallimore a022611e09 Merge branch 'MDL-64375-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-09 15:33:27 +08:00
Damyon Wiese 0d72593a7c MDL-62143 accessibility: Label breadcrumbs 2019-01-09 15:18:36 +08:00
Andrew Nicols 97a0132511 Merge branch 'MDL-62550-36-2' of https://github.com/snake/moodle into MOODLE_36_STABLE 2019-01-09 15:10:12 +08:00
Jake Dallimore 210429d952 Merge branch 'MDL-64345-36' of https://github.com/s-cenni/MDL-64345 into MOODLE_36_STABLE 2019-01-09 14:14:28 +08:00
Jake Dallimore aeb7c0026d MDL-62550 core_theme: remove unused #fgroup_ and #fitem_ rules
These ids didn't exists in form elements in Boost until now, so we'll
remove the rules to prevent them having any effect now.
2019-01-09 11:31:54 +08:00
Jake Dallimore 19c1651247 MDL-62550 core_form: bring back the form item unique ids to fix js fails
This id matches the id seen on the clean theme elements and is needed by
the forms js.
2019-01-09 11:31:52 +08:00
Jake Dallimore f369450561 Merge branch 'MDL-63761-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2019-01-09 09:07:07 +08:00
Eloy Lafuente (stronk7) b60fa84aad Merge branch 'MDL-64285-36' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2019-01-09 00:03:13 +01:00
Andrew Nicols 0c8852c98b Merge branch 'MDL-24951_36' of git://github.com/stronk7/moodle into MOODLE_36_STABLE 2019-01-09 06:43:45 +08:00
Andrew Nicols 0f44be2b7a Merge branch 'MDL-64426_36' of git://github.com/stronk7/moodle into MOODLE_36_STABLE 2019-01-09 06:38:34 +08:00
Eloy Lafuente (stronk7) db729d9510 MDL-64426 core_message: fix context::instance_by_id() wrong use 2019-01-08 23:07:22 +01:00
Eloy Lafuente (stronk7) e41fd189dd MDL-24951 mod_forum: Apply new string to related scenarios
Plus amend an scenario name that was clearly incorrect.
2019-01-08 16:51:21 +01:00
Michael Hawkins 279df86c7f MDL-64395 groups: Added XSS Risk to the manage groups capability 2019-01-08 16:26:48 +01:00
Michael Hawkins 2e057f082d MDL-64372 userpix: Escape fullname string on userpix index page 2019-01-08 16:26:48 +01:00
Sara Arjona 20c3619d77 MDL-64222 badge: Removed backpackurl from the edit_form 2019-01-08 16:26:48 +01:00
Eloy Lafuente (stronk7) d21c67114f Merge branch 'MDL-64509-36-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_36_STABLE 2019-01-08 16:18:31 +01:00
Andrew Nicols d55a0b81d6 Merge branch 'MDL-58596-36' of git://github.com/vmdef/moodle into MOODLE_36_STABLE 2019-01-08 16:15:34 +08:00
Andrew Nicols 987e822c5e Merge branch 'MDL-64426-36-2' of https://github.com/snake/moodle into MOODLE_36_STABLE 2019-01-08 16:10:06 +08:00
Leon Stringer 7ad3a22b79 MDL-58596 core_stats: fixed infinite loop cause by DST change 2019-01-08 08:08:14 +00:00
Jake Dallimore 0c638fda5c MDL-64426 core_message: fix filter support in api::get_conversations()
Conversation name and subname should support filters, so the data should
be passed through format_string, and advertised in the external params
as PARAM_TEXT.
2019-01-08 15:51:32 +08:00
Jake Dallimore caa2b2ce21 Merge branch 'MDL-63686-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE 2019-01-08 14:38:07 +08:00
Andrew Nicols afba820e1d MDL-63686 core: Preload parent contexts 2019-01-08 14:11:53 +08:00
Andrew Nicols 1e59e03e60 Merge branch 'MDL-24951-36' of git://github.com/Chocolate-lightning/moodle into MOODLE_36_STABLE 2019-01-08 13:52:35 +08:00
Andrew Nicols a155e8cb75 Merge branch 'MDL-64497-m36' of https://github.com/sammarshallou/moodle into MOODLE_36_STABLE 2019-01-08 12:28:56 +08:00
Andrew Nicols 6aa1364030 Merge branch 'MDL-63722-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-01-08 12:12:55 +08:00
Andrew Nicols 691a2997b8 Merge branch 'MDL-64400-36' of git://github.com/aanabit/moodle into MOODLE_36_STABLE 2019-01-08 08:28:21 +08:00
Andrew Nicols bd5464547a Merge branch 'MDL-63276_36' of https://github.com/stronk7/moodle into MOODLE_36_STABLE 2019-01-08 06:56:13 +08:00
Eloy Lafuente (stronk7) 90fc88b56d Merge branch 'MDL-63809-36-5' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2019-01-07 22:13:00 +01:00
Helen Foster bb7ebc0ee5 MDL-64509 lang: Import fixed English strings (en_fix)
Significant string change: enablerunnow_desc,tool_task - including
mention of pathtophp requirement
2019-01-07 20:09:48 +01:00
Sara Arjona 8555878283 Merge branch 'MDL-64419-36' of git://github.com/bmbrands/moodle into MOODLE_36_STABLE 2019-01-07 14:18:23 +01:00
Andrew Nicols 5a04efc1eb Merge branch 'MDL-57636_m36' of https://github.com/dasistwas/moodle into MOODLE_36_STABLE 2019-01-07 13:48:08 +08:00
David Bogner 352ddf9d42 MDL-57636 frontpage: Fix display enrolled courses 2019-01-04 11:00:25 +01:00
Damyon Wiese 20ad67d21d MDL-64375 gradingform_rubric: Styles for overflow
Allow people to define lots of levels, and make the scroll region just the rubric table,
not the entire content region.
2019-01-04 08:44:38 +08:00
sam marshall 6e7597f569 MDL-64497 GDPR: moodle_content_writer can cause endless loop
Fixes a buggy function by replacing it with a call to file_get_contents,
and adds error detection on a couple of file accesses.
2019-01-03 17:05:47 +00:00
Jake Dallimore 1f2934b656 Merge branch 'MDL-49651-36' of git://github.com/Chocolate-lightning/moodle into MOODLE_36_STABLE 2019-01-03 10:46:36 +08:00
Peter a03105e4b1 MDL-64486 mod_glossary: Add missing separator for special links 2019-01-03 08:39:59 +08:00
Eloy Lafuente (stronk7) 7bdf798d6a MDL-63276 environment: PHP 7.1 and Moodle 3.2 required 2019-01-03 01:19:48 +01:00
Eloy Lafuente (stronk7) fd1fb3e6db MDL-63276 environment: 3.7 base information
This is a direct copy of the 3.6 branch to
have changes under control easier in next commits.
2019-01-03 01:19:48 +01:00
Jake Dallimore 61bdf6fab3 MDL-64412 core_message: remove ordering code from message_search_users()
This code is no longer needed as get_member_info() now respects the
ordering of the $userids param.
2019-01-02 15:21:39 +08:00
Jake Dallimore bed5aa4d13 MDL-64412 core_message: get_member_info() respects provided ordering
This change makes sure the function returns the member information in
the same order as those users provided in the $userids param.
2019-01-02 15:21:34 +08:00
Peter 07deeb497c MDL-63148 mod_scorm: Accept userid param in event action
* Update lib scorm functions to accept and use a passed in userid
* Additional phpunit tests
2019-01-02 14:36:31 +08:00
Michael Hawkins 2fd170c550 MDL-62968 Boost: Adding editor SCSS support 2019-01-02 14:21:22 +08:00
Damyon Wiese e607001e7e MDL-63761 grade: Performance fix for regrading
Don't use a separate variable to count the number of items in finalids.
2019-01-02 10:25:04 +08:00
Amaia Anabitarte 844a59c301 MDL-64400 core_messages: Mark notifications sent via email as read 2018-12-27 09:18:14 +01:00
Amaia Anabitarte f10c2934aa MDL-64400 core_messages: Allow cron to delete unread notifications too 2018-12-27 09:18:14 +01:00
Mathew efe7f18200 MDL-49651 mod_forum: Respect course visibility in cron
This checks the courses' current visibility and the users permissions.
If they have the permission to view the course when it is hidden they'll get messages.

We already have checks for the users enrolled & subscription status.
2018-12-24 09:35:38 +08:00
Mathew 0df8f503a3 MDL-24951 mod_forum: Check user capability to know what message to show.
If the user has the following capabilty: mod/forum:canposttomygroups then show them
the more technical of the strings. Otherwise we use something a bit easier for them to ask their
tutor or teacher about.
2018-12-24 09:14:39 +08:00
Gareth Barnard 6a9e87112c MDL-64432 theme_bootstrapbase: Favourites myoverview icon tooltip. 2018-12-21 11:24:20 +00:00
AMOS bot c4b911d645 Automatically generated installer lang files 2018-12-21 00:08:07 +00:00
Sara Arjona 7534d21e59 MDL-64441 badges: Remove notice when language is empty 2018-12-20 16:29:28 +01:00
Víctor Déniz Falcón 524e1fa64e MDL-58596 core_stats: unit test for stats_get_base_weekly 2018-12-20 13:59:34 +00:00
Adrian Greeve 7f234acc6e weekly release 3.6.1+ 2018-12-20 11:09:17 +01:00
Adrian Greeve 1003775c7c NOBUG: Fixed SVG browser compatibility 2018-12-20 11:09:17 +01:00
Adrian Greeve 025c532aa9 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2018-12-20 11:09:16 +01:00
Andrew Nicols b1c50364d0 Merge branch 'MDL-64038-36' of git://github.com/bmbrands/moodle into MOODLE_36_STABLE 2018-12-20 13:56:45 +08:00
Andrew Nicols eac010fbb9 Merge branch 'MDL-63512-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2018-12-20 13:03:49 +08:00
Peter c556416385 MDL-63512 mod_lesson: Update the lesson css to exclude mediaplugin div 2018-12-20 12:51:04 +08:00
Peter 1f91c082c5 MDL-63512 mod_lesson: Fix video links provided in feedback 2018-12-20 12:51:04 +08:00
Stephen Bourget f4c843d00b MDL-63614 badges: Add COMPLETION_FAIL support to badge criteria 2018-12-19 10:30:27 -05:00
Adrian Greeve 421358bc47 Merge branch 'MDL-64392-36' of git://github.com/bmbrands/moodle into MOODLE_36_STABLE 2018-12-19 12:04:29 +01:00
Adrian Greeve 7b661b8d6f MDL-59954 course: Remove unused global. 2018-12-19 10:48:27 +01:00
Peter 74780ef62b MDL-59954 mod_course: Remove file size restriction on D&D on course page
Remove file size restrictions for teachers on course page.
Use user_max_upload_file_size instead of the max_file_size
2018-12-19 10:47:01 +01:00
Shamim Rezaie a9223b49a0 MDL-63722 javascript: misinterpret as outside click if DOM is modified 2018-12-19 16:06:38 +11:00
Jake Dallimore 50e3951acc Merge branch 'MDL-64229_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2018-12-19 11:37:40 +08:00
Jake Dallimore e4cac445c2 Merge branch 'MDL-64216-m36' of https://github.com/micaherne/moodle into MOODLE_36_STABLE 2018-12-19 11:08:05 +08:00
Andrew Nicols 1dca8a6679 Merge branch 'MDL-63512-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2018-12-19 10:00:10 +08:00
AMOS bot 2f90c2a35d Automatically generated installer lang files 2018-12-19 00:09:03 +00:00
Simey Lameze 6f76116cd2 MDL-64425 block_timeline: fix incorrect get_string parameter 2018-12-19 07:42:25 +08:00
Adrian Greeve 30ff131e71 Merge branch 'MDL-64025-36' of https://github.com/christianwolters/moodle into MOODLE_36_STABLE 2018-12-18 16:00:47 +01:00
Bas Brands 6d66740146 MDL-64171 block_myoverview: change course summary view image size
Size reduced from 7rem to 5rem for smaller devices
and for courses without a description.
2018-12-18 10:39:17 +01:00
Michael Hawkins a7c9b0b43d MDL-64240 mod_forum: Clean forum post text before storing
Previously only edited messages were cleaned, so longer strings could
be stored in the database, which would never be displayed.
This update takes into account trusted text before cleaning (as editing does).
2018-12-18 14:12:47 +08:00
Michael Hawkins 38a757cc18 MDL-64240 mod_forum: Update word count to use current message length
Previously this used the length of the message stored in the database,
before scripts etc are cleaned to display the content. That resulted
in cases where the count would seem much larger than the message size.
2018-12-18 14:12:47 +08:00
Shamim Rezaie 10c38b2e34 MDL-63809 question: handling bad questions in question_has_capability_on 2018-12-18 15:44:20 +11:00
Tim Hunt 636a752d11 MDL-63809 question bank: ensure question_has_capability_on can be called 2018-12-18 15:44:20 +11:00
Damyon Wiese 73d4d4f8c3 MDL-60082 assign: Grading worksheet with no grade
If the grade type is NONE - do not include the maxgrade column.
2018-12-18 11:14:17 +08:00
Jake Dallimore 909b8fe981 Merge branch 'MDL-64309_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2018-12-18 11:11:45 +08:00
Damyon Wiese 1e96000bb3 MDL-64004 webservice: Do not update accesstime
Do not update the automatically update the course access time when a
course is accessed via a webservice or ajax.
2018-12-18 09:08:17 +08:00
Bas Brands ceb92a3553 MDL-64419 core_message: fix user info in bootstrapbase message drawer
* updated the bootstrapbase template for the messaging conversation menu
info option to match the menu in
"/core_message/message_drawer_view_conversation_header_content_type_private.mustache"
2018-12-17 15:51:19 +01:00
John Beedell 79265f94a9 MDL-64404 qtype: gapselect currency like options dont show 2018-12-17 12:34:31 +00:00
Sara Cenni 9d235abdb4 MDL-64345 core: Make FB logo upgrade cross-DB compatible 2018-12-17 11:22:27 +01:00
Jun Pataleta c9e518f483 Merge branch 'MDL-59629-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2018-12-17 15:56:13 +08:00
Andrew Nicols bcc163c6fd MDL-63607 behat: Remove theme from config whitelist 2018-12-17 15:55:03 +08:00
Damyon Wiese 391eed0198 MDL-62963 boost: Increase contrast btn-secondary
The background colour of these buttons is too light, so they don't look like buttons.
2018-12-17 15:47:49 +08:00
Tomasz Muras c9f765452f MDL-52966 core: static cache fix for file types. 2018-12-17 15:40:39 +08:00
Andrew Nicols 6dea9ae21e Merge branch 'MDL-61633-36' of https://github.com/lucisgit/moodle into MOODLE_36_STABLE 2018-12-17 15:29:12 +08:00
Andrew Nicols b9ada50b92 Merge branch 'MDL-60518-36' of git://github.com/aanabit/moodle into MOODLE_36_STABLE 2018-12-17 14:59:39 +08:00
Jun Pataleta ff42789a76 Merge branch 'MDL-63260_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2018-12-17 14:10:12 +08:00
Damyon Wiese 174c288c0f MDL-63378 theme_boost: Contrast of menu items
Enforce the :active menu text colour during a mouse click on an action menu.
2018-12-17 14:02:56 +08:00
Damyon Wiese 1e6296c745 MDL-64107 questions: Increase highlight contrast
When a question has just been edited, it is highlighted. We need to ensure
the colour contrast of text on background is accessible.
2018-12-17 12:35:46 +08:00
Jake Dallimore 4cb644cf24 Merge branch 'MDL-62756_MOODLE_36' of https://github.com/miotto/moodle into MOODLE_36_STABLE 2018-12-17 11:24:59 +08:00
Andrew Nicols 867a3147ad Merge branch 'MDL-64388-36' of git://github.com/bmbrands/moodle into MOODLE_36_STABLE 2018-12-17 09:14:36 +08:00
Christian Wolters 26640d3831 MDL-64025 admin_bookmarks: Enable bookmarking of admin categories 2018-12-16 15:48:12 +01:00
AMOS bot 24aa36db21 Automatically generated installer lang files 2018-12-15 00:09:15 +00:00
Bas Brands 0cd2c36605 MDL-64392 core_question: flexbox compatible separator for question types
* the br tag does not work well in a flexbox context, a 100% with div
works in both clean and boost.
2018-12-14 16:30:52 +01:00
Bas Brands ea6ae74019 MDL-64038 core_message: add default group image
add default group image to improve the alignment
of group names in the message drawer group messages section
2018-12-14 14:13:51 +01:00
Bas Brands 99440d3db7 MDL-64388 core_themes: update docs on new required output method
* Method standard_after_main_region_html was added to the core_renderer
used by the messaging ui to message drawer
2018-12-14 11:30:30 +01:00
Mirko Otto 89f8d4adde MDL-62756 form: Remove any click handler first.
The handler has the old state variable. Remove any click handler first.
2018-12-14 10:30:49 +01:00
Amaia Anabitarte 7b11b53d51 MDL-60518 core_competency: Set $USER global variable for tests 2018-12-14 10:25:44 +01:00
Frédéric Massart dd815d254f MDL-60518 core_user: A user with ID 0 is never a real user 2018-12-14 10:25:44 +01:00
Jun Pataleta aa0b2c74dd MDL-64285 core: Skip 64 bits check for 32-bit PHP versions in unit tests 2018-12-14 11:21:00 +08:00
Jun Pataleta 06b76ab9c8 MDL-64285 core: Fix environment check test
* Looping the environment results and skipping some items mean that
if a test gets skipped, the rest of the environment results won't be
tested. It's better to use a data provider for this in order to
individually test each environment result.
2018-12-14 11:21:00 +08:00
Peter 90ec922213 MDL-59629 mod_block: Set the default region in add_region
Check and update default region in add_region if none set.
2018-12-14 10:30:07 +08:00
Peter 54ff8c77bf MDL-63512 mod_lesson: Fix video links provided in feedback 2018-12-14 10:27:24 +08:00
Jake Dallimore 9c85ac5d89 weekly release 3.6.1+ 2018-12-14 07:51:49 +08:00
Jake Dallimore 4a087d2701 Merge branch 'install_36_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_36_STABLE 2018-12-14 07:51:48 +08:00
Tony Butler 79c7162899 MDL-61633 assignfeedback_editpdf: Scroll back to top when changing pages 2018-12-13 12:18:43 +00:00
Mark Nelson fd12e12d8c MDL-64229 core_message: ensure profile pic links to profile 2018-12-13 12:15:13 +08:00
Jake Dallimore 19a759649c Merge branch 'MDL-62624-36' of git://github.com/mihailges/moodle into MOODLE_36_STABLE 2018-12-12 16:13:44 +08:00
Damyon Wiese 467efca6aa MDL-63916 backup: Do not display timestamp
Convert the date+time field to a userdate for display.
2018-12-12 12:20:13 +08:00
Jun Pataleta 39fbf414ad Merge branch 'MDL-41507-36' of git://github.com/rezaies/moodle into MOODLE_36_STABLE 2018-12-12 11:17:40 +08:00
Shamim Rezaie 6299c142c4 MDL-41507 core_group: Consistent default value for FEATURE_GROUPS 2018-12-12 14:04:47 +11:00
Jake Dallimore 17fccfc78b Merge branch 'MDL-64003-36' of https://github.com/aanabit/moodle into MOODLE_36_STABLE 2018-12-12 10:03:22 +08:00
Jake Dallimore 7c073af175 MDL-63887 auth_ldap: fix unclean exit from sync when users not found
We should return, not exit, and we should clean up before we do.
2018-12-12 09:43:04 +08:00
Jake Dallimore 3b114369bc Merge branch 'MDL-63887_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2018-12-12 09:42:55 +08:00
Jake Dallimore 1641091ae7 Merge branch 'MDL-63150-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2018-12-12 08:32:35 +08:00
Jake Dallimore 6b391174e4 Merge branch 'MDL-63145-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2018-12-12 08:30:00 +08:00
Jake Dallimore 5c2cae3d9c Merge branch 'MDL-63147-36' of git://github.com/peterRd/moodle into MOODLE_36_STABLE 2018-12-12 08:25:28 +08:00
Peter 8eae354c0f MDL-63145 mod_page: Accept userid param as override
Accept a userid as an override in the lib function instead of
relying on $USER
2018-12-12 07:32:09 +08:00
Peter 8a1ebcf100 MDL-63150 mod_url: Accept a userid override in event action
Accept a userid in the event action instead of depending on $USER
2018-12-12 07:18:40 +08:00
Peter c8289ad180 MDL-63147 mod_resource: Accept userid in resource event_action 2018-12-12 07:08:25 +08:00
Tim Hunt a637d77826 MDL-63260 qtype_random: orphaned random questions should be deleted
This fix is based on some original code written by Bo Pierce.
2018-12-11 14:04:13 +00:00
Amaia Anabitarte 00302ce7a2 MDL-64003 core_message: Use sql_like_escape() in message_search_users 2018-12-11 11:41:52 +01:00
Jake Dallimore 9617c3a660 Merge branch 'MDL-64357_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2018-12-11 17:44:27 +08:00
Mark Nelson 0ccc7a8a5c MDL-64357 ltiservice_gradebookservices: updated unit tests 2018-12-11 17:03:15 +08:00
Claude Vervoort 8d84ee97da MDL-64357 ltiservice_gradebookservices: fix cleanup deleting lineitems 2018-12-11 17:03:15 +08:00
Damyon Wiese 59f6c0c7dd MDL-64313 assign: feedback viewed event
When a student views their submission, if it has feedback create an event.
2018-12-11 14:07:12 +08:00
Jake Dallimore c8de0b91a0 Merge branch 'MDL-62922-36' of git://github.com/junpataleta/moodle into MOODLE_36_STABLE 2018-12-11 12:50:36 +08:00
Jun Pataleta 841c9314ba Merge branch 'MDL-64280-36' of https://github.com/lucaboesch/moodle into MOODLE_36_STABLE 2018-12-11 09:53:51 +08:00
AMOS bot bcab22a63b Automatically generated installer lang files 2018-12-11 00:10:00 +00:00
Luca Bösch 3fba5b6826 MDL-64280 core_outcome: Add/remove outcome buttons style. 2018-12-10 17:56:13 +01:00
Ryan Wyllie 67db9af9db MDL-64275 message: fix update unread conversation counts 2018-12-10 15:07:22 +08:00
Jun Pataleta 6b34db6b00 Merge branch 'MDL-62061-36' of git://github.com/abgreeve/moodle into MOODLE_36_STABLE 2018-12-10 14:46:44 +08:00
Mihail Geshoski 36d683c805 MDL-62624 lesson: Fix alignment in matching questions in boost 2018-12-10 13:47:37 +08:00
Jun Pataleta 6fe370eef9 Merge branch 'MDL-64332_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2018-12-10 09:37:51 +08:00
Jake Dallimore 11d0c68d56 weekly release 3.6.1+ 2018-12-10 08:10:21 +08:00
Andrew Nicols 0cd5cf60de Merge branch 'MDL-46783-36-fix' of https://github.com/snake/moodle into MOODLE_36_STABLE 2018-12-10 08:09:09 +08:00
Jake Dallimore e8cabad431 MDL-46783 accesslib: add recordrtc cap check to match master branch 2018-12-10 08:04:54 +08:00
Tim Hunt 343f4e9d56 MDL-64332 questions: idnumber should not prevent easy duplication 2018-12-06 14:41:58 +00:00
Adrian Greeve 6ff8d9bb2c MDL-62061 core_privacy: Stop directories being created.
This stops directories being created in the root directory
while running unit tests.
2018-12-06 11:37:41 +01:00
papillon326 53949e65a7 MDL-63887 auth_ldap: avoid infinite loop when search limit is reached 2018-12-06 15:40:34 +08:00
papillon326 946bef37bf MDL-63887 auth_ldap: changed variable names to be conform to core 2018-12-06 15:40:34 +08:00
Jun Pataleta ed9ee5743d Merge branch 'MDL-64283-36' of git://github.com/damyon/moodle into MOODLE_36_STABLE 2018-12-06 14:57:41 +08:00
Damyon Wiese 115b696f30 MDL-64283 competency: Correct numbering in tests 2018-12-06 14:27:26 +08:00
Jake Dallimore 8f0bd4fb15 Merge branch 'MDL-63710-MOODLE_36' of https://github.com/ilya-catalyst/moodle into MOODLE_36_STABLE 2018-12-06 11:41:11 +08:00
Jake Dallimore 4071cbebf5 Merge branch 'MDL-46783_36' of https://github.com/timhunt/moodle into MOODLE_36_STABLE 2018-12-06 10:23:32 +08:00
Ilya Tregubov 3b9f40920a MDL-63710 repository: Delete orphaned file records. 2018-12-06 12:35:47 +11:00
Jun Pataleta 866de1e3ff Merge branch 'MOODLE_36_STABLE-MDL-64290-imscc-restore-temp-dir' of https://github.com/mspall/moodle into MOODLE_36_STABLE 2018-12-06 08:57:09 +08:00
Michael Spall 60c93464b5 MDL-64290 backup imscc: Use correct tempdir for imscc restore
Use configured temp directory $CFG->tempdir instead of hard coded
$CFG->dataroot . '/temp/backup/'
Remove unused variable, $CFG
2018-12-05 11:09:20 -07:00
Tim Hunt 0c081d2468 MDL-46783 accesslib: add tests for MDL-63818
MDL-46783 and MDL-63818 were originally coded on the
assumption that MDL-46783 would get integrated first. However it wasn't.
Therefore, it was not easy to add unit tests for MDL-63818
at the time, but it is now, so here they are.
2018-12-05 16:46:20 +00:00
Tim Hunt 550c4bdf6e MDL-46783 permissions: let some moodle/ caps be overriden in all mods
The capabilities changed ('contextlevel' => CONTEXT_COURSE changed to
'contextlevel' => CONTEXT_MODULE) are:

* moodle/site:accessallgroups
* moodle/site:viewfullnames
* moodle/site:trustcontent
* moodle/site:viewuseridentity

This list came from reviewing the _get_extra_capabilities functions in
all core activities. They were all somewhat inconsistent, but I think it
makes sense that these capabilities are consistently overridable in all
activities. E.g. moodle/site:accessallgroups affects conditional
availability even if there is no other user of groups, and
moodle/site:viewuseridentity and moodle/site:viewfullnames affect the
logs report, if nothing else.

As a result of this, several _get_extra_capabilities functions are no
longer needed, and all the rest have been simplified.
2018-12-05 16:46:15 +00:00
Mark Nelson 54fc0f1b28 MDL-64309 core_message: minor string changes to drawer 2018-12-05 19:34:12 +08:00
Jun Pataleta 6522f66dd7 MDL-62922 core_user: Check auth mechanism before validating password
* External authentication mechanisms (e.g. via oauth2, etc.) don't store
  password in the user table, so we shouldn't be requiring password in
  such case when creating users via the core_user_create_users WS
  function.
2018-12-05 15:32:09 +08:00
Ryan Wyllie e7691f15b9 MDL-64274 message: deleteMessages in message_repository return promise 2018-12-05 14:57:43 +08:00
Jake Dallimore fe1d7d118e Merge branch 'MDL-64198-36' of https://github.com/lucaboesch/moodle into MOODLE_36_STABLE 2018-12-05 14:30:43 +08:00
Damyon Wiese 7e2f393054 Merge branch 'MDL-60267-master' of https://github.com/rogerbaba/moodle into MOODLE_36_STABLE 2018-12-05 12:46:51 +08:00
Eloy Lafuente (stronk7) d09dc52b0a Moodle release 3.6.1 2018-12-04 17:42:58 +01:00
Luca Bösch c192c5e4e3 MDL-64198 course: set formatted modulename for togglecompletion js. 2018-12-04 14:33:34 +01:00
Michael Aherne 3ff4fc8e45 MDL-64216 privacy: Split query to use indexes. 2018-12-04 13:31:10 +00:00
Eloy Lafuente (stronk7) 6e19850f6e weekly release 3.6+ 2018-12-04 13:06:09 +01:00
Bas Brands 5d30474242 MDL-63223 theme_boost: flexbox for login pagin footer 2018-12-04 12:06:49 +08:00
Jun Pataleta 1b972c31ac Merge branch 'MDL-64307_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2018-12-04 12:03:08 +08:00
Mark Nelson 29b6ac23e9 MDL-64307 core_message: do not include disabled conversations in count 2018-12-04 11:48:54 +08:00
Mark Nelson 44b6ffb68c MDL-64307 core: set all individual conversations to enabled 2018-12-04 11:44:59 +08:00
Jun Pataleta 79abbd9adc Merge branch 'MDL-64206_36' of git://github.com/markn86/moodle into MOODLE_36_STABLE 2018-12-04 11:13:37 +08:00
Tim Hunt 270524858e MDL-64286 qtype_gapselect: removed unneeded line of code
The extended Behat test show the qtype works fine without it.
2018-12-04 11:12:52 +08:00
Damyon Wiese 60f9a401a9 Merge branch 'MDL-64155-master' of git://github.com/vmdef/moodle into MOODLE_36_STABLE 2018-12-03 15:26:56 +08:00
Tim Hunt ac0b8201a9 MDL-63459 qtype_calculatedmulti: fix incorrect hint object type 2018-12-03 14:25:41 +08:00
Tim Hunt be27fc0fe3 MDL-63459 qtype_calculatedmulti: unit test should test this qtype
This also demonstrates the bug to be fixed
2018-12-03 14:25:17 +08:00
Mark Nelson ebd104448f MDL-64206 core: updated FB logo URL 2018-12-03 12:23:47 +08:00
Andrew Nicols c69f425a7a Merge branch 'MDL-64300_36' of git://github.com/stronk7/moodle into MOODLE_36_STABLE 2018-12-03 08:35:32 +08:00
Eloy Lafuente (stronk7) e38e718441 MDL-64300 upgrade: add 3.6.0 separation line to all upgrade scripts 2018-12-02 18:37:59 +01:00
Roger Barras 6959abc816 MDL-60267 user: Fix set default data for the user profile field 2018-11-02 20:09:04 +01:00
10779 changed files with 410329 additions and 771678 deletions
+21 -23
View File
@@ -4,13 +4,11 @@
node_modules/
vendor/
admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js
admin/tool/usertours/amd/src/tour.js
auth/cas/CAS/
cache/stores/mongodb/MongoDB/
enrol/lti/ims-blti/
filter/algebra/AlgParser.pm
filter/tex/mimetex.*
h5p/h5plib/v124/joubel/core/
h5p/h5plib/v124/joubel/editor/
lib/editor/atto/plugins/html/yui/src/codemirror/
lib/editor/atto/plugins/html/yui/src/beautify/
lib/editor/atto/yui/src/rangy/js/*.*
@@ -21,12 +19,15 @@ lib/mlbackend/php/phpml/
lib/adodb/
lib/bennu/
lib/evalmath/
lib/phpspreadsheet/
lib/lessphp/
lib/phpexcel/
lib/google/
lib/htmlpurifier/
lib/jabber/
lib/minify/matthiasmullie-minify/
lib/minify/matthiasmullie-pathconverter/
lib/pear/Auth/RADIUS.php
lib/pear/Crypt/CHAP.php
lib/pear/HTML/Common.php
lib/pear/HTML/QuickForm.php
lib/pear/HTML/QuickForm/
@@ -40,6 +41,7 @@ lib/yuilib/gallery/
lib/jquery/
lib/html2text/
lib/markdown/
lib/recaptchalib.php
lib/xhprof/
lib/horde/
lib/requirejs/
@@ -61,11 +63,6 @@ lib/amd/src/adapter.js
lib/validateurlsyntax.php
lib/amd/src/popper.js
lib/geopattern-php/
lib/php-jwt/
lib/babel-polyfill/
lib/polyfills/
lib/emoji-data/
lib/plist/
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
@@ -74,19 +71,20 @@ media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
theme/boost/amd/src/bootstrap/alert.js
theme/boost/amd/src/bootstrap/button.js
theme/boost/amd/src/bootstrap/carousel.js
theme/boost/amd/src/bootstrap/collapse.js
theme/boost/amd/src/bootstrap/dropdown.js
theme/boost/amd/src/bootstrap/index.js
theme/boost/amd/src/bootstrap/modal.js
theme/boost/amd/src/bootstrap/popover.js
theme/boost/amd/src/bootstrap/tools/sanitizer.js
theme/boost/amd/src/bootstrap/scrollspy.js
theme/boost/amd/src/bootstrap/tab.js
theme/boost/amd/src/bootstrap/toast.js
theme/boost/amd/src/bootstrap/tooltip.js
theme/boost/amd/src/bootstrap/util.js
theme/boost/amd/src/alert.js
theme/boost/amd/src/button.js
theme/boost/amd/src/carousel.js
theme/boost/amd/src/collapse.js
theme/boost/amd/src/dropdown.js
theme/boost/amd/src/modal.js
theme/boost/amd/src/popover.js
theme/boost/amd/src/scrollspy.js
theme/boost/amd/src/tab.js
theme/boost/amd/src/tooltip.js
theme/boost/amd/src/util.js
theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
theme/bootstrapbase/less/bootstrap/
theme/bootstrapbase/javascript/html5shiv.js
theme/bootstrapbase/amd/src/bootstrap.js
theme/bootstrapbase/less/fontawesome/
+2 -37
View File
@@ -1,6 +1,5 @@
{
'plugins': [
'babel',
'promise',
],
'env': {
@@ -204,45 +203,11 @@
}
},
{
files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile*.js", "babel-plugin-add-module-to-define.js"],
// We support es6 now. Woot!
env: {
es6: true
},
// We're using babel transpiling so use their parser
// for linting.
parser: 'babel-eslint',
files: ["**/amd/src/*.js"],
// Check AMD with some slightly stricter rules.
rules: {
'no-unused-vars': 'error',
'no-implicit-globals': 'error',
// Disable all of the rules that have babel versions.
'new-cap': 'off',
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'no-invalid-this': 'off',
'object-curly-spacing': 'off',
'quotes': 'off',
'semi': 'off',
'no-unused-expressions': 'off',
// Enable all of the babel version of these rules.
'babel/new-cap': ['warn', { 'properties': false }],
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'babel/no-invalid-this': 'off',
'babel/object-curly-spacing': 'warn',
// This is off in the original style int.
'babel/quotes': 'off',
'babel/semi': 'error',
'babel/no-unused-expressions': 'error',
// === Promises ===
// We have Promise now that we're using ES6.
'promise/no-native': 'off',
'promise/avoid-new': 'off'
},
parserOptions: {
'ecmaVersion': 9,
'sourceType': 'module'
'no-implicit-globals': 'error'
}
}
]
+3 -7
View File
@@ -3,8 +3,6 @@
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"example": 6,
"Step": 4,
"given": 4,
"and": 4
@@ -16,9 +14,7 @@
"no-multiple-empty-lines": "on",
"no-partially-commented-tag-lines": "on",
"no-trailing-spaces": "on",
"no-unnamed-features": "on",
"no-unnamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on",
"no-examples-in-scenarios": "on",
"new-line-at-eof": ["on", "yes"]
"no-unamed-features": "on",
"no-unamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on"
}
+2
View File
@@ -1,3 +1,5 @@
**/yui/build/** -diff
**/amd/build/** -diff
lib/dml/oci_native_moodle_package.sql text eol=lf
theme/bootstrapbase/style/editor.css -diff
theme/bootstrapbase/style/moodle.css -diff
-2
View File
@@ -1,2 +0,0 @@
# Primary donations pages.
custom: ["https://moodle.com/donations/", moodle.org]
-71
View File
@@ -1,71 +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/>.
/**
* Template configuraton file for github actions CI/CD.
*
* @package core
* @copyright 2020 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// This cannot be used out from a github actions workflow, so just exit.
getenv('GITHUB_WORKFLOW') || die; // phpcs:ignore moodle.Files.MoodleInternal.MoodleInternalGlobalState
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = getenv('dbtype');
$CFG->dblibrary = 'native';
$CFG->dbhost = '127.0.0.1';
$CFG->dbname = 'test';
$CFG->dbuser = 'test';
$CFG->dbpass = 'test';
$CFG->prefix = 'm_';
$CFG->dboptions = ['dbcollation' => 'utf8mb4_bin'];
$host = 'localhost';
$CFG->wwwroot = "http://{$host}";
$CFG->dataroot = realpath(dirname(__DIR__)) . '/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
// Debug options - possible to be controlled by flag in future.
$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;
$CFG->debugpageinfo = 1;
$CFG->allowthemechangeonurl = 1;
$CFG->passwordpolicy = 0;
$CFG->cronclionly = 0;
$CFG->pathtophp = getenv('pathtophp');
$CFG->phpunit_dataroot = realpath(dirname(__DIR__)) . '/phpunitdata';
$CFG->phpunit_prefix = 't_';
define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://localhost:8080');
define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://localhost:8080');
define('TEST_SESSION_REDIS_HOST', 'localhost');
define('TEST_CACHESTORE_REDIS_TESTSERVERS', 'localhost');
// TODO: add others (solr, mongodb, memcached, ldap...).
// Too much for now: define('PHPUNIT_LONGTEST', true); // Only leaves a few tests out and they are run later by CI.
require_once(__DIR__ . '/lib/setup.php');
-117
View File
@@ -1,117 +0,0 @@
name: Core
on:
push:
branches-ignore:
- master
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
env:
php: 7.4
jobs:
Grunt:
runs-on: ubuntu-18.04
steps:
- name: Checking out code
uses: actions/checkout@v2
- name: Configuring node & npm
shell: bash -l {0}
run: nvm install
- name: Installing node stuff
run: npm install
- name: Running grunt
run: npx grunt
- name: Looking for uncommitted changes
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
# We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
run: |
git add .
git reset -- npm-shrinkwrap.json
git diff --cached --exit-code
PHPUnit:
runs-on: ${{ matrix.os }}
services:
exttests:
image: moodlehq/moodle-exttests
ports:
- 8080:80
redis:
image: redis
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-18.04
php: 7.2
# Need to disable both redis and memcached (both are optional) in order to keep igbinary installed.
# (there are dependencies that become broken if we just switch the igbinary version).
# Need to do this for php 7.2 because of a bug with current default igbinary
# versions used by GHA being >= 3.2.2 and <= 3.2.4 (buggy ones).
# TODO: MDL-72399 - Revert this patch once igbinary 3.2.5 or up is the default @ GHA.
extensions: :redis, :memcached, igbinary-3.2.6
db: mysqli
- os: ubuntu-18.04
php: 7.4
extensions:
db: pgsql
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: johanmeiring/mysql-action@tmpfs-patch
with:
collation server: utf8mb4_bin
mysql version: 5.7
mysql database: test
mysql user: test
mysql password: test
use tmpfs: true
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 9.6
postgresql db: test
postgresql user: test
postgresql password: test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v3.x
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
coverage: none
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v2
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
sudo locale-gen en_AU.UTF-8
php admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
run: vendor/bin/phpunit -v
-1
View File
@@ -44,4 +44,3 @@ composer.phar
/lib/yuilib/*/*/*-coverage.js
atlassian-ide-plugin.xml
/node_modules/
moodle-plugin-ci.phar
-2
View File
@@ -1,2 +0,0 @@
**/amd/**
/*.js
-1
View File
@@ -1 +0,0 @@
v14.15.0
+24 -24
View File
@@ -1,17 +1,17 @@
# Generated by "grunt ignorefiles"
**/yui/build/*
theme/bootstrapbase/style/
theme/clean/style/custom.css
theme/more/style/custom.css
theme/boost/style/moodle.css
theme/classic/style/moodle.css
node_modules/
vendor/
admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js
admin/tool/usertours/amd/src/tour.js
auth/cas/CAS/
cache/stores/mongodb/MongoDB/
enrol/lti/ims-blti/
filter/algebra/AlgParser.pm
filter/tex/mimetex.*
h5p/h5plib/v124/joubel/core/
h5p/h5plib/v124/joubel/editor/
lib/editor/atto/plugins/html/yui/src/codemirror/
lib/editor/atto/plugins/html/yui/src/beautify/
lib/editor/atto/yui/src/rangy/js/*.*
@@ -22,12 +22,15 @@ lib/mlbackend/php/phpml/
lib/adodb/
lib/bennu/
lib/evalmath/
lib/phpspreadsheet/
lib/lessphp/
lib/phpexcel/
lib/google/
lib/htmlpurifier/
lib/jabber/
lib/minify/matthiasmullie-minify/
lib/minify/matthiasmullie-pathconverter/
lib/pear/Auth/RADIUS.php
lib/pear/Crypt/CHAP.php
lib/pear/HTML/Common.php
lib/pear/HTML/QuickForm.php
lib/pear/HTML/QuickForm/
@@ -41,6 +44,7 @@ lib/yuilib/gallery/
lib/jquery/
lib/html2text/
lib/markdown/
lib/recaptchalib.php
lib/xhprof/
lib/horde/
lib/requirejs/
@@ -62,11 +66,6 @@ lib/amd/src/adapter.js
lib/validateurlsyntax.php
lib/amd/src/popper.js
lib/geopattern-php/
lib/php-jwt/
lib/babel-polyfill/
lib/polyfills/
lib/emoji-data/
lib/plist/
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
@@ -75,19 +74,20 @@ media/player/videojs/videojs/video-js.swf
mod/assign/feedback/editpdf/fpdi/
repository/s3/S3.php
theme/boost/scss/bootstrap/
theme/boost/amd/src/bootstrap/alert.js
theme/boost/amd/src/bootstrap/button.js
theme/boost/amd/src/bootstrap/carousel.js
theme/boost/amd/src/bootstrap/collapse.js
theme/boost/amd/src/bootstrap/dropdown.js
theme/boost/amd/src/bootstrap/index.js
theme/boost/amd/src/bootstrap/modal.js
theme/boost/amd/src/bootstrap/popover.js
theme/boost/amd/src/bootstrap/tools/sanitizer.js
theme/boost/amd/src/bootstrap/scrollspy.js
theme/boost/amd/src/bootstrap/tab.js
theme/boost/amd/src/bootstrap/toast.js
theme/boost/amd/src/bootstrap/tooltip.js
theme/boost/amd/src/bootstrap/util.js
theme/boost/amd/src/alert.js
theme/boost/amd/src/button.js
theme/boost/amd/src/carousel.js
theme/boost/amd/src/collapse.js
theme/boost/amd/src/dropdown.js
theme/boost/amd/src/modal.js
theme/boost/amd/src/popover.js
theme/boost/amd/src/scrollspy.js
theme/boost/amd/src/tab.js
theme/boost/amd/src/tooltip.js
theme/boost/amd/src/util.js
theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
theme/bootstrapbase/less/bootstrap/
theme/bootstrapbase/javascript/html5shiv.js
theme/bootstrapbase/amd/src/bootstrap.js
theme/bootstrapbase/less/fontawesome/
+93 -71
View File
@@ -2,86 +2,84 @@
# process (which uses our internal CI system) this file is here for the benefit
# of community developers git clones - see MDL-51458.
sudo: required
# We currently disable Travis notifications entirely until https://github.com/travis-ci/travis-ci/issues/4976
# is fixed.
notifications:
email:
if: env(MOODLE_EMAIL) != no
email: false
language: php
os: linux
dist: bionic
services:
- mysql
- docker
php:
# We only run the highest and lowest supported versions to reduce the load on travis-ci.org.
- 7.2
- 7.0
addons:
postgresql: "9.6"
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
branches:
except:
- master
- /MOODLE_[0-9]+_STABLE/
- /^v[0-9]+\.[0-9]+\.[0-9]+.*/
# Redis tests are currently failing on php 7.2 due to https://bugs.php.net/bug.php?id=75628
# services:
# - redis-server
jobs:
env:
# Although we want to run these jobs and see failures as quickly as possible, we also want to get the slowest job to
# start first so that the total run time is not too high.
#
# We only run MySQL on PHP 7.2, so run that first.
# CI Tests should be second-highest in priority as these only take <= 60 seconds to run under normal circumstances.
# Postgres is significantly is pretty reasonable in its run-time.
# Run unit tests on MySQL
- DB=mysqli TASK=PHPUNIT
# Run CI Tests without running PHPUnit.
- DB=none TASK=CITEST
# Run unit tests on Postgres
- DB=pgsql TASK=PHPUNIT
# Perform an upgrade test too.
- DB=pgsql TASK=UPGRADE
matrix:
# Enable fast finish.
# This will fail the build if a single job fails (except those in allow_failures).
# It will not stop the jobs from running.
fast_finish: true
include:
# First all the lowest php ones (7.2)
# Run grunt/npm install on highest version ('node' is an alias for the latest node.js version.)
- php: 7.2
env: DB=none TASK=CITEST
- php: 7.2
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
- if: env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present
php: 7.2
env: DB=pgsql TASK=PHPUNIT
exclude:
# MySQL - it's just too slow.
# Exclude it on all versions except for 7.2
- if: env(MOODLE_DATABASE) = "mysqli" OR env(MOODLE_DATABASE) = "all"
php: 7.2
env: DB=mysqli TASK=PHPUNIT
# Then, conditionally, all the highest php ones (7.4)
- if: env(MOODLE_PHP) = "all"
php: 7.4
env: DB=none TASK=CITEST
- if: env(MOODLE_PHP) = "all"
php: 7.4
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
- if: env(MOODLE_PHP) = "all" AND (env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present)
php: 7.4
env: DB=pgsql TASK=PHPUNIT
- if: env(MOODLE_PHP) = "all" AND (env(MOODLE_DATABASE) = "mysqli" OR env(MOODLE_DATABASE) = "all")
php: 7.4
env: DB=mysqli TASK=PHPUNIT
- env: DB=mysqli TASK=PHPUNIT
php: 7.0
cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm
before_install:
- docker run -d -p 127.0.0.1:8080:80 --name exttests moodlehq/moodle-exttests
# Avoid IPv6 default binding as service (causes redis not to start).
- sudo service redis-server start --bind 127.0.0.1
install:
- >
if [ "$DB" = 'mysqli' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo service mysql stop
sudo stop mysql
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
sudo service mysql restart
sudo start mysql
fi
- >
if [ "$DB" = 'pgsql' ];
@@ -101,8 +99,10 @@ install:
echo 'auth.json' >> .git/info/exclude
fi
echo 'extension="redis.so"' > /tmp/redis.ini
phpenv config-add /tmp/redis.ini
# Enable Redis.
# Redis tests are currently failing on php 7.2 due to https://bugs.php.net/bug.php?id=75628
# echo 'extension="redis.so"' > /tmp/redis.ini
# phpenv config-add /tmp/redis.ini
# Install composer dependencies.
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
@@ -120,7 +120,7 @@ install:
before_script:
- phpenv config-rm xdebug.ini
- >
if [ "$TASK" = 'PHPUNIT' ];
if [ "$TASK" = 'PHPUNIT' -o "$TASK" = 'UPGRADE' ];
then
# Copy generic configuration in place.
cp config-dist.php config.php ;
@@ -173,25 +173,12 @@ before_script:
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
# Redis tests are currently failing on php 7.2 due to https://bugs.php.net/bug.php?id=75628
# -e "/require_once/i \\define('TEST_SESSION_REDIS_HOST', '127.0.0.1');" \
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Enable test external resources
sed -i \
-e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://127.0.0.1:8080');" \
-e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://127.0.0.1:8080');" \
config.php ;
# Redis cache store tests
sed -i \
-e "/require_once/i \\define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');" \
config.php ;
# Redis session tests, but not for PHP 7.2 and up. See MDL-60978 for more info.
redissession="define('TEST_SESSION_REDIS_HOST', '127.0.0.1');"
sed -i \
-e "/require_once/i \\${redissession}" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
@@ -220,7 +207,7 @@ before_script:
# We need the official upstream for comparison
git remote add upstream https://github.com/moodle/moodle.git;
git fetch upstream MOODLE_39_STABLE;
git fetch upstream MOODLE_36_STABLE;
export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`";
export GIT_COMMIT="$TRAVIS_COMMIT";
export UPSTREAM_FETCH_HEAD=`git rev-parse FETCH_HEAD`
@@ -231,6 +218,32 @@ before_script:
export phpcmd=`which php`;
fi
########################################################################
# Upgrade test
########################################################################
- >
if [ "$TASK" = 'UPGRADE' ];
then
# We need the official upstream.
git remote add upstream https://github.com/moodle/moodle.git;
# Checkout 30 STABLE branch (the first version compatible with PHP 7.x)
git fetch upstream MOODLE_30_STABLE;
git checkout MOODLE_30_STABLE;
# Perform the upgrade
php admin/cli/install_database.php --agree-license --adminpass=Password --adminemail=admin@example.com --fullname="Upgrade test" --shortname=Upgrade;
# Return to the previous commit
git checkout -;
# Perform the upgrade
php admin/cli/upgrade.php --non-interactive --allow-unstable ;
# The local_ci repository can be used to check upgrade savepoints.
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci ;
fi
script:
- >
if [ "$TASK" = 'PHPUNIT' ];
@@ -256,10 +269,19 @@ script:
git diff --cached --exit-code ;
fi
after_script:
########################################################################
# Upgrade test
########################################################################
- >
if [ "$TASK" = 'PHPUNIT' ];
if [ "$TASK" = 'UPGRADE' ];
then
EXTTESTS_HITS=$(docker logs exttests 2>&1 | grep -Fv -e 'AH00558' -e '[pid 1]' | wc -l)
echo -e "\nTest local resources number of hits: ${EXTTESTS_HITS}.\n"
cp local/ci/check_upgrade_savepoints/check_upgrade_savepoints.php ./check_upgrade_savepoints.php
result=`php check_upgrade_savepoints.php`;
# Check if there are problems
count=`echo "$result" | grep -P "ERROR|WARN" | wc -l` ;
if (($count > 0));
then
echo "$result"
exit 1 ;
fi
fi
+138 -600
View File
@@ -20,136 +20,18 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/* eslint-env node */
/**
* Calculate the cwd, taking into consideration the `root` option (for Windows).
*
* @param {Object} grunt
* @returns {String} The current directory as best we can determine
* Grunt configuration
*/
const getCwd = grunt => {
const fs = require('fs');
const path = require('path');
let cwd = fs.realpathSync(process.env.PWD || process.cwd());
// Windows users can't run grunt in a subdirectory, so allow them to set
// the root by passing --root=path/to/dir.
if (grunt.option('root')) {
const root = grunt.option('root');
if (grunt.file.exists(__dirname, root)) {
cwd = fs.realpathSync(path.join(__dirname, root));
grunt.log.ok('Setting root to ' + cwd);
} else {
grunt.fail.fatal('Setting root to ' + root + ' failed - path does not exist');
}
}
return cwd;
};
/**
* Register any stylelint tasks.
*
* @param {Object} grunt
* @param {Array} files
* @param {String} fullRunDir
*/
const registerStyleLintTasks = (grunt, files, fullRunDir) => {
const getCssConfigForFiles = files => {
return {
stylelint: {
css: {
// Use a fully-qualified path.
src: files,
options: {
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
}
}
}
},
},
};
};
const getScssConfigForFiles = files => {
return {
stylelint: {
scss: {
options: {syntax: 'scss'},
src: files,
},
},
};
};
let hasCss = true;
let hasScss = true;
if (files) {
// Specific files were passed. Just set them up.
grunt.config.merge(getCssConfigForFiles(files));
grunt.config.merge(getScssConfigForFiles(files));
} else {
// The stylelint system does not handle the case where there was no file to lint.
// Check whether there are any files to lint in the current directory.
const glob = require('glob');
const scssSrc = [];
glob.sync(`${fullRunDir}/**/*.scss`).forEach(path => scssSrc.push(path));
if (scssSrc.length) {
grunt.config.merge(getScssConfigForFiles(scssSrc));
} else {
hasScss = false;
}
const cssSrc = [];
glob.sync(`${fullRunDir}/**/*.css`).forEach(path => cssSrc.push(path));
if (cssSrc.length) {
grunt.config.merge(getCssConfigForFiles(cssSrc));
} else {
hasCss = false;
}
}
const scssTasks = ['sass'];
if (hasScss) {
scssTasks.unshift('stylelint:scss');
}
grunt.registerTask('scss', scssTasks);
const cssTasks = [];
if (hasCss) {
cssTasks.push('stylelint:css');
}
grunt.registerTask('rawcss', cssTasks);
grunt.registerTask('css', ['scss', 'rawcss']);
};
/**
* Grunt configuration.
*
* @param {Object} grunt
*/
module.exports = function(grunt) {
const path = require('path');
const tasks = {};
const async = require('async');
const DOMParser = require('xmldom').DOMParser;
const xpath = require('xpath');
const semver = require('semver');
const watchman = require('fb-watchman');
const watchmanClient = new watchman.Client();
const fs = require('fs');
const ComponentList = require(path.resolve('GruntfileComponents.js'));
const sass = require('node-sass');
var path = require('path'),
tasks = {},
cwd = process.env.PWD || process.cwd(),
async = require('async'),
DOMParser = require('xmldom').DOMParser,
xpath = require('xpath'),
semver = require('semver');
// Verify the node version is new enough.
var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
@@ -158,65 +40,22 @@ module.exports = function(grunt) {
grunt.fail.fatal('Node version not satisfied. Require ' + expected + ', version installed: ' + actual);
}
// Detect directories:
// * gruntFilePath The real path on disk to this Gruntfile.js
// * cwd The current working directory, which can be overridden by the `root` option
// * relativeCwd The cwd, relative to the Gruntfile.js
// * componentDirectory The root directory of the component if the cwd is in a valid component
// * inComponent Whether the cwd is in a valid component
// * runDir The componentDirectory or cwd if not in a component, relative to Gruntfile.js
// * fullRunDir The full path to the runDir
const gruntFilePath = fs.realpathSync(process.cwd());
const cwd = getCwd(grunt);
const relativeCwd = path.relative(gruntFilePath, cwd);
const componentDirectory = ComponentList.getOwningComponentDirectory(relativeCwd);
const inComponent = !!componentDirectory;
const runDir = inComponent ? componentDirectory : relativeCwd;
const fullRunDir = fs.realpathSync(gruntFilePath + path.sep + runDir);
grunt.log.debug('============================================================================');
grunt.log.debug(`= Node version: ${process.versions.node}`);
grunt.log.debug(`= grunt version: ${grunt.package.version}`);
grunt.log.debug(`= process.cwd: '` + process.cwd() + `'`);
grunt.log.debug(`= process.env.PWD: '${process.env.PWD}'`);
grunt.log.debug(`= path.sep '${path.sep}'`);
grunt.log.debug('============================================================================');
grunt.log.debug(`= gruntFilePath: '${gruntFilePath}'`);
grunt.log.debug(`= relativeCwd: '${relativeCwd}'`);
grunt.log.debug(`= componentDirectory: '${componentDirectory}'`);
grunt.log.debug(`= inComponent: '${inComponent}'`);
grunt.log.debug(`= runDir: '${runDir}'`);
grunt.log.debug(`= fullRunDir: '${fullRunDir}'`);
grunt.log.debug('============================================================================');
if (inComponent) {
grunt.log.ok(`Running tasks for component directory ${componentDirectory}`);
// Windows users can't run grunt in a subdirectory, so allow them to set
// the root by passing --root=path/to/dir.
if (grunt.option('root')) {
var root = grunt.option('root');
if (grunt.file.exists(__dirname, root)) {
cwd = path.join(__dirname, root);
grunt.log.ok('Setting root to ' + cwd);
} else {
grunt.fail.fatal('Setting root to ' + root + ' failed - path does not exist');
}
}
let files = null;
if (grunt.option('files')) {
// Accept a comma separated list of files to process.
files = grunt.option('files').split(',');
}
// If the cwd is the amd directory in the current component then it will be empty.
// If the cwd is a child of the component's AMD directory, the relative directory will not start with ..
const inAMD = !path.relative(`${componentDirectory}/amd`, cwd).startsWith('..');
var inAMD = path.basename(cwd) == 'amd';
// Globbing pattern for matching all AMD JS source files.
let amdSrc = [];
if (inComponent) {
amdSrc.push(componentDirectory + "/amd/src/*.js");
amdSrc.push(componentDirectory + "/amd/src/**/*.js");
} else {
amdSrc = ComponentList.getAmdSrcGlobList();
}
let yuiSrc = [];
if (inComponent) {
yuiSrc.push(componentDirectory + "/yui/src/**/*.js");
} else {
yuiSrc = ComponentList.getYuiSrcGlobList(gruntFilePath + '/');
}
var amdSrc = [inAMD ? cwd + '/src/*.js' : '**/amd/src/*.js'];
/**
* Function to generate the destination for the uglify task
@@ -228,9 +67,10 @@ module.exports = function(grunt) {
* @param {String} srcPath the matched src path
* @return {String} The rewritten destination path.
*/
var babelRename = function(destPath, srcPath) {
var uglifyRename = function(destPath, srcPath) {
destPath = srcPath.replace('src', 'build');
destPath = destPath.replace('.js', '.min.js');
destPath = path.resolve(cwd, destPath);
return destPath;
};
@@ -241,126 +81,70 @@ module.exports = function(grunt) {
* @return {array} The list of thirdparty paths.
*/
var getThirdPartyPathsFromXML = function() {
const thirdpartyfiles = ComponentList.getThirdPartyLibsList(gruntFilePath + '/');
const libs = ['node_modules/', 'vendor/'];
var thirdpartyfiles = grunt.file.expand('*/**/thirdpartylibs.xml');
var libs = ['node_modules/', 'vendor/'];
thirdpartyfiles.forEach(function(file) {
const dirname = path.dirname(file);
var dirname = path.dirname(file);
const doc = new DOMParser().parseFromString(grunt.file.read(file));
const nodes = xpath.select("/libraries/library/location/text()", doc);
var doc = new DOMParser().parseFromString(grunt.file.read(file));
var nodes = xpath.select("/libraries/library/location/text()", doc);
nodes.forEach(function(node) {
let lib = path.posix.join(dirname, node.toString());
if (grunt.file.isDir(lib)) {
// Ensure trailing slash on dirs.
lib = lib.replace(/\/?$/, '/');
}
nodes.forEach(function(node) {
var lib = path.join(dirname, node.toString());
if (grunt.file.isDir(lib)) {
// Ensure trailing slash on dirs.
lib = lib.replace(/\/?$/, '/');
}
// Look for duplicate paths before adding to array.
if (libs.indexOf(lib) === -1) {
libs.push(lib);
}
});
// Look for duplicate paths before adding to array.
if (libs.indexOf(lib) === -1) {
libs.push(lib);
}
});
});
return libs;
};
/**
* Get the list of feature files to pass to the gherkin linter.
*
* @returns {Array}
*/
const getGherkinLintTargets = () => {
if (files) {
// Specific files were requested. Only check these.
return files;
}
if (inComponent) {
return [`${runDir}/tests/behat/*.feature`];
}
return ['**/tests/behat/*.feature'];
};
// Project configuration.
grunt.initConfig({
eslint: {
// Even though warnings dont stop the build we don't display warnings by default because
// at this moment we've got too many core warnings.
// To display warnings call: grunt eslint --show-lint-warnings
// To fail on warnings call: grunt eslint --max-lint-warnings=0
// Also --max-lint-warnings=-1 can be used to display warnings but not fail.
options: {
quiet: (!grunt.option('show-lint-warnings')) && (typeof grunt.option('max-lint-warnings') === 'undefined'),
maxWarnings: ((typeof grunt.option('max-lint-warnings') !== 'undefined') ? grunt.option('max-lint-warnings') : -1)
},
amd: {src: files ? files : amdSrc},
options: {quiet: !grunt.option('show-lint-warnings')},
amd: {src: amdSrc},
// Check YUI module source files.
yui: {src: files ? files : yuiSrc},
yui: {src: ['**/yui/src/**/*.js', '!*/**/yui/src/*/meta/*.js']}
},
babel: {
options: {
sourceMaps: true,
comments: false,
plugins: [
'transform-es2015-modules-amd-lazy',
'system-import-transformer',
// This plugin modifies the Babel transpiling for "export default"
// so that if it's used then only the exported value is returned
// by the generated AMD module.
//
// It also adds the Moodle plugin name to the AMD module definition
// so that it can be imported as expected in other modules.
path.resolve('babel-plugin-add-module-to-define.js'),
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-class-properties', {'loose': false}],
'@babel/plugin-proposal-json-strings'
],
presets: [
['minify', {
// This minification plugin needs to be disabled because it breaks the
// source map generation and causes invalid source maps to be output.
simplify: false,
builtIns: false
}],
['@babel/preset-env', {
targets: {
browsers: [
">0.25%",
"last 2 versions",
"not ie <= 10",
"not op_mini all",
"not Opera > 0",
"not dead"
]
},
modules: false,
useBuiltIns: false
}]
]
},
dist: {
uglify: {
amd: {
files: [{
expand: true,
src: files ? files : amdSrc,
rename: babelRename
}]
src: amdSrc,
rename: uglifyRename
}],
options: {report: 'none'}
}
},
less: {
bootstrapbase: {
files: {
"theme/bootstrapbase/style/moodle.css": "theme/bootstrapbase/less/moodle.less",
"theme/bootstrapbase/style/editor.css": "theme/bootstrapbase/less/editor.less",
},
options: {
compress: false // We must not compress to keep the comments.
}
}
},
sass: {
dist: {
files: {
"theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss",
"theme/classic/style/moodle.css": "theme/classic/scss/classicgrunt.scss"
"theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss"
}
},
options: {
implementation: sass,
includePaths: ["theme/boost/scss/", "theme/classic/scss/"]
includePaths: ["theme/boost/scss/"]
}
},
watch: {
@@ -368,72 +152,83 @@ module.exports = function(grunt) {
nospawn: true // We need not to spawn so config can be changed dynamically.
},
amd: {
files: inComponent
? ['amd/src/*.js', 'amd/src/**/*.js']
: ['**/amd/src/**/*.js'],
files: ['**/amd/src/**/*.js'],
tasks: ['amd']
},
boost: {
files: [inComponent ? 'scss/**/*.scss' : 'theme/boost/scss/**/*.scss'],
tasks: ['scss']
},
rawcss: {
files: [
'**/*.css',
],
excludes: [
'**/moodle.css',
'**/editor.css',
],
tasks: ['rawcss']
bootstrapbase: {
files: ["theme/bootstrapbase/less/**/*.less"],
tasks: ["css"]
},
yui: {
files: inComponent
? ['yui/src/*.json', 'yui/src/**/*.js']
: ['**/yui/src/**/*.js'],
files: ['**/yui/src/**/*.js'],
tasks: ['yui']
},
gherkinlint: {
files: [inComponent ? 'tests/behat/*.feature' : '**/tests/behat/*.feature'],
files: ['**/tests/behat/*.feature'],
tasks: ['gherkinlint']
}
},
shifter: {
options: {
recursive: true,
// Shifter takes a relative path.
paths: files ? files : [runDir]
paths: [cwd]
}
},
gherkinlint: {
options: {
files: getGherkinLintTargets(),
files: ['**/tests/behat/*.feature'],
}
},
stylelint: {
less: {
options: {
syntax: 'less',
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
}
}
},
src: ['theme/**/*.less']
},
scss: {
options: {syntax: 'scss'},
src: ['*/**/*.scss']
},
css: {
src: ['*/**/*.css'],
options: {
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
}
}
}
}
}
});
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
tasks.ignorefiles = function() {
// An array of paths to third party directories.
const thirdPartyPaths = getThirdPartyPathsFromXML();
// Generate .eslintignore.
const eslintIgnores = [
'# Generated by "grunt ignorefiles"',
'*/**/yui/src/*/meta/',
'*/**/build/',
].concat(thirdPartyPaths);
grunt.file.write('.eslintignore', eslintIgnores.join('\n') + '\n');
// Generate .stylelintignore.
const stylelintIgnores = [
'# Generated by "grunt ignorefiles"',
'**/yui/build/*',
'theme/boost/style/moodle.css',
'theme/classic/style/moodle.css',
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n') + '\n');
// An array of paths to third party directories.
var thirdPartyPaths = getThirdPartyPathsFromXML();
// Generate .eslintignore.
var eslintIgnores = ['# Generated by "grunt ignorefiles"', '*/**/yui/src/*/meta/', '*/**/build/'].concat(thirdPartyPaths);
grunt.file.write('.eslintignore', eslintIgnores.join('\n'));
// Generate .stylelintignore.
var stylelintIgnores = [
'# Generated by "grunt ignorefiles"',
'**/yui/build/*',
'theme/bootstrapbase/style/',
'theme/clean/style/custom.css',
'theme/more/style/custom.css',
'theme/boost/style/moodle.css'
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n'));
};
/**
@@ -525,32 +320,19 @@ module.exports = function(grunt) {
};
tasks.gherkinlint = function() {
const done = this.async();
const options = grunt.config('gherkinlint.options');
var done = this.async(),
options = grunt.config('gherkinlint.options');
// Grab the gherkin-lint linter and required scaffolding.
const linter = require('gherkin-lint/dist/linter.js');
const featureFinder = require('gherkin-lint/dist/feature-finder.js');
const configParser = require('gherkin-lint/dist/config-parser.js');
const formatter = require('gherkin-lint/dist/formatters/stylish.js');
// Run the linter.
return linter.lint(
featureFinder.getFeatureFiles(grunt.file.expand(options.files)),
configParser.getConfiguration(configParser.defaultConfigFileName)
)
.then(results => {
// Print the results out uncondtionally.
formatter.printResults(results);
return results;
})
.then(results => {
// Report on the results.
// The done function takes a bool whereby a falsey statement causes the task to fail.
return results.every(result => result.errors.length === 0);
})
.then(done); // eslint-disable-line promise/no-callback-in-promise
var args = grunt.file.expand(options.files);
args.unshift(path.normalize(__dirname + '/node_modules/.bin/gherkin-lint'));
grunt.util.spawn({
cmd: 'node',
args: args,
opts: {stdio: 'inherit', env: process.env}
}, function(error, result, code) {
// Propagate the exit code.
done(code === 0);
});
};
tasks.startup = function() {
@@ -568,288 +350,44 @@ module.exports = function(grunt) {
}
};
/**
* This is a wrapper task to handle the grunt watch command. It attempts to use
* Watchman to monitor for file changes, if it's installed, because it's much faster.
*
* If Watchman isn't installed then it falls back to the grunt-contrib-watch file
* watcher for backwards compatibility.
*/
tasks.watch = function() {
var watchTaskDone = this.async();
var watchInitialised = false;
var watchTaskQueue = {};
var processingQueue = false;
// Grab the tasks and files that have been queued up and execute them.
var processWatchTaskQueue = function() {
if (!Object.keys(watchTaskQueue).length || processingQueue) {
// If there is nothing in the queue or we're already processing then wait.
return;
}
processingQueue = true;
// Grab all tasks currently in the queue.
var queueToProcess = watchTaskQueue;
// Reset the queue.
watchTaskQueue = {};
async.forEachSeries(
Object.keys(queueToProcess),
function(task, next) {
var files = queueToProcess[task];
var filesOption = '--files=' + files.join(',');
grunt.log.ok('Running task ' + task + ' for files ' + filesOption);
// Spawn the task in a child process so that it doesn't kill this one
// if it failed.
grunt.util.spawn(
{
// Spawn with the grunt bin.
grunt: true,
// Run from current working dir and inherit stdio from process.
opts: {
cwd: fullRunDir,
stdio: 'inherit'
},
args: [task, filesOption]
},
function(err, res, code) {
if (code !== 0) {
// The grunt task failed.
grunt.log.error(err);
}
// Move on to the next task.
next();
}
);
},
function() {
// No longer processing.
processingQueue = false;
// Once all of the tasks are done then recurse just in case more tasks
// were queued while we were processing.
processWatchTaskQueue();
}
);
};
const originalWatchConfig = grunt.config.get(['watch']);
const watchConfig = Object.keys(originalWatchConfig).reduce(function(carry, key) {
if (key == 'options') {
return carry;
}
const value = originalWatchConfig[key];
const taskNames = value.tasks;
const files = value.files;
let excludes = [];
if (value.excludes) {
excludes = value.excludes;
}
taskNames.forEach(function(taskName) {
carry[taskName] = {
files,
excludes,
};
});
return carry;
}, {});
watchmanClient.on('error', function(error) {
// We have to add an error handler here and parse the error string because the
// example way from the docs to check if Watchman is installed doesn't actually work!!
// See: https://github.com/facebook/watchman/issues/509
if (error.message.match('Watchman was not found')) {
// If watchman isn't installed then we should fallback to the other watch task.
grunt.log.ok('It is recommended that you install Watchman for better performance using the "watch" command.');
// Fallback to the old grunt-contrib-watch task.
grunt.renameTask('watch-grunt', 'watch');
grunt.task.run(['watch']);
// This task is finished.
watchTaskDone(0);
} else {
grunt.log.error(error);
// Fatal error.
watchTaskDone(1);
}
});
watchmanClient.on('subscription', function(resp) {
if (resp.subscription !== 'grunt-watch') {
return;
}
resp.files.forEach(function(file) {
grunt.log.ok('File changed: ' + file.name);
var fullPath = fullRunDir + '/' + file.name;
Object.keys(watchConfig).forEach(function(task) {
const fileGlobs = watchConfig[task].files;
var match = fileGlobs.some(function(fileGlob) {
return grunt.file.isMatch(`**/${fileGlob}`, fullPath);
});
if (match) {
// If we are watching a subdirectory then the file.name will be relative
// to that directory. However the grunt tasks expect the file paths to be
// relative to the Gruntfile.js location so let's normalise them before
// adding them to the queue.
var relativePath = fullPath.replace(gruntFilePath + '/', '');
if (task in watchTaskQueue) {
if (!watchTaskQueue[task].includes(relativePath)) {
watchTaskQueue[task] = watchTaskQueue[task].concat(relativePath);
}
} else {
watchTaskQueue[task] = [relativePath];
}
}
});
});
processWatchTaskQueue();
});
process.on('SIGINT', function() {
// Let the user know that they may need to manually stop the Watchman daemon if they
// no longer want it running.
if (watchInitialised) {
grunt.log.ok('The Watchman daemon may still be running and may need to be stopped manually.');
}
process.exit();
});
// Initiate the watch on the current directory.
watchmanClient.command(['watch-project', fullRunDir], function(watchError, watchResponse) {
if (watchError) {
grunt.log.error('Error initiating watch:', watchError);
watchTaskDone(1);
return;
}
if ('warning' in watchResponse) {
grunt.log.error('warning: ', watchResponse.warning);
}
var watch = watchResponse.watch;
var relativePath = watchResponse.relative_path;
watchInitialised = true;
watchmanClient.command(['clock', watch], function(clockError, clockResponse) {
if (clockError) {
grunt.log.error('Failed to query clock:', clockError);
watchTaskDone(1);
return;
}
// Generate the expression query used by watchman.
// Documentation is limited, but see https://facebook.github.io/watchman/docs/expr/allof.html for examples.
// We generate an expression to match any value in the files list of all of our tasks, but excluding
// all value in the excludes list of that task.
//
// [anyof, [
// [allof, [
// [anyof, [
// ['match', validPath, 'wholename'],
// ['match', validPath, 'wholename'],
// ],
// [not,
// [anyof, [
// ['match', invalidPath, 'wholename'],
// ['match', invalidPath, 'wholename'],
// ],
// ],
// ],
var matchWholeName = fileGlob => ['match', fileGlob, 'wholename'];
var matches = Object.keys(watchConfig).map(function(task) {
const matchAll = [];
matchAll.push(['anyof'].concat(watchConfig[task].files.map(matchWholeName)));
if (watchConfig[task].excludes.length) {
matchAll.push(['not', ['anyof'].concat(watchConfig[task].excludes.map(matchWholeName))]);
}
return ['allof'].concat(matchAll);
});
matches = ['anyof'].concat(matches);
var sub = {
expression: matches,
// Which fields we're interested in.
fields: ["name", "size", "type"],
// Add our time constraint.
since: clockResponse.clock
};
if (relativePath) {
/* eslint-disable camelcase */
sub.relative_root = relativePath;
}
watchmanClient.command(['subscribe', watch, 'grunt-watch', sub], function(subscribeError) {
if (subscribeError) {
// Probably an error in the subscription criteria.
grunt.log.error('failed to subscribe: ', subscribeError);
watchTaskDone(1);
return;
}
grunt.log.ok('Listening for changes to files in ' + fullRunDir);
});
});
});
};
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
var changedFiles = Object.create(null);
var onChange = grunt.util._.debounce(function() {
var files = Object.keys(changedFiles);
grunt.config('eslint.amd.src', files);
grunt.config('eslint.yui.src', files);
grunt.config('shifter.options.paths', files);
grunt.config('gherkinlint.options.files', files);
grunt.config('babel.dist.files', [{expand: true, src: files, rename: babelRename}]);
changedFiles = Object.create(null);
var files = Object.keys(changedFiles);
grunt.config('eslint.amd.src', files);
grunt.config('eslint.yui.src', files);
grunt.config('uglify.amd.files', [{expand: true, src: files, rename: uglifyRename}]);
grunt.config('shifter.options.paths', files);
grunt.config('stylelint.less.src', files);
grunt.config('gherkinlint.options.files', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function(action, filepath) {
changedFiles[filepath] = action;
onChange();
changedFiles[filepath] = action;
onChange();
});
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-stylelint');
grunt.loadNpmTasks('grunt-babel');
// Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
grunt.renameTask('watch', 'watch-grunt');
// Register JS tasks.
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', tasks.gherkinlint);
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', tasks.ignorefiles);
grunt.registerTask('watch', 'Run tasks on file changes', tasks.watch);
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
grunt.registerTask('amd', ['eslint:amd', 'babel']);
grunt.registerTask('amd', ['eslint:amd', 'uglify']);
grunt.registerTask('js', ['amd', 'yui']);
// Register CSS tasks.
registerStyleLintTasks(grunt, files, fullRunDir);
// Register CSS taks.
grunt.registerTask('css', ['stylelint:scss', 'sass', 'stylelint:less', 'less:bootstrapbase', 'stylelint:css']);
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', tasks.startup);
-188
View File
@@ -1,188 +0,0 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Helper functions for working with Moodle component names, directories, and sources.
*
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
/** @var {Object} A list of subsystems in Moodle */
const componentData = {};
/**
* Load details of all moodle modules.
*
* @returns {object}
*/
const fetchComponentData = () => {
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const gruntFilePath = process.cwd();
if (!Object.entries(componentData).length) {
componentData.subsystems = {};
componentData.pathList = [];
// Fetch the component definiitions from the distributed JSON file.
const components = JSON.parse(fs.readFileSync(`${gruntFilePath}/lib/components.json`));
// Build the list of moodle subsystems.
componentData.subsystems.lib = 'core';
componentData.pathList.push(process.cwd() + path.sep + 'lib');
for (const [component, thisPath] of Object.entries(components.subsystems)) {
if (thisPath) {
// Prefix "core_" to the front of the subsystems.
componentData.subsystems[thisPath] = `core_${component}`;
componentData.pathList.push(process.cwd() + path.sep + thisPath);
}
}
// The list of components incldues the list of subsystems.
componentData.components = componentData.subsystems;
// Go through each of the plugintypes.
Object.entries(components.plugintypes).forEach(([pluginType, pluginTypePath]) => {
// We don't allow any code in this place..?
glob.sync(`${pluginTypePath}/*/version.php`).forEach(versionPath => {
const componentPath = fs.realpathSync(path.dirname(versionPath));
const componentName = path.basename(componentPath);
const frankenstyleName = `${pluginType}_${componentName}`;
componentData.components[`${pluginTypePath}/${componentName}`] = frankenstyleName;
componentData.pathList.push(componentPath);
// Look for any subplugins.
const subPluginConfigurationFile = `${componentPath}/db/subplugins.json`;
if (fs.existsSync(subPluginConfigurationFile)) {
const subpluginList = JSON.parse(fs.readFileSync(fs.realpathSync(subPluginConfigurationFile)));
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);
});
});
}
});
});
}
return componentData;
};
/**
* Get the list of paths to build AMD sources.
*
* @returns {Array}
*/
const getAmdSrcGlobList = () => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
globList.push(`${componentPath}/amd/src/*.js`);
globList.push(`${componentPath}/amd/src/**/*.js`);
});
return globList;
};
/**
* Get the list of paths to build YUI sources.
*
* @param {String} relativeTo
* @returns {Array}
*/
const getYuiSrcGlobList = relativeTo => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
const relativeComponentPath = componentPath.replace(relativeTo, '');
globList.push(`${relativeComponentPath}/yui/src/**/*.js`);
});
return globList;
};
/**
* Get the list of paths to thirdpartylibs.xml.
*
* @param {String} relativeTo
* @returns {Array}
*/
const getThirdPartyLibsList = relativeTo => {
const fs = require('fs');
const path = require('path');
return fetchComponentData().pathList
.map(componentPath => path.relative(relativeTo, componentPath) + '/thirdpartylibs.xml')
.map(componentPath => componentPath.replace(/\\/g, '/'))
.filter(path => fs.existsSync(path))
.sort();
};
/**
* Find the name of the component matching the specified path.
*
* @param {String} path
* @returns {String|null} Name of matching component.
*/
const getComponentFromPath = path => {
const componentList = fetchComponentData().components;
if (componentList.hasOwnProperty(path)) {
return componentList[path];
}
return null;
};
/**
* Check whether the supplied path, relative to the Gruntfile.js, is in a known component.
*
* @param {String} checkPath The path to check. This can be with either Windows, or Linux directory separators.
* @returns {String|null}
*/
const getOwningComponentDirectory = checkPath => {
const path = require('path');
// Fetch all components into a reverse sorted array.
// This ensures that components which are within the directory of another component match first.
const pathList = Object.keys(fetchComponentData().components).sort().reverse();
for (const componentPath of pathList) {
// If the componentPath is the directory being checked, it will be empty.
// If the componentPath is a parent of the directory being checked, the relative directory will not start with ..
if (!path.relative(componentPath, checkPath).startsWith('..')) {
return componentPath;
}
}
return null;
};
module.exports = {
getAmdSrcGlobList,
getComponentFromPath,
getOwningComponentDirectory,
getYuiSrcGlobList,
getThirdPartyLibsList,
};
-1
View File
@@ -1 +0,0 @@
mod/forum/tests/behat/forum_subscriptions_default.feature
+1 -1
View File
@@ -2,7 +2,7 @@ MOODLE TRADEMARKS POLICY
========================
The word "Moodle" is trademarked in many countries around the world. The word
was originally coined as an acronym: Modular Object-Oriented Dynamic Learning
was originally an acronym: Modular Object-Oriented Dynamic Learning
Environment. The trademark is owned by Martin Dougiamas, Founder and Director
of Moodle.
+4 -5
View File
@@ -33,7 +33,8 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/antiviruses.php', array('action' => $action, 'antivirus' => $antivirus));
$PAGE->set_context(context_system::instance());
require_admin();
require_login();
require_capability('moodle/site:config', context_system::instance());
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageantiviruses";
@@ -98,10 +99,8 @@ switch ($action) {
default:
break;
}
$new = implode(',', $activeantiviruses);
add_to_config_log('antiviruses', $CFG->antiviruses, $new, 'core');
set_config('antiviruses', $new);
set_config('antiviruses', implode(',', $activeantiviruses));
core_plugin_manager::reset_caches();
redirect ($returnurl);
redirect ($returnurl);
+2 -1
View File
@@ -11,7 +11,8 @@ require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_admin();
require_login();
require_capability('moodle/site:config', context_system::instance());
$returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
+1
View File
@@ -30,6 +30,7 @@ $category = required_param('category', PARAM_SAFEDIR);
$return = optional_param('return','', PARAM_ALPHA);
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
/// no guest autologin
require_login(0, false);
$PAGE->set_context(context_system::instance());
$PAGE->set_url('/admin/category.php', array('category' => $category));
-1
View File
@@ -50,7 +50,6 @@ class purge_caches extends \moodleform {
$mform->createElement('advcheckbox', 'theme', '', get_string('purgethemecache', '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')),
$mform->createElement('advcheckbox', 'filter', '', get_string('purgefiltercache', 'admin')),
$mform->createElement('advcheckbox', 'muc', '', get_string('purgemuc', 'admin')),
$mform->createElement('advcheckbox', 'other', '', get_string('purgeothercaches', 'admin'))
@@ -1,59 +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/>.
/**
* Testing outgoing mail configuration form
*
* @package core
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\form;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Test mail form
*
* @package core
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testoutgoingmailconf_form extends \moodleform {
/**
* Add elements to form
*/
public function definition() {
$mform = $this->_form;
// Recipient.
$options = ['maxlength' => '100', 'size' => '25'];
$mform->addElement('text', 'recipient', get_string('testoutgoingmailconf_toemail', 'admin'), $options);
$mform->setType('recipient', PARAM_EMAIL);
$mform->addRule('recipient', get_string('required'), 'required');
$buttonarray = array();
$buttonarray[] = $mform->createElement('submit', 'send', get_string('testoutgoingmailconf_sendtest', 'admin'));
$buttonarray[] = $mform->createElement('cancel');
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$mform->closeHeaderBefore('buttonar');
}
}
-195
View File
@@ -1,195 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* File size admin setting.
*
* @package core_admin
* @copyright 2019 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/adminlib.php');
/**
* An admin setting to support entering and displaying of file sizes in Bytes, KB, MB or GB.
*
* @copyright 2019 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class filesize extends \admin_setting {
/** @var int The byte unit. Number of bytes in a byte */
const UNIT_B = 1;
/** @var int The kilobyte unit (number of bytes in a kilobyte) */
const UNIT_KB = 1024;
/** @var int The megabyte unit (number of bytes in a megabyte) */
const UNIT_MB = 1048576;
/** @var int The gigabyte unit (number of bytes in a gigabyte) */
const UNIT_GB = 1073741824;
/** @var int default size unit */
protected $defaultunit;
/**
* Constructor
*
* @param string $name unique ascii name, either 'mysetting' for settings that in config,
* or 'myplugin/mysetting' for ones in config_plugins.
* @param string $visiblename localised name
* @param string $description localised long description
* @param int|null $defaultvalue Value of the settings in bytes
* @param int|null $defaultunit GB, MB, etc. (in bytes)
*/
public function __construct(string $name, string $visiblename, string $description,
int $defaultvalue = null, int $defaultunit = null) {
$defaultsetting = self::parse_bytes($defaultvalue);
if ($defaultunit && array_key_exists($defaultunit, self::get_units())) {
$this->defaultunit = $defaultunit;
} else {
$this->defaultunit = self::UNIT_MB;
}
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
/**
* Returns selectable units.
*
* @return array
*/
protected static function get_units(): array {
return [
self::UNIT_GB => get_string('sizegb'),
self::UNIT_MB => get_string('sizemb'),
self::UNIT_KB => get_string('sizekb'),
self::UNIT_B => get_string('sizeb'),
];
}
/**
* Converts bytes to some more user friendly string.
*
* @param int $bytes The number of bytes we want to convert from
* @return string
*/
protected static function get_size_text(int $bytes): string {
if (empty($bytes)) {
return get_string('none');
}
return display_size($bytes);
}
/**
* Finds suitable units for given file size.
*
* @param int $bytes The number of bytes
* @return array Parsed file size in the format of ['v' => value, 'u' => unit]
*/
protected static function parse_bytes(int $bytes): array {
foreach (self::get_units() as $unit => $unused) {
if ($bytes % $unit === 0) {
return ['v' => (int)($bytes / $unit), 'u' => $unit];
}
}
return ['v' => (int)$bytes, 'u' => self::UNIT_B];
}
/**
* Get the selected file size as array.
*
* @return array|null An array containing 'v' => xx, 'u' => xx, or null if not set
*/
public function get_setting(): ?array {
$bytes = $this->config_read($this->name);
if (is_null($bytes)) {
return null;
}
return self::parse_bytes($bytes);
}
/**
* Store the file size as bytes.
*
* @param array $data Must be form 'h' => xx, 'm' => xx
* @return string The error string if any
*/
public function write_setting($data): string {
if (!is_array($data)) {
return '';
}
if (!is_numeric($data['v']) || $data['v'] < 0) {
return get_string('errorsetting', 'admin');
}
$bytes = $data['v'] * $data['u'];
$result = $this->config_write($this->name, $bytes);
return ($result ? '' : get_string('errorsetting', 'admin'));
}
/**
* Returns file size text+select fields.
*
* @param array $data The current setting value. Must be form 'v' => xx, 'u' => xx.
* @param string $query Admin search query to be highlighted.
* @return string File size text+select fields and wrapping div(s).
*/
public function output_html($data, $query = ''): string {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_number($default)) {
$defaultinfo = self::get_size_text($default);
} else if (is_array($default)) {
$defaultinfo = self::get_size_text($default['v'] * $default['u']);
} else {
$defaultinfo = null;
}
$inputid = $this->get_id() . 'v';
$units = self::get_units();
$defaultunit = $this->defaultunit;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'value' => $data['v'],
'readonly' => $this->is_readonly(),
'options' => array_map(function($unit, $title) use ($data, $defaultunit) {
return [
'value' => $unit,
'name' => $title,
'selected' => ($data['v'] == 0 && $unit == $defaultunit) || $unit == $data['u']
];
}, array_keys($units), $units)
];
$element = $OUTPUT->render_from_template('core_admin/setting_configfilesize', $context);
return format_admin_setting($this, $this->visiblename, $element, $this->description, $inputid, '', $defaultinfo, $query);
}
}
-289
View File
@@ -1,289 +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/>.
/**
* Task log table.
*
* @package core_admin
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/tablelib.php');
/**
* Table to display list of task logs.
*
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_log_table extends \table_sql {
/**
* Constructor for the task_log table.
*
* @param string $filter
* @param int $resultfilter
*/
public function __construct(string $filter = '', int $resultfilter = null) {
global $DB;
if (-1 === $resultfilter) {
$resultfilter = null;
}
parent::__construct('tasklogs');
$columnheaders = [
'classname' => get_string('name'),
'type' => get_string('tasktype', 'admin'),
'userid' => get_string('user', 'admin'),
'timestart' => get_string('task_starttime', 'admin'),
'duration' => get_string('task_duration', 'admin'),
'db' => get_string('task_dbstats', 'admin'),
'result' => get_string('task_result', 'admin'),
'actions' => '',
];
$this->define_columns(array_keys($columnheaders));
$this->define_headers(array_values($columnheaders));
// The name column is a header.
$this->define_header_column('classname');
// This table is not collapsible.
$this->collapsible(false);
// The actions class should not wrap. Use the BS text utility class.
$this->column_class('actions', 'text-nowrap');
// Allow pagination.
$this->pageable(true);
// Allow sorting. Default to sort by timestarted DESC.
$this->sortable(true, 'timestart', SORT_DESC);
// Add filtering.
$where = [];
$params = [];
if (!empty($filter)) {
$orwhere = [];
$filter = str_replace('\\', '\\\\', $filter);
// Check the class name.
$orwhere[] = $DB->sql_like('classname', ':classfilter', false, false);
$params['classfilter'] = '%' . $DB->sql_like_escape($filter) . '%';
$orwhere[] = $DB->sql_like('output', ':outputfilter', false, false);
$params['outputfilter'] = '%' . $DB->sql_like_escape($filter) . '%';
$where[] = "(" . implode(' OR ', $orwhere) . ")";
}
if (null !== $resultfilter) {
$where[] = 'tl.result = :result';
$params['result'] = $resultfilter;
}
$where = implode(' AND ', $where);
$this->set_sql('', '', $where, $params);
}
/**
* Query the db. Store results in the table object for use by build_table.
*
* @param int $pagesize size of page for paginated displayed table.
* @param bool $useinitialsbar do you want to use the initials bar. Bar
* will only be used if there is a fullname column defined for the table.
*/
public function query_db($pagesize, $useinitialsbar = true) {
global $DB;
// Fetch the attempts.
$sort = $this->get_sql_sort();
if ($sort) {
$sort = "ORDER BY $sort";
}
$extrafields = get_extra_user_fields(\context_system::instance());
$userfields = \user_picture::fields('u', $extrafields, 'userid2', 'user');
$where = '';
if (!empty($this->sql->where)) {
$where = "WHERE {$this->sql->where}";
}
$sql = "SELECT
tl.id, tl.type, tl.component, tl.classname, tl.userid, tl.timestart, tl.timeend,
tl.dbreads, tl.dbwrites, tl.result,
tl.dbreads + tl.dbwrites AS db,
tl.timeend - tl.timestart AS duration,
{$userfields}
FROM {task_log} tl
LEFT JOIN {user} u ON u.id = tl.userid
{$where}
{$sort}";
$this->pagesize($pagesize, $DB->count_records_sql("SELECT COUNT('x') FROM {task_log} tl {$where}", $this->sql->params));
if (!$this->is_downloading()) {
$this->rawdata = $DB->get_records_sql($sql, $this->sql->params, $this->get_page_start(), $this->get_page_size());
} else {
$this->rawdata = $DB->get_records_sql($sql, $this->sql->params);
}
}
/**
* Format the name cell.
*
* @param \stdClass $row
* @return string
*/
public function col_classname($row) : string {
$output = '';
if (class_exists($row->classname)) {
$task = new $row->classname;
if ($task instanceof \core\task\scheduled_task) {
$output = $task->get_name();
}
}
$output .= \html_writer::tag('div', "\\{$row->classname}", [
'class' => 'task-class',
]);
return $output;
}
/**
* Format the type cell.
*
* @param \stdClass $row
* @return string
*/
public function col_type($row) : string {
if (\core\task\database_logger::TYPE_SCHEDULED == $row->type) {
return get_string('task_type:scheduled', 'admin');
} else {
return get_string('task_type:adhoc', 'admin');
}
}
/**
* Format the timestart cell.
*
* @param \stdClass $row
* @return string
*/
public function col_result($row) : string {
if ($row->result) {
return get_string('task_result:failed', 'admin');
} else {
return get_string('success');
}
}
/**
* Format the timestart cell.
*
* @param \stdClass $row
* @return string
*/
public function col_timestart($row) : string {
return userdate($row->timestart, get_string('strftimedatetimeshort', 'langconfig'));
}
/**
* Format the duration cell.
*
* @param \stdClass $row
* @return string
*/
public function col_duration($row) : string {
$duration = round($row->timeend - $row->timestart, 2);
if (empty($duration)) {
// The format_time function returns 'now' when the difference is exactly 0.
// Note: format_time performs concatenation in exactly this fashion so we should do this for consistency.
return '0 ' . get_string('secs', 'moodle');
}
return format_time($duration);
}
/**
* Format the DB details cell.
*
* @param \stdClass $row
* @return string
*/
public function col_db($row) : string {
$output = '';
$output .= \html_writer::div(get_string('task_stats:dbreads', 'admin', $row->dbreads));
$output .= \html_writer::div(get_string('task_stats:dbwrites', 'admin', $row->dbwrites));
return $output;
}
/**
* Format the actions cell.
*
* @param \stdClass $row
* @return string
*/
public function col_actions($row) : string {
global $OUTPUT;
$actions = [];
$url = new \moodle_url('/admin/tasklogs.php', ['logid' => $row->id]);
// Quick view.
$actions[] = $OUTPUT->action_icon(
$url,
new \pix_icon('e/search', get_string('view')),
new \popup_action('click', $url)
);
// Download.
$actions[] = $OUTPUT->action_icon(
new \moodle_url($url, ['download' => true]),
new \pix_icon('t/download', get_string('download'))
);
return implode('&nbsp;', $actions);
}
/**
* Format the user cell.
*
* @param \stdClass $row
* @return string
*/
public function col_userid($row) : string {
if (empty($row->userid)) {
return '';
}
$user = (object) [];
username_load_fields_from_object($user, $row, 'user');
return fullname($user);
}
}
-122
View File
@@ -1,122 +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/>.
/**
* Task executor for adhoc tasks.
*
* @package core
* @subpackage cli
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once("{$CFG->libdir}/clilib.php");
require_once("{$CFG->libdir}/cronlib.php");
list($options, $unrecognized) = cli_get_params(
[
'execute' => false,
'help' => false,
'keep-alive' => 0,
'showsql' => false,
'showdebugging' => false,
'ignorelimits' => false,
], [
'h' => 'help',
'e' => 'execute',
'k' => 'keep-alive',
'i' => 'ignorelimits',
]
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] or empty($options['execute'])) {
$help = <<<EOT
Ad hoc cron tasks.
Options:
-h, --help Print out this help
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
-e, --execute Run all queued adhoc tasks
-k, --keep-alive=N Keep this script alive for N seconds and poll for new adhoc tasks
-i --ignorelimits Ignore task_adhoc_concurrency_limit and task_adhoc_max_runtime limits
Example:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --execute
EOT;
echo $help;
die;
}
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
$DB->set_debug(true);
}
if (CLI_MAINTENANCE) {
echo "CLI maintenance mode active, cron execution suspended.\n";
exit(1);
}
if (moodle_needs_upgrading()) {
echo "Moodle upgrade pending, cron execution suspended.\n";
exit(1);
}
if (empty($options['execute'])) {
exit(0);
}
if (empty($options['keep-alive'])) {
$options['keep-alive'] = 0;
}
if (!empty($CFG->showcronsql)) {
$DB->set_debug(true);
}
if (!empty($CFG->showcrondebugging)) {
set_debugging(DEBUG_DEVELOPER, true);
}
$checklimits = empty($options['ignorelimits']);
core_php_time_limit::raise();
// Increase memory limit.
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
cron_setup_user();
$humantimenow = date('r', time());
$keepalive = (int)$options['keep-alive'];
\core\local\cli\shutdown::script_supports_graceful_exit();
mtrace("Server Time: {$humantimenow}\n");
cron_run_adhoc_tasks(time(), $keepalive, $checklimits);
+2 -7
View File
@@ -83,7 +83,7 @@ Examples:
Stores the given configuration variable in the shell variable, escaped
so that it can be safely used as a shell argument.
# php cfg.php --name=theme --set=classic
# php cfg.php --name=theme --set=clean
Sets the given configuration variable to the given value.
# php cfg.php --name=noemailever --unset
@@ -124,12 +124,7 @@ if ($options['unset'] || $options['set'] !== null) {
cli_error('The configuration variable is hard-set in the config.php, unable to change.', 4);
}
$new = $options['set'];
$old = get_config($options['component'], $options['name']);
if ($new !== $old) {
set_config($options['name'], $options['set'], $options['component']);
add_to_config_log($options['name'], $old, $new, $options['component']);
}
set_config($options['name'], $options['set'], $options['component']);
exit(0);
}
-171
View File
@@ -1,171 +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/>.
/**
* CLI tool for system checks
*
* @package core
* @category check
* @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir.'/clilib.php');
use core\check\result;
list($options, $unrecognized) = cli_get_params([
'help' => false,
'filter' => '',
'type' => 'status',
'verbose' => false,
], [
'h' => 'help',
'f' => 'filter',
'v' => 'verbose',
't' => 'type',
]);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$checks = \core\check\manager::get_checks($options['type']);
$types = join(', ', \core\check\manager::TYPES);
$help = "Run Moodle system checks
Options:
-h, --help Print out this help
-f, --filter Filter to a subset of checks
-t, --type Which set of checks? Defaults to 'status'
One of $types
-v, --verbose Show details of all checks, not just failed checks
Example:
sudo -u www-data php admin/cli/checks.php
sudo -u www-data php admin/cli/checks.php -v
sudo -u www-data php admin/cli/checks.php -v --filter=environment
";
if ($options['help']) {
echo $help;
die();
}
$filter = $options['filter'];
if ($filter) {
$checks = array_filter($checks, function($check, $key) use ($filter) {
$ref = $check->get_ref();
return (strpos($ref, $filter) !== false);
}, 1);
}
// These shell exit codes and labels align with the NRPE standard.
$exitcodes = [
result::NA => 0,
result::OK => 0,
result::INFO => 0,
result::UNKNOWN => 3,
result::WARNING => 1,
result::ERROR => 2,
result::CRITICAL => 2,
];
$exitlabel = [
result::NA => 'OK',
result::OK => 'OK',
result::INFO => 'OK',
result::UNKNOWN => 'UNKNOWN',
result::WARNING => 'WARNING',
result::ERROR => 'CRITICAL',
result::CRITICAL => 'CRITICAL',
];
$format = "% 10s| % -60s\n";
$spacer = "----------+--------------------------------------------------------------------\n";
$prefix = ' |';
$output = '';
$header = $exitlabel[result::OK] . ': ' . get_string('checksok', '', $options['type']) . "\n";
$exitcode = $exitcodes[result::OK];
foreach ($checks as $check) {
$ref = $check->get_ref();
$result = $check->get_result();
$status = $result->get_status();
$checkexitcode = $exitcodes[$status];
// Summary is treated as html.
$summary = $result->get_summary();
$summary = html_to_text($summary, 60, false);
if ($checkexitcode > $exitcode) {
$exitcode = $checkexitcode;
$header = $exitlabel[$status] . ': ' . $check->get_name() . " (" . $check->get_ref() . ")\n";
}
if (empty($messages[$status])) {
$messages[$status] = $result;
}
$len = strlen(get_string('status' . $status));
if ($options['verbose'] ||
$status == result::WARNING ||
$status == result::CRITICAL ||
$status == result::ERROR) {
$output .= sprintf(
$format,
$OUTPUT->check_result($result),
sprintf('%s (%s)', $check->get_name(), $ref)
);
$summary = str_replace("\n", "\n" . $prefix . ' ', $summary);
$output .= sprintf( $format, '', ' ' . $summary);
if ($options['verbose']) {
$actionlink = $check->get_action_link();
if ($actionlink) {
$output .= sprintf( $format, '', ' ' . $actionlink->url);
}
$output .= sprintf( $format, '', '');
}
}
}
// Print NRPE header.
print $header;
// Only show the table header if there is anything to show.
if ($output) {
print sprintf($format,
get_string('status'). ' ',
get_string('check')
) . $spacer;
print $output;
}
// NRPE shell exit code.
exit($exitcode);
+2 -20
View File
@@ -35,16 +35,8 @@ require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(
array(
'help' => false,
'stop' => false,
),
array(
'h' => 'help',
's' => 'stop',
)
);
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -57,7 +49,6 @@ if ($options['help']) {
Options:
-h, --help Print out this help
-s, --stop Notify all other running cron processes to stop after the current task
Example:
\$sudo -u www-data /usr/bin/php admin/cli/cron.php
@@ -67,13 +58,4 @@ Example:
die;
}
if ($options['stop']) {
// By clearing the caches this signals to other running processes
// to exit after finishing the current task.
\core\task\manager::clear_static_caches();
die;
}
\core\local\cli\shutdown::script_supports_graceful_exit();
cron_run();
-138
View File
@@ -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/>.
/**
* Fix orphaned calendar events that were broken by MDL-67494.
*
* This script will look for all the calendar events which userids
* where broken by a wrong upgrade step, affecting to Moodle 3.9.5
* and up.
*
* It performs checks to both:
* a) Detect if the site was affected (ran the wrong upgrade step).
* b) Look for orphaned calendar events, categorising them as:
* - standard: site / category / course / group / user events
* - subscription: events created via subscriptions.
* - action: normal action events, created to show common important dates.
* - override: user and group override events, particular, that some activities support.
* - custom: other events, not being any of the above, common or particular.
* By specifying it (--fix) try to recover as many broken events (missing userid) as
* possible. Standard, subscription, action, override events in core are fully supported but
* override or custom events should be fixed by each plugin as far as there isn't any standard
* API (plugin-wise) to launch a rebuild of the calendar events.
*
* @package core
* @copyright 2021 onwards Simey Lameze <simey@moodle.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require_once(__DIR__ . '/../../config.php');
require_once($CFG->libdir . "/clilib.php");
require_once($CFG->libdir . '/db/upgradelib.php');
// Supported options.
$long = ['fix' => false, 'help' => false];
$short = ['f' => 'fix', 'h' => 'help'];
// CLI options.
[$options, $unrecognized] = cli_get_params($long, $short);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
$help = <<<EOT
Fix orphaned calendar events.
This script detects calendar events that have had their
userid lost. By default it will perform various checks
and report them, showing the site status in an easy way.
Also, optionally (--fix), it wil try to recover as many
lost userids as possible from different sources. Note that
this script aims to process well-know events in core,
leaving custom events in 3rd part plugins mostly unmodified
because there isn't any consistent way to regenerate them.
For more details: https://tracker.moodle.org/browse/MDL-71156
Options:
-h, --help Print out this help.
-f, --fix Fix the orphaned calendar events in the DB.
If not specified only check and report problems to STDERR.
Usage:
- Only report: \$ sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_calendar_events.php
- Report and fix: \$ sudo -u www-data /usr/bin/php admin/cli/fix_orphaned_calendar_events.php -f
EOT;
cli_writeln($help);
die;
}
// Check various usual pre-requisites.
if (empty($CFG->version)) {
cli_error('Database is not yet installed.');
}
$admin = get_admin();
if (!$admin) {
cli_error('Error: No admin account was found.');
}
if (moodle_needs_upgrading()) {
cli_error('Moodle upgrade pending, script execution suspended.');
}
// Do everything as admin by default.
\core\session\manager::set_user($admin);
// Report current site status.
cli_heading('Checking the site status');
$needsfix = upgrade_calendar_site_status();
// Report current calendar events status.
cli_heading('Checking the calendar events status');
$info = upgrade_calendar_events_status();
$hasbadevents = $info['total']->bad > 0 || $info['total']->bad != $info['other']->bad;
$needsfix = $needsfix || $hasbadevents;
// If, selected, fix as many calendar events as possible.
if ($options['fix']) {
// If the report has told us that the fix was not needed... ask for confirmation!
if (!$needsfix) {
cli_writeln("This site DOES NOT NEED to run the calendar events fix.");
$input = cli_input('Are you completely sure that you want to run the fix? (y/N)', 'N', ['y', 'Y', 'n', 'N']);
if (strtolower($input) != 'y') {
exit(0);
}
cli_writeln("");
}
cli_heading('Fixing as many as possible calendar events');
upgrade_calendar_events_fix_remaining($info);
// Report current (after fix) calendar events status.
cli_heading('Checking the calendar events status (after fix)');
upgrade_calendar_events_status();
} else if ($needsfix) {
// Fix option was not provided but problem events have been found. Notify the user and provide info how to fix these events.
cli_writeln("This site NEEDS to run the calendar events fix!");
cli_writeln("To fix the calendar events, re-run this script with the --fix option.");
}
+186 -204
View File
@@ -215,7 +215,6 @@ define('SITEID', 1);
//Database types
$databases = array('mysqli' => moodle_database::get_driver_instance('mysqli', 'native'),
'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'),
@@ -267,7 +266,6 @@ list($options, $unrecognized) = cli_get_params(
);
$interactive = empty($options['non-interactive']);
$skipdatabase = $options['skip-database'];
// set up language
$lang = clean_param($options['lang'], PARAM_SAFEDIR);
@@ -393,6 +391,7 @@ if ($interactive) {
$CFG->wwwroot = $wwwroot;
$CFG->httpswwwroot = $CFG->wwwroot;
//We need dataroot before lang download
$CFG->dataroot = $options['dataroot'];
if ($interactive) {
@@ -515,105 +514,100 @@ if ($interactive) {
$database = $databases[$CFG->dbtype];
// We cannot do any validation until all DB connection data is provided.
$hintdatabase = '';
do {
echo $hintdatabase;
// Ask for db host.
if ($interactive) {
cli_separator();
cli_heading(get_string('databasehost', 'install'));
if ($options['dbhost'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbhost']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbhost = cli_input($prompt, $options['dbhost']);
// ask for db host
if ($interactive) {
cli_separator();
cli_heading(get_string('databasehost', 'install'));
if ($options['dbhost'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbhost']);
} else {
$CFG->dbhost = $options['dbhost'];
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbhost = cli_input($prompt, $options['dbhost']);
// Ask for db name.
if ($interactive) {
cli_separator();
cli_heading(get_string('databasename', 'install'));
if ($options['dbname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbname = cli_input($prompt, $options['dbname']);
} else {
$CFG->dbhost = $options['dbhost'];
}
// ask for db name
if ($interactive) {
cli_separator();
cli_heading(get_string('databasename', 'install'));
if ($options['dbname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbname']);
} else {
$CFG->dbname = $options['dbname'];
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbname = cli_input($prompt, $options['dbname']);
// Ask for db prefix.
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 {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->prefix = cli_input($prompt, $options['prefix']);
} else {
$CFG->dbname = $options['dbname'];
}
// ask for db prefix
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 {
$CFG->prefix = $options['prefix'];
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->prefix = cli_input($prompt, $options['prefix']);
// Ask for db port.
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseport', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbport']);
$CFG->dboptions['dbport'] = (int) cli_input($prompt, $options['dbport']);
} else {
$CFG->prefix = $options['prefix'];
}
// ask for db port
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseport', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbport']);
$CFG->dboptions['dbport'] = (int)cli_input($prompt, $options['dbport']);
} else {
$CFG->dboptions['dbport'] = (int)$options['dbport'];
}
if ($CFG->dboptions['dbport'] <= 0) {
$CFG->dboptions['dbport'] = '';
}
// ask for db socket
if ($CFG->ostype === 'WINDOWS') {
$CFG->dboptions['dbsocket'] = '';
} else if ($interactive and empty($CFG->dboptions['dbport'])) {
cli_separator();
cli_heading(get_string('databasesocket', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbsocket']);
$CFG->dboptions['dbsocket'] = cli_input($prompt, $options['dbsocket']);
} else {
$CFG->dboptions['dbsocket'] = $options['dbsocket'];
}
// ask for db user
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseuser', 'install'));
if ($options['dbuser'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbuser']);
} else {
$CFG->dboptions['dbport'] = (int) $options['dbport'];
}
if ($CFG->dboptions['dbport'] <= 0) {
$CFG->dboptions['dbport'] = '';
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbuser = cli_input($prompt, $options['dbuser']);
// Ask for db socket.
if ($CFG->ostype === 'WINDOWS') {
$CFG->dboptions['dbsocket'] = '';
} else if ($interactive and empty($CFG->dboptions['dbport'])) {
cli_separator();
cli_heading(get_string('databasesocket', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbsocket']);
$CFG->dboptions['dbsocket'] = cli_input($prompt, $options['dbsocket']);
} else {
$CFG->dboptions['dbsocket'] = $options['dbsocket'];
}
// Ask for db user.
if ($interactive) {
cli_separator();
cli_heading(get_string('databaseuser', 'install'));
if ($options['dbuser'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
$CFG->dbuser = cli_input($prompt, $options['dbuser']);
} else {
$CFG->dbuser = $options['dbuser'];
}
// Ask for db password.
if ($interactive) {
cli_separator();
cli_heading(get_string('databasepass', 'install'));
} else {
$CFG->dbuser = $options['dbuser'];
}
// ask for db password
if ($interactive) {
cli_separator();
cli_heading(get_string('databasepass', 'install'));
do {
if ($options['dbpass'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['dbpass']);
} else {
@@ -621,118 +615,110 @@ do {
}
$CFG->dbpass = cli_input($prompt, $options['dbpass']);
if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation.
$distro = distro_pre_create_db($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix,
array('dbpersist' => 0, 'dbport' => $CFG->dboptions['dbport'], 'dbsocket' => $CFG->dboptions['dbsocket']),
$distro);
if (function_exists('distro_pre_create_db')) { // Hook for distros needing to do something before DB creation
$distro = distro_pre_create_db($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbport'=>$CFG->dboptions['dbport'], 'dbsocket'=>$CFG->dboptions['dbsocket']), $distro);
}
$hintdatabase = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix,
array('dbpersist' => 0, 'dbport' => $CFG->dboptions['dbport'], 'dbsocket' => $CFG->dboptions['dbsocket']));
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbport'=>$CFG->dboptions['dbport'], 'dbsocket'=>$CFG->dboptions['dbsocket']));
} while ($hint_database !== '');
} else {
$CFG->dbpass = $options['dbpass'];
$hintdatabase = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix,
array('dbpersist' => 0, 'dbport' => $CFG->dboptions['dbport'], 'dbsocket' => $CFG->dboptions['dbsocket']));
if ($hintdatabase !== '') {
cli_error(get_string('dbconnectionerror', 'install'));
}
} else {
$CFG->dbpass = $options['dbpass'];
$hint_database = install_db_validate($database, $CFG->dbhost, $CFG->dbuser, $CFG->dbpass, $CFG->dbname, $CFG->prefix, array('dbpersist'=>0, 'dbport'=>$CFG->dboptions['dbport'], 'dbsocket'=>$CFG->dboptions['dbsocket']));
if ($hint_database !== '') {
cli_error(get_string('dbconnectionerror', 'install'));
}
} while ($hintdatabase !== '');
}
// If --skip-database option is provided, we do not need to ask for site fullname, shortname, adminuser, adminpass, adminemail.
// These fields will be requested during the database install part.
if (!$skipdatabase) {
// Ask for fullname.
if ($interactive) {
cli_separator();
cli_heading(get_string('fullsitename', 'moodle'));
// ask for fullname
if ($interactive) {
cli_separator();
cli_heading(get_string('fullsitename', 'moodle'));
if ($options['fullname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['fullname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['fullname'] = cli_input($prompt, $options['fullname']);
} while (empty($options['fullname']));
if ($options['fullname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['fullname']);
} else {
if (empty($options['fullname'])) {
$a = (object)['option' => 'fullname', 'value' => $options['fullname']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for shortname.
if ($interactive) {
cli_separator();
cli_heading(get_string('shortsitename', 'moodle'));
if ($options['shortname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['shortname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['shortname'] = cli_input($prompt, $options['shortname']);
} while (empty($options['shortname']));
} else {
if (empty($options['shortname'])) {
$a = (object)['option' => 'shortname', 'value' => $options['shortname']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for admin user name.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminusername', 'install'));
if (!empty($options['adminuser'])) {
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['adminuser'] = cli_input($prompt, $options['adminuser']);
} while (empty($options['adminuser']) or $options['adminuser'] === 'guest');
} else {
if ((empty($options['adminuser']) || $options['adminuser'] === 'guest')) {
$a = (object)['option' => 'adminuser', 'value' => $options['adminuser']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for admin user password.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminpassword', 'install'));
$prompt = get_string('clitypevalue', 'admin');
do {
$options['adminpass'] = cli_input($prompt);
} while (empty($options['adminpass']) or $options['adminpass'] === 'admin');
} else {
if ((empty($options['adminpass']) or $options['adminpass'] === 'admin')) {
$a = (object)['option' => 'adminpass', 'value' => $options['adminpass']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for the admin email address.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminemail', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminemail']);
$options['adminemail'] = cli_input($prompt, $options['adminemail']);
}
// Validate that the address provided was an e-mail address.
if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
$a = (object)['option' => 'adminemail', 'value' => $options['adminemail']];
do {
$options['fullname'] = cli_input($prompt, $options['fullname']);
} while (empty($options['fullname']));
} else {
if (empty($options['fullname'])) {
$a = (object)array('option'=>'fullname', 'value'=>$options['fullname']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// ask for shortname
if ($interactive) {
cli_separator();
cli_heading(get_string('shortsitename', 'moodle'));
if ($options['shortname'] !== '') {
$prompt = get_string('clitypevaluedefault', 'admin', $options['shortname']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['shortname'] = cli_input($prompt, $options['shortname']);
} while (empty($options['shortname']));
} else {
if (empty($options['shortname'])) {
$a = (object)array('option'=>'shortname', 'value'=>$options['shortname']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// ask for admin user name
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminusername', 'install'));
if (!empty($options['adminuser'])) {
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminuser']);
} else {
$prompt = get_string('clitypevalue', 'admin');
}
do {
$options['adminuser'] = cli_input($prompt, $options['adminuser']);
} while (empty($options['adminuser']) or $options['adminuser'] === 'guest');
} else {
if (empty($options['adminuser']) or $options['adminuser'] === 'guest') {
$a = (object)array('option'=>'adminuser', 'value'=>$options['adminuser']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// ask for admin user password
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminpassword', 'install'));
$prompt = get_string('clitypevalue', 'admin');
do {
$options['adminpass'] = cli_input($prompt);
} while (empty($options['adminpass']) or $options['adminpass'] === 'admin');
} else {
if (empty($options['adminpass']) or $options['adminpass'] === 'admin') {
$a = (object)array('option'=>'adminpass', 'value'=>$options['adminpass']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
}
// Ask for the admin email address.
if ($interactive) {
cli_separator();
cli_heading(get_string('cliadminemail', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['adminemail']);
$options['adminemail'] = cli_input($prompt);
}
// Validate that the address provided was an e-mail address.
if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
$a = (object) array('option' => 'adminemail', 'value' => $options['adminemail']);
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
// Ask for the upgrade key.
if ($interactive) {
cli_separator();
@@ -751,27 +737,23 @@ if ($options['upgradekey'] !== '') {
$CFG->upgradekey = $options['upgradekey'];
}
// The user does not also need to pass agree-license when --skip-database is provided as the user will need to accept
// the license again in the database install part.
if (!$skipdatabase) {
if ($interactive) {
if (!$options['agree-license']) {
cli_separator();
cli_heading(get_string('copyrightnotice'));
echo "Moodle - Modular Object-Oriented Dynamic Learning Environment\n";
echo get_string('gpl3')."\n\n";
echo get_string('doyouagree')."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
} else {
if (!$options['agree-license'] && !$skipdatabase) {
cli_error(get_string('climustagreelicense', 'install'));
if ($interactive) {
if (!$options['agree-license']) {
cli_separator();
cli_heading(get_string('copyrightnotice'));
echo "Moodle - Modular Object-Oriented Dynamic Learning Environment\n";
echo get_string('gpl3')."\n\n";
echo get_string('doyouagree')."\n";
$prompt = get_string('cliyesnoprompt', 'admin');
$input = cli_input($prompt, '', array(get_string('clianswerno', 'admin'), get_string('cliansweryes', 'admin')));
if ($input == get_string('clianswerno', 'admin')) {
exit(1);
}
}
} else {
if (!$options['agree-license']) {
cli_error(get_string('climustagreelicense', 'install'));
}
}
// Finally we have all info needed for config.php
@@ -819,7 +801,7 @@ if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
cli_error(get_string('pluginschecktodo', 'admin'));
}
if (!$skipdatabase) {
if (!$options['skip-database']) {
install_cli_database($options, $interactive);
// This needs to happen at the end to ensure it occurs after all caches
// have been purged for the last time.
+8 -8
View File
@@ -119,7 +119,7 @@ if (!empty($options['collation'])) {
if ($dbcollation->value !== $collation || $dbcharset->value !== $charset) {
// Try to convert the DB.
echo "Converting database to '$collation' for $CFG->wwwroot:\n";
$sql = "ALTER DATABASE `$CFG->dbname` DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
$sql = "ALTER DATABASE $CFG->dbname DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation";
try {
$DB->change_database_structure($sql);
} catch (exception $e) {
@@ -146,7 +146,7 @@ if (!empty($options['collation'])) {
} else {
try {
$DB->change_database_structure("ALTER TABLE `$table->name` CONVERT TO CHARACTER SET $charset COLLATE $collation");
$DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation");
echo "CONVERTED\n";
$converted++;
} catch (ddl_exception $e) {
@@ -163,7 +163,7 @@ if (!empty($options['collation'])) {
}
}
$sql = "SHOW FULL COLUMNS FROM `$table->name` WHERE collation IS NOT NULL";
$sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL";
$rs2 = $DB->get_recordset_sql($sql);
foreach ($rs2 as $column) {
$column = (object)array_change_key_case((array)$column, CASE_LOWER);
@@ -181,7 +181,7 @@ if (!empty($options['collation'])) {
$notnull = ($column->null === 'NO') ? 'NOT NULL' : 'NULL';
$default = (!is_null($column->default) and $column->default !== '') ? "DEFAULT '$column->default'" : '';
// primary, unique and inc are not supported for texts
$sql = "ALTER TABLE `$table->name`
$sql = "ALTER TABLE $table->name
MODIFY COLUMN $column->field $column->type
CHARACTER SET $charset
COLLATE $collation $notnull $default";
@@ -192,11 +192,11 @@ if (!empty($options['collation'])) {
$default = !is_null($column->default) ? "DEFAULT '$column->default'" : '';
if ($rowformat != '') {
$sql = "ALTER TABLE `$table->name` $rowformat";
$sql = "ALTER TABLE $table->name $rowformat";
$DB->change_database_structure($sql);
}
$sql = "ALTER TABLE `$table->name`
$sql = "ALTER TABLE $table->name
MODIFY COLUMN $column->field $column->type
CHARACTER SET $charset
COLLATE $collation $notnull $default";
@@ -315,8 +315,8 @@ function mysql_set_row_format($tablename, $charset, $collation, $engine) {
if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') {
$rowformat = $DB->get_row_format_sql($engine, $collation);
// Try to convert to compressed format and then try updating the collation again.
$DB->change_database_structure("ALTER TABLE `$tablename` $rowformat");
$DB->change_database_structure("ALTER TABLE `$tablename` CONVERT TO CHARACTER SET $charset COLLATE $collation");
$DB->change_database_structure("ALTER TABLE $tablename $rowformat");
$DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation");
} else {
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
return false;
+2 -2
View File
@@ -158,7 +158,7 @@ if (!empty($options['info'])) {
}
foreach ($fixtables as $table) {
$DB->change_database_structure("ALTER TABLE `{$prefix}$table` ROW_FORMAT=Compressed");
$DB->change_database_structure("ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed");
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT) . " ... Compressed\n";
}
@@ -189,7 +189,7 @@ if (!empty($options['info'])) {
echo "SET GLOBAL innodb_file_per_table=1;\n";
echo "SET GLOBAL innodb_file_format=Barracuda;\n";
foreach ($fixtables as $table) {
echo "ALTER TABLE `{$prefix}$table` ROW_FORMAT=Compressed;\n";
echo "ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed;\n";
}
echo "\n";
exit(0);
+1 -1
View File
@@ -94,7 +94,7 @@ if ($options['password'] == '' ) {
$errmsg = '';//prevent eclipse warning
if (!$options['ignore-password-policy'] ) {
if (!check_password_policy($password, $errmsg, $user)) {
if (!check_password_policy($password, $errmsg)) {
cli_error(html_to_text($errmsg, 0));
}
}
-151
View File
@@ -1,151 +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/>.
/**
* CLI task execution.
*
* @package core
* @subpackage cli
* @copyright 2014 Petr Skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once("$CFG->libdir/clilib.php");
require_once("$CFG->libdir/cronlib.php");
list($options, $unrecognized) = cli_get_params(
array('help' => false, 'list' => false, 'execute' => false, 'showsql' => false, 'showdebugging' => false),
array('h' => 'help')
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] or (!$options['list'] and !$options['execute'])) {
$help =
"Scheduled cron tasks.
Options:
--execute=\\some\\task Execute scheduled task manually
--list List all scheduled tasks
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/scheduled_task.php --execute=\\core\\task\\session_cleanup_task
";
echo $help;
die;
}
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
$DB->set_debug(true);
}
if ($options['list']) {
cli_heading("List of scheduled tasks ($CFG->wwwroot)");
$shorttime = get_string('strftimedatetimeshort');
$tasks = \core\task\manager::get_all_scheduled_tasks();
echo str_pad(get_string('scheduledtasks', 'tool_task'), 50, ' ') . ' ' . str_pad(get_string('runpattern', 'tool_task'), 17, ' ')
. ' ' . str_pad(get_string('lastruntime', 'tool_task'), 40, ' ') . get_string('nextruntime', 'tool_task') . "\n";
foreach ($tasks as $task) {
$class = '\\' . get_class($task);
$schedule = $task->get_minute() . ' '
. $task->get_hour() . ' '
. $task->get_day() . ' '
. $task->get_day_of_week() . ' '
. $task->get_month() . ' '
. $task->get_day_of_week();
$nextrun = $task->get_next_run_time();
$lastrun = $task->get_last_run_time();
$plugininfo = core_plugin_manager::instance()->get_plugin_info($task->get_component());
$plugindisabled = $plugininfo && $plugininfo->is_enabled() === false && !$task->get_run_if_component_disabled();
if ($plugindisabled) {
$nextrun = get_string('plugindisabled', 'tool_task');
} else if ($task->get_disabled()) {
$nextrun = get_string('taskdisabled', 'tool_task');
} else if ($nextrun > time()) {
$nextrun = userdate($nextrun);
} else {
$nextrun = get_string('asap', 'tool_task');
}
if ($lastrun) {
$lastrun = userdate($lastrun);
} else {
$lastrun = get_string('never');
}
echo str_pad($class, 50, ' ') . ' ' . str_pad($schedule, 17, ' ') .
' ' . str_pad($lastrun, 40, ' ') . ' ' . $nextrun . "\n";
}
exit(0);
}
if ($execute = $options['execute']) {
if (!$task = \core\task\manager::get_scheduled_task($execute)) {
mtrace("Task '$execute' not found");
exit(1);
}
if (moodle_needs_upgrading()) {
mtrace("Moodle upgrade pending, cannot execute tasks.");
exit(1);
}
// Increase memory limit.
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
cron_setup_user();
// Execute the task.
\core\local\cli\shutdown::script_supports_graceful_exit();
$cronlockfactory = \core\lock\lock_config::get_lock_factory('cron');
if (!$cronlock = $cronlockfactory->get_lock('core_cron', 10)) {
mtrace('Cannot obtain cron lock');
exit(129);
}
if (!$lock = $cronlockfactory->get_lock('\\' . get_class($task), 10)) {
$cronlock->release();
mtrace('Cannot obtain task lock');
exit(130);
}
$task->set_lock($lock);
if (!$task->is_blocking()) {
$cronlock->release();
} else {
$task->set_cron_lock($cronlock);
}
cron_run_inner_scheduled_task($task);
}
-171
View File
@@ -1,171 +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/>.
/**
* CLI script to uninstall plugins.
*
* @package core
* @subpackage cli
* @copyright 2018 Dmitrii Metelkin <dmitriim@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require_once($CFG->libdir . '/adminlib.php');
$help = "Command line tool to uninstall plugins.
Options:
-h --help Print this help.
--show-all Displays a list of all installed plugins.
--show-contrib Displays a list of all third-party installed plugins.
--show-missing Displays a list of plugins missing from disk.
--purge-missing Uninstall all missing from disk plugins.
--plugins=<plugin name> A comma separated list of plugins to be uninstalled. E.g. mod_assign,mod_forum
--run Execute uninstall. If this option is not set, then the script will be run in a dry mode.
Examples:
# php uninstall_plugins.php --show-all
Prints tab-separated list of all installed plugins.
# php uninstall_plugins.php --show-contrib
Prints tab-separated list of all third-party installed plugins.
# php uninstall_plugins.php --show-missing
Prints tab-separated list of all missing from disk plugins.
# php uninstall_plugins.php --purge-missing
A dry run of uninstalling all missing plugins.
# php uninstall_plugins.php --purge-missing --run
Run uninstall of all missing plugins.
# php uninstall_plugins.php --plugins=mod_assign,mod_forum
A dry run of uninstalling mod_assign and mod_forum plugins.
# php uninstall_plugins.php --plugins=mod_assign,mod_forum --run
Run uninstall for mod_assign and mod_forum plugins.
";
list($options, $unrecognised) = cli_get_params([
'help' => false,
'show-all' => false,
'show-contrib' => false,
'show-missing' => false,
'purge-missing' => false,
'plugins' => false,
'run' => false,
], [
'h' => 'help'
]);
if ($unrecognised) {
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
}
if ($options['help']) {
cli_writeln($help);
exit(0);
}
$pluginman = core_plugin_manager::instance();
$plugininfo = $pluginman->get_plugins();
if ($options['show-all'] || $options['show-missing'] || $options['show-contrib']) {
foreach ($plugininfo as $type => $plugins) {
foreach ($plugins as $name => $plugin) {
if ($options['show-contrib'] && $plugin->is_standard()) {
continue;
}
$pluginstring = $plugin->component . "\t" . $plugin->displayname;
if ($options['show-all'] || $options['show-contrib']) {
cli_writeln($pluginstring);
} else {
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
cli_writeln($pluginstring);
}
}
}
}
exit(0);
}
if ($options['purge-missing']) {
foreach ($plugininfo as $type => $plugins) {
foreach ($plugins as $name => $plugin) {
if ($plugin->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
$pluginstring = $plugin->component . "\t" . $plugin->displayname;
if ($pluginman->can_uninstall_plugin($plugin->component)) {
if ($options['run']) {
cli_writeln('Uninstalling: ' . $pluginstring);
$progress = new progress_trace_buffer(new text_progress_trace(), true);
$pluginman->uninstall_plugin($plugin->component, $progress);
$progress->finished();
cli_write($progress->get_buffer());
} else {
cli_writeln('Will be uninstalled: ' . $pluginstring);
}
} else {
cli_writeln('Can not be uninstalled: ' . $pluginstring);
}
}
}
}
exit(0);
}
if ($options['plugins']) {
$components = explode(',', $options['plugins']);
foreach ($components as $component) {
$plugin = $pluginman->get_plugin_info($component);
if (is_null($plugin)) {
cli_writeln('Unknown plugin: ' . $component);
} else {
$pluginstring = $plugin->component . "\t" . $plugin->displayname;
if ($pluginman->can_uninstall_plugin($plugin->component)) {
if ($options['run']) {
cli_writeln('Uninstalling: ' . $pluginstring);
$progress = new progress_trace_buffer(new text_progress_trace(), true);
$pluginman->uninstall_plugin($plugin->component, $progress);
$progress->finished();
cli_write($progress->get_buffer());
} else {
cli_writeln('Will be uninstalled: ' . $pluginstring);
}
} else {
cli_writeln('Can not be uninstalled: ' . $pluginstring);
}
}
}
exit(0);
}
cli_writeln($help);
exit(0);
+2 -9
View File
@@ -52,8 +52,7 @@ list($options, $unrecognized) = cli_get_params(
'allow-unstable' => false,
'help' => false,
'lang' => $lang,
'verbose-settings' => false,
'is-pending' => false,
'verbose-settings' => false
),
array(
'h' => 'help'
@@ -89,8 +88,6 @@ Options:
--verbose-settings Show new settings values. By default only the name of
new core or plugin settings are displayed. This option
outputs the new values as well as the setting name.
--is-pending If an upgrade is needed it exits with an error code of
2 so it distinct from other types of errors.
-h, --help Print out this help
Example:
@@ -119,10 +116,6 @@ if (!moodle_needs_upgrading()) {
cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
}
if ($options['is-pending']) {
cli_error(get_string('cliupgradepending', 'core_admin'), 2);
}
// Test environment first.
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
if (!$envstatus) {
@@ -137,7 +130,7 @@ if (!$envstatus) {
// Test plugin dependencies.
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) {
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
cli_problem(get_string('pluginscheckfailed', 'admin', array('pluginslist' => implode(', ', array_unique($failed)))));
cli_error(get_string('pluginschecktodo', 'admin'));
}
-84
View File
@@ -1,84 +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/>.
/**
* Content bank and its plugins settings.
*
* @package core
* @subpackage contentbank
* @copyright 2020 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$name = required_param('name', PARAM_PLUGIN);
$syscontext = context_system::instance();
$PAGE->set_url('/admin/contentbank.php');
$PAGE->set_context($syscontext);
require_admin();
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'managecontentbanktypes'));
$plugins = core_plugin_manager::instance()->get_plugins_of_type('contenttype');
$sortorder = array_flip(array_keys($plugins));
if (!isset($plugins[$name])) {
print_error('contenttypenotfound', 'error', $return, $name);
}
switch ($action) {
case 'disable':
if ($plugins[$name]->is_enabled()) {
set_config('disabled', 1, 'contentbank_'. $name);
}
break;
case 'enable':
if (!$plugins[$name]->is_enabled()) {
unset_config('disabled', 'contentbank_'. $name);
}
break;
case 'up':
if ($sortorder[$name]) {
$currentindex = $sortorder[$name];
$seq = array_keys($plugins);
$seq[$currentindex] = $seq[$currentindex - 1];
$seq[$currentindex - 1] = $name;
set_config('contentbank_plugins_sortorder', implode(',', $seq));
}
break;
case 'down':
if ($sortorder[$name] < count($sortorder) - 1) {
$currentindex = $sortorder[$name];
$seq = array_keys($plugins);
$seq[$currentindex] = $seq[$currentindex + 1];
$seq[$currentindex + 1] = $name;
set_config('contentbank_plugins_sortorder', implode(',', $seq));
}
break;
}
core_plugin_manager::reset_caches();
$cache = cache::make('core', 'contentbank_enabled_extensions');
$cache->purge();
$cache = cache::make('core', 'contentbank_context_extensions');
$cache->purge();
redirect($return);
+2 -1
View File
@@ -32,7 +32,8 @@ $syscontext = context_system::instance();
$PAGE->set_url('/admin/courseformats.php');
$PAGE->set_context($syscontext);
require_admin();
require_login();
require_capability('moodle/site:config', $syscontext);
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'manageformats'));
-61
View File
@@ -1,61 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Allows the admin to enable, disable and uninstall custom fields
*
* @package core_admin
* @copyright 2018 Daniel Neis Araujo
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$customfieldname = required_param('field', PARAM_PLUGIN);
$syscontext = context_system::instance();
$PAGE->set_url('/admin/customfields.php');
$PAGE->set_context($syscontext);
require_admin();
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'managecustomfields'));
$customfieldplugins = core_plugin_manager::instance()->get_plugins_of_type('customfield');
$sortorder = array_flip(array_keys($customfieldplugins));
if (!isset($customfieldplugins[$customfieldname])) {
print_error('customfieldnotfound', 'error', $return, $customfieldname);
}
switch ($action) {
case 'disable':
if ($customfieldplugins[$customfieldname]->is_enabled()) {
set_config('disabled', 1, 'customfield_'. $customfieldname);
core_plugin_manager::reset_caches();
}
break;
case 'enable':
if (!$customfieldplugins[$customfieldname]->is_enabled()) {
unset_config('disabled', 'customfield_'. $customfieldname);
core_plugin_manager::reset_caches();
}
break;
}
redirect($return);
+2 -1
View File
@@ -33,7 +33,8 @@ $syscontext = context_system::instance();
$PAGE->set_url('/admin/dataformats.php');
$PAGE->set_context($syscontext);
require_admin();
require_login();
require_capability('moodle/site:config', $syscontext);
require_sesskey();
$return = new moodle_url('/admin/settings.php', array('section' => 'managedataformats'));
+2 -1
View File
@@ -15,7 +15,8 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/editors.php', array('action'=>$action, 'editor'=>$editor));
$PAGE->set_context(context_system::instance());
require_admin();
require_login();
require_capability('moodle/site:config', context_system::instance());
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageeditors";
+2 -1
View File
@@ -35,7 +35,8 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/enrol.php');
$PAGE->set_context(context_system::instance());
require_admin();
require_login();
require_capability('moodle/site:config', context_system::instance());
require_sesskey();
$enabled = enrol_get_plugins(true);
-927
View File
@@ -2451,7 +2451,6 @@
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.0.0" level="required">
<RESTRICT function="restrict_php_version_74" message="unsupportedphpversion74" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
@@ -2633,7 +2632,6 @@
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.1.0" level="required">
<RESTRICT function="restrict_php_version_74" message="unsupportedphpversion74" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
@@ -2801,929 +2799,4 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.8" requires="3.2">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="5.5.31" />
<VENDOR name="mysql" version="5.6" />
<VENDOR name="postgres" version="9.4" />
<VENDOR name="mssql" version="11.0" />
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.1.0" level="required">
<RESTRICT function="restrict_php_version_80" message="unsupportedphpversion80" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="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="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="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_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_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="optional">
<FEEDBACK>
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.9" requires="3.5">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.2.29" />
<VENDOR name="mysql" version="5.6" />
<VENDOR name="postgres" version="9.5" />
<VENDOR name="mssql" version="11.0" />
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.2.0" level="required">
<RESTRICT function="restrict_php_version_80" message="unsupportedphpversion80" />
</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="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="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_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_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="optional">
<FEEDBACK>
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_igbinary322_version" level="optional">
<FEEDBACK>
<ON_CHECK message="igbinary322buggyversion" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.10" requires="3.5">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.2.29" />
<VENDOR name="mysql" version="5.7" />
<VENDOR name="postgres" version="9.6" />
<VENDOR name="mssql" version="11.0" />
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.2.0" level="required">
<RESTRICT function="restrict_php_version_80" message="unsupportedphpversion80" />
</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="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="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_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_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="optional">
<FEEDBACK>
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_igbinary322_version" level="optional">
<FEEDBACK>
<ON_CHECK message="igbinary322buggyversion" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.11" requires="3.6">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.2.29" />
<VENDOR name="mysql" version="5.7" />
<VENDOR name="postgres" version="9.6" />
<VENDOR name="mssql" version="14.0" />
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.3.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="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="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="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_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="optional">
<FEEDBACK>
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="4.0" requires="3.6">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.2.29" />
<VENDOR name="mysql" version="5.7" />
<VENDOR name="postgres" version="10" />
<VENDOR name="mssql" version="14.0" />
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.3.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="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="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="optional"/>
<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_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="optional">
<FEEDBACK>
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+16 -45
View File
@@ -226,7 +226,7 @@ if (!core_tables_exist()) {
}
if (empty($confirmrelease)) {
require_once($CFG->libdir.'/environmentlib.php');
list($envstatus, $environmentresults) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
@@ -235,13 +235,13 @@ if (!core_tables_exist()) {
$PAGE->set_cacheable(false);
$output = $PAGE->get_renderer('core', 'admin');
echo $output->install_environment_page($maturity, $envstatus, $environmentresults, $release);
echo $output->install_environment_page($maturity, $envstatus, $environment_results, $release);
die();
}
// check plugin dependencies
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) {
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
$PAGE->navbar->add(get_string('pluginscheck', 'admin'));
$PAGE->set_title($strinstallation);
$PAGE->set_heading($strinstallation . ' - Moodle ' . $CFG->target_release);
@@ -358,9 +358,9 @@ if (!$cache and $version > $CFG->version) { // upgrade
echo $output->upgrade_confirm_page($a->newversion, $maturity, $testsite);
die();
} else if (empty($confirmrelease)) {
} else if (empty($confirmrelease)){
require_once($CFG->libdir.'/environmentlib.php');
list($envstatus, $environmentresults) = check_moodle_environment($release, ENV_SELECT_RELEASE);
list($envstatus, $environment_results) = check_moodle_environment($release, ENV_SELECT_RELEASE);
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
@@ -368,7 +368,7 @@ if (!$cache and $version > $CFG->version) { // upgrade
$PAGE->set_heading($strcurrentrelease);
$PAGE->set_cacheable(false);
echo $output->upgrade_environment_page($release, $envstatus, $environmentresults);
echo $output->upgrade_environment_page($release, $envstatus, $environment_results);
die();
} else if (empty($confirmplugins)) {
@@ -508,9 +508,8 @@ if (!$cache and $version > $CFG->version) { // upgrade
} else {
// Always verify plugin dependencies!
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) {
echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url,
array('confirmplugincheck' => 0)));
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
die();
}
unset($failed);
@@ -534,10 +533,7 @@ if (!$cache and $branch <> $CFG->branch) { // Update the branch
if (!$cache and moodle_needs_upgrading()) {
$PAGE->set_url(new moodle_url($PAGE->url, array(
'confirmrelease' => $confirmrelease,
'confirmplugincheck' => $confirmplugins,
)));
$PAGE->set_url(new moodle_url($PAGE->url, array('confirmplugincheck' => $confirmplugins)));
check_upgrade_key($upgradekeyhash);
@@ -547,21 +543,7 @@ if (!$cache and moodle_needs_upgrading()) {
$pluginman = core_plugin_manager::instance();
$output = $PAGE->get_renderer('core', 'admin');
if (empty($confirmrelease)) {
require_once($CFG->libdir . '/environmentlib.php');
list($envstatus, $environmentresults) = check_moodle_environment($release, ENV_SELECT_RELEASE);
$strcurrentrelease = get_string('currentrelease');
$PAGE->navbar->add($strcurrentrelease);
$PAGE->set_title($strcurrentrelease);
$PAGE->set_heading($strcurrentrelease);
$PAGE->set_cacheable(false);
echo $output->upgrade_environment_page($release, $envstatus, $environmentresults);
die();
} else if (!$confirmplugins) {
if (!$confirmplugins) {
$strplugincheck = get_string('plugincheck');
$PAGE->navbar->add($strplugincheck);
@@ -700,10 +682,9 @@ if (!$cache and moodle_needs_upgrading()) {
// Make sure plugin dependencies are always checked.
$failed = array();
if (!$pluginman->all_plugins_ok($version, $failed, $CFG->branch)) {
if (!$pluginman->all_plugins_ok($version, $failed)) {
$output = $PAGE->get_renderer('core', 'admin');
echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url,
array('confirmplugincheck' => 0)));
echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
die();
}
unset($failed);
@@ -821,7 +802,7 @@ $SESSION->admin_critical_warning = ($insecuredataroot==INSECURE_DATAROOT_ERROR);
$adminroot = admin_get_root();
// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)) {
if (any_new_admin_settings($adminroot)){
redirect('upgradesettings.php');
}
@@ -842,12 +823,9 @@ if (isset($SESSION->pluginuninstallreturn)) {
// Print default admin page with notifications.
$errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED');
$lastcron = get_config('tool_task', 'lastcronstart');
// We make the assumption that at least one schedule task should run once per day.
$lastcron = $DB->get_field_sql('SELECT MAX(lastruntime) FROM {task_scheduled}');
$cronoverdue = ($lastcron < time() - 3600 * 24);
$lastcroninterval = get_config('tool_task', 'lastcroninterval');
$expectedfrequency = $CFG->expectedcronfrequency ?? MINSECS;
$croninfrequent = !$cronoverdue && ($lastcroninterval > ($expectedfrequency + MINSECS) || $lastcron < time() - $expectedfrequency);
$dbproblems = $DB->diagnose();
$maintenancemode = !empty($CFG->maintenance_enabled);
@@ -901,12 +879,6 @@ if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || i
// Check if the site is being foced onto ssl.
$overridetossl = !empty($CFG->overridetossl);
// Check if moodle campaign content setting is enabled or not.
$showcampaigncontent = !isset($CFG->showcampaigncontent) || $CFG->showcampaigncontent;
// Encourage admins to enable the user feedback feature if it is not enabled already.
$showfeedbackencouragement = empty($CFG->enableuserfeedback);
admin_externalpage_setup('adminnotifications');
$output = $PAGE->get_renderer('core', 'admin');
@@ -914,5 +886,4 @@ $output = $PAGE->get_renderer('core', 'admin');
echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
$maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
$registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir,
$mobileconfigured, $overridetossl, $invalidforgottenpasswordurl, $croninfrequent,
$showcampaigncontent, $showfeedbackencouragement);
$mobileconfigured, $overridetossl, $invalidforgottenpasswordurl);
+57
View File
@@ -0,0 +1,57 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Allows admin to configure licenses.
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/licenselib.php');
require_login();
require_capability('moodle/site:config', context_system::instance());
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=managelicenses";
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$license = optional_param('license', '', PARAM_SAFEDIR);
////////////////////////////////////////////////////////////////////////////////
// process actions
if (!confirm_sesskey()) {
redirect($returnurl);
}
$return = true;
switch ($action) {
case 'disable':
license_manager::disable($license);
break;
case 'enable':
license_manager::enable($license);
break;
default:
break;
}
if ($return) {
redirect ($returnurl);
}
+2 -1
View File
@@ -35,7 +35,8 @@ $confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/media.php');
$PAGE->set_context(context_system::instance());
require_admin();
require_login();
require_capability('moodle/site:config', context_system::instance());
require_sesskey();
$plugins = core_plugin_manager::instance()->get_plugins_of_type('media');
+27 -101
View File
@@ -25,121 +25,47 @@ require_once(__DIR__ . '/../config.php');
require_once($CFG->dirroot . '/message/lib.php');
require_once($CFG->libdir.'/adminlib.php');
// This is an admin page.
// This is an admin page
admin_externalpage_setup('managemessageoutputs');
// Fetch processors.
$allprocessors = get_message_processors();
$processors = array_filter($allprocessors, function($processor) {
return $processor->enabled;
});
$disabledprocessors = array_filter($allprocessors, function($processor) {
return !$processor->enabled;
});
// Get the submitted params
$disable = optional_param('disable', 0, PARAM_INT);
$enable = optional_param('enable', 0, PARAM_INT);
// Fetch message providers.
$providers = get_message_providers();
// Fetch the manage message outputs interface.
$preferences = get_message_output_default_preferences();
$headingtitle = get_string('managemessageoutputs', 'message');
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';
$providerdisabled = false;
if (!isset($form->$disableprovidersetting)) {
$providerdisabled = true;
$newpreferences[$disableprovidersetting] = 1;
} else {
$newpreferences[$disableprovidersetting] = 0;
}
foreach (array('permitted', 'loggedin', 'loggedoff') as $setting) {
$value = null;
$componentprovidersetting = $componentproviderbase.'_'.$setting;
if ($setting == 'permitted') {
// If we deal with permitted select element, we need to create individual
// setting for each possible processor. Note that this block will
// always be processed first after entring parental foreach iteration
// so we can change form values on this stage.
foreach ($processors as $processor) {
$value = '';
if (isset($form->{$componentprovidersetting}[$processor->name])) {
$value = $form->{$componentprovidersetting}[$processor->name];
}
// Ensure that loggedin loggedoff options are set correctly for this permission.
if (($value == 'disallowed') || $providerdisabled) {
// It might be better to unset them, but I can't figure out why that cause error.
$form->{$componentproviderbase.'_loggedin'}[$processor->name] = 0;
$form->{$componentproviderbase.'_loggedoff'}[$processor->name] = 0;
} else if ($value == 'forced') {
$form->{$componentproviderbase.'_loggedin'}[$processor->name] = 1;
$form->{$componentproviderbase.'_loggedoff'}[$processor->name] = 1;
}
// Record the site preference.
$newpreferences[$processor->name.'_provider_'.$componentprovidersetting] = $value;
}
} else {
$newsettings = array();
if (property_exists($form, $componentprovidersetting)) {
// We must be processing loggedin or loggedoff checkboxes.
// Store defained 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;
}
}
if ($setting != 'permitted') {
// We have already recoded site preferences for 'permitted' type.
$newpreferences['message_provider_'.$componentprovidersetting] = $value;
}
}
if (!empty($disable) && confirm_sesskey()) {
if (!$processor = $DB->get_record('message_processors', array('id'=>$disable))) {
print_error('outputdoesnotexist', 'message');
}
// Update database.
$transaction = $DB->start_delegated_transaction();
// Save processors enabled/disabled status.
foreach ($allprocessors as $processor) {
$enabled = isset($form->{$processor->name});
\core_message\api::update_processor_status($processor, $enabled);
}
foreach ($newpreferences as $name => $value) {
set_config($name, $value, 'message');
}
$transaction->allow_commit();
\core_message\api::update_processor_status($processor, 0); // Disable output.
core_plugin_manager::reset_caches();
}
if (!empty($enable) && confirm_sesskey()) {
if (!$processor = $DB->get_record('message_processors', array('id'=>$enable))) {
print_error('outputdoesnotexist', 'message');
}
\core_message\api::update_processor_status($processor, 1); // Enable output.
core_plugin_manager::reset_caches();
}
if ($disable || $enable) {
$url = new moodle_url('message.php');
redirect($url);
}
// Page settings
$PAGE->set_context(context_system::instance());
$PAGE->requires->js_init_call('M.core_message.init_defaultoutputs');
// Grab the renderer
$renderer = $PAGE->get_renderer('core', 'message');
// Display the page.
// Display the manage message outputs interface
$processors = get_message_processors();
$messageoutputs = $renderer->manage_messageoutputs($processors);
// Display the page
echo $OUTPUT->header();
echo $renderer->manage_messageoutput_settings($allprocessors, $processors, $providers, $preferences);
echo $OUTPUT->heading($headingtitle);
echo $messageoutputs;
echo $OUTPUT->footer();
+3
View File
@@ -34,6 +34,9 @@ $step = optional_param('step', 'verify', PARAM_ALPHA);
$hostid = required_param('hostid', PARAM_INT);
$context = context_system::instance();
$mnet = get_mnet_environment();
$PAGE->set_url('/admin/mnet/delete.php');
+1 -1
View File
@@ -156,7 +156,7 @@ class mnet_review_host_form extends moodleform {
if ($mnet_peer && !empty($mnet_peer->deleted)) {
$radioarray = array();
$radioarray[] = $mform->createElement('static', 'deletedinfo', '',
$OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'alert alert-warning'));
$OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'deletedhostinfo'));
$radioarray[] = $mform->createElement('radio', 'deleted', '', get_string('yes'), 1);
$radioarray[] = $mform->createElement('radio', 'deleted', '', get_string('no'), 0);
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false);
+2 -4
View File
@@ -49,7 +49,6 @@
array($module->id));
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
redirect(new moodle_url('/admin/modules.php'));
}
if (!empty($show) and confirm_sesskey()) {
@@ -67,7 +66,6 @@
array($module->id));
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
redirect(new moodle_url('/admin/modules.php'));
}
echo $OUTPUT->header();
@@ -123,8 +121,8 @@
$count = -1;
}
if ($count>0) {
$countlink = $OUTPUT->action_link(new moodle_url('/course/search.php', ['modulelist' => $module->name]),
$count, null, ['title' => $strshowmodulecourse]);
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
"&amp;sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
} else if ($count < 0) {
$countlink = get_string('error');
} else {
+3 -2
View File
@@ -43,8 +43,9 @@ $confirminstallupdate = optional_param('confirminstallupdate', false, PARAM_BOOL
// NOTE: do not use admin_externalpage_setup() here because it loads
// full admin tree which is not possible during uninstallation.
require_admin();
require_login();
$syscontext = context_system::instance();
require_capability('moodle/site:config', $syscontext);
// URL params we want to maintain on redirects.
$pageparams = array('updatesonly' => $updatesonly, 'contribonly' => $contribonly);
@@ -53,6 +54,7 @@ $pageurl = new moodle_url('/admin/plugins.php', $pageparams);
$pluginman = core_plugin_manager::instance();
if ($uninstall) {
require_sesskey();
if (!$confirmed) {
admin_externalpage_setup('pluginsoverview', '', $pageparams);
@@ -91,7 +93,6 @@ if ($uninstall) {
exit();
} else {
require_sesskey();
$SESSION->pluginuninstallreturn = $pluginfo->get_return_url_after_uninstall($return);
$progress = new progress_trace_buffer(new text_progress_trace(), false);
$pluginman->uninstall_plugin($pluginfo->component, $progress);
+2 -2
View File
@@ -31,7 +31,7 @@ require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/tablelib.php');
// Check permissions.
require_login(null, false);
require_login();
$systemcontext = context_system::instance();
require_capability('moodle/question:config', $systemcontext);
@@ -170,7 +170,7 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
if ($version) {
$row[] = $version;
} else {
$row[] = html_writer::tag('span', get_string('nodatabase', 'admin'), array('class' => 'text-muted'));
$row[] = html_writer::tag('span', get_string('nodatabase', 'admin'), array('class' => 'disabled'));
}
// Other question types required by this one.
+3 -3
View File
@@ -30,12 +30,12 @@ require_once($CFG->libdir . '/questionlib.php');
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/tablelib.php');
admin_externalpage_setup('manageqtypes');
// Check permissions.
$systemcontext = context_system::instance();
require_capability('moodle/question:config', $systemcontext);
$canviewreports = has_capability('report/questioninstances:view', $systemcontext);
admin_externalpage_setup('manageqtypes');
$thispageurl = new moodle_url('/admin/qtypes.php');
$qtypes = question_bank::get_all_qtypes();
@@ -172,7 +172,7 @@ foreach ($sortedqtypes as $qtypename => $localname) {
if ($version) {
$row[] = $version;
} else {
$row[] = html_writer::tag('span', get_string('nodatabase', 'admin'), array('class' => 'text-muted'));
$row[] = html_writer::tag('span', get_string('nodatabase', 'admin'), array('class' => 'disabled'));
}
// Other question types required by this one.
+2 -2
View File
@@ -45,8 +45,8 @@ $error = optional_param('error', '', PARAM_ALPHANUM);
admin_externalpage_setup('registrationmoodleorg');
if (parse_url($url, PHP_URL_HOST) !== parse_url(HUB_MOODLEORGHUBURL, PHP_URL_HOST)) {
// Allow other plugins to confirm registration on custom hubs. Plugins implementing this
if ($url !== HUB_MOODLEORGHUBURL) {
// Allow other plugins to confirm registration on hubs other than moodle.net . Plugins implementing this
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
$callbacks = get_plugins_with_function('hub_registration');
foreach ($callbacks as $plugintype => $plugins) {
+2 -1
View File
@@ -32,4 +32,5 @@
defined('MOODLE_INTERNAL') || die();
debugging('Support for alternative hubs has been removed from Moodle in 3.4.', DEBUG_DEVELOPER);
debugging('Support for alternative hubs has been removed from Moodle in 3.4. For communication with moodle.net ' .
'see lib/classes/hub/ .', DEBUG_DEVELOPER);
+16 -18
View File
@@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* This page displays the site registration form.
* This page displays the site registration form for Moodle.net.
* It handles redirection to the hub to continue the registration workflow process.
* It also handles update operation by web service.
*/
@@ -32,25 +32,24 @@ require_once($CFG->libdir . '/adminlib.php');
admin_externalpage_setup('registrationmoodleorg');
$unregistration = optional_param('unregistration', false, PARAM_BOOL);
$confirm = optional_param('confirm', false, PARAM_BOOL);
$unregistration = optional_param('unregistration', 0, PARAM_INT);
if ($unregistration && \core\hub\registration::is_registered()) {
if ($confirm) {
require_sesskey();
\core\hub\registration::unregister(false, false);
$siteunregistrationform = new \core\hub\site_unregistration_form();
if ($siteunregistrationform->is_cancelled()) {
redirect(new moodle_url('/admin/registration/index.php'));
} else if ($data = $siteunregistrationform->get_data()) {
\core\hub\registration::unregister($data->unpublishalladvertisedcourses,
$data->unpublishalluploadedcourses);
if (!\core\hub\registration::is_registered()) {
redirect(new moodle_url('/admin/registration/index.php'));
}
}
echo $OUTPUT->header();
echo $OUTPUT->confirm(
get_string('registerwithmoodleorgremove', 'core_hub'),
new moodle_url(new moodle_url('/admin/registration/index.php', ['unregistration' => 1, 'confirm' => 1])),
new moodle_url(new moodle_url('/admin/registration/index.php'))
);
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', 'Moodle.net'), 3, 'main');
$siteunregistrationform->display();
echo $OUTPUT->footer();
exit;
}
@@ -83,7 +82,7 @@ if ($fromform = $siteregistrationform->get_data()) {
echo $OUTPUT->header();
// Current status of registration.
// Current status of registration on Moodle.net.
$notificationtype = \core\output\notification::NOTIFY_ERROR;
if (\core\hub\registration::is_registered()) {
@@ -105,11 +104,11 @@ if (\core\hub\registration::is_registered()) {
// Heading.
if (\core\hub\registration::is_registered()) {
echo $OUTPUT->heading(get_string('registerwithmoodleorgupdate', 'core_hub'));
echo $OUTPUT->heading(get_string('updatesite', 'hub', 'Moodle.net'));
} else if ($isinitialregistration) {
echo $OUTPUT->heading(get_string('registerwithmoodleorgcomplete', 'core_hub'));
echo $OUTPUT->heading(get_string('completeregistration', 'hub'));
} else {
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'core_hub'));
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
}
$renderer = $PAGE->get_renderer('core', 'admin');
@@ -120,9 +119,8 @@ $siteregistrationform->display();
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');
echo html_writer::div(html_writer::link($unregisterhuburl, get_string('unregister', 'hub')), 'unregister');
} else if ($isinitialregistration) {
echo html_writer::div(html_writer::link(new moodle_url($returnurl), get_string('skipregistration', 'hub')),
'skipregistration mt-2');
echo html_writer::div(html_writer::link(new moodle_url($returnurl), get_string('skipregistration', 'hub')), 'skipregistration');
}
echo $OUTPUT->footer();
+3 -3
View File
@@ -39,8 +39,8 @@ $token = optional_param('token', '', PARAM_TEXT);
admin_externalpage_setup('registrationmoodleorg');
if (parse_url($url, PHP_URL_HOST) !== parse_url(HUB_MOODLEORGHUBURL, PHP_URL_HOST)) {
// Allow other plugins to renew registration on custom hubs. Plugins implementing this
if ($url !== HUB_MOODLEORGHUBURL) {
// Allow other plugins to renew registration on hubs other than moodle.net . Plugins implementing this
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
$callbacks = get_plugins_with_function('hub_registration');
foreach ($callbacks as $plugintype => $plugins) {
@@ -56,7 +56,7 @@ if (parse_url($url, PHP_URL_HOST) !== parse_url(HUB_MOODLEORGHUBURL, PHP_URL_HOS
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
$hublink = html_writer::tag('a', HUB_MOODLEORGHUBURL, array('href' => HUB_MOODLEORGHUBURL));
$hublink = html_writer::tag('a', 'Moodle.net', array('href' => HUB_MOODLEORGHUBURL));
$deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
+100 -204
View File
@@ -253,7 +253,7 @@ class core_admin_renderer extends plugin_renderer_base {
$out .= $this->output->container(get_string('cancelinstallinfodir', 'core_plugin', $pluginfo->rootdir));
if ($repotype = $pluginman->plugin_external_source($pluginfo->component)) {
$out .= $this->output->container(get_string('uninstalldeleteconfirmexternal', 'core_plugin', $repotype),
'alert alert-warning mt-2');
'uninstalldeleteconfirmexternal');
}
}
@@ -281,9 +281,6 @@ class core_admin_renderer extends plugin_renderer_base {
* @param bool $mobileconfigured Whether the mobile web services have been enabled
* @param bool $overridetossl Whether or not ssl is being forced.
* @param bool $invalidforgottenpasswordurl Whether the forgotten password URL does not link to a valid URL.
* @param bool $croninfrequent If true, warn that cron hasn't run in the past few minutes
* @param bool $showcampaigncontent Whether the campaign content should be visible or not.
* @param bool $showfeedbackencouragement Whether the feedback encouragement content should be displayed or not.
*
* @return string HTML to output.
*/
@@ -291,9 +288,7 @@ class core_admin_renderer extends plugin_renderer_base {
$cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
$buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0,
$themedesignermode = false, $devlibdir = false, $mobileconfigured = false,
$overridetossl = false, $invalidforgottenpasswordurl = false, $croninfrequent = false,
$showcampaigncontent = false, bool $showfeedbackencouragement = false) {
$overridetossl = false, $invalidforgottenpasswordurl = false) {
global $CFG;
$output = '';
@@ -307,7 +302,6 @@ class core_admin_renderer extends plugin_renderer_base {
$output .= $this->display_errors_warning($errorsdisplayed);
$output .= $this->buggy_iconv_warning($buggyiconvnomb);
$output .= $this->cron_overdue_warning($cronoverdue);
$output .= $this->cron_infrequent_warning($croninfrequent);
$output .= $this->db_problems($dbproblems);
$output .= $this->maintenance_mode_warning($maintenancemode);
$output .= $this->overridetossl_warning($overridetossl);
@@ -316,8 +310,6 @@ class core_admin_renderer extends plugin_renderer_base {
$output .= $this->registration_warning($registered);
$output .= $this->mobile_configuration_warning($mobileconfigured);
$output .= $this->forgotten_password_url_warning($invalidforgottenpasswordurl);
$output .= $this->userfeedback_encouragement($showfeedbackencouragement);
$output .= $this->campaign_content($showcampaigncontent);
//////////////////////////////////////////////////////////////////////////////////////////////////
//// IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
@@ -367,15 +359,14 @@ class core_admin_renderer extends plugin_renderer_base {
$output = '';
if ($checker->enabled()) {
$output .= $this->container_start('checkforupdates mb-4');
$output .= $this->container_start('checkforupdates');
$output .= $this->single_button(
new moodle_url($reloadurl, array('fetchupdates' => 1)),
get_string('checkforupdates', 'core_plugin')
);
if ($timefetched = $checker->get_last_timefetched()) {
$timefetched = userdate($timefetched, get_string('strftimedatetime', 'core_langconfig'));
$output .= $this->container(get_string('checkforupdateslast', 'core_plugin', $timefetched),
'lasttimefetched small text-muted mt-1');
$output .= $this->container(get_string('checkforupdateslast', 'core_plugin', $timefetched), 'lasttimefetched');
}
$output .= $this->container_end();
}
@@ -439,7 +430,7 @@ class core_admin_renderer extends plugin_renderer_base {
if ($repotype = $pluginman->plugin_external_source($pluginfo->component)) {
$confirm .= $this->output->container(get_string('uninstalldeleteconfirmexternal', 'core_plugin', $repotype),
'alert alert-warning mt-2');
'uninstalldeleteconfirmexternal');
}
// After any uninstall we must execute full upgrade to finish the cleanup!
@@ -518,7 +509,7 @@ class core_admin_renderer extends plugin_renderer_base {
* @return string HTML to output.
*/
protected function warning($message, $type = 'warning') {
return $this->box($message, 'generalbox alert alert-' . $type);
return $this->box($message, 'generalbox admin' . $type);
}
/**
@@ -533,7 +524,7 @@ class core_admin_renderer extends plugin_renderer_base {
return $this->warning(get_string('datarootsecuritywarning', 'admin', $CFG->dataroot));
} else if ($insecuredataroot == INSECURE_DATAROOT_ERROR) {
return $this->warning(get_string('datarootsecurityerror', 'admin', $CFG->dataroot), 'danger');
return $this->warning(get_string('datarootsecurityerror', 'admin', $CFG->dataroot), 'error');
} else {
return '';
@@ -551,7 +542,7 @@ class core_admin_renderer extends plugin_renderer_base {
if ($devlibdir) {
$moreinfo = new moodle_url('/report/security/index.php');
$warning = get_string('devlibdirpresent', 'core_admin', ['moreinfourl' => $moreinfo->out()]);
return $this->warning($warning, 'danger');
return $this->warning($warning, 'error');
} else {
return '';
@@ -608,27 +599,19 @@ class core_admin_renderer extends plugin_renderer_base {
return '';
}
$check = new \tool_task\check\cronrunning();
$result = $check->get_result();
return $this->warning($result->get_summary() . '&nbsp;' . $this->help_icon('cron', 'admin'));
}
if (empty($CFG->cronclionly)) {
$url = new moodle_url('/admin/cron.php');
if (!empty($CFG->cronremotepassword)) {
$url = new moodle_url('/admin/cron.php', array('password' => $CFG->cronremotepassword));
}
/**
* Render an appropriate message if cron is not being run frequently (recommended every minute).
*
* @param bool $croninfrequent
* @return string HTML to output.
*/
public function cron_infrequent_warning(bool $croninfrequent) : string {
global $CFG;
if (!$croninfrequent) {
return '';
return $this->warning(get_string('cronwarning', 'admin', $url->out()) . '&nbsp;' .
$this->help_icon('cron', 'admin'));
}
$check = new \tool_task\check\cronrunning();
$result = $check->get_result();
return $this->warning($result->get_summary() . '&nbsp;' . $this->help_icon('cron', 'admin'));
// $CFG->cronclionly is not empty: cron can run only from CLI.
return $this->warning(get_string('cronwarningcli', 'admin') . '&nbsp;' .
$this->help_icon('cron', 'admin'));
}
/**
@@ -718,7 +701,7 @@ class core_admin_renderer extends plugin_renderer_base {
return $this->warning(
$this->container(get_string('maturitycorewarning', 'admin', $maturitylevel)) .
$this->container($this->doc_link('admin/versions', get_string('morehelp'))),
'danger');
'error');
}
/*
@@ -734,7 +717,7 @@ class core_admin_renderer extends plugin_renderer_base {
}
$warning = (get_string('testsiteupgradewarning', 'admin', $testsite));
return $this->warning($warning, 'danger');
return $this->warning($warning, 'error');
}
/**
@@ -769,7 +752,7 @@ class core_admin_renderer extends plugin_renderer_base {
$level = 'warning';
if ($maturity == MATURITY_ALPHA) {
$level = 'danger';
$level = 'error';
}
$maturitylevel = get_string('maturity' . $maturity, 'admin');
@@ -820,7 +803,7 @@ class core_admin_renderer extends plugin_renderer_base {
}
}
$updateinfo .= $this->container_start('checkforupdates mt-1');
$updateinfo .= $this->container_start('checkforupdates');
$fetchurl = new moodle_url('/admin/index.php', array('fetchupdates' => 1, 'sesskey' => sesskey(), 'cache' => 0));
$updateinfo .= $this->single_button($fetchurl, get_string('checkforupdates', 'core_plugin'));
if ($fetch) {
@@ -840,7 +823,8 @@ class core_admin_renderer extends plugin_renderer_base {
*/
protected function registration_warning($registered) {
if (!$registered && site_is_public()) {
if (!$registered) {
if (has_capability('moodle/site:config', context_system::instance())) {
$registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
get_string('register', 'admin'));
@@ -884,20 +868,6 @@ class core_admin_renderer extends plugin_renderer_base {
return $output;
}
/**
* Display campaign content.
*
* @param bool $showcampaigncontent Whether the campaign content should be visible or not.
* @return string the campaign content raw html.
*/
protected function campaign_content(bool $showcampaigncontent): string {
if (!$showcampaigncontent) {
return '';
}
return $this->render_from_template('core/campaign_content', ['lang' => current_language()]);
}
/**
* Display a warning about the forgotten password URL not linking to a valid URL.
*
@@ -923,7 +893,7 @@ class core_admin_renderer extends plugin_renderer_base {
*/
protected function moodle_available_update_info(\core\update\info $updateinfo) {
$boxclasses = 'moodleupdateinfo mb-2';
$boxclasses = 'moodleupdateinfo';
$info = array();
if (isset($updateinfo->release)) {
@@ -943,8 +913,7 @@ class core_admin_renderer extends plugin_renderer_base {
}
if (isset($updateinfo->download)) {
$info[] = html_writer::link($updateinfo->download, get_string('download'),
array('class' => 'info download btn btn-secondary'));
$info[] = html_writer::link($updateinfo->download, get_string('download'), array('class' => 'info download'));
}
if (isset($updateinfo->url)) {
@@ -952,9 +921,9 @@ class core_admin_renderer extends plugin_renderer_base {
array('class' => 'info more'));
}
$box = $this->output->container_start($boxclasses);
$box .= $this->output->container(implode(html_writer::tag('span', ' | ', array('class' => 'separator')), $info), '');
$box .= $this->output->container_end();
$box = $this->output->box_start($boxclasses);
$box .= $this->output->box(implode(html_writer::tag('span', ' ', array('class' => 'separator')), $info), '');
$box .= $this->output->box_end();
return $box;
}
@@ -966,7 +935,7 @@ class core_admin_renderer extends plugin_renderer_base {
protected function release_notes_link() {
$releasenoteslink = get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/dev/Releases');
$releasenoteslink = str_replace('target="_blank"', 'onclick="this.target=\'_blank\'"', $releasenoteslink); // extremely ugly validation hack
return $this->box($releasenoteslink, 'generalbox alert alert-info');
return $this->box($releasenoteslink, 'generalbox releasenoteslink');
}
/**
@@ -995,7 +964,7 @@ class core_admin_renderer extends plugin_renderer_base {
* @return string HTML code
*/
public function plugins_check_table(core_plugin_manager $pluginman, $version, array $options = array()) {
global $CFG;
$plugininfo = $pluginman->get_plugins();
if (empty($plugininfo)) {
@@ -1066,7 +1035,7 @@ class core_admin_renderer extends plugin_renderer_base {
$displayname = new html_table_cell(
$icon.
html_writer::span($plugin->displayname, 'pluginname').
html_writer::div($plugin->get_dir(), 'plugindir text-muted small')
html_writer::div($plugin->get_dir(), 'plugindir')
);
$versiondb = new html_table_cell($plugin->versiondb);
@@ -1074,46 +1043,44 @@ class core_admin_renderer extends plugin_renderer_base {
if ($isstandard = $plugin->is_standard()) {
$row->attributes['class'] .= ' standard';
$sourcelabel = html_writer::span(get_string('sourcestd', 'core_plugin'), 'sourcetext badge badge-secondary');
$sourcelabel = html_writer::span(get_string('sourcestd', 'core_plugin'), 'sourcetext label');
} else {
$row->attributes['class'] .= ' extension';
$sourcelabel = html_writer::span(get_string('sourceext', 'core_plugin'), 'sourcetext badge badge-info');
$sourcelabel = html_writer::span(get_string('sourceext', 'core_plugin'), 'sourcetext label label-info');
}
$coredependency = $plugin->is_core_dependency_satisfied($version);
$incompatibledependency = $plugin->is_core_compatible_satisfied($CFG->branch);
$otherpluginsdependencies = $pluginman->are_dependencies_satisfied($plugin->get_other_required_plugins());
$dependenciesok = $coredependency && $otherpluginsdependencies && $incompatibledependency;
$dependenciesok = $coredependency && $otherpluginsdependencies;
$statuscode = $plugin->get_status();
$row->attributes['class'] .= ' status-' . $statuscode;
$statusclass = 'statustext badge ';
$statusclass = 'statustext label ';
switch ($statuscode) {
case core_plugin_manager::PLUGIN_STATUS_NEW:
$statusclass .= $dependenciesok ? 'badge-success' : 'badge-warning';
$statusclass .= $dependenciesok ? 'label-success' : 'label-warning';
break;
case core_plugin_manager::PLUGIN_STATUS_UPGRADE:
$statusclass .= $dependenciesok ? 'badge-info' : 'badge-warning';
$statusclass .= $dependenciesok ? 'label-info' : 'label-warning';
break;
case core_plugin_manager::PLUGIN_STATUS_MISSING:
case core_plugin_manager::PLUGIN_STATUS_DOWNGRADE:
case core_plugin_manager::PLUGIN_STATUS_DELETE:
$statusclass .= 'badge-danger';
$statusclass .= 'label-important';
break;
case core_plugin_manager::PLUGIN_STATUS_NODB:
case core_plugin_manager::PLUGIN_STATUS_UPTODATE:
$statusclass .= $dependenciesok ? 'badge-light' : 'badge-warning';
$statusclass .= $dependenciesok ? '' : 'label-warning';
break;
}
$status = html_writer::span(get_string('status_' . $statuscode, 'core_plugin'), $statusclass);
if (!empty($installabortable[$plugin->component])) {
$status .= $this->output->single_button(
new moodle_url($this->page->url, array('abortinstall' => $plugin->component, 'confirmplugincheck' => 0)),
new moodle_url($this->page->url, array('abortinstall' => $plugin->component)),
get_string('cancelinstallone', 'core_plugin'),
'post',
array('class' => 'actionbutton cancelinstallone d-block mt-1')
array('class' => 'actionbutton cancelinstallone')
);
}
@@ -1122,7 +1089,7 @@ class core_admin_renderer extends plugin_renderer_base {
new moodle_url($this->page->url, array('abortupgrade' => $plugin->component)),
get_string('cancelupgradeone', 'core_plugin'),
'post',
array('class' => 'actionbutton cancelupgradeone d-block mt-1')
array('class' => 'actionbutton cancelupgradeone')
);
}
@@ -1134,11 +1101,8 @@ class core_admin_renderer extends plugin_renderer_base {
}
$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 {
$requires = new html_table_cell($this->required_column($plugin, $pluginman, $version));
}
$requires = new html_table_cell($this->required_column($plugin, $pluginman, $version));
$statusisboring = in_array($statuscode, array(
core_plugin_manager::PLUGIN_STATUS_NODB, core_plugin_manager::PLUGIN_STATUS_UPTODATE));
@@ -1195,7 +1159,7 @@ class core_admin_renderer extends plugin_renderer_base {
}
}
$out .= $this->output->container_start('actions mb-2');
$out .= $this->output->container_start('actions');
$installableupdates = $pluginman->filter_installable($pluginman->available_updates());
if ($installableupdates) {
@@ -1203,16 +1167,16 @@ class core_admin_renderer extends plugin_renderer_base {
new moodle_url($this->page->url, array('installupdatex' => 1)),
get_string('updateavailableinstallall', 'core_admin', count($installableupdates)),
'post',
array('class' => 'singlebutton updateavailableinstallall mr-1')
array('class' => 'singlebutton updateavailableinstallall')
);
}
if ($installabortable) {
$out .= $this->output->single_button(
new moodle_url($this->page->url, array('abortinstallx' => 1, 'confirmplugincheck' => 0)),
new moodle_url($this->page->url, array('abortinstallx' => 1)),
get_string('cancelinstallall', 'core_plugin', count($installabortable)),
'post',
array('class' => 'singlebutton cancelinstallall mr-1')
array('class' => 'singlebutton cancelinstallall')
);
}
@@ -1221,17 +1185,15 @@ class core_admin_renderer extends plugin_renderer_base {
new moodle_url($this->page->url, array('abortupgradex' => 1)),
get_string('cancelupgradeall', 'core_plugin', count($upgradeabortable)),
'post',
array('class' => 'singlebutton cancelupgradeall mr-1')
array('class' => 'singlebutton cancelupgradeall')
);
}
$out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 0)),
get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge badge-light'),
'btn btn-link mr-1');
get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge'));
$out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 1)),
get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge badge-light'),
'btn btn-link mr-1');
get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge'));
$out .= $this->output->container_end(); // End of .actions container.
$out .= $this->output->container_end(); // End of #plugins-check-info container.
@@ -1299,13 +1261,12 @@ class core_admin_renderer extends plugin_renderer_base {
}
}
$out = $this->output->container_start('plugins-check-dependencies mb-4');
$out = $this->output->container_start('plugins-check-dependencies');
if ($unavailable or $unknown) {
$out .= $this->output->heading(get_string('misdepsunavail', 'core_plugin'));
if ($unknown) {
$out .= $this->output->render((new \core\output\notification(get_string('misdepsunknownlist', 'core_plugin',
implode(', ', $unknown))))->set_show_closebutton(false));
$out .= $this->output->notification(get_string('misdepsunknownlist', 'core_plugin', implode($unknown, ', ')));
}
if ($unavailable) {
$unavailablelist = array();
@@ -1319,18 +1280,18 @@ class core_admin_renderer extends plugin_renderer_base {
}
$unavailablelist[] = $unavailablelistitem;
}
$out .= $this->output->render((new \core\output\notification(get_string('misdepsunavaillist', 'core_plugin',
implode(', ', $unavailablelist))))->set_show_closebutton(false));
$out .= $this->output->notification(get_string('misdepsunavaillist', 'core_plugin',
implode($unavailablelist, ', ')));
}
$out .= $this->output->container_start('plugins-check-dependencies-actions mb-4');
$out .= $this->output->container_start('plugins-check-dependencies-actions');
$out .= ' '.html_writer::link(new moodle_url('/admin/tool/installaddon/'),
get_string('dependencyuploadmissing', 'core_plugin'), array('class' => 'btn btn-secondary'));
get_string('dependencyuploadmissing', 'core_plugin'));
$out .= $this->output->container_end(); // End of .plugins-check-dependencies-actions container.
}
if ($available) {
$out .= $this->output->heading(get_string('misdepsavail', 'core_plugin'));
$out .= $this->output->container_start('plugins-check-dependencies-actions mb-2');
$out .= $this->output->container_start('plugins-check-dependencies-actions');
$installable = $pluginman->filter_installable($available);
if ($installable) {
@@ -1338,13 +1299,12 @@ class core_admin_renderer extends plugin_renderer_base {
new moodle_url($this->page->url, array('installdepx' => 1)),
get_string('dependencyinstallmissing', 'core_plugin', count($installable)),
'post',
array('class' => 'singlebutton dependencyinstallmissing d-inline-block mr-1')
array('class' => 'singlebutton dependencyinstallmissing')
);
}
$out .= html_writer::div(html_writer::link(new moodle_url('/admin/tool/installaddon/'),
get_string('dependencyuploadmissing', 'core_plugin'), array('class' => 'btn btn-link')),
'dependencyuploadmissing d-inline-block mr-1');
get_string('dependencyuploadmissing', 'core_plugin')), 'dependencyuploadmissing');
$out .= $this->output->container_end(); // End of .plugins-check-dependencies-actions container.
@@ -1383,9 +1343,9 @@ class core_admin_renderer extends plugin_renderer_base {
$supportedmoodles = array();
foreach ($plugin->version->supportedmoodles as $moodle) {
if ($CFG->branch == str_replace('.', '', $moodle->release)) {
$supportedmoodles[] = html_writer::span($moodle->release, 'badge badge-success');
$supportedmoodles[] = html_writer::span($moodle->release, 'label label-success');
} else {
$supportedmoodles[] = html_writer::span($moodle->release, 'badge badge-light');
$supportedmoodles[] = html_writer::span($moodle->release, 'label');
}
}
@@ -1399,7 +1359,7 @@ class core_admin_renderer extends plugin_renderer_base {
}
$info = html_writer::div(
get_string('requiredby', 'core_plugin', implode(', ', $requriedby)),
'requiredby mb-1'
'requiredby'
);
} else {
$info = '';
@@ -1410,39 +1370,38 @@ class core_admin_renderer extends plugin_renderer_base {
$info .= html_writer::div(
html_writer::link('https://moodle.org/plugins/view.php?plugin='.$plugin->component,
get_string('misdepinfoplugin', 'core_plugin')),
'misdepinfoplugin d-inline-block mr-3 mb-1'
'misdepinfoplugin'
);
$info .= html_writer::div(
html_writer::link('https://moodle.org/plugins/pluginversion.php?id='.$plugin->version->id,
get_string('misdepinfoversion', 'core_plugin')),
'misdepinfoversion d-inline-block mr-3 mb-1'
'misdepinfoversion'
);
$info .= html_writer::div(html_writer::link($plugin->version->downloadurl, get_string('download')),
'misdepdownload d-inline-block mr-3 mb-1');
$info .= html_writer::div(html_writer::link($plugin->version->downloadurl, get_string('download')), 'misdepdownload');
if ($pluginman->is_remote_plugin_installable($plugin->component, $plugin->version->version, $reason)) {
$info .= $this->output->single_button(
new moodle_url($this->page->url, array('installdep' => $plugin->component)),
get_string('dependencyinstall', 'core_plugin'),
'post',
array('class' => 'singlebutton dependencyinstall mr-3 mb-1')
array('class' => 'singlebutton dependencyinstall')
);
} else {
$reasonhelp = $this->info_remote_plugin_not_installable($reason);
if ($reasonhelp) {
$info .= html_writer::div($reasonhelp, 'reasonhelp dependencyinstall d-inline-block mr-3 mb-1');
$info .= html_writer::div($reasonhelp, 'reasonhelp dependencyinstall');
}
}
$info .= $this->output->container_end(); // End of .actions container.
$table->data[] = array(
html_writer::div($plugin->name, 'name').' '.html_writer::div($plugin->component, 'component text-muted small'),
html_writer::div($plugin->name, 'name').' '.html_writer::div($plugin->component, 'component'),
$plugin->version->release,
$plugin->version->version,
implode(' ', $supportedmoodles),
implode($supportedmoodles, ' '),
$info
);
}
@@ -1474,54 +1433,38 @@ class core_admin_renderer extends plugin_renderer_base {
* @param \core\plugininfo\base $plugin the plugin we are rendering the row for.
* @param core_plugin_manager $pluginman provides data on all the plugins.
* @param string $version
* @param int $branch the current Moodle branch
* @return string HTML code
*/
protected function required_column(\core\plugininfo\base $plugin, core_plugin_manager $pluginman, $version, $branch = null) {
protected function required_column(\core\plugininfo\base $plugin, core_plugin_manager $pluginman, $version) {
$requires = array();
$displayuploadlink = false;
$displayupdateslink = false;
$requirements = $pluginman->resolve_requirements($plugin, $version, $branch);
foreach ($requirements as $reqname => $reqinfo) {
foreach ($pluginman->resolve_requirements($plugin, $version) as $reqname => $reqinfo) {
if ($reqname === 'core') {
if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OK) {
$class = 'requires-ok text-muted';
$class = 'requires-ok';
$label = '';
} else {
$class = 'requires-failed';
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge badge-danger');
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'label label-important');
}
if ($branch != null && !$plugin->is_core_compatible_satisfied($branch)) {
$requires[] = html_writer::tag('li',
html_writer::span(get_string('incompatibleversion', 'core_plugin', $branch), 'dep dep-core').
$requires[] = html_writer::tag('li',
html_writer::span(get_string('moodleversion', 'core_plugin', $plugin->versionrequires), 'dep dep-core').
' '.$label, array('class' => $class));
} else if ($branch != null && $plugin->pluginsupported != null) {
$requires[] = html_writer::tag('li',
html_writer::span(get_string('moodlebranch', 'core_plugin',
array('min' => $plugin->pluginsupported[0], 'max' => $plugin->pluginsupported[1])), 'dep dep-core').
' '.$label, array('class' => $class));
} else if ($reqinfo->reqver != ANY_VERSION) {
$requires[] = html_writer::tag('li',
html_writer::span(get_string('moodleversion', 'core_plugin', $plugin->versionrequires), 'dep dep-core').
' '.$label, array('class' => $class));
}
} else {
$actions = array();
if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OK) {
$label = '';
$class = 'requires-ok text-muted';
$class = 'requires-ok';
} else if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_MISSING) {
if ($reqinfo->availability == $pluginman::REQUIREMENT_AVAILABLE) {
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'badge badge-warning');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'badge badge-warning');
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'label label-warning');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'label label-warning');
$class = 'requires-failed requires-missing requires-available';
$actions[] = html_writer::link(
new moodle_url('https://moodle.org/plugins/view.php', array('plugin' => $reqname)),
@@ -1529,24 +1472,24 @@ class core_admin_renderer extends plugin_renderer_base {
);
} else {
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'badge badge-danger');
$label = html_writer::span(get_string('dependencymissing', 'core_plugin'), 'label label-important');
$label .= ' '.html_writer::span(get_string('dependencyunavailable', 'core_plugin'),
'badge badge-danger');
'label label-important');
$class = 'requires-failed requires-missing requires-unavailable';
}
$displayuploadlink = true;
} else if ($reqinfo->status == $pluginman::REQUIREMENT_STATUS_OUTDATED) {
if ($reqinfo->availability == $pluginman::REQUIREMENT_AVAILABLE) {
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge badge-warning');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'badge badge-warning');
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'label label-warning');
$label .= ' '.html_writer::span(get_string('dependencyavailable', 'core_plugin'), 'label label-warning');
$class = 'requires-failed requires-outdated requires-available';
$displayupdateslink = true;
} else {
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'badge badge-danger');
$label = html_writer::span(get_string('dependencyfails', 'core_plugin'), 'label label-important');
$label .= ' '.html_writer::span(get_string('dependencyunavailable', 'core_plugin'),
'badge badge-danger');
'label label-important');
$class = 'requires-failed requires-outdated requires-unavailable';
}
$displayuploadlink = true;
@@ -1570,14 +1513,13 @@ class core_admin_renderer extends plugin_renderer_base {
return '';
}
$out = html_writer::tag('ul', implode("\n", $requires), array('class' => 'm-0'));
$out = html_writer::tag('ul', implode("\n", $requires));
if ($displayuploadlink) {
$out .= html_writer::div(
html_writer::link(
new moodle_url('/admin/tool/installaddon/'),
get_string('dependencyuploadmissing', 'core_plugin'),
array('class' => 'btn btn-secondary btn-sm m-1')
get_string('dependencyuploadmissing', 'core_plugin')
),
'dependencyuploadmissing'
);
@@ -1587,20 +1529,12 @@ class core_admin_renderer extends plugin_renderer_base {
$out .= html_writer::div(
html_writer::link(
new moodle_url($this->page->url, array('sesskey' => sesskey(), 'fetchupdates' => 1)),
get_string('checkforupdates', 'core_plugin'),
array('class' => 'btn btn-secondary btn-sm m-1')
get_string('checkforupdates', 'core_plugin')
),
'checkforupdates'
);
}
// Check if supports is present, and $branch is not in, only if $incompatible check was ok.
if ($plugin->pluginsupported != null && $class == 'requires-ok' && $branch != null) {
if ($pluginman->check_explicitly_supported($plugin, $branch) == $pluginman::VERSION_NOT_SUPPORTED) {
$out .= html_writer::div(get_string('notsupported', 'core_plugin', $branch));
}
}
return $out;
}
@@ -1819,13 +1753,13 @@ class core_admin_renderer extends plugin_renderer_base {
$source = '';
} else {
$row->attributes['class'] .= ' extension';
$source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source badge badge-info');
$source = html_writer::div(get_string('sourceext', 'core_plugin'), 'source label label-info');
}
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
$msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg badge badge-danger');
$msg = html_writer::div(get_string('status_missing', 'core_plugin'), 'statusmsg label label-important');
} else if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
$msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg badge badge-success');
$msg = html_writer::div(get_string('status_new', 'core_plugin'), 'statusmsg label label-success');
} else {
$msg = '';
}
@@ -1947,7 +1881,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'] = 'admintable environmenttable generaltable table-sm';
$servertable->attributes['class'] = 'admintable environmenttable generaltable';
$servertable->id = 'serverstatus';
$serverdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
@@ -1960,7 +1894,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'] = 'admintable environmenttable generaltable table-sm';
$othertable->attributes['class'] = 'admintable environmenttable generaltable';
$othertable->id = 'otherserverstatus';
$otherdata = array('ok'=>array(), 'warn'=>array(), 'error'=>array());
@@ -2056,7 +1990,7 @@ class core_admin_renderer extends plugin_renderer_base {
if (empty($CFG->docroot) or $environment_result->plugin) {
$report = get_string($stringtouse, 'admin', $rec);
} else {
$report = $this->doc_link(join('/', $linkparts), get_string($stringtouse, 'admin', $rec), true);
$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);
@@ -2064,15 +1998,15 @@ class core_admin_renderer extends plugin_renderer_base {
// Format error or warning line
if ($errorline) {
$messagetype = 'error';
$statusclass = 'badge-danger';
$statusclass = 'label-important';
} else if ($warningline) {
$messagetype = 'warn';
$statusclass = 'badge-warning';
$statusclass = 'label-warning';
} else {
$messagetype = 'ok';
$statusclass = 'badge-success';
$statusclass = 'label-success';
}
$status = html_writer::span($status, 'badge ' . $statusclass);
$status = html_writer::span($status, 'label ' . $statusclass);
// Here we'll store all the feedback found
$feedbacktext = '';
// Append the feedback if there is some
@@ -2157,44 +2091,6 @@ class core_admin_renderer extends plugin_renderer_base {
* @return string
*/
public function moodleorg_registration_message() {
$out = format_text(get_string('registerwithmoodleorginfo', 'core_hub'), FORMAT_MARKDOWN);
$out .= html_writer::link(
new moodle_url('/admin/settings.php', ['section' => 'moodleservices']),
$this->output->pix_icon('i/info', '').' '.get_string('registerwithmoodleorginfoapp', 'core_hub'),
['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
);
$out .= html_writer::link(
HUB_MOODLEORGHUBURL,
$this->output->pix_icon('i/stats', '').' '.get_string('registerwithmoodleorginfostats', 'core_hub'),
['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
);
$out .= html_writer::link(
HUB_MOODLEORGHUBURL.'/sites',
$this->output->pix_icon('i/location', '').' '.get_string('registerwithmoodleorginfosites', 'core_hub'),
['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
);
return $this->output->box($out);
}
/**
* Display message about benefits of enabling the user feedback feature.
*
* @param bool $showfeedbackencouragement Whether the encouragement content should be displayed or not
* @return string
*/
protected function userfeedback_encouragement(bool $showfeedbackencouragement): string {
$output = '';
if ($showfeedbackencouragement) {
$settingslink = new moodle_url('/admin/settings.php', ['section' => 'userfeedback']);
$output .= $this->warning(get_string('userfeedbackencouragement', 'admin', $settingslink->out()), 'info');
}
return $output;
return format_text(get_string('registermoodlenet', 'admin'), FORMAT_HTML, ['noclean' => true]);
}
}
+2 -2
View File
@@ -123,13 +123,13 @@ if (($action == 'edit') || ($action == 'new')) {
}
$instanceoptionnames = repository::static_function($repository, 'get_instance_option_names');
if (!empty($instanceoptionnames)) {
if (property_exists($fromform, 'enablecourseinstances')) {
if (array_key_exists('enablecourseinstances', $fromform)) {
$settings['enablecourseinstances'] = $fromform->enablecourseinstances;
}
else {
$settings['enablecourseinstances'] = 0;
}
if (property_exists($fromform, 'enableuserinstances')) {
if (array_key_exists('enableuserinstances', $fromform)) {
$settings['enableuserinstances'] = $fromform->enableuserinstances;
}
else {
+5 -2
View File
@@ -36,12 +36,15 @@ if (!is_siteadmin()) {
}
$admisselector = new core_role_admins_existing_selector();
$admisselector->set_extra_fields(array('username', 'email'));
$potentialadmisselector = new core_role_admins_potential_selector();
$potentialadmisselector->set_extra_fields(array('username', 'email'));
if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) {
if ($userstoadd = $potentialadmisselector->get_selected_users()) {
$user = reset($userstoadd);
$username = $potentialadmisselector->output_user($user);
$username = fullname($user) . " ($user->username, $user->email)";
echo $OUTPUT->header();
$yesurl = new moodle_url('/admin/roles/admins.php', array('confirmadd'=>$user->id, 'sesskey'=>sesskey()));
echo $OUTPUT->confirm(get_string('confirmaddadmin', 'core_role', $username), $yesurl, $PAGE->url);
@@ -55,7 +58,7 @@ if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) {
if ($USER->id == $user->id) {
// Can not remove self.
} else {
$username = $admisselector->output_user($user);
$username = fullname($user) . " ($user->username, $user->email)";
echo $OUTPUT->header();
$yesurl = new moodle_url('/admin/roles/admins.php', array('confirmdel'=>$user->id, 'sesskey'=>sesskey()));
echo $OUTPUT->confirm(get_string('confirmdeladmin', 'core_role', $username), $yesurl, $PAGE->url);
+19
View File
@@ -46,6 +46,25 @@ $controller = new $classformode[$mode]();
if (optional_param('submit', false, PARAM_BOOL) && data_submitted() && confirm_sesskey()) {
$controller->process_submission();
$event = null;
// Create event depending on mode.
switch ($mode) {
case 'assign':
$event = \core\event\role_allow_assign_updated::create(array('context' => $syscontext));
break;
case 'override':
$event = \core\event\role_allow_override_updated::create(array('context' => $syscontext));
break;
case 'switch':
$event = \core\event\role_allow_switch_updated::create(array('context' => $syscontext));
break;
case 'view':
$event = \core\event\role_allow_view_updated::create(array('context' => $syscontext));
break;
}
if ($event) {
$event->trigger();
}
redirect($baseurl);
}
@@ -46,8 +46,4 @@ class core_role_allow_assign_page extends core_role_allow_role_page {
public function get_intro_text() {
return get_string('configallowassign', 'core_admin');
}
protected function get_eventclass() {
return \core\event\role_allow_assign_updated::class;
}
}
@@ -46,8 +46,4 @@ class core_role_allow_override_page extends core_role_allow_role_page {
public function get_intro_text() {
return get_string('configallowoverride2', 'core_admin');
}
protected function get_eventclass() {
return \core\event\role_allow_override_updated::class;
}
}
-30
View File
@@ -59,36 +59,12 @@ abstract class core_role_allow_role_page {
*/
public function process_submission() {
global $DB;
$context = context_system::instance();
$this->load_current_settings();
// Delete all records, then add back the ones that should be allowed.
$DB->delete_records($this->tablename);
foreach ($this->roles as $fromroleid => $notused) {
foreach ($this->roles as $targetroleid => $alsonotused) {
$isallowed = $this->allowed[$fromroleid][$targetroleid];
if (optional_param('s_' . $fromroleid . '_' . $targetroleid, false, PARAM_BOOL)) {
$this->set_allow($fromroleid, $targetroleid);
// Only trigger events if this role allow relationship did not exist and the checkbox element
// has been submitted.
if (!$isallowed) {
$eventclass = $this->get_eventclass();
$eventclass::create([
'context' => $context,
'objectid' => $fromroleid,
'other' => ['targetroleid' => $targetroleid, 'allow' => true]
])->trigger();
}
} else if ($isallowed) {
// When the user has deselect an existing role allow checkbox but it is in the list of roles
// allowances.
$eventclass = $this->get_eventclass();
$eventclass::create([
'context' => $context,
'objectid' => $fromroleid,
'other' => ['targetroleid' => $targetroleid, 'allow' => false]
])->trigger();
}
}
}
@@ -185,10 +161,4 @@ abstract class core_role_allow_role_page {
* @return string
*/
public abstract function get_intro_text();
/**
* Returns the allow class respective event class name.
* @return string
*/
protected abstract function get_eventclass();
}
@@ -58,8 +58,4 @@ class core_role_allow_switch_page extends core_role_allow_role_page {
public function get_intro_text() {
return get_string('configallowswitch', 'core_admin');
}
protected function get_eventclass() {
return \core\event\role_allow_switch_updated::class;
}
}
-4
View File
@@ -74,8 +74,4 @@ class core_role_allow_view_page extends core_role_allow_role_page {
public function get_intro_text() {
return get_string('configallowview', 'core_admin');
}
protected function get_eventclass() {
return \core\event\role_allow_view_updated::class;
}
}
@@ -43,7 +43,7 @@ abstract class core_role_capability_table_base {
protected $id;
/** Added to the class="" attribute on output. */
protected $classes = array('rolecap table-hover');
protected $classes = array('rolecap');
/** Default number of capabilities in the table for the search UI to be shown. */
const NUM_CAPS_FOR_SEARCH = 12;
@@ -50,7 +50,6 @@ class core_role_check_capability_table extends core_role_capability_table_base {
$this->contextname = $contextname;
$this->stryes = get_string('yes');
$this->strno = get_string('no');
$this->add_classes(['table-striped']);
}
protected function add_header_cells() {
+2 -5
View File
@@ -69,11 +69,8 @@ class core_role_check_users_selector extends user_selector_base {
if ($coursecontext and $coursecontext != SITEID) {
$sql1 = " FROM {user} u
JOIN (SELECT DISTINCT subu.id
FROM {user} subu
JOIN {user_enrolments} ue ON (ue.userid = subu.id)
JOIN {enrol} e ON (e.id = ue.enrolid AND e.courseid = :courseid1)
) subq ON subq.id = u.id
JOIN {user_enrolments} ue ON (ue.userid = u.id)
JOIN {enrol} e ON (e.id = ue.enrolid AND e.courseid = :courseid1)
WHERE $wherecondition";
$params['courseid1'] = $coursecontext->instanceid;
@@ -55,7 +55,6 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
foreach ($levels as $level => $classname) {
$this->allcontextlevels[$level] = context_helper::get_level_name($level);
}
$this->add_classes(['table-striped']);
}
protected function load_current_permissions() {
@@ -158,19 +157,19 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
// Allowed roles.
$allow = optional_param_array('allowassign', null, PARAM_INT);
if (!is_null($allow)) {
$this->allowassign = array_filter($allow);
$this->allowassign = $allow;
}
$allow = optional_param_array('allowoverride', null, PARAM_INT);
if (!is_null($allow)) {
$this->allowoverride = array_filter($allow);
$this->allowoverride = $allow;
}
$allow = optional_param_array('allowswitch', null, PARAM_INT);
if (!is_null($allow)) {
$this->allowswitch = array_filter($allow);
$this->allowswitch = $allow;
}
$allow = optional_param_array('allowview', null, PARAM_INT);
if (!is_null($allow)) {
$this->allowview = array_filter($allow);
$this->allowview = $allow;
}
// Now read the permissions for each capability.
@@ -435,7 +434,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
}
public function save_changes() {
global $DB, $USER;
global $DB;
if (!$this->roleid) {
// Creating role.
@@ -445,20 +444,6 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
// Updating role.
$DB->update_record('role', $this->role);
// Trigger role updated event.
\core\event\role_updated::create([
'userid' => $USER->id,
'objectid' => $this->role->id,
'context' => $this->context,
'other' => [
'name' => $this->role->name,
'shortname' => $this->role->shortname,
'description' => $this->role->description,
'archetype' => $this->role->archetype,
'contextlevels' => $this->contextlevels
]
])->trigger();
// This will ensure the course contacts cache is purged so name changes get updated in
// the UI. It would be better to do this only when we know that fields affected are
// updated. But thats getting into the weeds of the coursecat cache and role edits
@@ -488,17 +473,10 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
$addfunction = "core_role_set_{$type}_allowed";
$deltable = 'role_allow_'.$type;
$field = 'allow'.$type;
$eventclass = "\\core\\event\\role_allow_" . $type . "_updated";
$context = context_system::instance();
foreach ($current as $roleid) {
if (!in_array($roleid, $wanted)) {
$DB->delete_records($deltable, array('roleid'=>$this->roleid, $field=>$roleid));
$eventclass::create([
'context' => $context,
'objectid' => $this->roleid,
'other' => ['targetroleid' => $roleid, 'allow' => false]
])->trigger();
continue;
}
$key = array_search($roleid, $wanted);
@@ -510,14 +488,6 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
$roleid = $this->roleid;
}
$addfunction($this->roleid, $roleid);
if (in_array($roleid, $wanted)) {
$eventclass::create([
'context' => $context,
'objectid' => $this->roleid,
'other' => ['targetroleid' => $roleid, 'allow' => true]
])->trigger();
}
}
}
@@ -619,9 +589,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
if ($this->roleid == 0) {
$options[-1] = get_string('thisnewrole', 'core_role');
}
return
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'allow'.$type.'[]', 'value' => "")) .
html_writer::select($options, 'allow'.$type.'[]', $selected, false, array('multiple' => 'multiple',
return html_writer::select($options, 'allow'.$type.'[]', $selected, false, array('multiple' => 'multiple',
'size' => 10, 'class' => 'form-control'));
}
@@ -655,7 +623,7 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
echo "</label>\n";
}
if ($helpicon) {
echo '<span class="float-sm-right text-nowrap">'.$helpicon.'</span>';
echo '<span class="pull-xs-right text-nowrap">'.$helpicon.'</span>';
}
echo '</div>';
if (isset($this->errors[$name])) {
@@ -66,9 +66,9 @@ class core_role_override_permissions_table_advanced extends core_role_capability
$rowattributes = parent::get_row_attributes($capability);
if ($this->permissions[$capability->name] !== 0) {
if (empty($rowattributes['class'])) {
$rowattributes['class'] = "overriddenpermission table-warning";
$rowattributes['class'] = "overriddenpermission";
} else {
$rowattributes['class'] .= " overriddenpermission table-warning";
$rowattributes['class'] .= " overriddenpermission";
}
}
return $rowattributes;
+2 -2
View File
@@ -96,7 +96,7 @@ class core_role_permissions_table extends core_role_capability_table_base {
"linkclass" => "preventlink", "adminurl" => $adminurl->out(), "icon" => "", "iconalt" => "");
if (isset($overridableroles[$id]) and ($allowoverrides or ($allowsafeoverrides and is_safe_capability($capability)))) {
$templatecontext['icon'] = 't/delete';
$templatecontext['iconalt'] = get_string('deletexrole', 'core_role', $name);
$templatecontext['iconalt'] = get_string('delete');
}
$neededroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
}
@@ -109,7 +109,7 @@ class core_role_permissions_table extends core_role_capability_table_base {
"icon" => "", "iconalt" => "");
if (isset($overridableroles[$id]) and prohibit_is_removable($id, $context, $capability->name)) {
$templatecontext['icon'] = 't/delete';
$templatecontext['iconalt'] = get_string('deletexrole', 'core_role', $name);
$templatecontext['iconalt'] = get_string('delete');
}
$forbiddenroles[$id] = $renderer->render_from_template('core/permissionmanager_role', $templatecontext);
}
+14 -3
View File
@@ -52,12 +52,10 @@ if ($return === 'manage') {
$returnurl = new moodle_url('/admin/roles/define.php', array('action'=>'view', 'roleid'=>$roleid));;
}
admin_externalpage_setup('defineroles', '', array('action' => $action, 'roleid' => $roleid),
new moodle_url('/admin/roles/define.php'));
// Check access permissions.
$systemcontext = context_system::instance();
require_capability('moodle/role:manage', $systemcontext);
admin_externalpage_setup('defineroles', '', array('action' => $action, 'roleid' => $roleid), new moodle_url('/admin/roles/define.php'));
// Export role.
if ($action === 'export') {
@@ -200,6 +198,19 @@ if (optional_param('cancel', false, PARAM_BOOL)) {
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey() && $definitiontable->is_submission_valid()) {
$definitiontable->save_changes();
$tableroleid = $definitiontable->get_role_id();
// Trigger event.
$event = \core\event\role_capabilities_updated::create(
array(
'context' => $systemcontext,
'objectid' => $tableroleid
)
);
$event->set_legacy_logdata(array(SITEID, 'role', $action, 'admin/roles/define.php?action=view&roleid=' . $tableroleid,
$definitiontable->get_role_name(), '', $USER->id));
if (!empty($role)) {
$event->add_record_snapshot('role', $role);
}
$event->trigger();
if ($action === 'add') {
redirect(new moodle_url('/admin/roles/define.php', array('action'=>'view', 'roleid'=>$definitiontable->get_role_id())));
+1 -2
View File
@@ -46,11 +46,10 @@ if ($action) {
$baseurl = $CFG->wwwroot . '/' . $CFG->admin . '/roles/manage.php';
$defineurl = $CFG->wwwroot . '/' . $CFG->admin . '/roles/define.php';
admin_externalpage_setup('defineroles');
// Check access permissions.
$systemcontext = context_system::instance();
require_capability('moodle/role:manage', $systemcontext);
admin_externalpage_setup('defineroles');
// Get some basic data we are going to need.
$roles = role_fix_names(get_all_roles(), $systemcontext, ROLENAME_ORIGINAL);
+1 -1
View File
@@ -51,7 +51,7 @@ M.core_role.init_cap_table_filter = function(Y, tableid, contextid) {
marginRight : 'auto'
});
// Create the capability search input.
this.input = Y.Node.create('<input class="form-control mx-1" type="text"' +
this.input = Y.Node.create('<input class="form-control m-x-1" type="text"' +
' id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
// Create a label for the search input.
this.label = Y.Node.create('<label for="' + this.input.get('id') + '">' +
+16
View File
@@ -134,6 +134,22 @@ $overridestable->read_submitted_permissions();
if (optional_param('savechanges', false, PARAM_BOOL) && confirm_sesskey()) {
$overridestable->save_changes();
$rolename = $overridableroles[$roleid];
// Trigger event.
$event = \core\event\role_capabilities_updated::create(
array(
'context' => $context,
'objectid' => $roleid,
)
);
$event->set_legacy_logdata(
array(
$course->id, 'role', 'override', 'admin/roles/override.php?contextid=' . $context->id . '&roleid=' . $roleid,
$rolename, '', $USER->id
)
);
$event->add_record_snapshot('role', $role);
$event->trigger();
redirect($returnurl);
}
+1 -1
View File
@@ -213,7 +213,7 @@ $arguments = array('contextid' => $contextid,
$PAGE->requires->strings_for_js(
array('roleprohibitinfo', 'roleprohibitheader', 'roleallowinfo', 'roleallowheader',
'confirmunassigntitle', 'confirmroleunprohibit', 'confirmroleprevent', 'confirmunassignyes',
'confirmunassignno', 'deletexrole'), 'core_role');
'confirmunassignno'), 'core_role');
$PAGE->requires->js_call_amd('core/permissionmanager', 'initialize', array($arguments));
$table = new core_role_permissions_table($context, $contextname, $allowoverrides, $allowsafeoverrides, $overridableroles);
echo $OUTPUT->box_start('generalbox capbox');
+1 -1
View File
@@ -45,7 +45,7 @@ $PAGE->set_pagelayout('admin');
// Check login and permissions.
if ($course->id == SITEID) {
require_login(null, false);
require_login();
$PAGE->set_context($usercontext);
} else {
require_login($course);
-9
View File
@@ -153,7 +153,6 @@ $table = new html_table();
$table->id = 'core-search-areas';
$table->head = [
get_string('searcharea', 'search'),
get_string('searchareacategories', 'search'),
get_string('enable'),
get_string('newestdocindexed', 'admin'),
get_string('searchlastrun', 'admin'),
@@ -166,14 +165,6 @@ foreach ($searchareas as $area) {
$areaid = $area->get_area_id();
$columns = array(new html_table_cell($area->get_visible_name()));
$areacategories = [];
foreach (\core_search\manager::get_search_area_categories() as $category) {
if (key_exists($areaid, $category->get_areas())) {
$areacategories[] = $category->get_visiblename();
}
}
$columns[] = new html_table_cell(implode(', ', $areacategories));
if ($area->is_enabled()) {
$columns[] = $OUTPUT->action_icon(admin_searcharea_action_url('disable', $areaid),
new pix_icon('t/hide', get_string('disable'), 'moodle', array('title' => '', 'class' => 'iconsmall')),
-7
View File
@@ -156,11 +156,4 @@ $PAGE->requires->yui_module('moodle-core-formchangechecker',
);
$PAGE->requires->string_for_js('changesmadereallygoaway', 'moodle');
if ($settingspage->has_dependencies()) {
$opts = [
'dependencies' => $settingspage->get_dependencies_for_javascript()
];
$PAGE->requires->js_call_amd('core/showhidesettings', 'init', [$opts]);
}
echo $OUTPUT->footer();
+12 -50
View File
@@ -24,53 +24,11 @@
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig && \core_analytics\manager::is_analytics_enabled()) {
$settings = new admin_settingpage('analyticssite', new lang_string('analyticssiteinfo', 'analytics'));
$ADMIN->add('analytics', $settings);
if ($ADMIN->fulltree) {
$modeinstructions = [
'facetoface' => get_string('modeinstructionfacetoface', 'analytics'),
'blendedhybrid' => get_string('modeinstructionblendedhybrid', 'analytics'),
'fullyonline' => get_string('modeinstructionfullyonline', 'analytics'),
];
$settings->add(new admin_setting_configmultiselect('analytics/modeinstruction', get_string('modeinstruction', 'analytics'),
'', [], $modeinstructions));
$settings->add(new admin_setting_configtext_with_maxlength('analytics/percentonline',
get_string('percentonline', 'analytics'),
get_string('percentonline_help', 'analytics'), '', PARAM_INT, 3, 3));
$typeinstitutions = [
'typeinstitutionacademic' => get_string('typeinstitutionacademic', 'analytics'),
'typeinstitutiontraining' => get_string('typeinstitutiontraining', 'analytics'),
'typeinstitutionngo' => get_string('typeinstitutionngo', 'analytics'),
];
$settings->add(new admin_setting_configmultiselect('analytics/typeinstitution', get_string('typeinstitution', 'analytics'),
'', [], $typeinstitutions));
$levelinstitutions = [
'levelinstitutionisced0' => get_string('levelinstitutionisced0', 'analytics'),
'levelinstitutionisced1' => get_string('levelinstitutionisced1', 'analytics'),
'levelinstitutionisced2' => get_string('levelinstitutionisced2', 'analytics'),
'levelinstitutionisced3' => get_string('levelinstitutionisced3', 'analytics'),
'levelinstitutionisced4' => get_string('levelinstitutionisced4', 'analytics'),
'levelinstitutionisced5' => get_string('levelinstitutionisced5', 'analytics'),
'levelinstitutionisced6' => get_string('levelinstitutionisced6', 'analytics'),
'levelinstitutionisced7' => get_string('levelinstitutionisced7', 'analytics'),
'levelinstitutionisced8' => get_string('levelinstitutionisced8', 'analytics'),
];
$settings->add(new admin_setting_configmultiselect('analytics/levelinstitution',
get_string('levelinstitution', 'analytics'), '', [], $levelinstitutions));
}
if ($hassiteconfig) {
$settings = new admin_settingpage('analyticssettings', new lang_string('analyticssettings', 'analytics'));
$ADMIN->add('analytics', $settings);
if ($ADMIN->fulltree) {
// Select the site prediction's processor.
$predictionprocessors = \core_analytics\manager::get_all_prediction_processors();
$predictors = array();
@@ -117,7 +75,7 @@ if ($hassiteconfig && \core_analytics\manager::is_analytics_enabled()) {
$defaultreader, $options));
// Enable/disable time splitting methods.
$alltimesplittings = \core_analytics\manager::get_time_splitting_methods_for_evaluation(true);
$alltimesplittings = \core_analytics\manager::get_all_time_splittings();
$timesplittingoptions = array();
$timesplittingdefaults = array('\core\analytics\time_splitting\quarters_accum',
@@ -125,16 +83,20 @@ if ($hassiteconfig && \core_analytics\manager::is_analytics_enabled()) {
foreach ($alltimesplittings as $key => $timesplitting) {
$timesplittingoptions[$key] = $timesplitting->get_name();
}
$settings->add(new admin_setting_configmultiselect('analytics/defaulttimesplittingsevaluation',
new lang_string('defaulttimesplittingmethods', 'analytics'),
new lang_string('defaulttimesplittingmethods_help', 'analytics'),
$settings->add(new admin_setting_configmultiselect('analytics/timesplittings',
new lang_string('enabledtimesplittings', 'analytics'), new lang_string('timesplittingmethod_help', 'analytics'),
$timesplittingdefaults, $timesplittingoptions)
);
// Predictions processor output dir - specify default in setting description (used if left blank).
$defaultmodeloutputdir = \core_analytics\model::default_output_dir();
// Predictions processor output dir.
$defaultmodeloutputdir = rtrim($CFG->dataroot, '/') . DIRECTORY_SEPARATOR . 'models';
if (empty(get_config('analytics', 'modeloutputdir')) && !file_exists($defaultmodeloutputdir) &&
is_writable($defaultmodeloutputdir)) {
// Automatically create the dir for them so users don't see the invalid value red cross.
mkdir($defaultmodeloutputdir, $CFG->directorypermissions, true);
}
$settings->add(new admin_setting_configdirectory('analytics/modeloutputdir', new lang_string('modeloutputdir', 'analytics'),
new lang_string('modeloutputdirwithdefaultinfo', 'analytics', $defaultmodeloutputdir), ''));
new lang_string('modeloutputdirinfo', 'analytics'), $defaultmodeloutputdir));
// Disable web interface evaluation and get predictions.
$settings->add(new admin_setting_configcheckbox('analytics/onlycli', new lang_string('onlycli', 'analytics'),
+1 -34
View File
@@ -25,12 +25,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
$temp->add(new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'), new lang_string('configallowcohortthemes', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), new lang_string('configallowthemechangeonurl', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('langmenuinsecurelayout',
new lang_string('langmenuinsecurelayout', 'admin'),
new lang_string('langmenuinsecurelayout_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('logininfoinsecurelayout',
new lang_string('logininfoinsecurelayout', 'admin'),
new lang_string('logininfoinsecurelayout_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowblockstodock', new lang_string('allowblockstodock', 'admin'), new lang_string('configallowblockstodock', 'admin'), 1));
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'),
new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
$temp->add(new admin_setting_configtextarea(
@@ -82,24 +77,6 @@ preferences,moodle|/user/preferences.php|t/preferences',
$ADMIN->add('appearance', $temp);
// Course colours section.
$temp = new admin_settingpage('coursecolors', new lang_string('coursecolorsettings', 'admin'));
$temp->add(new admin_setting_heading('coursecolorheading', '',
new lang_string('coursecolorheading_desc', 'admin')));
$basecolors = ['#81ecec', '#74b9ff', '#a29bfe', '#dfe6e9', '#00b894',
'#0984e3', '#b2bec3', '#fdcb6e', '#fd79a8', '#6c5ce7'];
foreach ($basecolors as $key => $color) {
$number = $key + 1;
$name = 'core_admin/coursecolor' . $number;
$title = get_string('coursecolor', 'admin', $number);
$setting = new admin_setting_configcolourpicker($name, $title, '', $color);
$temp->add($setting);
}
$ADMIN->add('appearance', $temp);
// Calendar settings.
$temp = new admin_settingpage('calendar', new lang_string('calendarsettings','admin'));
@@ -203,10 +180,6 @@ preferences,moodle|/user/preferences.php|t/preferences',
'idnumber' => new lang_string('sort_idnumber', 'admin'),
);
$temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
$temp->add(new admin_setting_configcheckbox('navsortmycourseshiddenlast',
new lang_string('navsortmycourseshiddenlast', 'admin'),
new lang_string('navsortmycourseshiddenlast_help', 'admin'),
1));
$temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
@@ -285,10 +258,4 @@ preferences,moodle|/user/preferences.php|t/preferences',
$temp->add(new admin_setting_configtextarea('additionalhtmlfooter', new lang_string('additionalhtmlfooter', 'admin'), new lang_string('additionalhtmlfooter_desc', 'admin'), '', PARAM_RAW));
$ADMIN->add('appearance', $temp);
$setting = new admin_setting_configcheckbox('cachetemplates', new lang_string('cachetemplates', 'admin'),
new lang_string('cachetemplates_help', 'admin'), 1);
$setting->set_updatedcallback('template_reset_all_caches');
$temp = new admin_settingpage('templates', new lang_string('templates', 'admin'));
$temp->add($setting);
$ADMIN->add('appearance', $temp);
} // end of speedup
+3 -30
View File
@@ -57,15 +57,9 @@ if (($hassiteconfig || has_any_capability(array(
new lang_string('badgesalt_desc', 'badges'),
'badges' . $SITE->timecreated, PARAM_ALPHANUM));
$backpacks = badges_get_site_backpacks();
$choices = array();
$defaultchoice = 0;
foreach ($backpacks as $backpack) {
$choices[$backpack->id] = $backpack->backpackweburl;
if ($backpack->backpackweburl == BADGRIO_BACKPACKWEBURL) {
$defaultchoice = $backpack->id;
}
}
$globalsettings->add(new admin_setting_configcheckbox('badges_allowexternalbackpack',
new lang_string('allowexternalbackpack', 'badges'),
new lang_string('allowexternalbackpack_desc', 'badges'), 1));
$globalsettings->add(new admin_setting_configcheckbox('badges_allowcoursebadges',
new lang_string('allowcoursebadges', 'badges'),
@@ -97,25 +91,4 @@ if (($hassiteconfig || has_any_capability(array(
array('moodle/badges:createbadge'), empty($CFG->enablebadges)
)
);
$backpacksettings = new admin_settingpage('backpacksettings', new lang_string('backpacksettings', 'badges'),
array('moodle/badges:manageglobalsettings'), empty($CFG->enablebadges));
$backpacksettings->add(new admin_setting_configcheckbox('badges_allowexternalbackpack',
new lang_string('allowexternalbackpack', 'badges'),
new lang_string('allowexternalbackpack_desc', 'badges'), 1));
$backpacksettings->add(new admin_setting_configselect('badges_site_backpack',
new lang_string('sitebackpack', 'badges'),
new lang_string('sitebackpack_help', 'badges'),
$defaultchoice, $choices));
$ADMIN->add('badges', $backpacksettings);
$ADMIN->add('badges',
new admin_externalpage('managebackpacks',
new lang_string('managebackpacks', 'badges'),
new moodle_url('/badges/backpacks.php'),
array('moodle/badges:manageglobalsettings'), empty($CFG->enablebadges) || empty($CFG->badges_allowexternalbackpack)
)
);
}
+4 -99
View File
@@ -37,12 +37,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
array('moodle/category:manage', 'moodle/course:create')
)
);
$ADMIN->add('courses',
new admin_externalpage('course_customfield', new lang_string('course_customfield', 'admin'),
$CFG->wwwroot . '/course/customfield.php',
array('moodle/course:configurecustomfields')
)
);
$ADMIN->add('courses',
new admin_externalpage('addcategory', new lang_string('addcategory', 'admin'),
new moodle_url('/course/editcategory.php', array('parent' => 0)),
@@ -163,15 +157,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
new lang_string('enablecourserequests', 'admin'),
new lang_string('configenablecourserequests', 'admin'), 1));
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory',
new lang_string('defaultrequestcategory', 'admin'),
new lang_string('configdefaultrequestcategory', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('lockrequestcategory',
new lang_string('lockrequestcategory', 'admin'),
new lang_string('configlockrequestcategory', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enablecourserequests', new lang_string('enablecourserequests', 'admin'), new lang_string('configenablecourserequests', 'admin'), 0));
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory', new lang_string('defaultrequestcategory', 'admin'), new lang_string('configdefaultrequestcategory', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('requestcategoryselection', new lang_string('requestcategoryselection', 'admin'), new lang_string('configrequestcategoryselection', 'admin'), 0));
$temp->add(new admin_setting_users_with_capability('courserequestnotify', new lang_string('courserequestnotify', 'admin'), new lang_string('configcourserequestnotify2', 'admin'), array(), 'moodle/site:approvecourse'));
$ADMIN->add('courses', $temp);
@@ -181,30 +169,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
}
// 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'));
$temp->add(
new admin_setting_configselect(
'activitychoosertabmode',
new lang_string('activitychoosertabmode', 'course'),
new lang_string('activitychoosertabmode_desc', 'course'),
0,
[
0 => new lang_string('activitychoosertabmodeone', 'course'),
1 => new lang_string('activitychoosertabmodetwo', 'course'),
2 => new lang_string('activitychoosertabmodethree', 'course'),
]
)
);
$ADMIN->add('activitychooser', $temp);
$ADMIN->add('activitychooser',
new admin_externalpage('activitychooserrecommended', new lang_string('activitychooserrecommendations', 'course'),
new moodle_url('/course/recommendations.php'),
array('moodle/course:recommendactivity')
)
);
// Add a category for backups.
$ADMIN->add('courses', new admin_category('backups', new lang_string('backups','admin')));
@@ -236,11 +200,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_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_general_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_general_files',
new lang_string('generalfiles', 'backup'),
new lang_string('configgeneralfiles', 'backup'),
array('value' => '1', 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_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_general_comments', new lang_string('generalcomments','backup'), new lang_string('configgeneralcomments','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_badges', new lang_string('generalbadges','backup'), new lang_string('configgeneralbadges','backup'), array('value'=>1,'locked'=>0)));
@@ -253,11 +212,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_competencies', new lang_string('generalcompetencies','backup'), new lang_string('configgeneralcompetencies','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configgeneralcontentbankcontent', 'backup'),
['value' => 1, 'locked' => 0])
);
$ADMIN->add('backups', $temp);
@@ -279,12 +233,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
new lang_string('generalgroups', 'backup'), new lang_string('configgeneralgroups', 'backup'),
array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_competencies', new lang_string('generalcompetencies','backup'), new lang_string('configgeneralcompetencies','backup'), array('value'=>1, 'locked'=>0)));
$temp->add(new admin_setting_configcheckbox_with_lock(
'backup/backup_import_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configgeneralcontentbankcontent', 'backup'),
['value' => 1, 'locked' => 0])
);
$ADMIN->add('backups', $temp);
@@ -311,8 +259,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$maxkeptoptions = array(
0 => new lang_string('all'), 1 => '1',
2 => '2',
3 => '3',
4 => '4',
5 => '5',
10 => '10',
20 => '20',
@@ -384,15 +330,11 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_skip_modif_prev', new lang_string('skipmodifprev', 'backup'), new lang_string('skipmodifprevhelp', 'backup'), 0));
// Automated defaults section.
$temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), new lang_string('recyclebin_desc', 'backup')));
$temp->add(new admin_setting_heading('automatedsettings', new lang_string('automatedsettings','backup'), ''));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_users', new lang_string('generalusers', 'backup'), new lang_string('configgeneralusers', 'backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_role_assignments', new lang_string('generalroleassignments','backup'), new lang_string('configgeneralroleassignments','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_activities', new lang_string('generalactivities','backup'), new lang_string('configgeneralactivities','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blocks', new lang_string('generalblocks','backup'), new lang_string('configgeneralblocks','backup'), 1));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_auto_files',
new lang_string('generalfiles', 'backup'),
new lang_string('configgeneralfiles', 'backup'), '1'));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_filters', new lang_string('generalfilters','backup'), new lang_string('configgeneralfilters','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_comments', new lang_string('generalcomments','backup'), new lang_string('configgeneralcomments','backup'), 1));
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_badges', new lang_string('generalbadges','backup'), new lang_string('configgeneralbadges','backup'), 1));
@@ -404,12 +346,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$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));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_auto_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configgeneralcontentbankcontent', 'backup'),
1)
);
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
@@ -470,9 +406,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_competencies',
new lang_string('generalcompetencies', 'backup'),
new lang_string('configrestorecompetencies', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configrestorecontentbankcontent', 'backup'), array('value' => 1, 'locked' => 0)));
// Restore defaults when merging into another course.
$temp->add(new admin_setting_heading('mergerestoredefaults', new lang_string('mergerestoredefaults', 'backup'), ''));
@@ -519,32 +452,4 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$ADMIN->add('backups', $temp);
// Create a page for asynchronous backup and restore configuration and defaults.
$temp = new admin_settingpage('asyncgeneralsettings', new lang_string('asyncgeneralsettings', 'backup'));
$temp->add(new admin_setting_configcheckbox('enableasyncbackup', new lang_string('enableasyncbackup', 'backup'),
new lang_string('enableasyncbackup_help', 'backup'), 0, 1, 0));
$temp->add(new admin_setting_configcheckbox(
'backup/backup_async_message_users',
new lang_string('asyncemailenable', 'backup'),
new lang_string('asyncemailenabledetail', 'backup'), 0));
$temp->hide_if('backup/backup_async_message_users', 'enableasyncbackup');
$temp->add(new admin_setting_configtext(
'backup/backup_async_message_subject',
new lang_string('asyncmessagesubject', 'backup'),
new lang_string('asyncmessagesubjectdetail', 'backup'),
new lang_string('asyncmessagesubjectdefault', 'backup')));
$temp->hide_if('backup/backup_async_message_subject', 'backup/backup_async_message_users');
$temp->add(new admin_setting_confightmleditor(
'backup/backup_async_message',
new lang_string('asyncmessagebody', 'backup'),
new lang_string('asyncmessagebodydetail', 'backup'),
new lang_string('asyncmessagebodydefault', 'backup')));
$temp->hide_if('backup/backup_async_message', 'backup/backup_async_message_users');
$ADMIN->add('backups', $temp);
}
+2 -7
View File
@@ -10,6 +10,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp = new admin_settingpage('experimentalsettings', new lang_string('experimentalsettings', 'admin'));
//TODO: Re-enable cc-import once re-implemented in 2.0.x
//$temp->add(new admin_setting_configcheckbox('enableimsccimport', new lang_string('enable_cc_import', 'imscc'), new lang_string('enable_cc_import_description', 'imscc'), 0));
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', new lang_string('enablesafebrowserintegration', 'admin'), new lang_string('configenablesafebrowserintegration', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
@@ -28,17 +29,13 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('forceclean', new lang_string('forceclean', 'core_admin'),
new lang_string('forceclean_desc', 'core_admin'), 0));
// Relative course dates mode setting.
$temp->add(new admin_setting_configcheckbox('enablecourserelativedates',
new lang_string('enablecourserelativedates', 'core_admin'),
new lang_string('enablecourserelativedates_desc', 'core_admin'), 0));
$ADMIN->add('experimental', $temp);
// "debugging" settingpage
$temp = new admin_settingpage('debugging', new lang_string('debugging', 'admin'));
$temp->add(new admin_setting_special_debug());
$temp->add(new admin_setting_configcheckbox('debugdisplay', new lang_string('debugdisplay', 'admin'), new lang_string('configdebugdisplay', 'admin'), ini_get_bool('display_errors')));
$temp->add(new admin_setting_configcheckbox('debugsmtp', new lang_string('debugsmtp', 'admin'), new lang_string('configdebugsmtp', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('perfdebug', new lang_string('perfdebug', 'admin'), new lang_string('configperfdebug', 'admin'), '7', '15', '7'));
$temp->add(new admin_setting_configcheckbox('debugstringids', new lang_string('debugstringids', 'admin'), new lang_string('debugstringids_desc', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('debugvalidators', new lang_string('debugvalidators', 'admin'), new lang_string('configdebugvalidators', 'admin'), 0));
@@ -62,8 +59,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('profilingallowme', new lang_string('profilingallowme', 'admin'), new lang_string('profilingallowme_help', 'admin'), false));
// Allow PROFILEALL/PROFILEALLSTOP GPC.
$temp->add(new admin_setting_configcheckbox('profilingallowall', new lang_string('profilingallowall', 'admin'), new lang_string('profilingallowall_help', 'admin'), false));
$temp->add(new admin_setting_configtext('profilingslow', new lang_string('profilingslow', 'admin'),
new lang_string('profilingslow_help', 'admin'), 0, PARAM_FLOAT));
// TODO: Allow to skip PHP functions (XHPROF_FLAGS_NO_BUILTINS)
// TODO: Allow to skip call_user functions (ignored_functions array)
// Specify the life time (in minutes) of profiling runs.
+1 -1
View File
@@ -58,7 +58,7 @@ if (!during_initial_install()) { //do not use during installation
foreach ($roles as $role) {
if (empty($role->archetype) or $role->archetype === 'guest' or $role->archetype === 'frontpage' or $role->archetype === 'student') {
$options[$role->id] = $role->localname;
if ($role->archetype === 'frontpage' && !$defaultfrontpageroleid) {
if ($role->archetype === 'frontpage') {
$defaultfrontpageroleid = $role->id;
}
}
-44
View File
@@ -1,44 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* H5P settings link.
*
* @package core_h5p
* @copyright 2019 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
// H5P overview.
$ADMIN->add('h5p', new admin_externalpage('h5poverview', get_string('h5poverview', 'core_h5p'),
new moodle_url('/h5p/overview.php'), ['moodle/site:config']));
// Manage H5P libraries page.
$ADMIN->add('h5p', new admin_externalpage('h5pmanagelibraries', get_string('h5pmanage', 'core_h5p'),
new moodle_url('/h5p/libraries.php'), ['moodle/site:config', 'moodle/h5p:updatelibraries']));
// H5P settings.
$defaulth5plib = \core_h5p\local\library\autoloader::get_default_handler_library();
if (!empty($defaulth5plib)) {
// As for now this page only has this setting, it will be hidden if there isn't any H5P libraries handler defined.
$settings = new admin_settingpage('h5psettings', new lang_string('h5psettings', 'core_h5p'));
$ADMIN->add('h5p', $settings);
$settings->add(new admin_settings_h5plib_handler_select('h5plibraryhandler', new lang_string('h5plibraryhandler', 'core_h5p'),
new lang_string('h5plibraryhandler_help', 'core_h5p'), $defaulth5plib));
}
-45
View File
@@ -1,45 +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/>.
/**
* This file defines the settings pages for licenses.
*
* @package core
* @copyright 2020 Tom Dickman <tomdickman@catalyst-au.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/licenselib.php');
if ($hassiteconfig) {
$temp = new admin_settingpage('licensesettings', new lang_string('licensesettings', 'admin'));
$licenses = license_manager::get_active_licenses_as_array();
$temp->add(new admin_setting_configselect('sitedefaultlicense',
new lang_string('configsitedefaultlicense', 'admin'),
new lang_string('configsitedefaultlicensehelp', 'admin'),
'unknown',
$licenses));
$temp->add(new admin_setting_configcheckbox('rememberuserlicensepref',
new lang_string('rememberuserlicensepref', 'admin'),
new lang_string('rememberuserlicensepref_help', 'admin'),
1));
$ADMIN->add('license', $temp);
}
+14 -50
View File
@@ -1,57 +1,21 @@
<?php
// This file is part of Moodle - https://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/>.
/**
* Define administration settings on the Location settings page.
*
* @package core
* @category admin
* @copyright 2006 Martin Dougiamas <martin@moodle.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
defined('MOODLE_INTERNAL') || die();
// "locations" settingpage
$temp = new admin_settingpage('locationsettings', new lang_string('locationsettings', 'admin'));
$temp->add(new admin_setting_servertimezone());
$temp->add(new admin_setting_forcetimezone());
$temp->add(new admin_settings_country_select('country', new lang_string('country', 'admin'), new lang_string('configcountry', 'admin'), 0));
$temp->add(new admin_setting_configtext('defaultcity', new lang_string('defaultcity', 'admin'), new lang_string('defaultcity_help', 'admin'), ''));
if ($hassiteconfig) {
$temp = new admin_settingpage('locationsettings', new lang_string('locationsettings', 'core_admin'));
$temp->add(new admin_setting_heading('iplookup', new lang_string('iplookup', 'admin'), new lang_string('iplookupinfo', 'admin')));
$temp->add(new admin_setting_configfile('geoip2file', new lang_string('geoipfile', 'admin'),
new lang_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLite2-City.mmdb'));
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'admin'), new lang_string('googlemapkey3_help', 'admin'), '', PARAM_RAW, 60));
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_servertimezone());
$temp->add(new admin_setting_forcetimezone());
$temp->add(new admin_settings_country_select('country', new lang_string('country', 'core_admin'),
new lang_string('configcountry', 'core_admin'), 0));
$temp->add(new admin_setting_configtext('defaultcity', new lang_string('defaultcity', 'core_admin'),
new lang_string('defaultcity_help', 'core_admin'), ''));
$temp->add(new admin_setting_heading('iplookup', new lang_string('iplookup', 'core_admin'),
new lang_string('iplookupinfo', 'core_admin')));
$temp->add(new admin_setting_configfile('geoip2file', new lang_string('geoipfile', 'core_admin'),
new lang_string('configgeoipfile', 'core_admin', $CFG->dataroot . '/geoip/'),
$CFG->dataroot . '/geoip/GeoLite2-City.mmdb'));
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'core_admin'),
new lang_string('googlemapkey3_help', 'core_admin'), '', PARAM_RAW, 60));
$temp->add(new admin_setting_countrycodes('allcountrycodes', new lang_string('allcountrycodes', 'core_admin'),
new lang_string('configallcountrycodes', 'core_admin')));
}
$temp->add(new admin_setting_configtext('allcountrycodes', new lang_string('allcountrycodes', 'admin'), new lang_string('configallcountrycodes', 'admin'), '', '/^(?:\w+(?:,\w+)*)?$/'));
$ADMIN->add('location', $temp);
}
} // end of speedup
-78
View File
@@ -1,78 +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/>.
/**
* Adds messaging related settings links for Messaging category to admin tree.
*
* @copyright 2019 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$temp = new admin_settingpage('messages', new lang_string('messagingssettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('messaging',
new lang_string('messaging', 'admin'),
new lang_string('configmessaging', 'admin'),
1));
$temp->add(new admin_setting_configcheckbox('messagingallusers',
new lang_string('messagingallusers', 'admin'),
new lang_string('configmessagingallusers', 'admin'),
0)
);
$temp->add(new admin_setting_configcheckbox('messagingdefaultpressenter',
new lang_string('messagingdefaultpressenter', 'admin'),
new lang_string('configmessagingdefaultpressenter', 'admin'),
1)
);
$options = array(
DAYSECS => new lang_string('secondstotime86400'),
WEEKSECS => new lang_string('secondstotime604800'),
2620800 => new lang_string('nummonths', 'moodle', 1),
7862400 => new lang_string('nummonths', 'moodle', 3),
15724800 => new lang_string('nummonths', 'moodle', 6),
0 => new lang_string('never')
);
$temp->add(new admin_setting_configselect(
'messagingdeletereadnotificationsdelay',
new lang_string('messagingdeletereadnotificationsdelay', 'admin'),
new lang_string('configmessagingdeletereadnotificationsdelay', 'admin'),
604800,
$options)
);
$temp->add(new admin_setting_configselect(
'messagingdeleteallnotificationsdelay',
new lang_string('messagingdeleteallnotificationsdelay', 'admin'),
new lang_string('configmessagingdeleteallnotificationsdelay', 'admin'),
2620800,
$options)
);
$temp->add(new admin_setting_configcheckbox('messagingallowemailoverride',
new lang_string('messagingallowemailoverride', 'admin'),
new lang_string('configmessagingallowemailoverride', 'admin'),
0));
$ADMIN->add('messaging', $temp);
$ADMIN->add('messaging', new admin_page_managemessageoutputs());
// Notification outputs plugins.
$plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\message $plugin */
$plugin->load_settings($ADMIN, 'messaging', $hassiteconfig);
}
}
+24 -54
View File
@@ -59,18 +59,6 @@ if ($hassiteconfig) {
$plugin->load_settings($ADMIN, 'formatsettings', $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);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('customfield');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\customfield $plugin */
$plugin->load_settings($ADMIN, 'customfieldsettings', $hassiteconfig);
}
// blocks
$ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks')));
$ADMIN->add('blocksettings', new admin_page_manageblocks());
@@ -81,6 +69,17 @@ if ($hassiteconfig) {
$plugin->load_settings($ADMIN, 'blocksettings', $hassiteconfig);
}
// message outputs
$ADMIN->add('modules', new admin_category('messageoutputs', new lang_string('messageoutputs', 'message')));
$ADMIN->add('messageoutputs', new admin_page_managemessageoutputs());
$ADMIN->add('messageoutputs', new admin_page_defaultmessageoutputs());
$plugins = core_plugin_manager::instance()->get_plugins_of_type('message');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\message $plugin */
$plugin->load_settings($ADMIN, 'messageoutputs', $hassiteconfig);
}
// authentication plugins
$ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin')));
@@ -175,12 +174,19 @@ if ($hassiteconfig) {
$plugin->load_settings($ADMIN, 'antivirussettings', $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);
/// License types
$ADMIN->add('modules', new admin_category('licensesettings', new lang_string('licenses')));
$temp = new admin_settingpage('managelicenses', new lang_string('managelicenses', 'admin'));
require_once($CFG->libdir . '/licenselib.php');
$licenses = array();
$array = explode(',', $CFG->licenses);
foreach ($array as $value) {
$licenses[$value] = new lang_string($value, 'license');
}
$temp->add(new admin_setting_configselect('sitedefaultlicense', new lang_string('configsitedefaultlicense','admin'), new lang_string('configsitedefaultlicensehelp','admin'), 'allrightsreserved', $licenses));
$temp->add(new admin_setting_managelicenses());
$ADMIN->add('licensesettings', $temp);
/// Filter plugins
$ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters')));
@@ -558,37 +564,14 @@ if ($hassiteconfig) {
$temp->add(new admin_setting_configduration('searchindextime',
new lang_string('searchindextime', 'admin'), new lang_string('searchindextime_desc', 'admin'),
600));
$temp->add(new admin_setting_heading('searchcoursesheading', new lang_string('searchablecourses', 'admin'), ''));
$options = [
0 => new lang_string('searchallavailablecourses_off', 'admin'),
1 => new lang_string('searchallavailablecourses_on', 'admin')
];
$temp->add(new admin_setting_configselect('searchallavailablecourses',
new lang_string('searchallavailablecourses', 'admin'),
new lang_string('searchallavailablecoursesdesc', 'admin'),
new lang_string('searchallavailablecourses_desc', 'admin'),
0, $options));
$temp->add(new admin_setting_configcheckbox('searchincludeallcourses',
new lang_string('searchincludeallcourses', 'admin'), new lang_string('searchincludeallcourses_desc', 'admin'),
0));
// Search display options.
$temp->add(new admin_setting_heading('searchdisplay', new lang_string('searchdisplay', 'admin'), ''));
$temp->add(new admin_setting_configcheckbox('searchenablecategories',
new lang_string('searchenablecategories', 'admin'),
new lang_string('searchenablecategories_desc', 'admin'),
0));
$options = [];
foreach (\core_search\manager::get_search_area_categories() as $category) {
$options[$category->get_name()] = $category->get_visiblename();
}
$temp->add(new admin_setting_configselect('searchdefaultcategory',
new lang_string('searchdefaultcategory', 'admin'),
new lang_string('searchdefaultcategory_desc', 'admin'),
\core_search\manager::SEARCH_AREA_CATEGORY_ALL, $options));
$temp->add(new admin_setting_configcheckbox('searchhideallcategory',
new lang_string('searchhideallcategory', 'admin'),
new lang_string('searchhideallcategory_desc', 'admin'),
0));
$ADMIN->add('searchplugins', $temp);
$ADMIN->add('searchplugins', new admin_externalpage('searchareas', new lang_string('searchareas', 'admin'),
@@ -643,19 +626,6 @@ 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);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('contenttype');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\contentbank $plugin */
$plugin->load_settings($ADMIN, 'contentbanksettings', $hassiteconfig);
}
}
/// Add all local plugins - must be always last!
if ($hassiteconfig) {
$ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
+7 -32
View File
@@ -1,29 +1,4 @@
<?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/>.
/**
* Adds security related settings links for security category to admin tree.
*
* @copyright 1999 Martin Dougiamas http://dougiamas.com
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
use core_admin\local\settings\filesize;
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
@@ -42,7 +17,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('forcelogin', new lang_string('forcelogin', 'admin'), new lang_string('configforcelogin', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', new lang_string('forceloginforprofiles', 'admin'), new lang_string('configforceloginforprofiles', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', new lang_string('forceloginforprofileimage', 'admin'), new lang_string('forceloginforprofileimage_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('opentowebcrawlers', new lang_string('opentowebcrawlers', 'admin'), new lang_string('configopentowebcrawlers', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('opentogoogle', new lang_string('opentogoogle', 'admin'), new lang_string('configopentogoogle', 'admin'), 0));
$temp->add(new admin_setting_configselect('allowindexing', new lang_string('allowindexing', 'admin'), new lang_string('allowindexing_desc', 'admin'),
0,
array(0 => new lang_string('allowindexingexceptlogin', 'admin'),
@@ -61,9 +36,12 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// maxbytes set to 0 will allow the maximum server limit for uploads
$temp->add(new admin_setting_configselect('maxbytes', new lang_string('maxbytes', 'admin'), new lang_string('configmaxbytes', 'admin'), 0, $max_upload_choices));
// 100MB
$defaultuserquota = 100 * filesize::UNIT_MB;
$temp->add(new filesize('userquota', new lang_string('userquota', 'admin'),
new lang_string('userquota_desc', 'admin'), $defaultuserquota));
$defaultuserquota = 104857600;
$params = new stdClass();
$params->bytes = $defaultuserquota;
$params->displaysize = display_size($defaultuserquota);
$temp->add(new admin_setting_configtext('userquota', new lang_string('userquota', 'admin'),
new lang_string('configuserquota', 'admin', $params), $defaultuserquota, PARAM_INT, 30));
$temp->add(new admin_setting_configcheckbox('allowobjectembed', new lang_string('allowobjectembed', 'admin'), new lang_string('configallowobjectembed', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enabletrusttext', new lang_string('enabletrusttext', 'admin'), new lang_string('configenabletrusttext', 'admin'), 0));
@@ -100,9 +78,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configtext('minpasswordupper', new lang_string('minpasswordupper', 'admin'), new lang_string('configminpasswordupper', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('minpasswordnonalphanum', new lang_string('minpasswordnonalphanum', 'admin'), new lang_string('configminpasswordnonalphanum', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_configtext('maxconsecutiveidentchars', new lang_string('maxconsecutiveidentchars', 'admin'), new lang_string('configmaxconsecutiveidentchars', 'admin'), 0, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('passwordpolicycheckonlogin',
new lang_string('passwordpolicycheckonlogin', 'admin'),
new lang_string('configpasswordpolicycheckonlogin', 'admin'), 0));
$temp->add(new admin_setting_configtext('passwordreuselimit',
new lang_string('passwordreuselimit', 'admin'),
+12 -114
View File
@@ -4,6 +4,7 @@
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// "systempaths" settingpage
$temp = new admin_settingpage('systempaths', new lang_string('systempaths','admin'));
$temp->add(new admin_setting_configexecutable('pathtophp', new lang_string('pathtophp', 'admin'),
@@ -44,10 +45,15 @@ $temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandlin
if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) {
$temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'), new lang_string('configdbsessions', 'admin'), 0));
}
$temp->add(new admin_setting_configduration('sessiontimeout', new lang_string('sessiontimeout', 'admin'),
new lang_string('configsessiontimeout', 'admin'), 8 * 60 * 60));
$temp->add(new admin_setting_configselect('sessiontimeout', new lang_string('sessiontimeout', 'admin'), new lang_string('configsessiontimeout', 'admin'), 7200, array(14400 => new lang_string('numhours', '', 4),
10800 => new lang_string('numhours', '', 3),
7200 => new lang_string('numhours', '', 2),
5400 => new lang_string('numhours', '', '1.5'),
3600 => new lang_string('numminutes', '', 60),
2700 => new lang_string('numminutes', '', 45),
1800 => new lang_string('numminutes', '', 30),
900 => new lang_string('numminutes', '', 15),
300 => new lang_string('numminutes', '', 5))));
$temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'), new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
$temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'), new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'), new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
@@ -92,10 +98,7 @@ $options = array(
GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
$temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'),
new lang_string('configgetremoteaddrconf', 'admin'),
GETREMOTEADDR_SKIP_DEFAULT, $options));
$temp->add(new admin_setting_configtext('reverseproxyignore', new lang_string('reverseproxyignore', 'admin'), new lang_string('configreverseproxyignore', 'admin'), ''));
$temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'), new lang_string('configgetremoteaddrconf', 'admin'), 0, $options));
$temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'), new lang_string('webproxyinfo', 'admin')));
$temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'), new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
@@ -170,15 +173,10 @@ $temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_stri
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_configduration('filescleanupperiod',
new lang_string('filescleanupperiod', 'admin'),
new lang_string('filescleanupperiod_help', 'admin'),
86400));
$ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
$ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
$ADMIN->add('server', new admin_externalpage('testoutgoingmailconf', new lang_string('testoutgoingmailconf', 'admin'),
new moodle_url("$CFG->wwwroot/$CFG->admin/testoutgoingmailconf.php"), 'moodle/site:config', true));
// "performance" settingpage
@@ -214,100 +212,6 @@ $temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('
$ADMIN->add('server', $temp);
$ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
$temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing','admin'));
$temp->add(
new admin_setting_configtext(
'task_scheduled_concurrency_limit',
new lang_string('task_scheduled_concurrency_limit', 'admin'),
new lang_string('task_scheduled_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
$temp->add(
new admin_setting_configduration(
'task_scheduled_max_runtime',
new lang_string('task_scheduled_max_runtime', 'admin'),
new lang_string('task_scheduled_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$temp->add(
new admin_setting_configtext(
'task_adhoc_concurrency_limit',
new lang_string('task_adhoc_concurrency_limit', 'admin'),
new lang_string('task_adhoc_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
$temp->add(
new admin_setting_configduration(
'task_adhoc_max_runtime',
new lang_string('task_adhoc_max_runtime', 'admin'),
new lang_string('task_adhoc_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$ADMIN->add('taskconfig', $temp);
$temp = new admin_settingpage('tasklogging', new lang_string('tasklogging','admin'));
$temp->add(
new admin_setting_configselect(
'task_logmode',
new lang_string('task_logmode', 'admin'),
new lang_string('task_logmode_desc', 'admin'),
\core\task\logmanager::MODE_ALL,
[
\core\task\logmanager::MODE_ALL => new lang_string('task_logmode_all', 'admin'),
\core\task\logmanager::MODE_FAILONLY => new lang_string('task_logmode_failonly', 'admin'),
\core\task\logmanager::MODE_NONE => new lang_string('task_logmode_none', 'admin'),
]
)
);
$temp->add(
new admin_setting_configcheckbox(
'task_logtostdout',
new lang_string('task_logtostdout', 'admin'),
new lang_string('task_logtostdout_desc', 'admin'),
1
)
);
if (\core\task\logmanager::uses_standard_settings()) {
$temp->add(
new admin_setting_configduration(
'task_logretention',
new \lang_string('task_logretention', 'admin'),
new \lang_string('task_logretention_desc', 'admin'),
28 * DAYSECS
)
);
$temp->add(
new admin_setting_configtext(
'task_logretainruns',
new \lang_string('task_logretainruns', 'admin'),
new \lang_string('task_logretainruns_desc', 'admin'),
20,
PARAM_INT
)
);
}
$ADMIN->add('taskconfig', $temp);
if (\core\task\logmanager::uses_standard_settings()) {
$ADMIN->add('taskconfig', new admin_externalpage(
'tasklogs',
new lang_string('tasklogs','admin'),
"{$CFG->wwwroot}/{$CFG->admin}/tasklogs.php"
));
}
// E-mail settings.
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
@@ -337,10 +241,6 @@ $temp->add(new admin_setting_configtextarea('allowedemaildomains',
new lang_string('allowedemaildomains', 'admin'),
new lang_string('configallowedemaildomains', 'admin'),
''));
$url = new moodle_url('/admin/testoutgoingmailconf.php');
$link = html_writer::link($url, get_string('testoutgoingmailconf', 'admin'));
$temp->add(new admin_setting_heading('testoutgoinmailc', new lang_string('testoutgoingmailconf', 'admin'),
new lang_string('testoutgoingmaildetail', 'admin', $link)));
$temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
new lang_string('doesnotfitdetail', 'admin')));
$charsets = get_list_of_charsets();
@@ -363,8 +263,6 @@ $choices = array(new lang_string('never', 'admin'),
new lang_string('onlynoreply', 'admin'));
$temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
new lang_string('configemailfromvia', 'admin'), 1, $choices));
$temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
new lang_string('configemailsubjectprefix', 'admin'), '', PARAM_RAW));
$ADMIN->add('email', $temp);
+33 -26
View File
@@ -13,6 +13,39 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$optionalsubsystems->add(new admin_setting_configcheckbox('enablewebservices', new lang_string('enablewebservices', 'admin'), new lang_string('configenablewebservices', 'admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('messaging', new lang_string('messaging', 'admin'), new lang_string('configmessaging','admin'), 1));
$optionalsubsystems->add(new admin_setting_configcheckbox('messagingallusers',
new lang_string('messagingallusers', 'admin'),
new lang_string('configmessagingallusers', 'admin'),
0)
);
$options = array(
DAYSECS => new lang_string('secondstotime86400'),
WEEKSECS => new lang_string('secondstotime604800'),
2620800 => new lang_string('nummonths', 'moodle', 1),
7862400 => new lang_string('nummonths', 'moodle', 3),
15724800 => new lang_string('nummonths', 'moodle', 6),
0 => new lang_string('never')
);
$optionalsubsystems->add(new admin_setting_configselect(
'messagingdeletereadnotificationsdelay',
new lang_string('messagingdeletereadnotificationsdelay', 'admin'),
new lang_string('configmessagingdeletereadnotificationsdelay', 'admin'),
604800,
$options)
);
$optionalsubsystems->add(new admin_setting_configselect(
'messagingdeleteallnotificationsdelay',
new lang_string('messagingdeleteallnotificationsdelay', 'admin'),
new lang_string('configmessagingdeleteallnotificationsdelay', 'admin'),
2620800,
$options)
);
$optionalsubsystems->add(new admin_setting_configcheckbox('messagingallowemailoverride', new lang_string('messagingallowemailoverride', 'admin'), new lang_string('configmessagingallowemailoverride','admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablestats', new lang_string('enablestats', 'admin'), new lang_string('configenablestats', 'admin'), 0));
$optionalsubsystems->add(new admin_setting_configcheckbox('enablerssfeeds', new lang_string('enablerssfeeds', 'admin'), new lang_string('configenablerssfeeds', 'admin'), 0));
@@ -48,30 +81,4 @@ 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));
$optionalsubsystems->add(new admin_setting_configcheckbox('enableanalytics', new lang_string('enableanalytics', 'admin'),
new lang_string('configenableanalytics', 'admin'), 1, 1, 0));
$fullunicodesupport = true;
if ($DB->get_dbfamily() == 'mysql') {
$collation = $DB->get_dbcollation();
$collationinfo = explode('_', $collation);
$charset = reset($collationinfo);
$fullunicodesupport = $charset === 'utf8mb4';
}
if ($fullunicodesupport) {
$optionalsubsystems->add(new admin_setting_configcheckbox(
'allowemojipicker',
new lang_string('allowemojipicker', 'admin'),
new lang_string('configallowemojipicker', 'admin'),
1
));
} else {
$optionalsubsystems->add(new admin_setting_description(
'allowemojipicker',
new lang_string('allowemojipicker', 'admin'),
new lang_string('configallowemojipickerincompatible', 'admin')
));
}
}
-6
View File
@@ -20,9 +20,6 @@ $moodleservices = new admin_settingpage('moodleservices', new lang_string('moodl
'admin'));
$ADMIN->add('root', $moodleservices);
$userfeedback = new admin_settingpage('userfeedback', new lang_string('feedbacksettings', 'admin'));
$ADMIN->add('root', $userfeedback);
if ($hassiteconfig) {
$optionalsubsystems = new admin_settingpage('optionalsubsystems', new lang_string('advancedfeatures', 'admin'));
$ADMIN->add('root', $optionalsubsystems);
@@ -34,11 +31,8 @@ $ADMIN->add('root', new admin_category('grades', new lang_string('grades')));
$ADMIN->add('root', new admin_category('analytics', new lang_string('analytics', 'analytics')));
$ADMIN->add('root', new admin_category('competencies', new lang_string('competencies', 'core_competency')));
$ADMIN->add('root', new admin_category('badges', new lang_string('badges'), empty($CFG->enablebadges)));
$ADMIN->add('root', new admin_category('h5p', new lang_string('h5p', 'core_h5p')));
$ADMIN->add('root', new admin_category('license', new lang_string('license')));
$ADMIN->add('root', new admin_category('location', new lang_string('location','admin')));
$ADMIN->add('root', new admin_category('language', new lang_string('language')));
$ADMIN->add('root', new admin_category('messaging', new lang_string('messagingcategory', 'admin')));
$ADMIN->add('root', new admin_category('modules', new lang_string('plugins', 'admin')));
$ADMIN->add('root', new admin_category('security', new lang_string('security','admin')));
$ADMIN->add('root', new admin_category('appearance', new lang_string('appearance','admin')));
-49
View File
@@ -1,49 +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/>.
/**
* This file contains call to feedback settings
*
* @package core
* @copyright 2020 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
if ($hassiteconfig) {
$userfeedback->add(new admin_setting_configcheckbox('enableuserfeedback',
new lang_string('enableuserfeedback', 'admin'),
new lang_string('enableuserfeedback_desc', 'admin'), 0, 1, 0));
$options = [
core_userfeedback::REMIND_AFTER_UPGRADE => new lang_string('userfeedbackafterupgrade', 'admin'),
core_userfeedback::REMIND_PERIODICALLY => new lang_string('userfeedbackperiodically', 'admin'),
core_userfeedback::REMIND_NEVER => new lang_string('never'),
];
$userfeedback->add(new admin_setting_configselect('userfeedback_nextreminder',
new lang_string('userfeedbacknextreminder', 'admin'),
new lang_string('userfeedbacknextreminder_desc', 'admin'), 1, $options));
$userfeedback->hide_if('userfeedback_nextreminder', 'enableuserfeedback');
$userfeedback->add(new admin_setting_configtext('userfeedback_remindafter',
new lang_string('userfeedbackremindafter', 'admin'),
new lang_string('userfeedbackremindafter_desc', 'admin'), 90, PARAM_INT));
$userfeedback->hide_if('userfeedback_remindafter', 'enableuserfeedback');
$userfeedback->hide_if('userfeedback_remindafter', 'userfeedback_nextreminder', 'eq', 3);
}
+11 -61
View File
@@ -1,6 +1,6 @@
<?php
// This file defines settingpages and externalpages under the "users" category.
// This file defines settingpages and externalpages under the "users" category
$ADMIN->add('users', new admin_category('accounts', new lang_string('accounts', 'admin')));
$ADMIN->add('users', new admin_category('roles', new lang_string('permissions', 'role')));
@@ -13,47 +13,15 @@ if ($hassiteconfig
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.
or has_capability('moodle/cohort:view', $systemcontext)) { // speedup for non-admins, add all caps used on this page
// Stuff under the "accounts" subcategory.
// stuff under the "accounts" subcategory
$ADMIN->add('accounts', new admin_externalpage('editusers', new lang_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('userbulk', new lang_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$CFG->wwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
// User management settingpage.
$temp = new admin_settingpage('usermanagement', new lang_string('usermanagement', 'admin'));
if ($ADMIN->fulltree) {
$choices = array();
$choices['realname'] = new lang_string('fullnameuser');
$choices['lastname'] = new lang_string('lastname');
$choices['firstname'] = new lang_string('firstname');
$choices['username'] = new lang_string('username');
$choices['email'] = new lang_string('email');
$choices['city'] = new lang_string('city');
$choices['country'] = new lang_string('country');
$choices['confirmed'] = new lang_string('confirmed', 'admin');
$choices['suspended'] = new lang_string('suspended', 'auth');
$choices['profile'] = new lang_string('profilefields', 'admin');
$choices['courserole'] = new lang_string('courserole', 'filters');
$choices['anycourses'] = new lang_string('anycourses', 'filters');
$choices['systemrole'] = new lang_string('globalrole', 'role');
$choices['cohort'] = new lang_string('idnumber', 'core_cohort');
$choices['firstaccess'] = new lang_string('firstaccess', 'filters');
$choices['lastaccess'] = new lang_string('lastaccess');
$choices['neveraccessed'] = new lang_string('neveraccessed', 'filters');
$choices['timemodified'] = new lang_string('lastmodified');
$choices['nevermodified'] = new lang_string('nevermodified', 'filters');
$choices['auth'] = new lang_string('authentication');
$choices['idnumber'] = new lang_string('idnumber');
$choices['lastip'] = new lang_string('lastip');
$choices['mnethostid'] = new lang_string('mnetidprovider', 'mnet');
$temp->add(new admin_setting_configmultiselect('userfiltersdefault', new lang_string('userfiltersdefault', 'admin'),
new lang_string('userfiltersdefault_desc', 'admin'), array('realname'), $choices));
}
$ADMIN->add('accounts', $temp);
// User default preferences settingpage.
// "User default preferences" settingpage.
$temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin'));
if ($ADMIN->fulltree) {
$choices = array();
@@ -94,9 +62,9 @@ if ($hassiteconfig
$ADMIN->add('accounts', new admin_externalpage('cohorts', new lang_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
// Stuff under the "roles" subcategory.
// stuff under the "roles" subcategory
// User policies settingpage.
// "userpolicies" settingpage
$temp = new admin_settingpage('userpolicies', new lang_string('userpolicies', 'admin'));
if ($ADMIN->fulltree) {
if (!during_initial_install()) {
@@ -170,7 +138,7 @@ if ($hassiteconfig
$temp->add(new admin_setting_configselect('restorernewroleid', new lang_string('restorernewroleid', 'admin'),
new lang_string('restorernewroleid_help', 'admin'), $defaultteacherid, $restorersnewrole));
// Release memory.
// release memory
unset($otherroles);
unset($guestroles);
unset($userroles);
@@ -186,7 +154,6 @@ if ($hassiteconfig
'email' => new lang_string('email'),
'city' => new lang_string('city'),
'country' => new lang_string('country'),
'moodlenetprofile' => new lang_string('moodlenetprofile', 'user'),
'timezone' => new lang_string('timezone'),
'webpage' => new lang_string('webpage'),
'icqnumber' => new lang_string('icqnumber'),
@@ -207,11 +174,12 @@ if ($hassiteconfig
// Options include fields from the user table that might be helpful to
// distinguish when adding or listing users ('I want to add the John
// Smith from Science faculty').
// Username is not included as an option because in some sites, it might
// be a security problem to reveal usernames even to trusted staff.
// Custom user profile fields are not currently supported.
$temp->add(new admin_setting_configmulticheckbox('showuseridentity',
new lang_string('showuseridentity', 'admin'),
new lang_string('showuseridentity_desc', 'admin'), array('email' => 1), array(
'username' => new lang_string('username'),
'idnumber' => new lang_string('idnumber'),
'email' => new lang_string('email'),
'phone1' => new lang_string('phone1'),
@@ -242,7 +210,7 @@ if ($hassiteconfig
$ADMIN->add('roles', new admin_externalpage('assignroles', new lang_string('assignglobalroles', 'role'), "$CFG->wwwroot/$CFG->admin/roles/assign.php?contextid=".$systemcontext->id, 'moodle/role:assign'));
$ADMIN->add('roles', new admin_externalpage('checkpermissions', new lang_string('checkglobalpermissions', 'role'), "$CFG->wwwroot/$CFG->admin/roles/check.php?contextid=".$systemcontext->id, array('moodle/role:assign', 'moodle/role:safeoverride', 'moodle/role:override', 'moodle/role:manage')));
} // End of speedup.
} // end of speedup
// Privacy settings.
if ($hassiteconfig) {
@@ -261,28 +229,10 @@ if ($hassiteconfig) {
$temp->add($setting);
// See {@link https://gdpr-info.eu/art-8-gdpr/}.
// See {@link https://www.betterinternetforkids.eu/web/portal/practice/awareness/detail?articleId=3017751}.
$ageofdigitalconsentmap = implode(PHP_EOL, [
'*, 16',
'AT, 14',
'BE, 13',
'BG, 14',
'CY, 14',
'CZ, 15',
'DK, 13',
'EE, 13',
'ES, 14',
'FI, 13',
'FR, 15',
'GB, 13',
'GR, 15',
'IT, 14',
'LT, 14',
'LV, 13',
'MT, 13',
'NO, 13',
'PT, 13',
'SE, 13',
'US, 13'
]);
$setting = new admin_setting_agedigitalconsentmap('agedigitalconsentmap',
@@ -305,4 +255,4 @@ if ($hassiteconfig) {
new lang_string('sitepolicyguest_help', 'core_admin'), (isset($CFG->sitepolicy) ? $CFG->sitepolicy : ''), PARAM_RAW));
$ADMIN->add('privacy', $temp);
}
}
-95
View File
@@ -1,95 +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/>.
/**
* Task log.
*
* @package admin
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once("{$CFG->libdir}/adminlib.php");
require_once("{$CFG->libdir}/tablelib.php");
require_once("{$CFG->libdir}/filelib.php");
$filter = optional_param('filter', '', PARAM_RAW);
$result = optional_param('result', null, PARAM_INT);
$pageurl = new \moodle_url('/admin/tasklogs.php');
$pageurl->param('filter', $filter);
$pageurl->param('result', $result);
$PAGE->set_url($pageurl);
$PAGE->set_context(context_system::instance());
$PAGE->set_pagelayout('admin');
$strheading = get_string('tasklogs', 'tool_task');
$PAGE->set_title($strheading);
$PAGE->set_heading($strheading);
admin_externalpage_setup('tasklogs');
$logid = optional_param('logid', null, PARAM_INT);
$download = optional_param('download', false, PARAM_BOOL);
if (null !== $logid) {
// Raise memory limit in case the log is large.
raise_memory_limit(MEMORY_HUGE);
$log = $DB->get_record('task_log', ['id' => $logid], '*', MUST_EXIST);
if ($download) {
$filename = str_replace('\\', '_', $log->classname) . "-{$log->id}.log";
header("Content-Disposition: attachment; filename=\"{$filename}\"");
}
readstring_accel($log->output, 'text/plain');
exit;
}
$renderer = $PAGE->get_renderer('tool_task');
echo $OUTPUT->header();
// Output the search form.
echo $OUTPUT->render_from_template('core_admin/tasklogs', (object) [
'action' => $pageurl->out(),
'filter' => htmlentities($filter),
'resultfilteroptions' => [
(object) [
'value' => -1,
'title' => get_string('all'),
'selected' => (-1 === $result),
],
(object) [
'value' => 0,
'title' => get_string('success'),
'selected' => (0 === $result),
],
(object) [
'value' => 1,
'title' => get_string('task_result:failed', 'admin'),
'selected' => (1 === $result),
],
],
]);
// Output any matching logs.
$table = new \core_admin\task_log_table($filter, $result);
$table->baseurl = $pageurl;
$table->out(100, false);
echo $OUTPUT->footer();
+15 -46
View File
@@ -29,7 +29,6 @@
* element - The Element HTML
* forceltr - Force this element to be displayed LTR
* default - Default value
* dependenton - optional message listing the settings this one is dependent on
Example context (json):
{
@@ -44,57 +43,27 @@
"default": "Default value"
}
}}
{{!
Setting.
}}
<div class="form-item row" id="{{id}}">
<div class="form-label col-sm-3 text-sm-right">
{{#customcontrol}}
<p {{#labelfor}}id="{{labelfor}}_label"{{/labelfor}}>
{{{title}}}
{{#override}}
<div class="alert alert-info">{{override}}</div>
{{/override}}
{{#warning}}
<div class="alert alert-warning">{{warning}}</div>
{{/warning}}
</p>
{{/customcontrol}}
{{^customcontrol}}
<label {{#labelfor}}for="{{labelfor}}"{{/labelfor}}>
{{{title}}}
{{#override}}
<div class="alert alert-info">{{override}}</div>
{{/override}}
{{#warning}}
<div class="alert alert-warning">{{warning}}</div>
{{/warning}}
</label>
{{/customcontrol}}
<span class="form-shortname d-block small text-muted">{{{name}}}</span>
<div class="form-item clearfix" id="{{id}}">
<div class="form-label">
<label {{#labelfor}}for="{{labelfor}}"{{/labelfor}}>
{{{title}}}
{{#override}}
<div class="form-overridden">{{override}}</div>
{{/override}}
{{#warning}}
<div class="form-warning">{{warning}}</div>
{{/warning}}
</label>
<span class="form-shortname">{{{name}}}</span>
</div>
<div class="form-setting col-sm-9">
<div class="form-setting">
{{#error}}
<div><span class="error">{{error}}</span></div>
{{/error}}
{{{element}}}
{{#default}}
<div class="form-defaultinfo text-muted {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
<div class="form-defaultinfo {{#forceltr}}text-ltr{{/forceltr}}">{{{default}}}</div>
{{/default}}
<div class="form-description mt-3">{{{description}}}</div>
{{#dependenton}}<div class="form-dependenton mb-4 text-muted">{{{.}}}</div>{{/dependenton}}
</div>
<div class="form-description">{{{description}}}</div>
</div>
{{#customcontrol}}
{{#js}}
require(['jquery'], function($) {
$('#{{id}}_label').css('cursor', 'default');
$('#{{id}}_label').click(function() {
$('#{{id}}')
.find('button, a, input:not([type="hidden"]), select, textarea, [tabindex]')
.filter(':not([disabled]):not([tabindex="0"]):not([tabindex="-1"])')
.first().focus();
});
});
{{/js}}
{{/customcontrol}}
@@ -25,7 +25,6 @@
* value - yes value
* id - element id
* checked - boole
* readonly - bool
Example context (json):
{
@@ -33,11 +32,10 @@
"no": "False",
"value": "True",
"id": "test0",
"checked": "checked",
"readonly": false
"checked": "checked"
}
}}
<div class="form-checkbox defaultsnext">
<input type="hidden" name="{{name}}" value="{{no}}">
<input {{#readonly}}disabled{{/readonly}} type="checkbox" name="{{name}}" value="{{value}}" id="{{id}}" {{#checked}}checked{{/checked}}>
<input type="checkbox" name="{{name}}" value="{{value}}" id="{{id}}" {{#checked}}checked{{/checked}}>
</div>
@@ -25,7 +25,6 @@
* id - element id
* value - element value
* haspreviewconfig - show preview of selected color
* readonly - bool
Example context (json):
{
@@ -33,20 +32,16 @@
"name": "name0",
"id": "id0",
"value": "#555655",
"readonly": false,
"haspreviewconfig": false
}
}}
{{!
Setting configcolourpicker.
}}
<div class="form-colourpicker defaultsnext">
<div class="admin_colourpicker clearfix">
{{#icon}}
{{>core/pix_icon}}
{{/icon}}
</div>
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="text-ltr">
{{#haspreviewconfig}}
<input type="button" id="{{id}}_preview" value={{#quote}}{{#str}}preview{{/str}}{{/quote}} class="admin_colourpicker_preview">
{{/haspreviewconfig}}

Some files were not shown because too many files have changed in this diff Show More