Compare commits

..

1885 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) e25e165231 Moodle release 3.1.11 2018-03-17 01:18:16 +01:00
Eloy Lafuente (stronk7) fdcf7fb3f6 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2018-03-17 01:18:13 +01:00
David Mudrák 88bd118665 MDL-61392 enrol_paypal: Improve IPN input parameters checking 2018-03-14 09:19:02 +08:00
David Mudrák b061fba2c4 MDL-61392 enrol_paypal: Improve the IPN notifications handling
* Notify administrators once incoming IPN request is verified by PayPal.
* Fix the HTTP status as expected by the IPN protocol.
2018-03-14 09:19:02 +08:00
Eloy Lafuente (stronk7) 7f5f07b68e Merge branch 'MDL-48501-mdl31' of git://github.com/jswebster/moodle into MOODLE_31_STABLE 2018-03-12 23:51:49 +01:00
Jeff Webster 6843744660 MDL-48501 mod_feedback: update feedback to use reCAPTCHA v2 2018-03-07 17:49:47 -05:00
Jeff Webster fe82348810 MDL-48501 login: update signup_form to use reCAPTCHA v2 2018-03-07 17:49:46 -05:00
Jeff Webster cfefd25d6c MDL-48501 form/recaptcha: update to use reCAPTCHA v2 2018-03-07 17:01:01 -05:00
Jeff Webster 956166b766 MDL-48501 recaptchalib_v2: add new lib to support reCAPTCHA v2 2018-03-07 17:01:01 -05:00
Jeff Webster c692bb567f MDL-48501 lang: update reCAPTCHA language strings 2018-03-07 15:52:02 -05:00
AMOS bot 70a7b23df5 Automatically generated installer lang files 2018-03-07 00:07:03 +00:00
AMOS bot 42c5d3aa9d Automatically generated installer lang files 2018-02-19 00:06:59 +00:00
AMOS bot f0a15feedb Automatically generated installer lang files 2018-02-17 00:07:02 +00:00
David Monllao 2078761831 weekly release 3.1.10+ 2018-02-08 17:40:21 +01:00
Andrew Nicols 6fb9c39256 Merge branch 'MDL-61269_31' of git://github.com/stronk7/moodle into MOODLE_31_STABLE 2018-02-05 17:55:08 +08:00
David Monllao 8103058154 weekly release 3.1.10+ 2018-02-01 14:26:54 +01:00
David Monllao f9000970ca Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2018-02-01 14:26:53 +01:00
AMOS bot 2412171944 Automatically generated installer lang files 2018-02-01 00:07:20 +00:00
David Mudrák ea12e51d4d MDL-61242 repository_equella: Fix missing class repository
The call to the class 'repository' introduced in the commit d05c2ac7cc
didn't fully work and threw: "Exception - Class 'repository' not found".
This fixes the missing library inclusion.
2018-01-31 23:42:58 +01:00
AMOS bot 40b1f7f86d Automatically generated installer lang files 2018-01-31 00:07:08 +00:00
AMOS bot e052fe614f Automatically generated installer lang files 2018-01-30 00:07:08 +00:00
Eloy Lafuente (stronk7) 52c730014e Merge branch 'wip-MDL-61242-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2018-01-29 16:35:57 +08:00
Andrew Nicols 787727c745 weekly release 3.1.10+ 2018-01-29 11:02:31 +08:00
Andrew Nicols 5e99464c96 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2018-01-29 11:02:28 +08:00
Eloy Lafuente (stronk7) 46ecac536c MDL-61269 behat-extension: bump to fix some caps & defaults 2018-01-25 00:55:14 +01:00
Adrian Greeve b4e05280c1 MDL-61242 repository_equella: Add source key when sending the source.
A thank you to Nelson Cheng for find this issue and suggesting a patch.
2018-01-20 11:03:58 +08:00
AMOS bot 572838664d Automatically generated installer lang files 2018-01-19 00:07:34 +00:00
AMOS bot 2090c294bc Automatically generated installer lang files 2018-01-17 00:06:58 +00:00
Jun Pataleta a9c4c8da11 Merge branch 'MDL-61221-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2018-01-16 23:02:14 +08:00
Andrew Nicols 499c8d894d MDL-61221 badges: Ignore site availabilty for behat
Behat sites should not be available publically, and the check against
the backpack API for site availablity can time out in some situations.

We should be testing as though the site _is_ available, as this is the
standard expectation.
2018-01-16 13:26:30 +08:00
Eloy Lafuente (stronk7) 16ab239fb4 Merge branch 'MDL-61204-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2018-01-16 02:17:39 +01:00
Andrew Nicols 4940aa5152 MDL-61204 user: Fix random failure in behat
We need to get into the habit of not using usernames like 'student1'
and 'student10' as our matches are non-strict, and the tests become
dependent upon DB sort order.

This change adds a character after the varying value to act as a
delimter for all of these tests.
2018-01-16 08:33:09 +08:00
AMOS bot 3e130de203 Automatically generated installer lang files 2018-01-16 00:07:14 +00:00
Eloy Lafuente (stronk7) f41a173317 Moodle release 3.1.10 2018-01-12 20:35:29 +01:00
Eloy Lafuente (stronk7) dc7420d411 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2018-01-12 20:35:27 +01:00
Adrian Greeve 96e40b6cfc MDL-61131 repositories: Added a key to verify incoming urls. 2018-01-09 11:35:05 +01:00
Simey Lameze a1eb47211d MDL-60235 core_calendar: clean event name field 2018-01-08 22:05:36 +08:00
Juan Leyva f5f0074aee MDL-60908 mod_quiz: Return question state only when configured
The question state should be returned following the quiz review options
settings.
2018-01-08 22:05:36 +08:00
Andrew Nicols ea8f903568 MDL-61169 iplookup: Change to github.com IP 2018-01-08 15:02:47 +01:00
AMOS bot 51a43f5fa7 Automatically generated installer lang files 2018-01-04 00:07:36 +00:00
AMOS bot 2edcf6861a Automatically generated installer lang files 2018-01-03 00:06:55 +00:00
AMOS bot bd5779cfb5 Automatically generated installer lang files 2017-12-18 00:06:49 +00:00
Eloy Lafuente (stronk7) 5a13113b07 weekly release 3.1.9+ 2017-12-14 14:47:35 +01:00
Eloy Lafuente (stronk7) 6ac052dbc4 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-12-14 14:47:34 +01:00
AMOS bot c8c5e35bb1 Automatically generated installer lang files 2017-12-14 00:06:41 +00:00
Damyon Wiese 28964ed251 Merge branch 'MDL-61002-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-12-11 09:49:00 +08:00
Andrew Nicols e362c66d49 MDL-61002 iplookup: Improve test stability 2017-12-11 08:12:43 +08:00
AMOS bot 977861a47b Automatically generated installer lang files 2017-12-08 00:10:26 +00:00
Jun Pataleta b8067e0b01 weekly release 3.1.9+ 2017-12-08 09:09:56 +13:00
Andrew Nicols cf877600b7 Merge branch 'MDL-59159_31' of git://github.com/stronk7/moodle into MOODLE_31_STABLE 2017-12-06 10:06:26 +08:00
Eloy Lafuente (stronk7) d1660a6aae MDL-59159 environment: 3.1 (LTS) required 2017-12-04 02:05:42 +01:00
Eloy Lafuente (stronk7) e0b391da98 MDL-59159 environment: 3.5 base information
This is a direct copy of the 3.4 branch to
have changes under control easier in next commits.
2017-12-04 02:05:41 +01:00
Eloy Lafuente (stronk7) 687aad78bd Moodle release 3.1.9 2017-11-11 19:29:23 +01:00
Eloy Lafuente (stronk7) 21144b8419 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-11-11 19:29:19 +01:00
AMOS bot 0372a0accb Automatically generated installer lang files 2017-11-11 00:06:07 +00:00
AMOS bot fea4000d5e Automatically generated installer lang files 2017-11-09 00:05:29 +00:00
AMOS bot 7105cb7684 Automatically generated installer lang files 2017-11-08 00:05:29 +00:00
AMOS bot d868aafa8e Automatically generated installer lang files 2017-11-05 00:07:15 +00:00
Sara Arjona 54bb01439e MDL-60550 user: Add more restrictions in keyword searches
Original patch provided by Tim Schroeder.
2017-10-31 11:55:28 +13:00
David Monllao 0b42937599 weekly release 3.1.8+ 2017-10-27 12:48:23 +02:00
David Monllao fab3e4fa3d Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-10-27 12:48:22 +02:00
Damyon Wiese 2393486db4 Merge branch 'MDL-60366_feedback_upgrade_31' of git://github.com/davosmith/moodle into MOODLE_31_STABLE 2017-10-26 16:05:16 +08:00
Andrew Nicols 853fbda447 Merge branch 'wip-MDL-60543-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-10-26 14:35:45 +08:00
AMOS bot 007edbdecb Automatically generated installer lang files 2017-10-25 00:06:28 +08:00
Davo Smith c614487d2d MDL-60366 mod_feedback: fix deletion of valid anonymous duplicates 2017-10-24 09:38:49 +01:00
Marina Glancy 58643c8b11 MDL-60543 env: Moodle 3.2 and 3.3 do no support PHP7.2 2017-10-23 14:25:43 +08:00
AMOS bot 9cdf50cb79 Automatically generated installer lang files 2017-10-14 00:09:00 +08:00
AMOS bot 03bfea8134 Automatically generated installer lang files 2017-10-10 00:12:39 +08:00
AMOS bot 9962df9eb3 Automatically generated installer lang files 2017-09-29 00:06:41 +08:00
AMOS bot 6f845655e5 Automatically generated installer lang files 2017-09-22 00:08:45 +08:00
AMOS bot 1ff9dccd8d Automatically generated installer lang files 2017-09-22 00:08:45 +08:00
AMOS bot 5fd13b5970 Automatically generated installer lang files 2017-09-21 00:06:44 +08:00
AMOS bot f79a3236ea Automatically generated installer lang files 2017-09-13 00:07:27 +08:00
Eloy Lafuente (stronk7) 25fd679aaf Moodle release 3.1.8 2017-09-09 22:48:00 +02:00
Eloy Lafuente (stronk7) 93cca9afbe Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-09-09 22:47:57 +02:00
David Mudrák 26663756fb MDL-59969 admin: Warn admins if a development libs directory exists
We can't really control the direct web access to directories in dirroot,
that is part of the server setup. So we at least warn admins as they may
not realize the risks of having directories like vendor or node_modules
exposed.

Credit goes to Petr Škoda for mentioning the PHPUnit issue CVE-2017-9841
to me.
2017-09-05 21:59:01 +08:00
Marina Glancy e404606458 MDL-59972 mod_feedback: escape subject when showing the contact form 2017-09-04 11:31:15 +08:00
Jake Dallimore 68b925e274 MDL-58953 user: additional test case for user_can_view_profile() 2017-08-30 10:35:51 +08:00
Jake Dallimore 0a8190569f MDL-58953 user: fix course checking logic in user_can_view_profile()
Make sure to check that $user in enrolled in $course before checking
whether the current user has capabilities in that course, and make sure
that we don't check user context caps when handling a specific course.
2017-08-30 10:35:51 +08:00
AMOS bot d95fb5245b Automatically generated installer lang files 2017-08-29 00:08:35 +08:00
AMOS bot fcea6de794 Automatically generated installer lang files 2017-08-28 00:10:01 +08:00
AMOS bot e5b89df732 Automatically generated installer lang files 2017-08-26 00:07:44 +08:00
AMOS bot 67ea841f41 Automatically generated installer lang files 2017-08-25 00:06:23 +08:00
AMOS bot a64872eb59 Automatically generated installer lang files 2017-08-25 00:06:23 +08:00
AMOS bot 5d20a3ed14 Automatically generated installer lang files 2017-08-17 00:09:03 +08:00
Simey Lameze 39aacd1dfe MDL-59776 core_calendar: unit tests of module events deletion 2017-08-15 11:34:25 +08:00
Simey Lameze bc312c648a MDL-59776 core_calendar: prevent deletion of module events 2017-08-15 11:34:25 +08:00
AMOS bot b545f830d0 Automatically generated installer lang files 2017-08-14 00:09:03 +08:00
AMOS bot 5325b4efe1 Automatically generated installer lang files 2017-07-31 00:10:57 +08:00
AMOS bot c6d38b89dc Automatically generated installer lang files 2017-07-29 00:11:21 +08:00
AMOS bot 73e0775d26 Automatically generated installer lang files 2017-07-26 00:08:17 +08:00
AMOS bot e4eb50ae15 Automatically generated installer lang files 2017-07-23 00:09:26 +08:00
AMOS bot 34e60f0dbf Automatically generated installer lang files 2017-07-22 00:08:38 +08:00
AMOS bot 5f2a1f0c36 Automatically generated installer lang files 2017-07-21 00:07:28 +08:00
Juan Leyva 1357976049 MDL-58762 core: Get full course objects on navigation
The course object passed as parameter to extend_navigation_user
callback contained only a few parameters, some parameters like
showgrades or showreports were missing.
The callback should receive a full course object.
2017-07-20 20:23:43 +08:00
Juan Leyva 9f7af133fd MDL-58762 report: Check group permissions in course user reports
Teachers were able to see any student report even with forced separated
groups and capability moodle/course:accessallgroups off.
2017-07-20 20:23:43 +08:00
Dan Poltawski 0faa1175fe weekly release 3.1.7+ 2017-07-20 13:21:01 +01:00
Dan Poltawski f3fe4f52e1 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-07-20 13:21:00 +01:00
Andrew Nicols 45a405014e Merge branch 'wip-MDL-57649-31-fix2' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-07-20 10:24:43 +08:00
Adrian Greeve b77e45119c MDL-57649 mod_lesson: Improvement to upgrade query.
We only need one record for each filearea that we
are removing.
2017-07-20 10:03:29 +08:00
AMOS bot 9a3855aa00 Automatically generated installer lang files 2017-07-20 00:07:29 +08:00
Dan Poltawski f06abbd040 Merge branch 'wip-MDL-57649-31-fix' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-07-19 09:33:31 +01:00
Adrian Greeve 9e1375fac0 MDL-57649 mod_lesson: Additional refinement to upgrade script. 2017-07-19 15:48:59 +08:00
Dani Palou 62be5f6154 MDL-59068 lesson: Revert MDL-54849
MDL-54859 made the 'wrong jump' setting useless, since clicking 'No' always sends the user to the next page.
2017-07-17 10:10:22 +02:00
Dan Poltawski 5db085f0a7 Merge branch 'wip-MDL-57649-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-07-17 09:01:12 +01:00
Adrian Greeve 734fb0f015 MDL-57649 mod_lesson: Delete answer files correctly.
The files associated with answers and responses were
not being deleted due to the fact that the wrong itemid
was being used.
2017-07-17 09:20:40 +08:00
AMOS bot 0fd90e2044 Automatically generated installer lang files 2017-07-17 00:07:23 +08:00
Dan Poltawski ab4afd711a weekly release 3.1.7+ 2017-07-14 11:46:55 +01:00
Dan Poltawski 4fc794b7ef Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-07-14 11:46:54 +01:00
Eloy Lafuente (stronk7) f883e31728 Merge branch 'MDL-57432-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2017-07-11 10:18:31 +02:00
AMOS bot c2e08a97c1 Automatically generated installer lang files 2017-07-11 00:07:01 +08:00
Dan Poltawski cd7cd469ae MDL-57432 environment: raise Moodle requirement
Due to Moodle 2.7 and Moodle 3.4 not having a common compatible php version
between them to upgrade from Moodle 3.4 from Moodle 2.7 you'll need to upgrade
to a higher version first or upgrade php at the same time as upgrade,
this encourages the former.
2017-07-10 09:22:51 +01:00
Dan Poltawski 43d1a8695c MDL-57432 environment: raise Moodle 3.4 requirements
1) PHP minimum version raised to 7.0.0
2) Intl extension raised from optional to required
2017-07-10 09:22:51 +01:00
Dan Poltawski 499e619868 MDL-57432 environment: 3.4 base information
This is a direct copy of the 3.3 branch to
have changes under control easier in next commits.
2017-07-10 09:22:51 +01:00
Eloy Lafuente (stronk7) 914ce2602e Moodle release 3.1.7 2017-07-08 20:43:29 +02:00
AMOS bot 43663a70af Automatically generated installer lang files 2017-07-08 00:16:44 +08:00
Jake Dallimore c072f462c6 weekly release 3.1.6+ 2017-07-07 12:10:24 +08:00
Jake Dallimore 99b4c8bb10 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-07-07 12:10:22 +08:00
AMOS bot 6e1f0e9527 Automatically generated installer lang files 2017-07-07 00:06:52 +08:00
Simey Lameze bd83aa0cd6 MDL-59456 auth_cas: patch phpCAS auth bypass vulnerability 2017-07-06 09:36:17 +01:00
Marina Glancy c7a89d2009 MDL-59409 admin: set admin user in unittest 2017-07-04 11:05:41 +08:00
Ankit Agarwal 548c5fa21e MDL-56565: core_message\helper was not present in 3.1, remove it 2017-07-04 10:11:39 +08:00
Ankit Agarwal 106fa63926 MDL-56565 forum: Add sitename as heading when there is nothing to display 2017-07-04 10:11:39 +08:00
Ankit Agarwal 5176a91648 MDL-56565 forum: Make sure userfullname is not disclosed 2017-07-04 10:11:39 +08:00
Jake Dallimore 540a38d586 MDL-56565 navigation: fix for cap checks in nav and context header
Fix to:
- Make sure we properly check both user and course contexts in
the load_for_user function in navigation lib and user the
user_can_view_profile function for same-course access checks.
- Use user_can_view_profile in the renderer's context_header to
properly decide whether a user can view another user's picture
and messaging options in the page header.
2017-07-04 10:11:39 +08:00
Jake Dallimore 47f81ef27f MDL-56565 navigation: fix user details disclosure in nav tree
Fixes a bug in which a user's full name might be disclosed via the
nav tree. Nav generation now checks the current user's access to the
user before adding the node, else adds a dummy node.
2017-07-04 10:11:39 +08:00
Jake Dallimore d4fa90b0e9 MDL-56565 core: fix user details disclosure in page context header
Fixes a bug with context_header function in which user details were
displayed regardless of the current user's capabilities.
2017-07-04 10:11:39 +08:00
Marina Glancy 033429a51c MDL-59409 admin: check access to every setting in category 2017-07-04 10:06:01 +08:00
AMOS bot 3c8e25328c Automatically generated installer lang files 2017-06-26 00:12:32 +08:00
AMOS bot bd08b92fcb Automatically generated installer lang files 2017-06-23 00:08:21 +08:00
AMOS bot 13add2b85c Automatically generated installer lang files 2017-06-11 00:06:40 +08:00
AMOS bot e42fa42955 Automatically generated installer lang files 2017-06-04 00:07:40 +08:00
AMOS bot bbbaa37cc5 Automatically generated installer lang files 2017-06-04 00:07:40 +08:00
AMOS bot 7c26a6bd77 Automatically generated installer lang files 2017-06-03 00:08:20 +08:00
AMOS bot ebbf9851c8 Automatically generated installer lang files 2017-06-01 00:12:59 +08:00
AMOS bot 65cd459455 Automatically generated installer lang files 2017-05-23 00:06:03 +08:00
AMOS bot df91963a70 Automatically generated installer lang files 2017-05-18 00:07:35 +08:00
AMOS bot eb58b204ff Automatically generated installer lang files 2017-05-16 00:07:39 +08:00
AMOS bot 11106c1bcc Automatically generated installer lang files 2017-05-14 00:05:09 +08:00
AMOS bot 6e76ce1689 Automatically generated installer lang files 2017-05-13 00:04:59 +08:00
AMOS bot bbe6b470aa Automatically generated installer lang files 2017-05-11 00:05:01 +08:00
Eloy Lafuente (stronk7) 6d0649e537 Moodle release 3.1.6 2017-05-07 21:32:51 +02:00
AMOS bot b36b735a3b Automatically generated installer lang files 2017-05-07 00:06:27 +08:00
Eloy Lafuente (stronk7) 1df212a569 weekly release 3.1.5+ 2017-05-05 17:26:50 +02:00
Andrew Nicols 843fcc5fac Merge branch 'wip-MDL-50670-31-fix' of https://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-05-05 15:10:15 +08:00
Marina Glancy 4d3595e7af MDL-50670 course: apply defaults when format was switched 2017-05-05 14:52:08 +08:00
Jun Pataleta c68568541f Merge branch 'MDL-58807-31' of https://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-05-05 14:45:00 +08:00
Luca Bösch dde166ba07 MDL-58807 block_activity_results: Use multilang in block title
The title passes format_string now.
2017-05-05 14:43:47 +08:00
Andrew Nicols 542536418d MDL-58259 mod_forum: Check if attachments allowed
If the current user is not allowed to submit attachments with a post,
and attachments are incldued, they are now dropped.
2017-05-05 10:29:45 +08:00
Andrew Nicols 603ba08d27 Merge branch 'MDL-55371-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-05-05 10:10:56 +08:00
Dan Poltawski 0dcab26cd9 Merge branch 'MDL-58709-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-05-04 15:15:06 +01:00
Juan Leyva 26c501f37e MDL-55371 mod_assign: Do not return empty users in get_participant WS
The WS was returning null users making the WS to fail.
2017-05-04 10:10:43 +02:00
Jun Pataleta 545174182a Merge branch 'MDL-58749-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-05-04 14:51:07 +08:00
Andrew Nicols 5166e06e08 MDL-56675 cachestore_memcached: Check all connected servers for support 2017-05-04 13:35:00 +08:00
Andrew Nicols e7e9d4c0b5 Merge branch 'MDL-58707-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-05-04 11:45:55 +08:00
Andrew Nicols 2786be9622 Merge branch 'MDL-58431-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-05-04 11:03:44 +08:00
David Monllao 27442e8c01 Merge branch 'MDL-56675-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-05-04 10:57:04 +08:00
Helen Foster 5e2cd4637e MDL-58749 lang: Merge English strings from the en_fix language pack
Significant string change:

* errorinvalidbyhour,core_calendar - correcting number from 59 to 23
2017-05-03 22:07:50 +02:00
Eloy Lafuente (stronk7) 2588195fc0 Merge branch 'MDL-58754-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-05-03 20:53:56 +02:00
Eloy Lafuente (stronk7) 315214fd80 Merge branch 'MDL-58788-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2017-05-03 19:06:13 +02:00
Dan Poltawski 04f5ebb886 MDL-58788 behat: backport of course navigation with editing step 2017-05-03 17:34:43 +01:00
Dan Poltawski 08ff55dad7 Merge branch 'MDL-58772_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2017-05-03 16:50:33 +01:00
Dan Poltawski 5c93b9a5ce Merge branch 'MDL-35913-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-05-03 14:13:22 +01:00
Dan Poltawski 4f14f2f491 Merge branch 'MDL-58434-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-05-03 14:03:11 +01:00
Marina Glancy 24db354737 MDL-50670 course: correctly apply defaults for format options 2017-05-03 13:31:04 +01:00
Dan Poltawski c0e9e7e0a0 MDL-58788 behat: backport of course navigation step
These got introduced in master on
3353cfd8c1 / MDL-58265

It will be useful for third party devs sharing feature files between
multiple branches.
2017-05-03 10:36:17 +01:00
Marina Glancy 900f974216 MDL-58740 block_course_overview: check session key
Thanks to Kukas Schmidt for initial patch
2017-05-03 10:47:27 +08:00
Marina Glancy 61f2bbbf36 MDL-58670 blog: respect capability to search entries 2017-05-03 10:47:27 +08:00
Marina Glancy e5bec10f56 MDL-58635 blogs: check edited blog belongs to current user 2017-05-03 10:47:27 +08:00
Andrew Hancox 9005f18486 MDL-58172 mod_choice: Make export choice respect id fields 2017-05-03 10:47:27 +08:00
David Monllao 29df554433 weekly release 3.1.5+ 2017-05-03 10:27:43 +08:00
Andrew Nicols b31860af40 MDL-56675 cachestore_memcached: Disable store if not purgeable
If the store is shared and the getAllKeys function is broken due to an
incompatability between libmemcached and memcached >= 1.4.23, then it is
not possible to purge the cache, and we cannot support the plugin.

This patch adjusts the isready check to additionally check if the
combination of libmemcached and memcached is affected by this issue.
2017-05-03 09:25:04 +08:00
Andrew Nicols 605cba073c MDL-58746 core: Simplify environment check 2017-05-03 08:33:02 +08:00
Juan Leyva 46573be04b MDL-58434 mod_lesson: Display invalid responses in detailed report
In the detailed statistics view for one user attempt, the user response
for numerical question types was not being displayed.
This was only happening for incorrect responses.
2017-05-02 19:59:55 +02:00
Andrew Nicols 6adcb47532 MDL-58754 competency: Change query for DISTINCT COUNT 2017-05-02 14:49:24 +08:00
Adam Olley 0fc3aba77e MDL-58772 mod_feedback: Dont overwrite anonymous entries
The feedback module lets you alternate between responses being anonymised and
not anonymised. When the module is in anonymous mode, its possible for a single
user to make multiple responses.

However when the activity is switched to non-anon mode, if a user leaves a
follow up feedback, one of their previously anonymous responses is used, so
their new response stays anonymous and their old anon response is lost.

This change lets them leave a new non-anonymised feedback entry and retains all
previous anonymous responses instead of incorrectly reusing one of their anon
ones at random.
2017-05-02 12:50:05 +09:30
Marina Glancy 29c2971468 MDL-55468 mod_feedback: revive export analysis to excel 2017-05-01 14:34:27 +01:00
Andrew Nicols 1536b56796 MDL-58746 core: Add environment check for finfo 2017-05-01 13:09:38 +08:00
Dan Poltawski 26713f79f4 weekly release 3.1.5+ 2017-04-28 12:35:50 +01:00
Dan Poltawski 1769ede142 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-04-28 12:35:49 +01:00
Dan Poltawski e411b59f80 Merge branch 'MDL-58722-31-fix' of https://github.com/xow/moodle into MOODLE_31_STABLE 2017-04-28 07:50:29 +01:00
John Okely 21b902996a MDL-58722 mathjax: Fix httpsurl upgrade 2017-04-28 14:30:34 +08:00
Damyon Wiese 9c68807f6c MDL-54849 lesson: Fix backport
The backport branch was using undefined behat steps and functions.
2017-04-28 10:31:35 +08:00
Dan Poltawski c06dc57666 Merge branch 'wip-MDL-58689-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-27 18:35:30 +01:00
Juan Leyva e707c69cce MDL-58709 registration: Fix incorrect setType 2017-04-27 16:58:31 +02:00
Dan Poltawski d39fbc3e06 Merge branch 'MDL-58722-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-04-27 14:36:25 +01:00
David Monllao 1d2368318a Merge branch 'MDL-58628-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-04-27 17:09:54 +08:00
Damyon Wiese 7dfa47b2dd MDL-58722 mathjax: Update to 2.7.1 and remove a11y
2.7.1 bundles the accessibility and mchem extensions so we no longer need to bundle them and apply custom config.
2017-04-27 16:56:14 +08:00
Juan Leyva 0c61a163ae MDL-58628 mod_quiz: Return missing fields in get_quizzes_by_courses
These fields must be returned always (even if the quiz is closed).
Those fields are required to display data to users that, for example,
finished a timed quiz.
2017-04-27 09:57:24 +02:00
Jake Dallimore 0af674082c Merge branch 'MDL-58701-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-04-27 13:34:11 +08:00
Ankit Agarwal 927a6221aa MDL-58701 phpunit: Add tests for external_settings 2017-04-27 09:44:28 +05:30
Ankit Agarwal e63627f50e MDL-58701 libraries: Use pluginfile.php as rewrite url for web req. 2017-04-27 09:40:19 +05:30
David Monllao 77be0785fd Merge branch 'MDL-58698-31-strlang' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-04-27 11:35:20 +08:00
David Monllao 9427e333c7 Merge branch 'wip-MDL-57807-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-04-27 11:33:52 +08:00
David Monllao 506fd9545c Merge branch 'MDL-58372-31' of git://github.com/Dagefoerde/moodle into MOODLE_31_STABLE 2017-04-27 11:32:15 +08:00
Andrew Nicols a7ce01cc70 Merge branch 'MDL-58691-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-04-27 11:27:23 +08:00
David Monllao de9af122db Merge branch 'MDL-54849-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-04-27 11:20:38 +08:00
Marina Glancy 9b04032e45 MDL-58689 dml: prevent logging during setup 2017-04-27 10:06:12 +08:00
Adrian Greeve e42f41b81a MDL-57807 mod_data: Advanced search with menu item.
It is now possible to search other criteria without first
setting the menu items.

Thanks to Sergey Gorbatov for providing this patch.
2017-04-27 09:08:31 +08:00
AMOS bot 5b1b83101e Automatically generated installer lang files 2017-04-27 00:05:53 +08:00
Jan Dageförde 50e53bb6ea MDL-58372 repository_webdav: Explicitly pass some filename
Not passing anything triggers PHP 7.1 "Too few arguments" exception.
2017-04-26 11:28:52 +02:00
David Mudrák e025fd2123 MDL-58698 js: Fix the detection of the language in core_str module
This is the same problem that we had in MDL-52486. When the language
pack with multiple underscores (such as "en_us_k12") is selected, the
html root element's "lang" attribute is set to

    <html lang="en-us-12" ...>

which we then map back to the Moodle lang code using the JS function
replace().

What was missed in MDL-52486 was that when replacing a value (and not a
regular expression), only the first instance of the value is replaced.
So the value "en_us-k12" was sent as the lang parameter which is invalid
PARAM_LANG value and the exception was thrown.
2017-04-26 10:21:12 +02:00
Jake Dallimore 4b7b979d39 weekly release 3.1.5+ 2017-04-26 14:49:09 +08:00
Jake Dallimore e2180dbc89 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-04-26 14:49:08 +08:00
Jun Pataleta 7b4ecf6fe2 Merge branch 'MDL-58668-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-04-26 11:03:09 +08:00
Juan Leyva 51134125fc MDL-58707 mod_assign: Fix param type for returned field
The ‘description’ field is populated via a get_string call, this means
that it may content html.
The component used for translation is also fixed in this commit.
2017-04-25 14:42:48 +02:00
Juan Leyva 4268f10674 MDL-58668 mod_lesson: Fix how multi answers are processed
The module was choosing as incorrect the first possible incorrect
answer instead the first student incorrect answer.
In the patch I also refactored the foreach loop to avoid code
duplication.
2017-04-24 13:33:30 +02:00
Dan Poltawski 6cbdb4c31c Merge branch 'MDL-58556-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-04-24 11:05:19 +01:00
Ankit Agarwal 2bbd04781c MDL-58691 exporter: Filters should always apply for web pages
The variables AJAX_SCIRPT, CLI_SCRIPT, WS_SERVER are always defined (and set to false)
when webpages are rendered, hence the check of 'defined' is invalid
2017-04-24 13:46:07 +05:30
Jake Dallimore 454d532acb Merge branch 'MDL-57793-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-04-24 15:18:13 +08:00
Damyon Wiese b30c0b6b68 MDL-58556 auth: better expired password
If the auth plugin is using a custom url to change password - don't rely on forcepasswordchange
user preference being reset.
2017-04-24 15:09:11 +08:00
Damyon Wiese afb659ff15 MDL-54849 lesson: Move on to next question
Move on to next question button takes you to the same question again.
2017-04-24 14:50:32 +08:00
Jun Pataleta a7457acc52 Merge branch 'MDL-58586-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-04-24 09:33:55 +08:00
AMOS bot 34ed4e0e19 Automatically generated installer lang files 2017-04-23 00:04:43 +08:00
Dan Poltawski c7c84089f1 weekly release 3.1.5+ 2017-04-21 15:47:35 +01:00
Dan Poltawski 3b9df47dfe Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-04-21 15:47:32 +01:00
Damyon Wiese 79f0d69bca MDL-58586 css: add margin to userpictures
Boost has a right margin on the userpicture but this is missing in bootstrapbase (it is
added only on random pages).

Add a margin to bootstrapbase so it matches boost.
2017-04-21 11:44:20 +08:00
Jake Dallimore 89cd3cfc02 Merge branch 'MDL-58613-31-workshopfullname' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-04-21 10:27:56 +08:00
David Monllao b57860bfbb Merge branch 'MDL-58590_31' of https://github.com/sk-unikent/moodle into MOODLE_31_STABLE 2017-04-21 10:05:43 +08:00
AMOS bot 740917fa43 Automatically generated installer lang files 2017-04-21 00:10:54 +08:00
Skylar Kelty 9c5c5e2ee6 MDL-58590 mobile: Cache mobile-supporting plugins 2017-04-20 09:37:12 +01:00
David Monllao e88bef20f5 Merge branch 'MDL-58278-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-04-20 14:06:35 +08:00
Damyon Wiese 6785483b81 MDL-58278 mod_assign: Ignore send notify with mw
When marking workflow is on and the grade is not released we never send notifications anyway.
Instead of preventing the grading form from submitting (validation error) we silently ignore it.
2017-04-20 13:13:49 +08:00
AMOS bot 0923ed6bb8 Automatically generated installer lang files 2017-04-20 00:07:30 +08:00
Juan Leyva 42ee071ab5 MDL-58431 mod_lesson: Fix error in random jumps on first visit
Random jumps to content pages were not working when they were set in
the first page.
This was caused because the page where the jump was, was not being
marked as visited before calculating the jump.
2017-04-19 17:48:14 +02:00
David Mudrák a22951044f MDL-58613 workshop: Provide all data to display user name
Additional fields such as middlename, alternatename and others were not
passed to the fullname(), causing a debugging message.
2017-04-19 14:19:56 +02:00
David Monllao bd34549316 Merge branch 'MDL-54901_31' of git://github.com/stronk7/moodle into MOODLE_31_STABLE 2017-04-19 11:31:12 +08:00
David Monllao 3bef945fbe Merge branch 'MDL-58096-31' of git://github.com/StudiUM/moodle into MOODLE_31_STABLE 2017-04-19 05:18:40 +08:00
Gilles-Philippe Leblanc 4bd3c5766e MDL-58096 reports: Add SQL required by preload_from_record() 2017-04-18 15:41:48 -04:00
Dan Poltawski c6fa627a23 Merge branch 'MDL-58463-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-04-18 18:54:02 +01:00
David Monllao 79d8b6f1bd Merge branch 'MDL-58116-31' of https://github.com/barrasroger/moodle-1 into MOODLE_31_STABLE 2017-04-19 00:50:16 +08:00
AMOS bot f5850997b4 Automatically generated installer lang files 2017-04-19 00:05:04 +08:00
Dan Poltawski df2b12bf1b Merge branch 'MDL-58374-31-ltierrorlog' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-04-18 16:49:05 +01:00
Gilles-Philippe Leblanc e8d61c6f11 MDL-58096 reports: Optimize database request 2017-04-18 11:00:29 -04:00
Dan Poltawski 4a1f3cf807 weekly release 3.1.5+ 2017-04-18 12:34:04 +01:00
Dan Poltawski c075a898e1 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-04-18 12:34:03 +01:00
barrasroger f181e3cf70 MDL-58116 core_enrol: fix handling of users on different methods 2017-04-18 11:00:31 +02:00
Jun Pataleta 6ef412801f MDL-57793 calendar: Additional edge-case tests
* Added leap year and 31th day of the month tests.
2017-04-18 13:57:53 +08:00
Jun Pataleta baf42679ab MDL-57793 calendar: Add recursion to satisfy COUNT rule
* Add recursion to the creation of recurring calendar events to satisfy
  the COUNT rule, if necessary.
2017-04-18 13:57:52 +08:00
Jun Pataleta 2c0857ba05 MDL-58463 mod_assign: Improve coverage of test_assign_refresh_events() 2017-04-18 13:24:18 +08:00
Jun Pataleta 781f643d95 MDL-58463 mod_assign: Use correct course ID for fetching assignment's CM 2017-04-18 13:24:18 +08:00
Andrew Nicols 520a528943 Merge branch 'MDL-58559-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2017-04-18 09:48:00 +08:00
Andrew Nicols 7e95809a37 Merge branch 'MDL-58582-31' of https://github.com/Dagefoerde/moodle into MOODLE_31_STABLE 2017-04-18 09:33:29 +08:00
Andrew Nicols a3309be840 Merge branch 'MDL-58539_31' of https://github.com/dmonllao/moodle into MOODLE_31_STABLE 2017-04-18 09:05:53 +08:00
Simey Lameze 637b3ff3de MDL-58559 block_community: check if the course has subject 2017-04-18 08:57:27 +08:00
Eloy Lafuente (stronk7) 22983bd4da MDL-54901 environment: pg93, openssl, https & utf8mb4 2017-04-18 02:56:41 +02:00
Eloy Lafuente (stronk7) 3422a9148b MDL-54901 environment: 3.3 base information
This is a direct copy of the 3.2 branch to
have changes under control easier in next commits.
2017-04-18 02:54:13 +02:00
Ruslan Kabalin 231a80c010 MDL-58539 assignfeedback_editpdf: Fix group assignment fatal error.
This makes sure that $grade->attemptnumber is not NULL before using its
value.
2017-04-17 16:58:58 +02:00
Jan Dageförde a6c36884b3 MDL-58582 theme: Improve PHPDoc comment on SVG image resolution 2017-04-17 15:24:40 +02:00
Dan Poltawski 81292696c8 MDL-58486 userprefs: clarifying comment 2017-04-17 12:18:05 +01:00
Dan Poltawski 89e5f43109 Merge branch 'MDL-58486_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2017-04-17 12:17:53 +01:00
Dan Poltawski f6ae580fbb Merge branch 'MDL-58479-31-weblib-notice-phpdoc' of git://github.com/roperto/moodle into MOODLE_31_STABLE 2017-04-17 10:46:09 +01:00
Dan Poltawski d8928b4535 Merge branch 'MDL-58465-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-04-17 10:41:19 +01:00
Dan Poltawski 23ba40cf63 Merge branch 'MDL-58393-31_filter-order' of https://github.com/roperto/moodle into MOODLE_31_STABLE 2017-04-17 10:30:39 +01:00
Dan Poltawski 09d7121146 Merge branch 'MDL-58593-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2017-04-17 10:03:25 +01:00
Eric Merrill db370772bd MDL-58593 database: More efficiently track issued key names 2017-04-13 12:24:21 -04:00
Dan Poltawski 47abeb18f6 Merge branch 'MDL-32596_31' of https://github.com/rezaies/moodle into MOODLE_31_STABLE 2017-04-13 15:57:27 +01:00
David Monllao 8890feae27 Merge branch 'MDL-58512_31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2017-04-13 13:07:26 +02:00
David Monllao e1fffdbc27 Merge branch 'MDL-58244-31' of https://github.com/MartinGauk/moodle into MOODLE_31_STABLE 2017-04-13 13:00:48 +02:00
David Monllao f654011e0d Merge branch 'MDL-58171_31-report-role-format_text' of https://github.com/lucaboesch/moodle into MOODLE_31_STABLE 2017-04-13 12:40:18 +02:00
Martin Gauk 9de798de71 MDL-58244 shibboleth: handle users who are logged out
If the user is (already) logged out, do not access $USER->auth and redirect him to the return URL.
2017-04-13 10:07:29 +00:00
Tim Hunt 4d6d096336 MDL-58555 ajax: make ajax web service log entries more useful
It is not used for anything, but we put the method name(s) being called in the URL.
2017-04-13 08:31:57 +02:00
AMOS bot 65704ab9b3 Automatically generated installer lang files 2017-04-13 00:04:43 +08:00
Luca Bösch f3f513ec7b MDL-58171 report: role name passing format_text
Have the role name in h2 of the participation report passing filters
like multilang2 by having it call format_text.

Signed-off-by: Luca Bösch <luca.boesch@bfh.ch>
2017-04-12 15:32:16 +02:00
David Monllao f14510d944 weekly release 3.1.5+ 2017-04-12 09:32:33 +02:00
David Monllao 4d19341a0a Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-04-12 09:32:31 +02:00
Andrew Nicols 6df5fb575c Merge branch 'wip-MDL-57616-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-11 12:22:38 +08:00
Mathew Gancarz 1eee389afe MDL-58512 core: pre-load 'changesmadereallygoaway' string for JS 2017-04-11 12:06:42 +08:00
Andrew Nicols c2a65ab688 Merge branch 'MDL-58461-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-04-11 11:35:50 +08:00
AMOS bot e02ebdc5fe Automatically generated installer lang files 2017-04-11 00:04:58 +08:00
David Monllao b702e5b44e Merge branch 'patch-26' of https://github.com/sk-unikent/moodle into MOODLE_31_STABLE 2017-04-10 16:59:56 +02:00
David Monllao b77027c57d Merge branch 'mdl-58489-m31' of https://github.com/Dagefoerde/moodle into MOODLE_31_STABLE 2017-04-10 16:56:33 +02:00
David Monllao 5acfcf8777 Merge branch 'mdl-58485-m31' of https://github.com/Dagefoerde/moodle into MOODLE_31_STABLE 2017-04-10 16:34:36 +02:00
David Monllao 201812e592 Merge branch 'wip-MDL-55950-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-10 16:12:18 +02:00
David Monllao 87562dbe24 Merge branch 'MDL-57858-31' of git://github.com/pavelsokolov/moodle into MOODLE_31_STABLE 2017-04-10 14:17:14 +02:00
David Monllao e5a5962d00 MDL-56370 mod_feedback: Note about undeprecation 2017-04-10 13:18:29 +02:00
David Monllao e9569a7fa3 Merge branch 'wip-MDL-56370-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-10 13:17:33 +02:00
David Monllao 76e50ea9e7 Merge branch 'wip-MDL-55939-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-10 12:58:01 +02:00
David Monllao 8b196aa53e Merge branch 'MDL-58104-31' of git://github.com/pavelsokolov/moodle into MOODLE_31_STABLE 2017-04-10 09:58:52 +02:00
Andrew Nicols f0be1f90da Merge branch 'wip-MDL-58180-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-10 13:41:33 +08:00
AMOS bot 42f9eb4c56 Automatically generated installer lang files 2017-04-08 00:06:21 +08:00
David Mudrák d3c4f13490 MDL-58374 lti: Log the error message of a failed message verification
Previously the exception message (which holds the actual explanation of
what went wrong) was thrown away so the user had no way to debug.
2017-04-07 11:29:37 +02:00
Jan Dageförde e8e2c512b8 MDL-58485 admin: Show all SVG plugin icons 2017-04-07 10:11:10 +02:00
Jan Dageförde 31d8260331 MDL-58489 core: Fix unreachable HTTP error handling 2017-04-07 10:09:52 +02:00
Jun Pataleta 6fd68f6967 weekly release 3.1.5+ 2017-04-07 12:45:51 +08:00
Jun Pataleta 11f3ea4f94 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-04-07 12:45:50 +08:00
Marina Glancy 07e95f49fc MDL-56370 mod_feedback: behat for repeat completion 2017-04-07 08:23:30 +08:00
Skylar Kelty 0f7ed737fc MDL-58456 chat: Add missing new in throw 2017-04-06 09:48:14 +01:00
Shamim Rezaie f821c0a5e2 MDL-32596 tool_xmldb: Updated confirmcheckforeignkeys
Updated $string['confirmcheckforeignkeys']
2017-04-06 18:27:07 +10:00
Marina Glancy 2321c81d52 MDL-55950 mod_feedback: correct link to response in the email 2017-04-06 15:44:02 +08:00
Marina Glancy 94f61491de MDL-55939 course: no permission is needed to view frontpage 2017-04-06 14:52:44 +08:00
Damyon Wiese 913493048b MDL-58461 filter_mathjaxloader: Update defaults
Also included a version bump for Moodle in order to trigger a filter upgrade.
2017-04-06 13:58:58 +08:00
Damyon Wiese 8d82a20f4b MDL-58461 mathjax: Ship accessibility extensions
There are not mirrored on the new CDN so we need to ship them with moodle.
2017-04-06 13:58:53 +08:00
AMOS bot 1ea218b63e Automatically generated installer lang files 2017-04-06 00:07:51 +08:00
AMOS bot 75728ebe8d Automatically generated installer lang files 2017-04-06 00:07:51 +08:00
Marina Glancy af6a891144 MDL-56370 mod_feedback: allow to restore values from last attempt 2017-04-05 16:08:27 +08:00
Eloy Lafuente (stronk7) 2eda090ebe Merge branch 'MDL-58055-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-04-05 00:30:37 +02:00
Eloy Lafuente (stronk7) a239fdd2a0 Merge branch 'MDL-55326-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-04-04 19:26:48 +02:00
Eloy Lafuente (stronk7) 5f368c5dd7 Merge branch 'MDL-55499-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-04-04 18:24:11 +02:00
AMOS bot 37e25a19a8 Automatically generated installer lang files 2017-04-05 00:04:59 +08:00
Tim Hunt 7a27817f98 MDL-58486 user_prefs: always update $USER cache when applicable
set_user_preference and unset_user_preference let you pass the user to
set preferences for as an id. Previously, if you passed $USER->id there,
those methods did not update the Cache in $USER, which was surprising,
and not easy to debug.

Now, we always update the preference cache in $USER if the preference is
being changed for the current user.
2017-04-04 16:22:57 +01:00
Daniel Thee Roperto 6b00083d7f MDL-58479 documentation: fixed phpdoc for notice(). 2017-04-04 16:14:56 +10:00
Marina Glancy 5dc2aeda9a MDL-57616 label: allow to drag and drop video/audio files 2017-04-04 12:00:27 +08:00
Andrew Nicols 75cb3afa71 Merge branch 'wip-MDL-41809-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-04-04 10:56:20 +08:00
AMOS bot 4b98e2986c Automatically generated installer lang files 2017-04-04 00:06:02 +08:00
Damyon Wiese d77585c672 MDL-58461 filter_mathjaxloader: Change CDN url
The MathJax CDN url is going away - we need to switch to another mirror.
2017-04-03 12:48:35 +08:00
Daniel Thee Roperto dd82501911 MDL-58394 filters: Fixed order not being respected. 2017-04-03 14:47:00 +10:00
Ankit Agarwal acdf91203c MDL-58465 unittests: Fix invalid use of exception 2017-04-03 09:26:04 +05:30
Dan Poltawski 3f48012eb5 weekly release 3.1.5+ 2017-03-31 11:16:19 +01:00
David Monllao 31867bb1b4 MDL-58450 mod_forum: Force groups to be returned as they are created
Long history resumed: The test relies on the first group
being the first that is created, the first group is
actually the first one ordering by name. If  is
group-999 and  is group-1000  is returned
as the first group.
2017-03-31 11:14:20 +01:00
Pavel Sokolov 97baaf9a53 MDL-57858 mod_assign: fix submissions count for assign with scales 2017-03-31 12:00:41 +03:00
Dan Poltawski becf6318c2 weekly release 3.1.5+ 2017-03-31 09:16:35 +01:00
Dan Poltawski c7806282a8 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-03-31 09:16:34 +01:00
Andrew Nicols 2f8db6a31e MDL-58055 theme_bootstrap: Change padding around unread link 2017-03-31 14:21:20 +08:00
Pavel Sokolov c26566f21b MDL-58104 mod_assign: Show attempt settings for the latest attempt 2017-03-30 11:10:04 +03:00
Andrew Nicols 0ae9094a96 MDL-55499 mod_forum: Use context when formatting e-mail text 2017-03-30 11:38:52 +08:00
Dan Poltawski 1a1cc84af1 Merge branch 'MDL-58264_31' of https://github.com/darrencocco/moodle into MOODLE_31_STABLE 2017-03-28 18:02:44 +01:00
AMOS bot 10fed49ab2 Automatically generated installer lang files 2017-03-29 00:06:01 +08:00
David Monllao e57beee8dc MDL-58079 enrol: Move new test to existing test case 2017-03-28 17:36:54 +02:00
David Monllao 2be51b7633 Merge branch 'MDL-58079_31' of https://github.com/kiklop74/moodle into MOODLE_31_STABLE 2017-03-28 17:36:10 +02:00
Juan Leyva 48d02c4437 MDL-35913 site home: Set the page layout before setting blocks
When the default home page is set by user preference the site home
blocks are gone.
This is caused because the page layout is not correctly set before
manipulating the navigation block (the base layout it is used instead).
2017-03-28 17:11:19 +02:00
Dan Poltawski b72615601b MDL-58227 mod_feedback: remove uncessary if 2017-03-28 16:00:42 +01:00
Dan Poltawski ac5f2bc552 Merge branch 'MDL-58227-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-03-28 16:00:25 +01:00
Dan Poltawski f569989db3 Merge branch 'MOODLE_31_STABLE' of https://github.com/fwsl/moodle into MOODLE_31_STABLE 2017-03-28 12:07:30 +01:00
Dan Poltawski af84c619a0 Merge branch 'MDL-58160_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2017-03-28 11:34:41 +01:00
Dan Poltawski ce51586b24 Merge branch 'wip-MDL-58092-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-03-28 10:56:01 +01:00
Dan Poltawski b9866e9e71 Merge branch 'MDL-58257_M31' of https://github.com/ak4t0sh/moodle into MOODLE_31_STABLE 2017-03-28 10:51:01 +01:00
Andrew Nicols 45a4ebb697 MDL-55326 core_text: Correct typo3 file permissions 2017-03-27 15:09:00 +08:00
Luca Bösch 9574aee37c MDL-58180 lib: Role name pass format_text.
In function stats_get_report_options, the role names are returned after
having been processed through format_text which lets the filters work on them.

Signed-off-by: Luca Bösch <luca.boesch@bfh.ch>
2017-03-27 10:41:48 +08:00
Darren Cocco 229ffe02dc MDL-58264 quiz: removed additional = symbol
Removed superflous = symbol from SQL snippet
2017-03-27 11:09:20 +11:00
Grzegorz Ziółek 52f391ceab MDL-58325 config_log: Record changes in editor management to config_log. 2017-03-24 08:48:30 +01:00
Marina Glancy f494350d40 MDL-58092 gradingform_guide: behat to demonstrate double quote fix 2017-03-24 13:28:52 +08:00
gthomas2 ef79f05067 MDL-58092 grading methods: Fix double escape for freq used questions 2017-03-24 13:28:51 +08:00
Eloy Lafuente (stronk7) 3fc319c0c4 weekly release 3.1.5+ 2017-03-23 20:30:49 +01:00
Eloy Lafuente (stronk7) 57d9979b43 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-03-23 20:30:47 +01:00
Marina Glancy 3cd85bbfae MDL-41809 course: do not rely on page context
page context may not be set, use the correct course context when calling format_string
2017-03-23 14:46:05 +08:00
Andrew Nicols 354d0f5e84 Merge branch 'MDL-57429-31-fix' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-03-23 11:54:49 +08:00
Jake Dallimore 42306af15e MDL-57429 badges: handle curl problems nicely during connection creation
- Properly validate the displayer API response before sending the
verification email.
- Properly validate the displayer API response before creating the
saved connection.
2017-03-23 11:39:45 +08:00
AMOS bot 9ffd2349a2 Automatically generated installer lang files 2017-03-22 00:04:37 +08:00
Juan Leyva 5efec4d5a3 MDL-58227 mod_feedback: Delete duplicated completions records
This commit also fixes the way the previous completion record was
fetched to avoid the creation of new duplicates.
2017-03-21 09:57:00 +01:00
Dan Poltawski 00a142859b Merge branch 'MDL-58317-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-03-21 07:58:00 +00:00
John Okely 17b7ca5b2b MDL-37168 mod_lti: Fix rename behat 2017-03-21 10:25:03 +08:00
Eloy Lafuente (stronk7) e5edbe8ccd Merge branch 'MDL-57840-31-get_users_by_field' of https://github.com/roperto/moodle into MOODLE_31_STABLE 2017-03-21 01:06:07 +01:00
Dan Poltawski 258db34bfc Merge branch 'MDL-58273-31-ldapenrol' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-03-20 11:09:41 +00:00
David Monllao c3c88e8673 Merge branch 'MDL-37168-31' of https://github.com/xow/moodle into MOODLE_31_STABLE 2017-03-20 10:19:01 +01:00
Dan Poltawski be12bb8ab8 Merge branch 'MDL-58285-m31' of https://github.com/NeillM/moodle into MOODLE_31_STABLE 2017-03-20 08:54:11 +00:00
John Okely 8da9781a25 MDL-37168 grade: Debugging if gradebook callbacks are not both present 2017-03-20 16:31:14 +08:00
John Okely 6f3be9d5ce MDL-37168 mod_lti: Add behat test to cover lti quick edit 2017-03-20 16:00:47 +08:00
Sam Chaffee 045a69fd3e MDL-37168 mod_lti: Fix LTI activity quick edit title 2017-03-20 16:00:47 +08:00
Darko Miletic 7bfa58873a MDL-58079 core_enrol: Fixed invalid category tag 2017-03-20 04:12:23 -03:00
Damyon Wiese 889a985b62 MDL-58317 templates: Fix async template render
There is an edge case where we do not wait for all promises before
rendering a template. This can generate "failed to pre-fetch the template" JS errors.
2017-03-20 13:37:41 +08:00
David Monllao 5f90019098 Merge branch 'MDL-58166-31' of git://github.com/pavelsokolov/moodle into MOODLE_31_STABLE 2017-03-20 05:12:09 +01:00
David Monllao c5ed804680 Merge branch 'MDL-58182-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-03-20 05:04:49 +01:00
Andrew Nicols 72536bd5a8 Merge branch 'MDL-57429-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-03-20 10:38:50 +08:00
AMOS bot 94ae0b7f7b Automatically generated installer lang files 2017-03-20 00:07:54 +08:00
AMOS bot 5d8822ff11 Automatically generated installer lang files 2017-03-18 00:09:47 +08:00
Pavel Sokolov ea8ce0c362 MDL-58166 mod_assign: markingworkflow breaks assign for non-graders 2017-03-17 17:53:09 +03:00
Arnaud Trouve afbb1b7fb5 MDL-58257 course: fix search containing a hyphen
In case a hyphen (-) was preceded and followed by spaces,
the pattern for the "not regex" was empty causing an empty response from the database
2017-03-17 08:29:49 +01:00
Jake Dallimore cd099d041f MDL-58182 javascript: Fix for buttons regression in core dialog.
Fixes a regression caused by MDL-56364, wherein the buttons were made
readOnly, meaning addButtons wouldn't work. This removes that change,
while maintaining the original dependency between the buttons and the
closeButton config options.
2017-03-17 09:07:26 +08:00
Darko Miletic 6e0b2cde30 MDL-58079 core_enrol: Implementing fix and unit test 2017-03-16 14:27:06 -03:00
Neill Magill 2c60b80795 MDL-58285 tool_mobile: Web service generates incorrect fileurl on IIS
The tool_mobile_get_plugins_supporting_mobile generated an incorrect
fileurl on IIS. The /mobile/filename.zip part was generated as
\mobile\filename.zip, this failed the PARAM_URL check.

This change stops the use of OS specific directory separators and uses
the linux/web separator. PHP file functions recognise this properly.
2017-03-16 12:12:34 +00:00
Dan Poltawski 6e0c45eab6 weekly release 3.1.5+ 2017-03-16 11:52:54 +00:00
Dan Poltawski 71a3196ddf Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-03-16 11:52:52 +00:00
Jake Dallimore 9ec7dbc419 MDL-57429 badges: add email verification for openbackpack connections
With the Persona provider now out of commission, no new connections to
the Mozilla openbackpack can be created. This patch adds an email
verification step to core to restore the openbackpack functionality.
2017-03-16 09:34:33 +08:00
David Mudrák b147cea65f MDL-58273 enrol_ldap: Fix the name of the capability
This capability controls who can hide/show the enrolment instance.
2017-03-15 18:39:58 +01:00
Andrew Nicols 0c9a5310f9 Merge branch 'MDL-57658-31-integration-fix-2' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-03-15 15:15:22 +08:00
Jun Pataleta 67f8fc9419 MDL-57658 calendar: Remove BYDAY filtering dependence on NumberFormatter 2017-03-15 14:25:34 +08:00
Andrew Nicols aec0f344de Merge branch 'MDL-57658-31-integration-fix' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-03-15 11:42:58 +08:00
Jun Pataleta baad350a71 MDL-57658 calendar: Set sort order for fetched DB records 2017-03-15 11:30:06 +08:00
Dan Poltawski 3a9570a37a Merge branch 'MDL-57658-31-3' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-03-14 16:11:36 +00:00
David Monllao 3203027f54 Merge branch 'MDL-58114-31-excparams' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-03-14 11:03:20 +01:00
AMOS bot f96f84cb19 Automatically generated installer lang files 2017-03-14 00:04:58 +08:00
Eloy Lafuente (stronk7) f285d9203f Moodle release 3.1.5 2017-03-11 22:16:02 +01:00
AMOS bot 6766dabe82 Automatically generated installer lang files 2017-03-12 00:04:35 +08:00
AMOS bot d56e2cd3eb Automatically generated installer lang files 2017-03-12 00:04:34 +08:00
Eloy Lafuente (stronk7) 9b7f4e9e8e weekly release 3.1.4+ 2017-03-10 20:59:51 +01:00
Eloy Lafuente (stronk7) 7b3608625e Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-03-10 20:59:46 +01:00
Damyon Wiese 0a76cd2ca1 MDL-57596 forms: CLEANHTML in persistent forms
Add special handling for text fields with the CLEANHTML type. This should
be used when students and teachers can edit the same field (you can't trust those students).

Applies cleaning on submitted data, and on data stored in the DB before it is put back in an editing form.
2017-03-10 18:09:30 +00:00
Marina Glancy 36706f5b98 MDL-58010 user: allow to update only whitelisted preferences 2017-03-10 18:09:29 +00:00
Eloy Lafuente (stronk7) ff2b56b538 Merge branch 'MDL-58123-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-03-10 18:09:29 +00:00
Dan Poltawski b6a8a31088 Merge branch 'MDL-58035_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2017-03-10 18:09:28 +00:00
David Mudrák 3fe3805d79 MDL-57597 competency: Fix serving of prior learning evidence files
For security reasons, all files submitted by students must be disposed
as attachments, not inline contents.
2017-03-10 18:09:28 +00:00
AMOS bot 3ce9798faf Automatically generated installer lang files 2017-03-10 00:04:45 +08:00
Jun Pataleta e0a41273a6 MDL-57658 calendar: Fix rrulemanager and unit tests
Issues fixed:
* Additional rule validations.
* Rewrote recurrence logic.
* Additional unit tests, especially from the examples in the RFC.
* The date format "YmdThis" results into an incorrect date for the
  "UNTIL" parameter. The literal "T" should be escaped, and a literal
  "Z" is also needed at the end of the format string to indicate UTC.
* Implemented handling of negative modifier values for BYxxx rules.
* Implemented handling of BYWEEKNO, BYYEARDAY, BYSETPOS, BYHOUR,
  BYMINUTE, BYSECOND rules.
2017-03-09 16:15:47 +08:00
AMOS bot 238b87a2fb Automatically generated installer lang files 2017-03-08 00:06:24 +08:00
Eloy Lafuente (stronk7) 7ea1dd1580 Merge branch 'MDL-58064-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-03-07 16:37:59 +01:00
Dan Poltawski 1a13098682 Merge branch 'wip-mdl-58056-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-03-07 11:08:32 -03:00
Tim Hunt ed961702c6 MDL-58035 lib: log when the expected theme cannot be initialised 2017-03-07 13:33:48 +00:00
David Monllao 17da61847f Merge branch 'MDL-58106_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2017-03-07 13:38:27 +01:00
David Monllao 6805a9e11b Merge branch 'wip-mdl-58091-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-03-07 13:16:11 +01:00
David Mudrák fe785db8db MDL-58064 lang: Clarify the PHP 7.x limitations
These are related to SQL*Server support only and affect all PHP 7
versions, not just 7.0.x. Credit goes to Eloy Lafuente for spotting
this.
2017-03-07 12:56:28 +01:00
Ankit Agarwal b6500c619a MDL-55859 assign_editpdf: cleanup htmlfile in case of errors 2017-03-07 07:14:11 -03:00
Dan Poltawski 62fbaeecbb Merge branch 'wip-mdl-58052-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-03-07 06:54:28 -03:00
Ankit Agarwal 80e10c2278 MDL-57362 assign: Fix permission checks 2017-03-07 13:21:01 +05:30
Rajesh Taneja dcbcc94a51 MDL-58052 behat: user session function - use to edit current profile 2017-03-07 11:06:14 +08:00
Dan Poltawski 0ce3aa0562 MDL-57362 assign: fix php54 compatability 2017-03-06 10:53:56 -03:00
Dan Poltawski 47dc780e98 Merge branch 'MDL-57362-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-03-06 10:27:03 -03:00
Adam Olley 471a306b44 MDL-58160 coursecat: Use set_many to populate category cache
When the course category cache needs to be repopulated, two entries are added
to the cache for each category. In core this is currently done in a for-loop,
resulting in N set calls to the cache (where N is twice the number of
categories in Moodle).

This change switches that code to using a single set_many cache call instead,
which makes this an O(1) operation instead of O(N).

For a site with say, 1000 categories, this results in only 1 set call to the
cachestore instead of 2000.
2017-03-06 12:06:51 +10:30
Eloy Lafuente (stronk7) e52a7a4fe0 weekly release 3.1.4+ 2017-03-03 10:33:43 +01:00
Eloy Lafuente (stronk7) 5e1a2d2a42 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-03-03 10:33:39 +01:00
Tim Hunt 20c506c970 MDL-58106 random Q restore: avoid MySQL performance issues 2017-03-02 19:41:35 +00:00
Jun Pataleta c8e6ceb4c4 MDL-58123 mod_lesson: Fix lesson table name in refresh_events DB query 2017-03-02 10:55:53 +08:00
David Mudrák 967451e8ed MDL-58114 plugin manager: Fix exception parameters 2017-03-01 15:10:51 +01:00
Eloy Lafuente (stronk7) 6098e65822 Merge branch 'wip-MDL-48228-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-03-01 02:57:34 +01:00
Adrian Greeve fb1fcfb4f3 MDL-48228 database: Unit test addition and update. 2017-03-01 09:07:14 +08:00
Adrian Greeve 39e019735f MDL-48228 database: Make utf8mb4 the default character set for mysql.
Thanks to Jetha Chan for providing the initial patch that this is
based on.
2017-03-01 09:07:14 +08:00
Eloy Lafuente (stronk7) b95cb5e0e5 Merge branch 'MDL-58071-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-02-28 23:00:50 +01:00
Eloy Lafuente (stronk7) 44b6b2318f Merge branch 'MDL-55762-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-02-28 20:41:09 +01:00
David Monllao c89650cd42 MDL-51833 docs: Move upgrade note under 3.1.5 2017-02-28 11:33:55 +01:00
David Monllao 3d062e2cdf Merge branch 'wip-MDL-51833-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-02-28 11:33:05 +01:00
Ankit Agarwal f9465c0974 MDL-57362 assignlib: Fix minor bug in phpdocs 2017-02-28 10:34:28 +05:30
Ankit Agarwal ced9b94a04 MDL-57362 assignlib: Check for sep groups edge case 2017-02-28 10:34:27 +05:30
Rajesh Taneja 55bf30c23c MDL-58091 behat: Added missing @_file_upload tag 2017-02-28 11:23:10 +08:00
Andrew Nicols c91507f8d5 Merge branch 'MDL-35980-31' of git://github.com/snake/moodle into MOODLE_31_STABLE 2017-02-28 10:34:09 +08:00
Jake Dallimore c8d7affbb5 MDL-35980 behat: fix link text in submission_comments feature 2017-02-28 10:26:37 +08:00
Andrew Nicols 188892a7a8 MDL-55547 tool_monitor: Coding style fixes 2017-02-28 09:12:04 +08:00
Andrew Nicols 12ec6228a5 Merge branch 'wip-MDL-55547-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-02-28 09:09:54 +08:00
Eloy Lafuente (stronk7) b7265c5a4f Merge branch 'MDL-58030_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2017-02-27 22:54:19 +01:00
Helen Foster bdff8c070f MDL-58064 lang: Merge English strings from the en_fix language pack 2017-02-27 10:27:58 +01:00
Andrew Nicols 3b8f30b128 Merge branch 'MDL-50719-fast-locks-MOODLE_31_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_31_STABLE 2017-02-27 13:49:51 +08:00
Andrew Nicols f76f70f1b3 Merge branch 'MDL-35980-31' of git://github.com/snake/moodle into MOODLE_31_STABLE 2017-02-27 12:21:39 +08:00
Ankit Agarwal 7b14fef527 MDL-55762 assignpdf: Handle errored pages better 2017-02-27 09:27:07 +05:30
Ankit Agarwal cf350bc4f4 MDL-55762 assignpdf: Fix bug in phpdocs 2017-02-27 09:27:06 +05:30
Andrew Nicols 99105dabb5 Merge branch 'MDL-58032-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-02-27 11:52:24 +08:00
Adrian Greeve 9634c940d4 MDL-51833 tool_monitor: Improve access check for monitor. 2017-02-27 09:01:45 +08:00
Juan Leyva 330f27b3fd MDL-58071 user: Return usernotfullysetup exception in WS
If there is an empty required custom user profile field, Web Services
should return the usernotfullysetup exception instead ignoring it.
The mobile app already handles this exception for core fields
redirecting the user to web in order to fill the missing field.
2017-02-24 20:15:45 +01:00
Brendan Heywood 48f3c5744d MDL-50719 cron: Fixed parallel task lock contention issues 2017-02-24 13:18:33 +11:00
Jake Dallimore 8b913c588a MDL-56364 javascript: Prevent bad prototype chains in core dialogue
The DIALOGUE object was using Y.clone to copy the input config, messing
up the prototype chains for any objects in the config param. Really,
this doesn't need to clone the config, so I've refactored to avoid doing
so. Also moved some of the other attribute init and setup calls to the
appropriate places (initializer and modifyAttrs).
2017-02-24 08:35:32 +08:00
Jake Dallimore 3bf7fdb1e8 MDL-35980 comment: add comment info to delete button for screen readers
For each delete button in the comments widget, make the spoken text a
string containing the name of the poster and the datetime.
2017-02-24 08:17:43 +08:00
AMOS bot 6a85db36f5 Automatically generated installer lang files 2017-02-24 00:08:13 +08:00
David Monllao ac4c7623fe weekly release 3.1.4+ 2017-02-23 08:07:44 +01:00
David Monllao d0f5f3ad11 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-02-23 08:07:43 +01:00
Rajesh Taneja 8a63956d8d MDL-58056 behat: Ensure form element exists
Before getting form field, ensure node is
visible. Else it may fail to get form
field
2017-02-23 14:46:06 +08:00
Rajesh Taneja 957f81aaa6 MDL-58056 behat: Catch webdriver exception if element removed
While checking for element visibility, ensure
that element is there in dom
2017-02-23 14:46:06 +08:00
AMOS bot 9a910e7e8c Automatically generated installer lang files 2017-02-23 00:05:58 +08:00
David Monllao 2135c7e9ed MDL-56206 less: Build css styles after rewrite 2017-02-22 09:50:59 +01:00
Andrew Nicols 87cafedcc0 Merge branch 'MDL-56206-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-02-22 09:39:37 +01:00
Eloy Lafuente (stronk7) 5911ac9525 Merge branch 'MDL-55867_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2017-02-22 09:34:19 +01:00
Eloy Lafuente (stronk7) 5a6e167a0b Merge branch 'MDL-56206_31-text-enrolled-users-page-aligned' of https://github.com/lucaboesch/moodle into MOODLE_31_STABLE 2017-02-22 09:34:19 +01:00
David Monllao 771f6902df Merge branch 'MDL-57576-31-updatefeedbackfile' of git://github.com/roperto/moodle into MOODLE_31_STABLE 2017-02-22 09:34:18 +01:00
Dan Poltawski 1626dc7c1f Merge branch 'MDL-57962-31' of git://github.com/dpalou/moodle into MOODLE_31_STABLE 2017-02-22 09:34:18 +01:00
David Monllao 4eb15e3225 Merge branch 'MDL-57795-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-02-22 09:34:17 +01:00
David Monllao 1d9bd31e42 Merge branch 'MDL-57801-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2017-02-22 09:34:17 +01:00
Daniel Thee Roperto 4d2bd9a054 MDL-57840 libraries: Fixed missing fields in get_users_by_field(). 2017-02-22 16:05:49 +11:00
Ankit Agarwal 34502102b4 MDL-58032 core_user: Fix case when acting user is a visitor 2017-02-22 09:56:18 +05:30
Jake Dallimore 95cd5edfab MDL-56206 themes: Text on Enrolled users page well aligned
Helps to align the table row content.
2017-02-22 10:37:40 +08:00
Adam Olley c36e94ad98 MDL-58030 gradingform_guide: Init $commentchooser before use
The initialisation of $commentschooser was moved into an IF condition,
whilst still using it outside of that IF conditions scope. As such, if
there are no comments to choose from, the variable is never init'd but
it still goes to use it, emitting a PHP notice.
2017-02-21 14:36:08 +10:30
David Monllao 8225414388 Merge branch 'MDL-56679-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-02-20 09:20:39 +01:00
David Monllao 71f3a6c9c0 Merge branch 'MDL-50729-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-02-20 08:27:21 +01:00
Marina Glancy c1ee0772ff MDL-55547 tool_monitor: fix exceptions when course was deleted
Delete subscriptions when course is deleted
2017-02-20 12:13:48 +08:00
Jake Dallimore f5b9fddac4 MDL-57795 mod_assign: fix for filters killing review pane when grading
Fixes a bug in which the review pane was destroyed if the user selected
a combination of filters resulting in no matched users. Now, the pane
is just hidden in such cases, and displayed again if subsequent filter
changes return one or more users.
2017-02-20 08:54:55 +08:00
Matteo Scaramuccia ea76a7cde3 MDL-57379 Files: Improved file argument evaluation.
get_file_argument() is responsible to extract the relative path
of the file to be served by a specific Moodle component
like a theme or a module.
Some modules like scorm and imscp require slasharguments support
and they force it when creating the URLs to serve their files.
It should honor the slasharguments setting but this could break
those instances where existing hard-coded links still make usage of
the "old" format, the one when slasharguments is set to No i.e. '?file='.

Its logic has been improved by looking at when the URL is related to
serving a plug-in file in a "forced" slasharguments way of serving it
i.e. using '/pluginfile.php/' and not '/pluginfile.php?'.
2017-02-19 18:44:52 +00:00
Tony Butler 8e99e8c014 MDL-57801 core_filestorage: Delete temp file if disk space runs out 2017-02-16 12:48:57 +00:00
Tony Butler 131e69e29b MDL-57801 core_filestorage: Verify hash of temp file before committing
This addresses an edge scenario on NFS filesystems with no space
remaining, where subsequent uploads fail silently while zero byte files
are saved to the pool (and for some reason the filesize check passes).
2017-02-16 12:48:57 +00:00
Gergely Kún 9c6cc265da MDL-56679 core: Initialise $SESSION if necessary 2017-02-16 16:19:52 +08:00
Dan Poltawski 0767770d95 weekly release 3.1.4+ 2017-02-16 08:14:43 +00:00
Dan Poltawski 79fcb7446a Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-02-16 08:14:37 +00:00
Eloy Lafuente (stronk7) 91f22e1486 Merge branch 'MDL-53991_m31v4' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2017-02-14 18:16:34 +01:00
David Monllao b2a8d8af06 MDL-56122 editpdf: Fix ghostscript checking 2017-02-14 13:45:48 +01:00
Brendan Heywood b34f0b369f MDL-57810 lib: Disable nginx buffers when not required 2017-02-14 11:35:54 +00:00
Dani Palou 8163446fee MDL-57962 forum: Allow creating new discussions with groupid -1 2017-02-14 10:45:57 +01:00
David Monllao a331f6b0d8 Merge branch 'MDL-56122-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2017-02-14 09:53:48 +01:00
Ankit Agarwal b3094c4751 MDL-50729 gradelib: Regrade event should be assigned to system 2017-02-14 11:40:52 +05:30
Ankit Agarwal 2d47619503 MDL-50729 events: Add user constants to events base class 2017-02-14 11:40:52 +05:30
Damyon Wiese 1494620bfb MDL-57766 assign: Put back the manual marker filter
I removed too much from gradingtable.php in the last patch.
2017-02-14 10:20:24 +08:00
Eloy Lafuente (stronk7) f1fd291473 Merge branch 'MDL-57868-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2017-02-13 23:42:58 +01:00
Tony Butler b20d56c357 MDL-56122 assignfeedback_editpdf: Add test assertions for pdf generation 2017-02-13 17:31:08 +00:00
Tony Butler 9e49655f16 MDL-56122 assignfeedback_editpdf: Regenerate PDF & page images if blank 2017-02-13 17:31:08 +00:00
Dan Poltawski 805a4017ab Merge branch 'MDL-56841_31' of https://github.com/andrewhancox/moodle into MOODLE_31_STABLE 2017-02-13 16:39:39 +00:00
Davo Smith 0e69daef28 MDL-57752 session: fix check_security() session termination 2017-02-13 13:54:47 +00:00
Dan Poltawski c704f0da1a Merge branch 'MDL-57768-webservice-config-error-MOODLE_31_STABLE' of https://github.com/ilya-catalyst/moodle into MOODLE_31_STABLE 2017-02-13 13:31:05 +00:00
David Monllao f15c70ab7f Merge branch 'MDL-57766-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-02-13 09:44:36 +01:00
David Monllao 26ef0c5c79 Merge branch 'wip-MDL-50770-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-02-13 09:14:31 +01:00
AMOS bot 7f5df63d6e Automatically generated installer lang files 2017-02-11 00:12:02 +08:00
Ilya Tregubov ae1cb40c5e MDL-57768 webservice: Delete manual setting of config in test 2017-02-10 11:47:25 +11:00
Damyon Wiese 609d5f1826 MDL-57766 mod_assign: Marker allocation fixes
Marking allocation was only ever applied in the view for the grading table. It should
have been added to the list_participants function because that is used by webservices and
the new grading UI.
2017-02-09 17:14:12 +08:00
Andrew Nicols 70b465a75c MDL-57766 assign: backport MDL-54872
We need to backport the changes in MDL-54872 so we can apply a fix on top of them in this issue.
2017-02-09 17:14:03 +08:00
David Monllao 341af0a779 weekly release 3.1.4+ 2017-02-09 08:00:06 +01:00
David Monllao 1e2f25c79c Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-02-09 08:00:04 +01:00
Damyon Wiese 95004c72af MDL-57009 javascript: Fix "failed to prefetch"
The scanForPartials in amd/src/templates.js function is not handling
nested sections (the list of tokens is a tree not a flat list).
2017-02-08 11:11:40 +08:00
AMOS bot da83f4d2fc Automatically generated installer lang files 2017-02-08 00:09:38 +08:00
Damyon Wiese 5799fb8640 MDL-57009 javascript: Reject on all errors
Not all error paths were resulting in a reject() call to fail a promise.
2017-02-07 12:36:14 +00:00
Damyon Wiese e1c3a4d24f MDL-57009 javascript: Always use when.apply
Or it does not really wait for the promises.
2017-02-07 12:36:09 +00:00
Dan Poltawski c20f9c6678 Merge branch 'MDL-57009-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2017-02-07 12:32:32 +00:00
Eloy Lafuente (stronk7) 556ca7fa16 Merge branch 'wip-mdl-57851-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-02-07 01:26:36 +01:00
AMOS bot 7dfbe69352 Automatically generated installer lang files 2017-02-07 00:05:39 +08:00
Eloy Lafuente (stronk7) bc091a045b Merge branch 'MDL-53349-31' of https://github.com/xow/moodle into MOODLE_31_STABLE 2017-02-06 16:26:02 +01:00
Dan Poltawski 257ef7c065 Merge branch 'MDL-57660-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2017-02-06 13:47:31 +00:00
Dan Poltawski d8b7b023a6 Merge branch 'MDL-56592-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2017-02-06 12:33:59 +00:00
Dan Poltawski 622a713fa1 Merge branch 'MDL-57587_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2017-02-06 11:02:23 +00:00
Juan Leyva 7b48139c7a MDL-57868 mod_feedback: Fix incorrect query parameters order
get_records_menu call get_records using the same params ordering, it is
causing a duplicated value error for the first column
2017-02-06 11:32:45 +01:00
David Monllao 5ef761f4d8 Merge branch 'MDL-57777-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2017-02-06 09:42:05 +01:00
Stephen Bourget 4f865489f0 MDL-55867 block_activity_results: Sort activities alphabetically. 2017-02-05 21:30:59 -05:00
Rajesh Taneja 475a266e31 MDL-57851 behat: Add some more wait for scenario to pass
On slow machine with phnatomjs profile
this scenario keeps failing. Add some more
wait to ensure the page is stable and next
step can be executed
2017-02-03 12:55:13 +08:00
AMOS bot d77412d35f Automatically generated installer lang files 2017-02-03 00:04:26 +08:00
Andrew Hancox 5fee906a30 MDL-56841 mod_folder: Display edit and download buttons inline 2017-02-02 15:18:01 +00:00
Andrew Nicols a04076a1f2 weekly release 3.1.4+ 2017-02-02 11:32:09 +08:00
Nadav Kavalerchik d0ed5742d0 MDL-53349 Autocomplete: Support multi lingual COMMA keycode (44) 2017-02-01 16:39:00 +08:00
Ankit Agarwal 2ba930d7bb MDL-57027 accesslib: Improve perf of sql 2017-02-01 13:07:47 +08:00
Petr Skoda 650197e4dc MDL-57027 fix get_users_by_capability()
Change-Id: I98dc88784dfa0293f88a19c3d36e7a46a3f52672
2017-02-01 13:07:47 +08:00
Eloy Lafuente (stronk7) 53b48f0116 Merge branch 'MDL-57592-31' of https://github.com/mwehr/moodle into MOODLE_31_STABLE 2017-02-01 13:07:46 +08:00
Dan Poltawski 21f77735fc Merge branch 'MDL-57588_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2017-02-01 13:07:46 +08:00
Michael Aherne 049838f998 MDL-57777 rss: Return 404 when context not found. 2017-01-31 09:33:20 +00:00
Andrew Nicols 6df1f24a6b Merge branch 'wip-MDL-57785-31' of git://github.com/amygroshek/moodle into MOODLE_31_STABLE 2017-01-31 12:26:38 +08:00
Andrew Nicols 1f47d41b03 Merge branch 'MDL-35978-31-blockfix' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-01-31 11:52:12 +08:00
Jake Dallimore 903ef33978 MDL-35978 comments: fix for comments block which has no toggler 2017-01-31 11:36:42 +08:00
Andrew Nicols 7d2477a859 Merge branch 'MDL-57296-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-01-31 08:55:27 +08:00
wehr 054a23264c MDL-57592 assignment: Adds filtering of assignment name in grader view 2017-01-30 18:31:51 +01:00
Tim Hunt 9e50e8c386 MDL-57588 questions: regrading should not lose flags 2017-01-30 14:32:28 +00:00
Dan Poltawski 1a52d63ea9 Merge branch 'MDL-35978-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-01-30 09:54:15 +00:00
Dan Poltawski 78d40d3e6d Merge branch 'MDL-36233-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2017-01-30 09:34:56 +00:00
Ankit Agarwal afaeae1796 MDL-57296 gradelib: Fix get_hidding_effect for grade_type_none items 2017-01-30 13:49:59 +05:30
Ankit Agarwal f518505d71 MDL-57296 gradebook: Fix issue with gradebook while collapsing grades 2017-01-30 13:49:58 +05:30
Mike Churchward b5c0146072 MDL-36233 mod_assign: fixed submission time comparison sql and test. 2017-01-30 09:27:26 +08:00
Amy Groshek d5b78c7c81 MDL-57785 scorm: Prevents SCORM nav refresh when nav not shown.
This improvement prevents refresh of SCORM 1.2 navigation menu
when the navigation menu is not displayed.
2017-01-27 09:13:31 -06:00
Luca Bösch 99e0439396 MDL-56206 themes: Text on Enrolled users page well aligned
Helps to align the table row content.
2017-01-27 08:20:13 +01:00
Jake Dallimore 9660b5f471 MDL-35978 comments: expandable comments announce change when toggled
Added role and aria-expanded attributes to the toggler link and added
a key handler for the space and enter keys.
2017-01-27 13:08:41 +08:00
Jun Pataleta 742671e7c9 MDL-57660 mod_forum: Preserve forum ID selection after form submission 2017-01-27 10:10:14 +08:00
Eloy Lafuente (stronk7) 81e812c697 weekly release 3.1.4+ 2017-01-27 00:27:57 +01:00
Eloy Lafuente (stronk7) b984606f45 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-01-27 00:27:53 +01:00
Tim Hunt 072a971908 MDL-57587 question file access: fix regression caused by MDL-53744 2017-01-26 18:54:47 +00:00
Michael Aherne 829e7ae8a3 MDL-57777 rss: Return 404 when context not found. 2017-01-26 10:49:13 +00:00
Eloy Lafuente (stronk7) df222f7338 Merge branch 'MDL-55915_31' of https://github.com/rezaies/moodle into MOODLE_31_STABLE 2017-01-24 22:11:53 +01:00
AMOS bot 8a0eb277db Automatically generated installer lang files 2017-01-25 00:04:55 +08:00
Dan Poltawski 836747b10a Merge branch 'MDL-57639-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2017-01-24 10:11:26 +00:00
Rajesh Taneja b638f51bd0 MDL-46782 scorm: Fixed behat in multisco_reentry
Require all scos to return completion status is not
in 31, by default the scos will return completion
2017-01-24 10:31:14 +08:00
Dan Poltawski 371f4c2e72 Merge branch 'wip_31_mdl-50625_ldap_better_check_paged_results_support' of https://github.com/iarenaza/moodle into MOODLE_31_STABLE 2017-01-23 16:21:05 +00:00
Dan Poltawski 787e897899 Merge branch 'mdl57668-moodle31' of https://github.com/tlock/moodle into MOODLE_31_STABLE 2017-01-23 12:05:35 +00:00
Dan Poltawski c341626927 Merge branch 'wip-mdl-57700-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-01-23 11:59:09 +00:00
Dan Poltawski 86ef5ce6be Merge branch 'MDL-57677-31-usermodified' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-01-23 09:48:14 +00:00
Dan Poltawski eee6c61ea6 Merge branch 'm31_MDL-46782' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2017-01-23 09:29:37 +00:00
Shamim Rezaie 79441b56ba MDL-55915 enrol_manual: let fullname()know if user has viewfullnames cap
fullname() relies on its second parameter to determine wheter it should use fullnamedisplay or alternativefullnameformat.
We need to check for moodle/site:viewfullnames capability and pass true as the second parameter to fullname() whereever
the user has this capability.
2017-01-20 20:08:47 +11:00
Shamim Rezaie c4b9228d18 MDL-55915 core_user: let fullname() know if user has viewfullnames cap
Added $viewfullnames property to the user_selector_base class so anyone using a child class of this class can
let it know if user has viewfullnames capability or not.
2017-01-20 20:08:17 +11:00
Shamim Rezaie 571f5aba3e MDL-55915 Gradebook: let fullname() know if user has viewfullnames cap
Instruct fullname() to format names on the gradebook grader report with alternativefullnameformat when user
has moodle/site:viewfullnames capability.
2017-01-20 20:07:45 +11:00
Shamim Rezaie 8a954a1571 MDL-55915 mod_assign: let fullname() know if user has viewfullnames cap
Instruct fullname() to format names on the assignment grading page with alternativefullnameformat when user
has moodle/site:viewfullnames capability.
2017-01-20 20:07:11 +11:00
Rajesh Taneja 4e9072d20b MDL-57700 behat: Fixed undefined RuntimeException 2017-01-20 11:14:00 +08:00
AMOS bot f49ff4b736 Automatically generated installer lang files 2017-01-20 00:07:28 +08:00
Iñaki Arenaza 52c14af205 MDL-50625 auth_ldap: Better check for paged results support
There is at least one LDAP server (Sun Directory Server) that doesn't
support Paged Results extension, even if it supports LDAP version 3. So
checking just for LDAP version is not enough.

If possible, we check the supportedControl attribute of the LDAP rootDSE
and see if the paged results control is available. This needs an LDAP
connection, which might not be possible to establish before we configure
some essential LDAP settings (server, bind user, password, etc.). Thus
we try to establish the connection and check the supportedControl
attribute. But if we fail, we perform only basic checks that are less
accurate and err on the side of cautiousness.
2017-01-19 11:02:13 +01:00
Andrew Nicols 087e52eccf MDL-57639 mod_forum: Update to use correct variable name
This addresses a regression where unnecessary attributes were removed
from the old variable. This one was missed.
2017-01-19 13:48:50 +08:00
Andrew Nicols 26c76fcc0b weekly release 3.1.4+ 2017-01-19 12:17:52 +08:00
Andrew Nicols 544a47fc07 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-01-19 12:17:50 +08:00
Tim Lock dfbbb39a25 MDL-57668 mod_assign: Fix optional_param() form processing 2017-01-19 08:07:05 +10:30
Dan Poltawski c52766af64 MDL-57604 mod_assign: fix empty case in user selector
Sadly the js arguments object gives an arguments.length of 1 when
no arguments are passed, so we have to explicitly check for it.
2017-01-18 09:59:45 +01:00
Dan Marsden 4af0bb82e1 MDL-46782 mod_scorm: Load first incomplete sco on re-entry. 2017-01-18 21:06:24 +13:00
Andrew Nicols c2a9f46692 Merge branch 'wip-mdl-45821-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-01-18 13:10:53 +08:00
Rajesh Taneja 3398ecbfc2 MDL-45821 behat: navigate back to scorm to avoid scroll
On Exiting scrom activity, it goes back to course
and scrolls to section. On slow machines next step
fails. To avoid such case navigate to home screen
and then follow next step.
2017-01-18 13:08:29 +08:00
Rajesh Taneja 3ce28cce2e MDL-45821 behat: navigate back to scorm to avoid scroll
On Exiting scrom activity, it goes back to course
and scrolls to section. On slow machines next step
fails. To avoid such case navigate to home screen
and then follow next step.
2017-01-18 13:05:24 +08:00
Eloy Lafuente (stronk7) 54cbf4279a Merge branch 'MDL-57604-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2017-01-18 00:18:31 +01:00
David Mudrák e611797d37 MDL-57677 mod_forum: Fix wrong user displayed as the last post's author
In the recent issue MDL-56225, we started to record the current user as
the usermodified in the forum_discussions table when updating a forum
post. It made sense but it was a mistake.

Even if the current user really modifies the discussion by updating the
post, the field usermodified has actually been always interpreted and
displayed as the last post' author. Not as the last user who touched the
discussion.

This patch reverts that particular change to the previous behaviour and
adds explicit unit test for it.
2017-01-17 20:09:36 +01:00
AMOS bot db27b57aa5 Automatically generated installer lang files 2017-01-18 00:07:35 +08:00
Dan Poltawski 8d270f56e2 Merge branch 'wip-mdl-57669-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-01-17 10:28:36 +00:00
Dan Poltawski 1e25d9306d Merge branch 'MDL-57515-m31' of https://github.com/sammarshallou/moodle into MOODLE_31_STABLE 2017-01-17 10:21:15 +00:00
Rajesh Taneja b3b8d045b7 MDL-45821 behat: Added test scorm package for behat 2017-01-17 13:39:40 +08:00
Rajesh Taneja ab1c2037fc MDL-57669 behat: Exit with error code if step undefined 2017-01-17 10:28:35 +08:00
AMOS bot 29aafc0ec7 Automatically generated installer lang files 2017-01-17 00:08:19 +08:00
Dan Poltawski 03ed7684d4 Merge branch 'MDL-57452_behat_completion_fix_master_MOODLE_31_STABLE' of https://github.com/gthomas2/moodle into MOODLE_31_STABLE 2017-01-16 13:34:10 +00:00
Dan Poltawski 8d1bf87c0e Merge branch 'MDL-57601-m31' of https://github.com/sammarshallou/moodle into MOODLE_31_STABLE 2017-01-16 12:23:07 +00:00
Dan Poltawski ec4e2838cd Merge branch 'MDL-57374_m31' of https://github.com/dasistwas/moodle into MOODLE_31_STABLE 2017-01-16 12:11:06 +00:00
Dan Poltawski d3bfb8ceac Merge branch 'MDL-57554-31' of git://github.com/crazyserver/moodle into MOODLE_31_STABLE 2017-01-16 11:18:00 +00:00
Dan Poltawski 10ce06e159 Merge branch 'm31_MDL-45821' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2017-01-16 09:17:54 +00:00
Dan Poltawski 23cf2f6db3 Merge branch 'wip-MDL-56271-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2017-01-16 08:01:24 +00:00
Pau Ferrer Ocaña d3a22bc5a8 MDL-57554 forum: Mark as read on view_forum_discussion calls 2017-01-13 09:27:14 +01:00
David Bogner 18937c1577 MDL-57374 editor: Pasting plain text in Atto removes all styles/classes 2017-01-12 17:58:28 +01:00
AMOS bot 93c8f9347e Automatically generated installer lang files 2017-01-13 00:05:50 +08:00
Stephen Bourget 26c09bc165 MDL-53991 calendar: fix repeating events on course import 2017-01-12 09:41:14 -05:00
gthomas2 35ce557a91 MDL-57452 behat: Make completion check work with manual completion input 2017-01-12 11:43:22 +00:00
Dan Poltawski bdccf17907 weekly release 3.1.4+ 2017-01-12 07:42:31 +00:00
Eloy Lafuente (stronk7) 91557e03ee Merge branch 'wip-mdl-57595-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-01-11 02:37:53 +01:00
Rajesh Taneja 5b5424a8ee MDL-57595 behat: Added wait to ensure next step pass 2017-01-11 09:34:03 +08:00
Dan Poltawski 3a5de34b03 Merge branch 'MDL-57480-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2017-01-10 08:40:13 +00:00
Marina Glancy 6608a30b15 MDL-56271 mod_feedback: recaptcha was not working 2017-01-10 14:08:37 +08:00
Marina Glancy bb21b0ad57 MDL-50770 blocks: copy sitewide blocks positions when cloning dashboards 2017-01-10 11:40:19 +08:00
Jake Dallimore 8e2349f196 MDL-57480 core_course: make drag and drop fire a dom updated event
When adding media via drag and drop, the notifyFilterContentUpdated
event should be called after the item is added to the DOM. This allows
things like videojs for example, to process the new content.
2017-01-10 07:52:46 +08:00
Dan Poltawski c4f051e2e9 MDL-57604 mod_assign: fix incorrect user being selector from chooser
Previously there was a logic bug where by if some students were filtered
from the list, the label for another student could be attached to the
'filered' student.

This fix reworks the promises a bit so we render the student summary and
then build an row with the explict user id, rather than itterating through
the array later.

I also remove the storing of the initial promise in a varible because
this is an easy way to introduce a bug (not waiting for the .then()
chained promise)
2017-01-09 20:41:09 +00:00
sam marshall 691868bdaa MDL-57601 Grade report: Error for ungraded quiz without view hidden
If a course contains an ungraded quiz (max grade set to 0), and there
is a user account which can view the grader reports but does not have
permission to view hidden grades, they will get errors.
2017-01-09 17:15:13 +00:00
sam marshall bc1643135c MDL-57515 Resource: 'not very efficient' with a large number of files
Fixes bug where the resource module loads metadata for all files while
building course modinfo, even though it only needs the first file.
(This causes problems if you have ~10k files.)
2017-01-09 16:36:41 +00:00
Dan Poltawski 1910eaf251 Merge branch 'MDL-57427_m31' of https://github.com/jrchamp/moodle into MOODLE_31_STABLE 2017-01-09 16:26:30 +00:00
Jonathan Champ e3d53b99aa MDL-57427 cache: Use perfdebug only when enabled 2017-01-09 10:19:02 -05:00
David Monllao d05d5cd4c7 Merge branch 'wip-mdl-55042-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-01-09 12:56:22 +01:00
godric 1790647ff9 MDL-40132 lib: Using compare rule results in fatal error.
In getValidationScript function variable $element can be an array or object.
Function attempt get non-existing attributes.
To avoid this we should check before accessing.
2017-01-09 10:30:12 +00:00
Dan Poltawski fe51a68590 Merge branch 'MDL-53367_31' of https://github.com/juancs/moodle into MOODLE_31_STABLE 2017-01-09 08:28:02 +00:00
Dan Marsden 62ca5c4b91 MDL-45821 mod_scorm: Check lesson_status correctly for multi-sco. 2017-01-09 20:08:38 +13:00
Eloy Lafuente (stronk7) edab0782a3 Moodle release 3.1.4 2017-01-08 11:04:30 +01:00
AMOS bot ea40017100 Automatically generated installer lang files 2017-01-08 00:05:17 +08:00
Dan Poltawski cef7920cd1 weekly release 3.1.3+ 2017-01-06 01:30:54 +00:00
Dan Poltawski ea69f5f78f Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2017-01-06 01:30:53 +00:00
David Mudrák 29c56ec89e MDL-57580 mod_assign: Fix the incorrect type of some input parameters
The PARAM_TEXT has been misused in certain cases here. The 'action'
parameter seems to always be alphabetic, with values like
savesubmission, editsubmission and others as handled in assign::view().

Fixing the action handling fixes the reported XSS issue. While working
on it, I spotted two more places where PARAM_TEXT does not seem
appropriate. I include changes for them too, even if they are no
strictly related to the reported bug and there are no known ways to
abuse it.

* The 'plugin' looks like PARAM_PLUGIN and is even declared as such in
  some other parts of the assignment code (such as feedback forms).

* The 'workflowstate' is one of the ASSIGN_MARKING_WORKFLOW_STATE
  constants and is supposed to be alpha in external function input
  parameters handling, too.
2017-01-05 17:40:13 +01:00
Dan Poltawski cb84158ba7 Merge branch 'MDL-57563-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-01-05 10:11:42 +00:00
Helen Foster 530656cedb MDL-57563 lang: Merge English strings from the en_fix language pack 2017-01-05 10:46:12 +01:00
Rajesh Taneja d33d5f302e MDL-57531 behat: Set noreplyaddress to valid address
noreplyaddress should be a valid address, else
it will not be saved. For behat we don't send
email, so set it to noreply@example.com, to
avoid failing validation on localhost
2017-01-05 06:52:11 +00:00
Daniel Thee Roperto 33952ce027 MDL-57576 assignment: Overwrite feedback file if it has the same name. 2017-01-05 15:31:31 +11:00
Damyon Wiese 893ed748bc MDL-57009 javascript: cibot nagging
Conflicts:
	lib/amd/build/templates.min.js
2017-01-05 09:38:09 +08:00
Damyon Wiese 13c9addc7d MDL-57009 javascript: Dont rely on async ajax
Recursively pre-scan mustache templates to extract the list of blocks and partials. Then
we can pre-fetch them all and don't have to rely on jquery async ajax (which is deprecated).

This is part of a refactoring of the promises code in the templates module to prevent duplicate requests.

Conflicts:
	lib/amd/build/templates.min.js
2017-01-05 09:37:55 +08:00
Damyon Wiese 0d1c739aeb MDL-57009 js: Do not fetch the same template twice
Also clean up promises use of done vs then.

Conflicts:
	lib/amd/build/templates.min.js
	lib/amd/src/templates.js
2017-01-05 09:37:32 +08:00
Damyon Wiese 3ef9d54387 MDL-57009 js: Skip ajax request for same string
This is done by caching the first promise generated to fetch a string.
2017-01-05 09:36:49 +08:00
AMOS bot 6302ddbece Automatically generated installer lang files 2017-01-05 00:05:35 +08:00
Dan Poltawski 3ad6c077d9 Merge branch 'MDL-57531-31-phpmailer' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2017-01-04 13:33:46 +00:00
David Mudrák f3d6e11ca0 MDL-57531 mail: Validate the sender's email address
The patch adds validation for the noreplyaddress setting variable, for
the explicit $replyto parameter and for the sender's email. In case of
misconfigured noreplyaddress setting, it falls back to the default
noreply address value. In case of invalid email in the user's record,
the email is not sent.

The patch also adds unit test for the value returned by the function
generate_email_processing_address() so that it can be considered as a
valid email, too.

This is supposed to significantly minimise the risk of exploiting the
vulnerability in PHPMailer's Sender field.
2017-01-04 13:05:03 +01:00
David Mudrák 7d1d26c48d MDL-57531 mail: Do not let admins set invalid email addresses
The noreply and support emails should always be valid.
2017-01-04 12:43:12 +01:00
Eloy Lafuente (stronk7) 14cc2f7d83 Merge branch 'MDL-57192-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2017-01-04 11:59:02 +01:00
David Mudrák a910f710fc MDL-56225 mod_forum: Fix inability to edit attachments
The 'attachments' is not a real DB field here. It comes from the form's
filepicker and holds the id of the attachments filearea. The function
forum_add_attachment() expects it as a property of the first argument.

There were two possible approaches here. Either to pass the raw $newpost
to forum_add_attachment(), or add the attachments into the list
modifiable fields. The second approach is safer.
2017-01-04 10:36:29 +00:00
David Monllao df676dea41 Merge branch 'm31_MDL-49557' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2017-01-04 06:14:31 +01:00
Ankit Agarwal a331b1d791 MDL-57192 dml: Temporarily disable query logging during setup 2017-01-04 08:17:52 +05:30
Dan Marsden d0c5c6e60c MDL-49557 mod_scorm: optionally strip quotes. 2017-01-04 15:45:38 +13:00
Ankit Agarwal 8684514333 MDL-57192 dml: Support temporarily disabling query logs during setup 2017-01-04 08:06:22 +05:30
Andrew Nicols e6a855e81d MDL-56225 mod_forum: Remove unnecessary attributes from update 2017-01-03 16:58:47 +00:00
Rajesh Taneja 29c62b300c MDL-55042 phpunit: Get sorted sections
Sometimes db doesn't return records in order
So enusre it is in order so that last record
doesn't have section equal 0. As section 0
can't be deleted.
2017-01-03 10:01:00 +08:00
Eloy Lafuente (stronk7) 274c7ad7da Merge branch 'wip-mdl-57494-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2017-01-03 02:35:21 +01:00
Davo Smith 00b860d0d1 MDL-47198 filelib: fix curl handling headers with no value 2017-01-02 16:44:01 +01:00
Dan Poltawski 65e7dd7798 Merge branch 'm31_MDL-49557' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2017-01-02 12:35:11 +00:00
Dan Poltawski 8dea0f4533 Merge branch 'MDL-57080-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2017-01-02 12:15:04 +00:00
Dan Poltawski 28bb924937 Merge branch 'wip-MDL-57464-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2017-01-02 11:16:22 +00:00
AMOS bot f556e14028 Automatically generated installer lang files 2016-12-30 00:05:34 +08:00
Dan Poltawski 3b95075ddd Merge branch 'MDL-57512-31' of git://github.com/crazyserver/moodle into MOODLE_31_STABLE 2016-12-29 11:50:59 +00:00
Dan Poltawski eb9aa63303 Merge branch 'm31_MDL-50643' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-12-29 11:46:50 +00:00
Pau Ferrer Ocaña 0ebebc2552 MDL-57512 categories: Use maxcategorydepth only when getting all cats 2016-12-29 12:09:57 +01:00
David Monllao 104a76930d Merge branch 'MDL-57338-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-12-29 10:52:47 +01:00
Dan Poltawski 977b92dd0b Merge branch 'MDL-55955_31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-12-28 15:11:58 +00:00
Dan Poltawski 9ff6b6d5fa Merge branch 'wip-MDL-57366-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-12-28 15:05:59 +00:00
David Monllao c5be0c6b22 Merge branch 'MDL-52366-31-mustachethemedir' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-12-28 12:24:14 +01:00
Dan Marsden 751e80769c MDL-49557 mod_scorm: fix AICC pre-requisite handling. 2016-12-28 10:09:44 +13:00
AMOS bot 845cf5b198 Automatically generated installer lang files 2016-12-27 00:09:29 +08:00
AMOS bot 0dff58bb16 Automatically generated installer lang files 2016-12-26 00:06:07 +08:00
AMOS bot 1f859dd6d7 Automatically generated installer lang files 2016-12-25 00:04:46 +08:00
Adrian Greeve c27a165ccf MDL-57464 mod_lesson: fix notice with sub-clusters. 2016-12-23 11:13:13 +08:00
Jake Dallimore 39fc6c210e MDL-57357 auth: add behat coverage for remember username login feature 2016-12-23 11:11:37 +08:00
Adrian Greeve 4f2c239ea4 MDL-57366 mod_lesson: Zero now acceptable numeric answer.
When creating a numerical question. If the answer to the
question is 0 then the answer will not save.
2016-12-23 10:37:40 +08:00
Mark Nelson 84f6435a14 MDL-55955 mod_quiz: ensure duplicated override events are removed 2016-12-23 10:02:55 +08:00
Dan Marsden 850e56c5c6 MDL-50643 mod_scorm: redirect using current window instead of parent. 2016-12-23 10:18:15 +13:00
Dan Poltawski 5f0e1523f7 MDL-57338 templates: add missing example context 2016-12-22 13:02:57 +00:00
Michael Aherne 9a177e48f3 MDL-57080 completion: Update completion expected date on reset 2016-12-22 11:50:06 +00:00
Dan Poltawski 6b5bff8870 weekly release 3.1.3+ 2016-12-22 08:15:11 +00:00
Dan Poltawski 0d5aa55fb6 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-12-22 08:15:10 +00:00
Rajesh Taneja 8d9d32653b MDL-57494 behat: Fixed tags and removed reset in after_scenario
1. Added missing switch_window tags
2. Fixed switch_frame tags to use switch_iframe
3. Removed reset from after_scenario.
2016-12-22 12:46:05 +08:00
David Monllao af63b87738 Merge branch 'MDL-55575_B_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-12-21 05:50:32 +01:00
Eric Merrill b7afb51132 MDL-56592 gradereport_user: Add ability to view report as other user
Backport of MDL-30179.
2016-12-20 13:19:40 -05:00
AMOS bot 9ca2bb46f4 Automatically generated installer lang files 2016-12-21 00:04:14 +08:00
Dan Poltawski a902c76035 Merge branch 'MDL-54996_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-12-20 09:19:28 +00:00
Juan Segarra Montesinos d346c55175 MDL-53367 mod_forum: Subscribe current users when importing a forum
Subscribes currently enrolled users when importing a forum with
automatic subscription enabled.
2016-12-20 09:00:51 +01:00
John Okely 149c4fc1fa MDL-57268 auth_db: Unit tests for deletion from a large user set 2016-12-20 02:27:15 +01:00
Rafal Domagalski ec3260126f MDL-52366 themes: check for templates in themedir 2016-12-19 18:13:14 +01:00
Dan Poltawski 04f2ca8403 Merge branch 'MDL-55568_m31v2' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-12-19 14:33:08 +00:00
Dan Poltawski 52c8ba9fb5 Merge branch 'wip-MDL-56912-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-12-19 12:21:24 +00:00
Dan Poltawski e23b813fba Merge branch 'MDL-52098_31_STABLE' of git://github.com/Chocolate-lightning/moodle into MOODLE_31_STABLE 2016-12-19 11:25:50 +00:00
David Monllao a8f1c2d081 Merge branch 'MDL-57402_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-12-19 12:21:06 +01:00
Dan Poltawski c828f9f1a9 Merge branch 'MDL-53044-m31' of https://github.com/ak4t0sh/moodle into MOODLE_31_STABLE 2016-12-19 08:47:24 +00:00
Dan Poltawski 9ca69b62a7 Merge branch 'MDL-55715_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-12-19 08:35:44 +00:00
Stephen Bourget ae427d9bde MDL-54996 Calendar: Fix dates for future multi-day events
Thanks to Martin Cunliffe for providing the fix
2016-12-17 10:54:32 -05:00
Mathew May 344afe028c MDL-52098 enrol: cohort now looks at instance status 2016-12-16 11:23:42 +13:00
Arnaud Trouve ca8ccd3960 MDL-53044 auth : force change on expired password 2016-12-15 15:07:06 +01:00
Andrew Nicols 84ad325c69 weekly release 3.1.3+ 2016-12-15 11:34:14 +08:00
Andrew Nicols 03023520d8 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-12-15 11:34:10 +08:00
Tim Hunt 8aa1fb5a2c MDL-57402 quiz editing: fix add heading after remove page break 2016-12-14 16:29:13 +00:00
AMOS bot 40279bf2ea Automatically generated installer lang files 2016-12-15 00:04:23 +08:00
Stephen Bourget 44990fffb0 MDL-55715 calendar: Only update events from the current subscription
The iCal import should only update calendar events from the current
subscription not any subscription that contains the same event.
2016-12-13 22:07:26 -05:00
Andrew Nicols 3543f44073 Merge branch 'wip-mdl-57380-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-12-14 10:03:06 +08:00
Rajesh Taneja 548b707034 MDL-57380 behat: Check for list tags and text
after list tag span can be added on few browsers
like chrome 51.0, so test if text starts with
list tag and contains text
2016-12-14 09:59:46 +08:00
Andrew Nicols 1fc45fb305 Merge branch 'MDL-55062_31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-12-14 09:49:46 +08:00
Stephen Bourget c879145e42 MDL-55568 chat: chat_refresh_events should only create published events 2016-12-13 18:54:48 -05:00
Eloy Lafuente (stronk7) 02aa2c5257 Merge branch 'MDL-55809-31' of https://github.com/xow/moodle into MOODLE_31_STABLE 2016-12-13 20:05:34 +01:00
Dan Poltawski ed41e34699 Merge branch 'MDL-57125-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-12-13 16:34:59 +00:00
Dan Poltawski 8656edd2e5 Merge branch 'MDL-56810' of https://github.com/Syxton/moodle into MOODLE_31_STABLE 2016-12-13 14:55:53 +00:00
Eloy Lafuente (stronk7) e1fbc8e4da Merge branch 'MOODLE_31_STABLE' of https://github.com/fwsl/moodle into MOODLE_31_STABLE 2016-12-13 12:01:05 +01:00
Eloy Lafuente (stronk7) b3d43b015d Merge branch 'MDL-55720_m31' of https://github.com/ak4t0sh/moodle into MOODLE_31_STABLE 2016-12-13 11:49:57 +01:00
Henning Bostelmann 5e7abb9900 MDL-55575 mod_glossary: Allow viewing all entries on one page 2016-12-13 11:44:56 +01:00
Dan Poltawski 419bec2fd3 Merge branch 'MDL-57250_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-12-13 10:25:11 +00:00
Dan Poltawski 727759006c Merge branch 'MDL-56859-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-12-13 09:45:20 +00:00
Dan Poltawski 5e4744bb90 Merge branch 'MDL-57074-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-12-13 09:26:20 +00:00
Dan Poltawski 92d3e80482 Merge branch 'MDL-57182-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-12-13 08:47:38 +00:00
Dan Poltawski 00d9bc4a34 Merge branch 'wip-MDL-57257-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-12-13 08:46:10 +00:00
Marina Glancy e02a11ad0a MDL-56912 feedback: empty multichoice questions do not submit 2016-12-13 15:01:11 +08:00
Mark Nelson e4f1771a60 MDL-55062 tool_uploaduser: prevent defaults when not selected 2016-12-13 12:43:45 +08:00
Simey Lameze 17ffb3eca7 MDL-57125 comment: prevent js execution if there are no comments 2016-12-13 12:11:09 +08:00
Jan Dageförde f77e3ebb30 MDL-57257 lesson: Validate type of numerical answer 2016-12-13 10:35:51 +08:00
Andrew Nicols f2a59f5cf0 Merge branch 'MDL-57222_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-12-13 10:31:56 +08:00
Rajesh Taneja d8f02a7489 MDL-57328 core: Remove xdebug extension, so test run faster 2016-12-13 02:30:52 +01:00
Eloy Lafuente (stronk7) c2834ccb6e Merge branch 'mdl31_MDL-57324' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-12-13 02:02:16 +01:00
Jake Dallimore f6d2455657 MDL-57182 navigation: fix login failures display in page footer.
A bug introduced with MDL-45893 meant that the failure count was being
reset, causing the footer code to be skipped. This patch fixes that
bug and adds behat tests covering the displayloginfailures feature.
2016-12-13 07:21:47 +08:00
Dan Poltawski fae39b86c3 Merge branch 'MDL-56525-m31' of https://github.com/ak4t0sh/moodle into MOODLE_31_STABLE 2016-12-12 14:09:39 +00:00
Dan Poltawski 67dc08ecf4 Merge branch 'MDL-55782-31-test' of git://github.com/ryanwyllie/moodle into MOODLE_31_STABLE 2016-12-12 13:18:21 +00:00
Matt Davidson 31a9b403ca MDL-56810 unoconv: task fails if user removed
If the user is removed from a course after a submission has been made,
the task will crash and never continue.  This removes submissions from
the cron task if the user isn't enrolled in the course.
2016-12-12 08:18:17 -05:00
Dan Poltawski 6df5f57257 Merge branch 'wip-mdl-52796-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-12-12 13:00:58 +00:00
Dan Poltawski c780854bb9 Merge branch 'wip-MDL-54846-31-2' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-12-12 09:34:05 +00:00
Dan Poltawski 4d700925ef Merge branch 'MDL-56566_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-12-12 09:20:17 +00:00
Dan Poltawski 4f91062cf3 Merge branch 'MDL-55906-grading-table-filters-not-reset' of https://github.com/ilya-catalyst/moodle into MOODLE_31_STABLE 2016-12-12 09:04:28 +00:00
Andrew Nicols 92b777eb87 Merge branch 'MDL-46714-31-nadav' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-12-12 13:27:26 +08:00
Nadav Kavalerchik acc13191d9 MDL-46714 Calendar: Properly order Date & Time fields in RTL mode 2016-12-12 12:40:52 +08:00
Marina Glancy 99fce6b523 MDL-54846 media: cleanup of supported formats
.wav is supported in all browsers except IE
.aac, .mp3, .mp4 are supported in Opera
.aac is supported in Firefox
also remove check for firefox version above 27 - it's really ancient
2016-12-12 12:39:39 +08:00
Mark Nelson 9bf610d343 MDL-57222 mod_assign: show validation message on visible element 2016-12-12 11:57:37 +08:00
Mark Nelson 4c26d1af76 MDL-57250 core: show admin settings when only one category exists 2016-12-12 11:57:18 +08:00
Ramindu Deshapriya 4b7140242f MDL-52796 behat: Behat feature to test reset wiki page, tags & comments 2016-12-12 10:28:15 +08:00
Jake Dallimore 1405a62f1c MDL-57074 Filepicker: Fix alias and link icons in RTL mode 2016-12-12 09:18:26 +08:00
Bram Tassyns 36b70df814 MDL-56859 SCORM: player shouldn't display TOC while loading 2016-12-12 09:13:29 +08:00
AMOS bot 0221b1f366 Automatically generated installer lang files 2016-12-10 00:04:17 +08:00
Arnaud Trouve 8e17ff2876 MDL-56525 forum: remove targeted user enrolment
By removing the check on the targeted user's enrolment we allow to show his forum posts even if he is unenrol from a course (obviouly we need to have access to this course to view them)
2016-12-09 10:25:22 +01:00
Dan Marsden 84fc36beee MDL-57324 scorm: exclude objective raw.score from grade update 2016-12-09 10:13:46 +13:00
Henning Bostelmann 3e4036a44b MDL-56566 mod_assign: ignore "doanything" in course overview
Do not count site admin "doanything" capability for determining
what should be shown in the course overview for assignments.
2016-12-08 19:54:56 +00:00
Dan Poltawski 45fe30fc2d weekly release 3.1.3+ 2016-12-08 08:43:01 +00:00
Dan Poltawski df35af5c64 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-12-08 08:43:00 +00:00
Franziska Hübler 0d31a7a8ac MDL-55809 glossary: Keep file author and license across import/export 2016-12-08 12:28:01 +08:00
Ilya Tregubov d6f74c4937 MDL-55906 table: Update user preferences table when reset preferences 2016-12-08 15:04:25 +11:00
Andrew Nicols 73852e5538 Merge branch 'wip-mdl-56614-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-12-08 09:19:41 +08:00
Rajesh Taneja 6f5c29d565 MDL-56642 dataformat: Fixed method_exits parameters 2016-12-08 00:37:16 +01:00
AMOS bot a5380d3a30 Automatically generated installer lang files 2016-12-08 00:05:14 +08:00
Dan Poltawski 7371bec501 Merge branch 'MDL-56674-MOODLE_31_STABLE' of https://github.com/kenneth-hendricks/moodle into MOODLE_31_STABLE 2016-12-07 08:46:19 +00:00
= c278cfab69 MDL-55782 groups: wrap long group names
In the groups UI if a group name is very long it now no longer underlaps the user
column on its right hand side.
2016-12-07 09:41:56 +01:00
Marina Glancy 89c3ec5772 MDL-56614 behat: backport new steps to Moodle 3.1 2016-12-07 14:41:49 +08:00
Andrew Nicols 6e8ca5c281 Merge branch 'wip-mdl-56353-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-12-07 12:05:44 +08:00
Andrew Nicols 172848e96a Merge branch 'wip-MDL-56642-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-12-07 10:04:46 +08:00
Marina Glancy 90d346bbdc MDL-56642 dataformat: set temp dir
Thanks to Chien Wen-Chang for proposing a patch
2016-12-07 10:03:32 +08:00
Rajesh Taneja f2de91ec41 MDL-57137 behat: Subcategory has black space before name 2016-12-07 09:14:11 +08:00
Dan Poltawski 519a5a57db Merge branch 'MDL-45873_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-12-06 15:56:30 +00:00
Dan Poltawski 2011db7312 Merge branch 'MDL-53677-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2016-12-06 12:48:39 +00:00
Dan Poltawski 35f03242b0 Merge branch 'MDL-56836-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-12-06 12:46:20 +00:00
Dan Poltawski 9504cb7ced Merge branch 'MDL-56233-31-mocksubmit' of https://github.com/roperto/moodle into MOODLE_31_STABLE 2016-12-06 12:42:05 +00:00
Dan Poltawski c0a448e3aa Merge branch 'MDL-57199_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-12-06 12:25:38 +00:00
Dan Poltawski 8ab44d9222 Merge branch 'MDL-56971-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-12-06 11:08:09 +00:00
Grzegorz Ziółek 5400ad13dd MDL-56830 config_log: Add block plugin visibility changes to config_log. 2016-12-06 11:42:30 +01:00
Andrew Nicols 4826567e87 Merge branch 'MOODLE_31_STABLE_MDL_57137_question_category_with_parent' of https://github.com/melihovv/moodle into MOODLE_31_STABLE 2016-12-06 15:34:48 +08:00
SSRF e716d6e8f7 MDL-53677 tool_spamcleaner: CSRF Fix
Resolves minor CSRF within Moodle spamcleaner.
2016-12-06 12:25:48 +05:30
Andrew Nicols 738652678f Merge branch 'MDL-56346-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2016-12-06 14:35:38 +08:00
Andrew Nicols 1d3f57daed Merge branch 'MDL-56301-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-12-06 14:27:30 +08:00
Andrew Nicols f1b3e2ef1f Merge branch 'MDL-57161-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-12-06 13:11:13 +08:00
Donald Barrett 3724d12ab4 MDL-56301 course: Use value for intro field if set in a mods function
Respects a module that has set a value for the db field intro in it's lib function modulename_add_instance.
2016-12-06 10:42:03 +08:00
David Monllao b8f4c0561a MDL-57161 search: Set the correct HTTP header
All credit goes to Test Valley School
2016-12-06 10:01:29 +08:00
Andrew Nicols 89040af78e Merge branch 'MDL-56759-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-12-06 09:24:54 +08:00
Dan Poltawski f8c8f9aeb1 Merge branch 'MDL-56459-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-12-05 15:48:34 +00:00
Henning Bostelmann c7afcfa623 MDL-45873 mode_data: Allow "0" entries in menu field 2016-12-05 09:17:40 +00:00
Andrew Nicols 561825915b Merge branch 'MDL-54921-31' of https://github.com/xow/moodle into MOODLE_31_STABLE 2016-12-05 15:36:03 +08:00
Simey Lameze 8aa669c314 MDL-56759 themes: fix alignment issues on badges list 2016-12-05 15:25:37 +08:00
Andrew Nicols f6c5ef8c38 Merge branch 'MDL-52840_31' of https://github.com/rezaies/moodle into MOODLE_31_STABLE 2016-12-05 13:02:41 +08:00
Andrew Nicols 65728e136e Merge branch 'MDL-56893-MOODLE_31-edit-grade-item-bug' of https://github.com/mspall/moodle into MOODLE_31_STABLE 2016-12-05 12:22:55 +08:00
Bram Tassyns 20aff96aec MDL-56836 SCORM: player doesn't remember display mode when not logged in 2016-12-05 09:30:32 +08:00
Daniel Thee Roperto 5af5ee7687 MDL-56233 forms library: Fixed form identifier when mocking a form.
If the plugin is using namespaces instead of frankenstyle class name,
get_called_class() will return 'type\name' instead of 'type_name'.

Added code to replace backslashes to underscores and fix that issue.
2016-12-05 11:23:50 +11:00
Dan Poltawski f945d178cc weekly release 3.1.3+ 2016-12-02 15:18:01 +00:00
Dan Poltawski 180f6c85e4 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-12-02 15:18:00 +00:00
Eloy Lafuente (stronk7) 7c303ca2ba Merge branch 'wip-mdl-57245-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-12-02 14:15:37 +01:00
Eloy Lafuente (stronk7) cfef5a80d5 Merge branch 'MDL-57193-31-notest' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-12-02 11:41:13 +01:00
Frederic Massart 8432dbef4b MDL-57193 auth_db: Flip the array outside the loop for better perf
Also as the recent changes where affecting the whitespaces quite
a lot, I took the liberty of aligning a few lines which weren't.
2016-12-02 16:30:30 +08:00
John Okely a43c2ab9cb MDL-57193 auth_db: Use a recordset and array_key_exists 2016-12-02 16:30:29 +08:00
Josh Willcock 1c2f811212 MDL-57193 auth_db: Fixed bug suspends all users if external DB has > 10k 2016-12-02 16:30:29 +08:00
David Monllao 29d9983114 Merge branch 'MDL-57209-m31' of git://github.com/crmpicco/moodle into MOODLE_31_STABLE 2016-12-02 13:28:11 +08:00
Rajesh Taneja 09b502827f MDL-57245 behat: Use correct @_file_upload tag 2016-12-02 12:39:06 +08:00
Craig R Morton 4b0de02648 MDL-57209 forms: Notice: Undefined index: options in profile edit page
Skipping a loop iteration if the option group has no options.
2016-12-01 16:34:49 +08:00
Michael Spall 13cba568ff MDL-56893 grades: Fix edit grade item when grade_report_showmin is false
Check to make sure $data['grademin'] exists. When grade_report_showmin
is false $data['grademin'] doesn't exist.
2016-11-30 12:07:14 -07:00
AMOS bot d9ae5e8320 Automatically generated installer lang files 2016-12-01 00:05:53 +08:00
AMOS bot 5a9fcb1e7e Merge branch 'MOODLE_31_STABLE' into install_31_STABLE 2016-12-01 00:05:52 +08:00
Dan Poltawski 12661fa0d1 Merge branch 'MDL-57169_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-11-30 11:04:41 +00:00
Dan Poltawski cf9332a2b6 Merge branch 'MDL-52199-incoming-nice-fail-MOODLE_31_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_31_STABLE 2016-11-30 09:52:45 +00:00
David Monllao 8b522b74d6 Merge branch 'MDL-56682_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-11-30 13:56:19 +08:00
Eloy Lafuente (stronk7) 7e09179adb Merge branch 'MDL-57133-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-11-29 22:36:40 +01:00
Tim Hunt 5102a3f6d2 MDL-57199 question preview: make HTML ids unique 2016-11-29 18:32:20 +00:00
AMOS bot 67564b1899 Automatically generated installer lang files 2016-11-30 00:04:51 +08:00
Dan Poltawski ba6633aedc weekly release 3.1.3+ 2016-11-29 13:32:20 +00:00
Dan Poltawski a02daa446b Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-11-29 13:32:19 +00:00
David Herney cd6ba4eff2 MDL-57169 backup: ensure images in category descriptions are shown 2016-11-29 11:44:01 +08:00
David Monllao 274e089eaa Merge branch 'MDL-57163-31' of https://github.com/vvzh/moodle into MOODLE_31_STABLE 2016-11-29 11:41:59 +08:00
Helen Foster bb8916ed88 MDL-57133 lang: Merge English strings from the en_fix language pack 2016-11-29 02:03:12 +01:00
Mark Nelson b5d811f85c MDL-56682 mod_assign: ensure the variable is not null 2016-11-28 16:48:44 +08:00
David Monllao 08d5732bf3 Merge branch 'MDL-57170-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-11-28 15:43:40 +08:00
John Okely 8b1f793c47 MDL-54921 signup: Only clear wanturl when necessary
Thanks to Juho Jaakkola for original patch idea.
2016-11-28 13:55:42 +08:00
Tim Lock 42d6fc0b83 MDL-57170 repository_dropbox: Ensure Dropbox Legacy continues to work 2016-11-28 10:30:37 +08:00
Rajesh Taneja adc22bb264 MDL-57147 phpunit: Check if time is greater than or equal to
Some windows only have 1/100 microtime resolution
so a lot of times it does not advance enough.
2016-11-28 09:41:13 +08:00
Vladimir Zhirov ac47ed92fb MDL-57163 installation: fixed "Call to undefined function curl_version" 2016-11-27 12:14:08 +04:00
AMOS bot 267cc3a385 Automatically generated installer lang files 2016-11-27 00:05:54 +08:00
Tony Butler 68e1e99dff MDL-56346 assignfeedback_editpdf: Correct typo in property name 2016-11-25 11:09:55 +00:00
David Monllao aaa2f52b97 weekly release 3.1.3+ 2016-11-25 15:56:17 +08:00
David Monllao 682b43f63e Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-11-25 15:56:16 +08:00
Alexander Melihov fa5fdc0231 MDL-57137 quiz: Create question category with specified parent category
Fix question category generator bug. Now it is possible to specify parent category of subcategory, supply only name of parent category
2016-11-25 09:27:45 +03:00
David Monllao b854302dba Merge branch 'MDL-57126-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-11-25 09:18:36 +08:00
Jake Dallimore 72b9069024 MDL-57126 core: add 'scss' to list of core filetypes.
This allows filetype restrictions to work when uploading additional
preset files on the Boost admin settings page.
2016-11-25 07:57:09 +08:00
Dan Poltawski 164225f770 Merge branch 'MDL-56948-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2016-11-24 15:58:03 +00:00
Andrew Nicols c8f16d104f Merge branch 'wip-mdl-56898-fix31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-11-24 11:09:33 +08:00
Rajesh Taneja d7b20b8023 MDL-56898 behat: No need to trigger error, as it sometimes hangs behat 2016-11-24 07:34:22 +08:00
Damyon Wiese ab464e1382 MDL-57100 JS: Exceptions give exceptions
Exceptions returned from ajax are not in the format expected by the JS, so
an error occurs and the exception popups are not appearing.

Conflicts:
	lib/amd/build/notification.min.js
	lib/amd/src/notification.js
2016-11-23 18:08:20 +00:00
Dan Poltawski 3caf199992 Merge branch 'MDL-53964_31' of https://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-11-23 16:07:26 +00:00
AMOS bot af23df9c80 Merge branch 'MOODLE_31_STABLE' into install_31_STABLE 2016-11-24 00:06:29 +08:00
Dan Poltawski 94d47cf18e Merge branch 'MDL-35949_31' of https://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-11-23 12:31:24 +00:00
Dan Poltawski 38ea1a51e4 Merge branch 'MDL-56182-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-11-23 08:26:23 +00:00
Frederic Massart 7350a42d0f MDL-56182 mod_lti: Include the query string when comparing type URLs 2016-11-23 10:19:07 +08:00
AMOS bot 8c48e53238 Automatically generated installer lang files 2016-11-23 00:05:10 +08:00
Eloy Lafuente (stronk7) 41bb9ff743 weekly release 3.1.3+ 2016-11-22 16:21:02 +01:00
Andrew Nicols fc56dcb9c7 Merge branch 'MDL-57035-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-11-22 12:03:48 +08:00
Frederic Massart 244ad80521 MDL-57035 repository_skydrive: Compability with converged type apps
http://go.microsoft.com/fwlink/p/?LinkID=615760
2016-11-22 11:50:23 +08:00
Brendan Heywood a900b899b5 MDL-52199 core_message: IMAP errors passed to task api 2016-11-22 12:50:27 +11:00
Dan Poltawski 003171089d Merge branch 'wip-mdl-56898-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-11-21 15:07:49 +00:00
David Monllao 1fda873603 Merge branch 'MDL-57063-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-11-21 16:54:11 +08:00
Frederic Massart 3a03fa68c5 MDL-57063 backup: Do not try to set default value on locked setting
We cannot set a default value on settings which are 'config' or
'permission' locked or an exception will be thrown from
base_setting::set_value.
2016-11-21 11:10:58 +08:00
Andrew Nicols a18bf664a8 Merge branch 'MDL-56877-31' of https://github.com/eSrem/moodle into MOODLE_31_STABLE 2016-11-21 11:10:19 +08:00
Andrew Nicols aaa9be33b2 Merge branch 'MDL-55275_MOODLE_31_STABLE' of https://github.com/tobiasreischmann/moodle into MOODLE_31_STABLE 2016-11-21 11:01:58 +08:00
Rajesh Taneja 9136cf7ce9 MDL-56898 behat: Go to a non html page to avoid any unwanted ajax calls
After scenario is finished, go to README.txt, so
there is no JS/AJAX calls pending and site is ready
for reset before next scenario
2016-11-21 09:41:59 +08:00
Rajesh Taneja 2db00c9537 MDL-56898 behat: Increase autosavefrequency for behat tests
We don't need editor to autosave, as this cause
unwanted ajax request
2016-11-21 09:41:59 +08:00
Rajesh Taneja afe2fcea3e MDL-56898 behat: Try data reset if it fails because of pending process 2016-11-21 09:41:59 +08:00
David Monllao 3f5584c55c Merge branch 'MDL-56972-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-11-21 09:06:11 +08:00
Andrew Nicols 496e1f307c Merge branch 'MDL-42977-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-11-21 08:53:58 +08:00
Andrew Nicols c102cde4f5 Merge branch 'MDL-57002-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-11-21 08:21:55 +08:00
Tim Hunt 1d34a7bf9d MDL-53964 qtype_ddmarker: marker label 0 should be allowed 2016-11-20 21:33:13 +00:00
Shamim Rezaie a1e7685b36 MDL-52840 assignsubmission_file: Change default setting file size
The default value of the assignsubmission_file/maxbytes setting is changed to $CFG->maxbytes.
2016-11-21 04:52:16 +11:00
Tim Hunt ce1b0ee4f1 MDL-35949 quiz accessibility: move input outside label 2016-11-20 17:03:29 +00:00
Tony Butler 499fbf48e3 MDL-56948 mod_assign: Don't call get_grade_item() unless we have one 2016-11-18 15:38:45 +00:00
Dan Poltawski 71d8200285 weekly release 3.1.3+ 2016-11-18 09:57:38 +00:00
Dan Poltawski eb11d15cb8 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-11-18 09:57:36 +00:00
Frederic Massart 8dbfe13362 MDL-57002 repository_webdav: Use default temporary file name
The WebDAV library does not like when there are UTF-8 characters
in the temporary file name. It changes the path but does not return
it, so the file ends up being saved somewhere unknown. As we do not
need the file name at all, we let repository::prepare_file()
generate one.
2016-11-18 12:48:16 +08:00
Jake Dallimore 57371336ad MDL-56972 backup: fix question category stamp duplicates during restore
To kerb future stamp duplication, MDL-54864 added a unique index to the
question_categories table (stamp, contextid) and added an upgrade step
to fix existing duplicate stamps. It missed the case where a course with
duplicate stamps in the same context is directly restored into moodle
3.1, causing index clashes. This issue provides a fix for that.
2016-11-18 11:12:58 +08:00
David Monllao ae045565dd Merge branch 'MDL-55869_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-11-18 09:16:15 +08:00
David Monllao 2585fa374e Merge branch 'MDL-55566_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-11-18 09:05:26 +08:00
AMOS bot cb5d7ff050 Automatically generated installer lang files 2016-11-18 00:06:51 +08:00
David Monllao 5af0e614bb Merge branch 'MDL-57015_31' of git://github.com/stronk7/moodle into MOODLE_31_STABLE 2016-11-17 20:23:31 +08:00
Virgil Ashruf 1337e2b0ef MDL-56877 autogroup form: no limit on cohorts 2016-11-17 10:49:11 +01:00
Andrew Nicols 6872515e7f Merge branch 'wip-MDL-57007-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-11-17 14:36:30 +08:00
Andrew Nicols a7aad09ce4 Merge branch 'MDL-56221_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-11-17 13:32:07 +08:00
Marina Glancy 6912bad471 MDL-57007 behat: assume all capabilities during installation 2016-11-17 13:07:27 +08:00
Andrew Nicols c6be25957b Merge branch 'MDL-56978_iconv-31' of https://github.com/mrmark/moodle into MOODLE_31_STABLE 2016-11-17 11:20:57 +08:00
David Monllao 09a6cc6e4a Merge branch 'MDL-52186-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-11-17 10:41:55 +08:00
Jun Pataleta 39d602e4b9 MDL-52186 enrol_meta: Sync only active enrol_meta instances
Thanks to Peter Klinka for the solution!
2016-11-17 10:41:17 +08:00
David Monllao dba7d01504 Merge branch 'wip-mdl-56865-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-11-17 10:35:49 +08:00
David Monllao fbd5f35012 Merge branch 'MDL-56915-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-11-17 10:33:58 +08:00
Eloy Lafuente (stronk7) 76075b3415 MDL-57015 tests: Use preventResetByRollback() if test uses transactions 2016-11-17 02:42:04 +01:00
Rajesh Taneja b9f40d95db MDL-56865 behat: Don't set error handler for behat install 2016-11-17 08:58:19 +08:00
Henning Bostelmann 78e9adb9f2 MDL-56221 mod_assign: Suppress unwanted grade notifications
* Quick grading: Properly recognize unchanged grades
* Individual grading: Amend JS that transfers checkbox state
2016-11-16 22:05:22 +00:00
Mark Nielsen edfc913460 MDL-56978 core: fix error handling in min_fix_utf8
Must completely suppress notice from iconv as Behat's
shutdown function uses error_get_last() which is
unable to detect if the error was suppressed or not.
2016-11-16 09:04:16 -08:00
AMOS bot f7e9adbecb Automatically generated installer lang files 2016-11-17 00:04:46 +08:00
Tobias Reischmann 25bb8b64f9 MDL-55275 assign: Prevent exception under admin role assignment.
In group mode the submission status was displayed to admins.
This caused an exception when the admins were enrolled as teachers
in a course while being the only member of a group.
2016-11-16 16:49:16 +01:00
gabrielrosset 1a9d089f6e MDL-33960 mod_lti: fix page scroll 2016-11-16 13:04:03 +00:00
Eloy Lafuente (stronk7) d9e0132c18 Merge branch 'MDL-55362_31_STABLE' of git://github.com/Chocolate-lightning/moodle into MOODLE_31_STABLE 2016-11-16 11:29:30 +01:00
Frederic Massart d44c0f5ab8 MDL-56915 webdav: Increase maximum expected header size 2016-11-16 17:20:12 +08:00
Frederic Massart 647e2bd9b0 MDL-56459 competency: Invalid use of indirect property key
This change ensures that PHP7 and earlier work the same way. Before
the patch PHP < 7 would not expand the property as we expected it.

More information here:
http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect
2016-11-16 14:06:39 +08:00
Andrew Nicols b0b6675407 Merge branch 'MDL-56958-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-11-16 11:07:51 +08:00
Andrew Nicols 8bd4b31a85 Merge branch 'wip_MDL-48055_31_quiz_activity_report_grade_visibility' of https://github.com/POETGroup/moodle into MOODLE_31_STABLE 2016-11-16 10:10:16 +08:00
Mathew May ef6cdec4e5 MDL-55362 core: Fixed topic section default name empty h2 tag 2016-11-16 14:15:31 +13:00
David Monllao 2a79c833e3 Merge branch 'mdl31_MDL-56358' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-11-16 08:33:58 +08:00
Andrew Nicols 2f973be713 Merge branch 'MDL-55209-m31' of https://github.com/NeillM/moodle into MOODLE_31_STABLE 2016-11-16 08:28:38 +08:00
David Monllao 586ec7ace3 Merge branch 'MDL-56942-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-11-16 08:10:05 +08:00
Mike Churchward 4e3c08c004 MDL-48055 q_u_outline, q_u_complete: added checks for grade visibility. 2016-11-15 12:43:34 -05:00
Dan Poltawski 789678b0d6 Merge branch 'wip-mdl-56860-m31' of git://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-11-15 16:29:42 +00:00
Michael Aherne d5cff77f4d MDL-56971 enrol: Use autoloading in enrol_get_plugin() 2016-11-15 12:25:30 +00:00
Dan Poltawski 55fb326d70 weekly release 3.1.3+ 2016-11-15 11:02:08 +00:00
Dan Poltawski de7781f68b Merge branch 'MDL-56903-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-11-15 10:43:32 +00:00
Helen Foster af70659cce MDL-56903 lang: Merge English strings from the en_fix language pack 2016-11-15 11:06:49 +01:00
David Monllao 8cc149d22d Merge branch 'wip-MDL-56899-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-11-15 09:07:02 +00:00
Andrew Nicols b1ac630276 Merge branch 'MDL-56823_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2016-11-15 09:07:01 +00:00
Dan Poltawski c90864ca48 Merge branch 'MDL-54871_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-11-15 09:07:01 +00:00
Dan Poltawski 726e86074b Merge branch 'MDL-56913_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-11-15 09:07:00 +00:00
Damyon Wiese 3389d9a5cc MDL-56958 ajax: Prefer the general renderer 2016-11-15 12:45:45 +08:00
EizEddin AlKatrib 231edf2c51 MDL-42977 course: Fixed the default behaviour of the Collapse/Expand all link 2016-11-15 10:25:07 +08:00
Rajesh Taneja a6552b684f MDL-56860 behat: Fixed moodle_list format and printer description 2016-11-15 08:49:13 +08:00
Dan Poltawski ad0f00c75a Merge branch 'mdl-56831-31_STABLE' of https://github.com/Dagefoerde/moodle into MOODLE_31_STABLE 2016-11-14 13:21:33 +00:00
Dan Poltawski 49a50541d1 Merge branch 'MDL-56916-31-normalizedoc' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-11-14 13:10:58 +00:00
Juan Leyva a96e384124 MDL-56942 login: Add missing required lib in complete_user_login 2016-11-14 12:28:13 +00:00
Eloy Lafuente (stronk7) 89b7d746fa Merge branch 'MDL-56880-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-11-14 12:04:45 +01:00
Eloy Lafuente (stronk7) 268ac082fb Merge branch 'MDL-56882-31' of git://github.com/crazyserver/moodle into MOODLE_31_STABLE 2016-11-14 11:14:56 +01:00
Pau Ferrer Ocaña 32b3dd2fd8 MDL-56882 assign: Enable revert outcomes to No outcome 2016-11-14 09:56:21 +01:00
Marina Glancy db7e6deca4 MDL-56899 filter: suppress dom parsing errors
Domdocument does not know about <video> and <audio> tags, also it's too strict for html style
solution from http://stackoverflow.com/questions/6090667/php-domdocument-errors-warnings-on-html5-tags
2016-11-14 15:17:21 +08:00
Jan Dageförde d2297fdc35 MDL-56831 quiz: Declare YUI dependencies explicitly where needed 2016-11-13 23:53:13 +01:00
Eloy Lafuente (stronk7) de572fbf03 Moodle release 3.1.3 2016-11-12 20:21:36 +01:00
David Mudrák 95a36b52f3 MDL-56916 docs: Fix documentation of the normalize_component return 2016-11-12 10:48:01 +01:00
Tim Hunt 00081c06fa MDL-56913 quiz: teachers should see a review link for a preview
So what they see is like what students see.
2016-11-11 16:52:19 +00:00
AMOS bot 40a96de9cd Automatically generated installer lang files 2016-11-12 00:29:04 +08:00
Dan Poltawski 0c65936086 weekly release 3.1.2+ 2016-11-11 12:05:53 +00:00
Andrew Nicols a05308d366 Merge branch 'MDL-55121-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-11-11 15:13:25 +08:00
Andrew Nicols 8303ecdf44 Merge branch 'MDL-55994_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-11-11 13:59:46 +08:00
Andrew Nicols c467b6b705 Merge branch 'MDL-56417_31' of https://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-11-11 12:00:03 +08:00
Andrew Nicols 60daca3928 Merge branch 'MDL-52216_31_STABLE' of https://github.com/eugeneventer/moodle-fixes into MOODLE_31_STABLE 2016-11-11 11:21:42 +08:00
Simey Lameze 5ed79a453a MDL-55121 environment: check for unsuported php version 7.1 2016-11-11 10:04:20 +08:00
Eloy Lafuente (stronk7) 5c93ce2433 MDL-56363 mod_assign: rebuild js 2016-11-11 00:44:21 +01:00
Adrian Greeve a18b518496 MDL-56363 mod_assign: Restrictions added for tutors.
If the grader does not have the accessallgroups capability
or is not a member of the group then no participants are
shown.
2016-11-11 00:31:04 +01:00
Eugene Venter 2395ad0dbc MDL-52216 mod_lesson: prevent invalid view modes 2016-11-11 09:29:14 +13:00
Michael Aherne 3a9f23b595 MDL-56880 webservices: Fix documentation of get_enabled_plugins() 2016-11-10 16:19:47 +00:00
Dan Poltawski 96f92a0279 Merge branch 'MDL-56623_31-messages-to-adressed-to-until' of git://github.com/lucaboesch/moodle into MOODLE_31_STABLE 2016-11-10 15:04:35 +00:00
Dan Poltawski 20bae1ef3b Merge branch 'MDL-55249_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-11-10 15:01:41 +00:00
Dan Poltawski dde3017dfd Merge branch 'MDL-56720-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-11-10 15:00:24 +00:00
Dan Poltawski a287200f18 MDL-55777 version: bump 2016-11-10 13:47:53 +00:00
Dan Poltawski 201a89c4b7 Merge branch 'MDL-55777-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2016-11-10 13:46:45 +00:00
Eloy Lafuente (stronk7) d7631af5d8 Merge branch 'MDL-53481-31-uniqsqlparam' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-11-10 13:15:46 +01:00
David Mudrák 598a02dade MDL-53481 availability: Fix unit test to not execute the huge query
Some DBs have troubles to execute such a huge query as generated in this
test. We do not actually need to execute it. All we need is to make sure
that the parameter placeholders are enumerated correctly. So it is what
this new test does.
2016-11-10 09:55:19 +01:00
Nicholas Hoobin 044f6d7f46 MDL-56417 session: Respect the return value of ignore_timeout_hook. 2016-11-10 14:25:44 +08:00
Ankit Agarwal 26f3554922 MDL-55777 installation: Check libcurl version on install 2016-11-10 10:20:18 +05:30
Juan Leyva f5c6a29803 MDL-56268 webservice: Format backtrace to avoid display private data 2016-11-10 11:54:25 +08:00
Simey Lameze a5ecc22147 MDL-51347 core_notes: check view notes capability by course context 2016-11-10 11:54:25 +08:00
Tim Hunt 2a229e74a3 MDL-53744 question file access: fix access checks 2016-11-10 11:54:25 +08:00
Juan Leyva c3bb491c25 MDL-56065 user: Fix update_users Web Service
Users won’t be updated if:
- They are admins and the user updating is not
- They are the guest user
- They are mnet users
- They are deleted users
2016-11-10 11:54:24 +08:00
Andrew Nicols 179a26ff76 Merge branch 'MDL-54646-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-11-10 11:49:59 +08:00
David Monllao b6a4f42d9c Merge branch 'MDL-56753-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-11-10 11:39:04 +08:00
Andrew Nicols 751132ba58 Merge branch 'MDL-55883_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-11-10 11:13:08 +08:00
Simey Lameze 07949dafdd MDL-56753 mod_assign: behat tests for groups and grouping counting 2016-11-10 11:11:20 +08:00
Simey Lameze 6c29f655d2 MDL-56753 mod_assign: fix groups and submitted counting on grading summary
This also fixes a coding error that was displayed when a group was not part of
assignment grouping.
2016-11-10 11:11:19 +08:00
Tomasz Muras c429d0abec MDL-54646 tags: Hide manage tags in menu if tags disabled. 2016-11-10 11:09:21 +08:00
Andrew Nicols 1717bd7cd4 Merge branch 'wip-mdl-56840-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-11-10 09:45:49 +08:00
Adam Olley c483076ad9 MDL-56823 session: redis sessions don't honour $CFG->sessiontimeout
The redis session handler doesn't use the sessiontimeout config setting
to determine session lifetime.

It has a lock expiry, which is set to 7200 (or a config setting) that is
used to determine how long a lock is held onto, but that should be
distinct from the session timeout.
2016-11-10 10:28:50 +10:30
Andrew Nicols b81f565740 Merge branch 'MDL-56755-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-11-09 15:43:02 +08:00
Andrew Nicols 5ff3938e19 Merge branch 'MDL-56726-31-cfgadmin' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-11-09 14:52:10 +08:00
Rajesh Taneja 60a67bd6ee MDL-56840 behat: Wait till pdf conversion progress is finished 2016-11-09 14:50:53 +08:00
David Monllao a6af6fb6ef Merge branch 'MDL-56133-m31' of https://github.com/NeillM/moodle into MOODLE_31_STABLE 2016-11-09 14:24:13 +08:00
David Monllao bf937a647f Merge branch 'mdl-54852-31_STABLE' of https://github.com/Dagefoerde/moodle into MOODLE_31_STABLE 2016-11-09 13:07:44 +08:00
David Monllao 7cc5b700c8 Merge branch 'MDL-53481-31-uniqsqlparam' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-11-09 12:50:07 +08:00
Stephen Bourget 5223adf258 MDL-55566 chat: Improve next scheduled chat message 2016-11-08 16:02:29 -05:00
Stephen Bourget e97b51a94a MDL-55869 mod_chat: Only create calendar events when chat is published 2016-11-08 15:06:18 -05:00
David Mudrák e22a93a603 MDL-53481 availability: Fix uniqueness of SQL named param placeholders
Static variables do not behave the way you might expect when accessing
them through the classes inheritance. When accessing a method via self::
or static:: operators, even though the method is inherited, its variable
scope is not. So the method unique_sql_parameter() was using the scope
of the child class and each child class had its own sequence of usp1,
usp2, usp3, ... placeholders. This led to "Incorrect number of query
parameters" error when multiuple condition classes were contributing to
a single SQL query.

All credit should go to Adam Olley who debugged and described the
essence of the problem in the tracker.
2016-11-08 14:24:02 +01:00
Neill Magill e2b4b56eee MDL-56133 tool_langimport: Changes should be visible after import
Before this change if a language pack was updated by the
\tool_langimport\task\update_langpacks_task scheduled task, changes
would not be available to users until an admin manually cleared the
strings cache.

This change causes the cache to purged when a language pack it update,
this will cause it to rebuild so users will start seeing updates
automatically.
2016-11-08 10:54:52 +00:00
Dan Poltawski 67b81de806 weekly release 3.1.2+ 2016-11-08 10:16:41 +00:00
Dan Poltawski 6e0495afef Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-11-08 10:16:40 +00:00
Michael Aherne 4eab05dfc5 MDL-56755 assign: Improve documentation of assign::get_grade_item() 2016-11-08 09:00:24 +00:00
Andrew Nicols 70d32d0516 Merge branch 'wip-MDL-56120-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-11-08 10:34:40 +08:00
David Monllao 334b25e0c6 Merge branch 'MDL-53718_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2016-11-08 09:59:51 +08:00
Adrian Greeve 197554d49a MDL-56120 calendar: Unit tests for getting events.
Added a unit test for checking that calendar_get_events
will only return events for activated activities.
2016-11-08 08:32:09 +08:00
Adrian Greeve 0582765407 MDL-56120 calendar: Fix disabled modules showing events.
calendar_get_events now check s for disabled activities
and only shows events for active modules.
2016-11-08 08:30:57 +08:00
Eloy Lafuente (stronk7) 4e7dde97fc Merge branch 'MDL-56765-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-11-08 01:27:49 +01:00
Henning Bostelmann 6d5167d88b MDL-54871 mod_data: Remove text field when forced name present 2016-11-07 22:01:00 +00:00
Eloy Lafuente (stronk7) 49e291c7a6 Merge branch 'MDL-54916-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-11-07 16:20:09 +01:00
Jan Dageförde 131ec75f8a MDL-54852 assignment: Suppress "leave page" warning after save
If the user navigates away from the grading page immediately
after saving the grading form, the browser warning can be
safely omitted, as there are no unsaved changes. This is achieved
by calling `reset_form_dirty_state()` of the core_formchangechecker
YUI module, which is responsible for the warning.
2016-11-07 10:29:47 +01:00
David Monllao ff6af70f81 Merge branch 'mdl31_MDL-54575' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-11-07 13:58:26 +08:00
Adam Olley 9e4b6232d4 MDL-53718 badges: Dont display course badges when disabled 2016-11-07 15:58:08 +10:30
David Monllao 498163486c Merge branch 'MDL-56129-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-11-07 11:16:13 +08:00
David Monllao fc8be7dfab Merge branch 'MDL-56731_31_STABLE' of https://github.com/tonynlin/moodle into MOODLE_31_STABLE 2016-11-07 10:44:45 +08:00
Jonathon Fowler 00f53031f6 MDL-56129 core: Change HTTP error code for iOS 10 video playback
This patch changes the effective response code from a 407 to a 403 when
erroring on iOS 10 and when a HTTP_X_PLAYBACK_SESSION_ID HTTP header is
found.

This causes the iOS Media framework to send the cookie with the request
which subsequently succeeds.
2016-11-07 10:01:26 +08:00
David Monllao 23853266d7 Merge branch 'MDL-55203-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-11-07 09:49:44 +08:00
Russell Smith 12b5512f2d MDL-55203 forms: Use correct admin folder name.
When the admin folder if renamed, the system must replace that when
adding the competencies form elements to the QuickForm Library.
2016-11-07 11:44:05 +11:00
Jan Dageförde ce50f55c1f MDL-54852 assignment: Suppress "leave page" warning after save
If the user navigates away from the grading page immediately
after saving the grading form, the browser warning can be
safely omitted, as there are no unsaved changes. This is achieved
by calling `reset_form_dirty_state()` of the core_formchangechecker
YUI module, which is responsible for the warning.
2016-11-06 21:58:18 +01:00
Henning Bostelmann d558b6629b MDL-55994 blog: Resolve warning messages in RSS feed generation 2016-11-06 17:40:13 +00:00
AMOS bot 1968cc587c Automatically generated installer lang files 2016-11-07 00:04:50 +08:00
Juan Leyva 001bd88aee MDL-56765 webservice: After a new session is started unset old preferences 2016-11-04 19:16:06 +00:00
Dan Poltawski 10d1ea1ae2 Merge branch 'wip-MDL-54986-31' of https://github.com/Beedell/moodle into MOODLE_31_STABLE 2016-11-04 14:31:00 +00:00
Dan Poltawski 59469bcc0b Merge branch 'MDL-56668-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-11-04 14:23:10 +00:00
Dan Poltawski 1f15bdfeb4 Merge branch 'MDL-53945_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2016-11-04 14:07:25 +00:00
Tony Lin 6faa78c935 MDL-56731 groups: Fixes breadcrumb when returning to groups/index.php 2016-11-04 13:26:23 +00:00
Dan Poltawski c1971a2fdf weekly release 3.1.2+ 2016-11-04 11:17:59 +00:00
Dan Poltawski fcf6e01377 MDL-56673 tool_templatelibrary: fix externallib backwards compat
The function now matches the VALUE_DEFAULT option of the service.
2016-11-04 11:45:21 +01:00
Jun Pataleta e31e111cdf MDL-46903 mod_scorm: Apply alias to compare text column 2016-11-04 14:24:02 +08:00
Andrew Nicols 71482ec7e2 Merge branch 'MDL-56673-31-fix1' of http://github.com/damyon/moodle into MOODLE_31_STABLE 2016-11-04 14:08:59 +08:00
Damyon Wiese 53ee4f0635 MDL-56673 tool_templatelibrary: Don't show templates from other themes 2016-11-04 14:04:37 +08:00
David Monllao 1ffe600b32 Merge branch 'MDL-56748-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-11-04 13:45:40 +08:00
Andrew Nicols 67747af0d3 MDL-56748 cache: Removes cache definition instances in purge_store
Previously a purge_store was only purging caches but it was leaving a
reference to the store instance for the cache definition.

As a result, the cache was never cleared away correctly and, in cases
where the cache store makes a TCP connection to a backend system, the
number of open sockets was increasing for each store instance.

After a complete purge, as found in the unit test reset, the cache
definitions should be both purged and removed.

This change should also lead to a drop in memory consumption for unit
tests as there will no longer be references to unused definition stores.
2016-11-04 13:44:39 +08:00
David Monllao 8bc7de537c Merge branch 'mdl31_MDL-46903' of https://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-11-04 08:24:53 +08:00
Adam Olley d6e1f28ef4 MDL-53945 mnet: Use moodle_url to provide string with url
Using moodle_url where possible is preferable to hardcoding uri's as
moodle_url is able to take care of alot of the formatting for us.

In this instance, it handles the $CFG->admin url path for us.
2016-11-04 09:12:00 +10:30
Michael Aherne 9263132f8d MDL-56668 competencies: Correct namespacing of coding_exception 2016-11-03 14:06:21 +00:00
David Mudrák 9257b81e26 MDL-56726 admin: Fix hard-coded path to the admin directory 2016-11-03 10:17:23 +01:00
David Monllao f87e7aa6ee Merge branch 'MDL-56481-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-11-03 14:52:25 +08:00
Tim Lock fedb3cf539 MDL-56481 tool_lpmigrate: Fix notice when cancelling framework migration 2016-11-03 14:17:22 +08:00
Jun Pataleta 91809b1fef MDL-56720 tool_lp: Do not push empty values to IDs array 2016-11-03 14:10:21 +08:00
Adam Olley c8b70b6ec2 MDL-53945 mnet: replace hardcoded admin dir with cfg
Several places in admin/mnet pull in required files using a hardcoded
admin dir string, as this is configurable it needs to use $CFG->admin
instead.

Places where the url is passed through moodle_url don't need to be
updated as that already automatically translates the urls for us.
2016-11-03 11:12:11 +10:30
ak4t0sh 03718099d6 MDL-55720 course: fix potential undefined variable and cleaning
This commit replace $e usage by $returnfromfunc.
Indeed $returnfromfunc always exists in the scope and take $e value in case of moodle_exception.

This commit also remove useless $modcontext affectation.
2016-11-03 00:01:18 +01:00
John Beedell e251d9fe45 MDL-54986 Quiz: Disable add button for quiz with attempts 2016-11-02 17:25:54 +00:00
Neill Magill 4ab8a932c7 MDL-55209 coursecat: Should be able to remove category idnumber
Users should be able to remove an idnumber from a category, before this
change when trying to delete an idnumber users would be told it already
existed.

This change also stops 0 from being allowed multiple times as an idnumber.
2016-11-02 09:52:34 +00:00
Neill Magill dbd9082621 MDL-55209 coursecat: Should be able to remove category idnumber test
A user should be able to remove an idnumber from a category, also 0
should not be allowed multiple times.
2016-11-02 09:52:10 +00:00
Andrew Nicols 5f7d070080 Merge branch 'MDL-56634-31' of git://github.com/ankitagarwal/moodle into MOODLE_31_STABLE 2016-11-02 14:05:11 +08:00
David Monllao 72aca897d4 Merge branch 'MDL-56323-31' of git://github.com/l-campbell/moodle into MOODLE_31_STABLE 2016-11-02 13:12:18 +08:00
David Monllao cdacdf7f41 Merge branch 'wip-MDL-55930-31' of https://github.com/Beedell/moodle into MOODLE_31_STABLE 2016-11-02 12:50:04 +08:00
Ankit Agarwal c97015c0c6 MDL-56634 webservices: clean api desc 2016-11-02 10:05:16 +05:30
David Monllao a35dea73e7 Merge branch 'MDL-43796_31_blindmarking' of https://github.com/SWiT/moodle into MOODLE_31_STABLE 2016-11-02 12:29:04 +08:00
Andrew Nicols b46e384dd3 Merge branch 'MDL-56673-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-11-02 12:15:53 +08:00
Kenneth Hendricks c4d310361f MDL-56674 core: Fix test_get_all_observers 2016-11-02 13:22:38 +11:00
Stephen Bourget 93c2d2c971 MDL-55883 mod_lesson: Missing include in lesson_update_events 2016-11-01 21:21:03 -04:00
Stephen Bourget 149a5b1e05 MDL-55249 mod_feedback: Associate status with current activity
The status screen in mod_feedback simply checks to see if there are any
attempts in progress to return the user status.  This check should be
limited to only include instances of the current feedback activity not
any feedback activity on the site.
2016-11-01 21:15:41 -04:00
Dan Poltawski 7fa03088be Merge branch 'MDL-54112-31' of https://github.com/hcpss-banderson/moodle into MOODLE_31_STABLE 2016-11-01 21:31:04 +00:00
Dan Poltawski e343b2438b Merge branch 'mdl31_MDL-47500' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-11-01 21:29:32 +00:00
Dan Poltawski d62bde657b Merge branch 'mdl55456-moodle31' of https://github.com/tlock/moodle into MOODLE_31_STABLE 2016-11-01 21:27:50 +00:00
Eloy Lafuente (stronk7) a8c64d6267 weekly release 3.1.2+ 2016-11-01 19:48:11 +01:00
John Beedell 26d38b03cd MDL-55930 Quiz: "Next page button" showing in sequential mode 2016-11-01 11:25:05 +00:00
Dan Poltawski 82974222af MDL-56673 templatelibrary: return false when core template doesn't exist 2016-11-01 10:19:17 +00:00
Dan Marsden 40c10bebe7 MDL-54575 scorm: fix typo in data_preprocessing function
thanks to Mike Finch for the patch/report.
2016-11-01 12:14:05 +13:00
Dan Marsden 086bc8870a MDL-46903 scorm: Fix db error in objectives report for oracle.
also improve 2004 report handling to help with testing.
2016-11-01 12:06:08 +13:00
Eloy Lafuente (stronk7) 421a78a564 Merge branch 'wip-MDL-56615-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-10-31 20:26:12 +01:00
Dan Poltawski a20a0a48f0 Merge branch 'MDL-56542-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-10-31 15:14:02 +00:00
Andrew Nicols e5dc9a44ba Merge branch 'MDL-56282-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-10-31 12:27:20 +08:00
Frédéric Massart 51256b8ab5 MDL-56282 enrol_meta: Fix error when editing existing instances
We had a few problems here.

1/ The auto complete element was displaying the picker though the
   field was frozen.
2/ Checking for existing enrolment including the courses chosen was
   not checking if the courses found were in the instance we edit.
3/ Upon creation we support multiple courses but when editing we
   should not expect more than the course in the instance being edited.
2016-10-31 12:16:15 +08:00
Marina Glancy 04872de103 MDL-56615 portfolio_googledocs: add basic unittests 2016-10-31 10:58:26 +08:00
Marina Glancy f0fab142a7 MDL-56615 portfolio: fix php 7.0.9 warning 2016-10-31 10:58:25 +08:00
Luca Bösch d0ebb9f35f MDL-56623 messages: To (addressed) and to (until) different
In some languages "to" having the meaning of "until" and "to" having the meaning of "addressed to" are different.
This should be taken care of by having two different translation terms.

AMOS BEGIN
  CPY [to,core],[addressedto,core]
AMOS END
2016-10-28 07:20:32 +02:00
Brian Barnes 9b16dd4632 MDL-47500 scorm: improved height calculation 2016-10-28 13:42:10 +13:00
Dan Marsden 1452bab3ab MDL-56358 tool_lp tool_cohortroles: allow null idnumber 2016-10-28 12:04:50 +13:00
Brendan Anderson e50b26fa7c MDL-54112 mod_assign: Add scale null grade filter 2016-10-27 10:33:47 -04:00
Dan Poltawski f4f89d4728 weekly release 3.1.2+ 2016-10-27 12:19:37 +01:00
Dan Poltawski b659e9d05c Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-10-27 12:19:36 +01:00
Dan Poltawski 17f1295e23 Revert "Merge branch 'MDL-56129-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE"
This reverts commit 1483afc59b, reversing
changes made to 9edd48f894.
2016-10-27 10:00:05 +01:00
Eloy Lafuente (stronk7) bf639be2ef Merge branch 'MDL-56448-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-10-26 17:06:21 +02:00
Dan Poltawski f093a38342 MDL-56448 mustache: fix json errors in example context 2016-10-26 12:37:40 +01:00
Eloy Lafuente (stronk7) c341f6ddaf Merge branch 'MDL-56354-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-10-26 02:15:43 +02:00
Russell Smith 9eb3fb41c3 MDL-56354 unittests: Put debug messages in the failure notice. 2016-10-26 09:24:37 +11:00
Dan Poltawski 73a3ebcecf Merge branch 'MDL-56288_31-messages-time-extra-space' of https://github.com/lucaboesch/moodle into MOODLE_31_STABLE 2016-10-25 20:57:36 +01:00
Dan Poltawski 2c08b71880 Merge branch 'MDL-56136_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-10-25 20:44:37 +01:00
Eloy Lafuente (stronk7) aba9531852 Merge branch 'MDL-56250-31-formvalidation' of https://github.com/roperto/moodle into MOODLE_31_STABLE 2016-10-25 20:30:16 +02:00
Helen Foster 9f809b1818 MDL-56542 lang: Merge English strings from the en_fix language pack 2016-10-25 20:26:36 +02:00
Eloy Lafuente (stronk7) 4b108d2ccb Merge branch 'MOODLE_31_STABLE' of https://github.com/yuriy-os/moodle into MOODLE_31_STABLE 2016-10-25 20:00:16 +02:00
Dan Poltawski bd519a6e80 Merge branch 'MDL-55143-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-10-25 18:38:41 +01:00
AMOS bot cb3e164f68 Automatically generated installer lang files 2016-10-26 00:04:40 +08:00
David Monllao ff370663c6 Merge branch 'wip-mdl-56347-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-10-25 15:20:18 +08:00
Dan Poltawski 540cdcaca1 Merge branch 'MDL-55902-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-10-25 06:38:13 +01:00
Russell Smith 533addff9c MDL-54916 filestorage: Only write empty zip on change.
In some cases we may inspect an empty zip file. If we do open
an empty zip file, check that it changed before we attempt to write
it to disk.  It may be the case that we were reading the file from
a location that we don't have write access to.
2016-10-25 14:12:51 +11:00
Russell Smith a14e796549 MDL-56347 caching: Better class variables for notices. 2016-10-25 09:52:04 +08:00
Rajesh Taneja ca08b73300 MDL-56347 phpunit: Set class for alternative cache store
If alternative cache store is sued, then set the class
and warn user about this.
2016-10-25 09:51:27 +08:00
lazydaisy ad070273a5 MDL-48350 theme_bootstrapbase: restyle action icons in docked blocks 2016-10-24 21:38:07 +02:00
Dan Poltawski 05292ca201 Merge branch 'wip-MDL-56439-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-10-24 14:33:55 +01:00
Lee Campbell 3508f1b8e2 MDL-56323 core_user: User profile field default value not on signup page
The default value of a configured text input user profile field is not rendering on signup page
2016-10-24 09:33:42 +01:00
David Monllao 6c91de2362 Merge branch 'mdl56466-moodle31' of https://github.com/tlock/moodle into MOODLE_31_STABLE 2016-10-24 15:24:08 +08:00
David Monllao 1483afc59b Merge branch 'MDL-56129-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-10-24 12:01:00 +08:00
Andrew Nicols 9c74040c3b MDL-56129 core: Set a timeout on the session cookie
This is primarily because iOS has changed something under the hood which
means that only session cookies which have an expiry are passed around the
OS.

In order to make media playable outside of the browser (e.g. a video), we
must set a session cookie timeout.

Since the session timeout is configurable, this patch sets the cookie
timeout to the session timeout plus a period of one week.

This ensures that videos continue to work, and that the expired session
message is shown on the login page, but without requiring excessively long
session times.
2016-10-24 11:47:51 +08:00
Luke Carrier 7e3e81c330 MDL-55902 my: Add additional information to dashboard reset events
* Add $private and $pagetype information to the 'other' parameter of
the dashboard(s) reset events.
2016-10-24 11:04:12 +08:00
Frédéric Massart 9edd48f894 MDL-56341 mustache: JS engines handles strings wrapped in quote
Prior to the patch the strings wrapped as the following one
where not found and replaced when rendering the template via Javascript

{{#quote}}{{#str}}string,component{{/str}}{{/quote}}
2016-10-24 10:10:07 +08:00
Yuriy Osychenko 24ec5de709 MDL-53098 lib: Mark form as submitted in confirmation dialog.
If the quiz attempt use popup window with Javascript security it will
show to the user misleading message that he is going to lose entered
data.
To avoid this we should mark form as submitted to turn off browser`s
pop-up window when user confirms finishing attempt.
Also we need to check if core_formchangechecker is present on a page.
2016-10-24 00:44:00 +03:00
AMOS bot 22e7edad43 Merge branch 'MOODLE_31_STABLE' into install_31_STABLE 2016-10-22 00:04:59 +08:00
Daniel Thee Roperto 9bac677826 MDL-56250 forms library: Changed form to validate once per object.
If two instances of moodleforms are validated in the same run, most
likely a phpunit test run, it would store the first validation result.
Now it stores the validation result per instance, not for all instances.
2016-10-21 10:41:23 +11:00
AMOS bot cfae450c61 Automatically generated installer lang files 2016-10-21 00:04:54 +08:00
Eloy Lafuente (stronk7) 2afadc066b weekly release 3.1.2+ 2016-10-20 17:52:48 +02:00
Eloy Lafuente (stronk7) 870fcca1e0 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-10-20 17:52:45 +02:00
Andrew Nicols fbe2c4f979 Merge branch 'MDL-56328_31-fix-rtl' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-10-19 13:30:04 +08:00
David Monllao 70e4268d66 MDL-56328 theme: Remove RTL styles
They should only be applied while editing mode is on
2016-10-19 12:34:25 +08:00
Eloy Lafuente (stronk7) acacf89d1a Merge branch 'MDL-29774-31-by-sam-wilson' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-10-18 17:34:46 +02:00
Andrew Nicols a518a7bc8c MDL-55858 mod_forum: Remove subscription links when not relevant
When a forum is force-subscribed or subscription is disabled, do not
include the subscription link in forum posts.
2016-10-18 17:01:03 +02:00
Dan Poltawski 7008ee479d Merge branch 'MDL-56131-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-10-18 13:44:38 +01:00
Dan Poltawski a0f41c8b2d Merge branch 'MDL-56062-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2016-10-18 12:06:58 +01:00
Eloy Lafuente (stronk7) a8d92101dc Merge branch 'MDL-56275-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-10-18 12:13:07 +02:00
Dan Poltawski fa40bd7e08 MDL-56275 blog: do not display the 'choose a link' button
When registereing an external blog the choose a link button is
misleading, we don't have any repos which restrict to RSS feeds, so the
majority of results you get from the repo picker will be wrong.
2016-10-18 11:09:00 +01:00
David Monllao 7071e0949c Merge branch 'MDL-56328-M31' of git://github.com/lazydaisy/moodle into MOODLE_31_STABLE 2016-10-18 16:06:54 +08:00
Eloy Lafuente (stronk7) 096ea34f43 Merge branch 'MDL-56345-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2016-10-18 09:38:41 +02:00
Tim Lock 5e80e0bce9 MDL-55456 course: set context for category ajax requests 2016-10-18 12:49:47 +10:30
Tim Lock fe9831dd7d MDL-56466 assign: fix database error with team submissions
This fixes the error when viewing the Grading summary with Blind Marking and Team submission is enabled:

ERROR: Incorrect number of query parameters. Expected 32, got 31.
2016-10-18 12:09:16 +10:30
Sam Wilson 3aff88f24c MDL-29774 core_user: Update group-membership summaries on AJAX calls 2016-10-18 09:37:32 +08:00
Eloy Lafuente (stronk7) eb8323829c Merge branch 'wip-mdl-56369-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-10-18 01:33:11 +02:00
Eloy Lafuente (stronk7) b2a3cd6f90 Merge branch 'wip-mdl-56348-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-10-18 01:10:32 +02:00
Russell Smith 0a97a2e574 MDL-55143 unittests: Check the db rather than cache for version hash. 2016-10-18 09:53:24 +11:00
Eloy Lafuente (stronk7) e1b22d2ee0 Merge branch 'MDL-56368-M31' of git://github.com/lazydaisy/moodle into MOODLE_31_STABLE 2016-10-18 00:38:53 +02:00
Eloy Lafuente (stronk7) 2e22fc8a24 Merge branch 'MDL-56022_m31v3' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-10-18 00:07:30 +02:00
Stephen Bourget 8fbdc47ab8 MDL-56022 Assign: Make folders structure in the downloaded zip optional
Special thanks to Matt McDermott for the contributing the Javascript
code to fix this issue.
2016-10-17 16:26:12 -04:00
Eloy Lafuente (stronk7) 66add1538d Merge branch 'MDL-56300_31' of git://github.com/reskit/moodle into MOODLE_31_STABLE 2016-10-17 18:51:17 +02:00
Dan Poltawski b5179a16d4 Merge branch 'MDL-56208-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-10-17 12:52:28 +01:00
Dan Poltawski 94410cf875 Merge branch 'MDL-55630-31' of https://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-10-17 10:25:01 +01:00
Michael Aherne 6e4ad85606 MDL-56131 choice: Set maximum lifetime for lock 2016-10-17 13:51:08 +08:00
Andrew Nicols 403cc20e1e MDL-56208 mod_forum: Move Display period below Group 2016-10-17 11:47:13 +08:00
= 20afbd1e0d MDL-56288 messages: Extra space in front of message time
If the line break in the HTML code is at a different location
the extra space doesn't appear any more.
2016-10-16 22:51:14 +02:00
AMOS bot e210b6be12 Automatically generated installer lang files 2016-10-17 00:06:49 +08:00
Matthew Switlik 33b8704892 MDL-43796 assign: Reset revealidentities on restore
Set revealidentities to 0 when restoring with blindmarking and no user data
2016-10-14 14:11:05 -04:00
AMOS bot 476d9208d4 Automatically generated installer lang files 2016-10-15 00:04:48 +08:00
lazydaisy 12dba02ab0 MDL-56368 theme_bootstrapbase: Settings for Restrict Access not inline. 2016-10-14 15:51:25 +01:00
lazydaisy 657f59bb7d MDL-56328 theme_bootstrapbase: reduce activity indent when not editing 2016-10-14 15:30:34 +01:00
Jean-Philippe Gaudreau 70363d7394 MDL-55630 mod_assign: Exclude users courses from user details
Exclude users' enrolled courses for performance reason.
A new 'includeenrolments' parameter was added
to mod_assign::list_particpants.
2016-10-14 09:28:29 -04:00
Marc Català 4bb8469038 MDL-56300 mod_assign: Filtering students throws a javascript error 2016-10-14 09:27:30 +02:00
acorbier 6bed8d49b6 MDL-56369 behat: Updated comment for i_look_for_exceptions
After upgrade to Behat 3.x, i_look_for_exception is called from
Moodle\BehatExtension\EventDispatcher\Tester\ChainedStepTester
2016-10-14 13:25:16 +08:00
Marina Glancy 3b08a859f8 MDL-56439 course: added missing require 2016-10-14 08:21:21 +08:00
Eloy Lafuente (stronk7) 0b70ff8a16 weekly release 3.1.2+ 2016-10-13 20:02:38 +02:00
Eloy Lafuente (stronk7) d709527dc4 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-10-13 20:02:34 +02:00
Eloy Lafuente (stronk7) 2f3978dac5 Merge branch 'MDL-56319-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-10-13 19:41:37 +02:00
Tony Butler 73792e3ff2 MDL-56345 assignfeedback_editpdf: Use correct strings for tool alt text 2016-10-13 10:07:57 +01:00
Rajesh Taneja 7099db9f68 MDL-56353 behat: Added test for multi select dependency 2016-10-13 14:34:21 +08:00
Tony Butler 76e4c52a2f MDL-56062 mod_assign: Use $gradeitem->get_decimals() for grade display 2016-10-12 20:47:01 +01:00
AMOS bot c867851817 Automatically generated installer lang files 2016-10-12 00:04:59 +08:00
Paul Holden df0a2112d2 MDL-55345 user: correct userid when linking to iplookup from profile 2016-10-11 17:06:45 +02:00
Eloy Lafuente (stronk7) e798553ab0 Merge branch 'MDL-55954_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-10-11 12:46:47 +02:00
David Monllao dbc83491f7 Merge branch 'MOODLE_31_MDL-51401' of https://github.com/janeklb/moodle into MOODLE_31_STABLE 2016-10-11 17:59:19 +08:00
David Monllao d2eb91d7df Merge branch 'MDL-52051-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-10-11 17:11:41 +08:00
Dan Poltawski 323e12f7a6 Merge branch 'MDL-36611-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-10-11 08:53:30 +01:00
Rajesh Taneja 39ffd19e25 MDL-56348 cache: Removed second parameter
There is no second parameter in the api
and identifier should be set by set_identifiers
2016-10-11 12:51:23 +08:00
Andrew Nicols 7609261d84 MDL-52051 repository_dropbox: Add the V2 API 2016-10-11 11:45:55 +08:00
Kirill Astashov e9c915c050 MDL-36611 outcome: Set page context when editing outcome 2016-10-11 10:02:12 +08:00
Eloy Lafuente (stronk7) f029c8fd93 Merge branch 'MDL-56220-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-10-11 01:18:35 +02:00
Eloy Lafuente (stronk7) 84f5f4706f Merge branch 'MDL-56261-31-taglist' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-10-11 00:32:58 +02:00
Eloy Lafuente (stronk7) b81712cd5d Merge branch 'MDL-56316-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-10-10 18:14:06 +02:00
Eloy Lafuente (stronk7) 1a6ba31a95 Merge branch 'MDL-51633_M31' of git://github.com/lazydaisy/moodle into MOODLE_31_STABLE 2016-10-10 17:37:57 +02:00
Simey Lameze 52306fe019 MDL-56050 core: set missing context to maintenance mode 2016-10-10 23:15:21 +08:00
Dan Poltawski 7d1b63df6e Merge branch 'MDL-56052-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-10-10 14:19:06 +01:00
Andrew Nicols 8069695b30 MDL-52051 repository_dropbox: Move v1 API aside 2016-10-10 20:32:03 +08:00
Andrew Nicols 19098c49d9 MDL-52051 oauth: expires_in is optional 2016-10-10 20:32:03 +08:00
Dan Poltawski bffe12cd9f Merge branch 'MDL-51584-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-10-10 13:27:08 +01:00
Dan Poltawski 2b05e813d6 Merge branch 'MDL-55597-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-10-10 11:33:14 +01:00
Dan Poltawski 2f3ffd55c5 Merge branch 'MDL-56285-31' of git://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-10-10 11:14:24 +01:00
Michael Aherne 7e47b00c34 MDL-56319 blocks: Observe empty default blocks setting 2016-10-10 09:52:47 +01:00
Janek Lasocki-Biczysko 616effd0d4 MDL-51401 enrol: ensures correct order of roles in UI components
Role sort order was not available in the UI (in JavaScript) due to
the use of PHP assoc arrays and JSON encoding/decoding. This patch
addresses this by sending the roles in a json array, rather than
json object.
2016-10-10 07:52:08 +01:00
Russell Smith bf907918c9 MDL-51584 gradebook: use direct $CFG access for freeze.
get_config() is called a lot of times on freeze and is expensive,
using $CFG is much lower overhead.
2016-10-10 15:42:55 +11:00
AMOS bot 6794c1f117 Automatically generated installer lang files 2016-10-09 00:06:23 +08:00
lazydaisy 5a36fc8bd2 MDL-51633 theme_bootstrapbase: Restyled ADD BLOCK to remove max-width. 2016-10-07 18:56:19 +01:00
AMOS bot 26a8cc00a8 Automatically generated installer lang files 2016-10-08 00:04:50 +08:00
Frédéric Massart 490afb5182 MDL-55597 tool_templatelibrary: Re-inforce logic to skip theme templates 2016-10-07 10:45:44 +02:00
Andrew Nicols 88e3401109 MDL-56316 tests: Ensure consistent assertion count 2016-10-07 14:46:16 +08:00
Eloy Lafuente (stronk7) 0c332af374 weekly release 3.1.2+ 2016-10-06 22:31:41 +02:00
Dan Poltawski 7d984d3e6d MDL-56303 quiz: lack of quiz filtering
Also, correctly feed completiongradeitemnumber with grade item numbers
and not with grade item ids.
2016-10-06 22:22:38 +02:00
Issam Taboubi fd135d1611 MDL-56285 competency: fix move competencies capabilities
In learning plan templates, cannot move competencies
around even if capability templatemanage is given
to the role because of bad context check
2016-10-06 11:30:14 -04:00
Eloy Lafuente (stronk7) 3e75aab436 weekly release 3.1.2+ 2016-10-06 11:51:45 +02:00
Eloy Lafuente (stronk7) 18019dd5a5 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-10-06 11:51:41 +02:00
Cameron Ball e1b37e8638 MDL-54802 mod_quiz: Improve validation when editing a quiz uusing require passing grade
When editing a quiz that is using the require passing grade completion method,
the grade to pass cannot be zero. Since the completion method is locked we
cannot recommend that the completion method is changed (as we do when the quiz
is being created). Instead we have to inform the user that the grade to pass
must not be zero.
2016-10-05 19:30:06 +08:00
Dan Poltawski 0f871cff57 Merge branch 'MDL-54802-31-fix' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-10-05 10:33:45 +01:00
Cameron Ball 5749d00b25 MDL-54802 mod_quiz: Move grade to pass error to require passing grade element
When using a passing grade of zero, with the required passing grade
option, an error was displayed on the "grade to pass" element.
This was confusing as the error message is referring to the
"Require passing grade" element. This patch moves the message to
the "Require passing grade" element.

Additionaly this patch fixes a small typo in a comment.
2016-10-05 17:17:49 +08:00
Rajesh Taneja e4f5b42015 MDL-56210 behat: Pending and complete js is added by js_init_code 2016-10-05 15:46:10 +08:00
David Monllao 139dda66cc Merge branch 'MDL-45969-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-10-05 09:43:05 +08:00
Eloy Lafuente (stronk7) 35e1ae4464 Merge branch 'MDL-56231-31-flexible_table-construct-phpdoc' of https://github.com/roperto/moodle into MOODLE_31_STABLE 2016-10-05 01:49:05 +02:00
AMOS bot fbdc6adbdd Automatically generated installer lang files 2016-10-05 00:05:59 +08:00
Dan Poltawski a129767a8a Merge branch 'MDL-55861_31_STABLE' of https://github.com/dj4452/moodle into MOODLE_31_STABLE 2016-10-04 15:44:22 +01:00
Eloy Lafuente (stronk7) cc82a7e864 Merge branch 'MDL-56069_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-10-04 16:42:09 +02:00
Michael Aherne d0f145c0d5 MDL-56220 cache: Call static method correctly 2016-10-04 15:00:09 +01:00
David Mudrák 714ddc74c3 MDL-56261 tags: Do not follow the empty anchor link on more/less toggle
Some browsers tend to follow the empty <a href="#"> link and scroll to
the top of the page.
2016-10-04 15:20:33 +02:00
Eloy Lafuente (stronk7) 8f26a5e064 MDL-55910 my: various fixes
- bump version
- point to correct 3.1.3 version in @since
- add missing phpunit-dist.xml suite
- fix context in tests
2016-10-04 12:58:10 +02:00
Eloy Lafuente (stronk7) 2f008b75a7 Merge branch 'MDL-55910-31' of https://github.com/LukeCarrier/moodle into MOODLE_31_STABLE 2016-10-04 12:36:54 +02:00
Andrew Nicols 5bb831e317 Merge branch 'MDL-55886-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-10-04 11:21:39 +08:00
Andrew Nicols 8796156112 Merge branch 'MDL-56198_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-10-04 09:05:26 +08:00
David Monllao 2027e7a8ea MDL-55954 search_solr: Check connection before anything else
- Silents the system call when no correct data provided
- Converts long exception messages to standard server
  error + debugging message with the exception
2016-10-04 09:01:15 +08:00
AMOS bot 593ac7fa80 Automatically generated installer lang files 2016-10-04 00:04:31 +08:00
Dan Poltawski 4a8bc70154 Merge branch 'MDL-56181-31-czechia' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-10-03 16:43:54 +01:00
Dan Poltawski db68a1e688 Merge branch 'MDL-52317-m31' of https://github.com/NeillM/moodle into MOODLE_31_STABLE 2016-10-03 16:09:33 +01:00
Dan Poltawski c213250ca7 MDL-54802 quiz: fix bad whitespace 2016-10-03 14:47:04 +01:00
Dan Poltawski 75e4ff3874 Merge branch 'MDL-54802-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-10-03 14:47:00 +01:00
Andrew Nicols 75092504a1 Merge branch 'MDL-55421-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-10-03 19:48:28 +08:00
Dan Poltawski 573979aa1e Merge branch 'wip-MDL-55911-31' of https://github.com/Beedell/moodle into MOODLE_31_STABLE 2016-10-03 10:25:18 +01:00
David Monllao 13caba9006 Merge branch 'wip-mdl-56210-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-10-03 13:53:44 +08:00
Daniel Thee Roperto 3ac97c70d7 MDL-56231 library: Fixed PhpDoc for flexible_table constructor.
The flexible_table::__construct($uniqueid) accepts a string, not an int
as previously noted in the PhpDoc.
2016-10-03 16:06:32 +11:00
David Monllao 72a08226d6 Merge branch 'MDL-55222-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-10-03 13:02:28 +08:00
David Monllao d65b8227c9 Merge branch 'wip-MDL-55990-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-10-03 13:00:20 +08:00
David Monllao 62164d315f Merge branch 'MDL-55964_31' of https://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-10-03 12:40:46 +08:00
Tim Hunt d7a5bef2d6 MDL-56069 quiz: nav buttons don't scroll to the right question
When there is more than one question on a page, say questions 2, 3 & 4.
Then when you click the navigation button for Q4, then it should load
the next page scrolled down so that Q4 is visible. That was not working.
2016-09-30 15:05:31 +01:00
Tim Hunt e7d8a6079b MDL-56198 assignment: improve grading info responsiveness 2016-09-30 15:02:13 +01:00
John Beedell 04c6fd9498 MDL-55911 Quiz: Accessibility, Label blanks in DD questions 2016-09-30 09:49:25 +01:00
Neill Magill b9143c7883 MDL-52317 Atto: Large resized images may display scroll bars
When an image was added via Atto and it was set to resize automatically
if the alignment was set to Top, Middle or Bottom when it was made
smaller then a vertical scroll bar would be displayed.

This was caused by the interaction of the margin settings on the image
and the 100% width set via the img-responsive css class. The width of
an element only includes the content area and not any borders, padding
or margins.

This change stops atto hardcoding the styles for image alignment into
the images style tag, it instead adds a class that defines the alignment
the image should have.

This change has the benefit that themers will now be able to adjust
how atto image alignments work if they wish.

Images added before this patch will continue to have the issue
until they are edited by the plugin, at which time their legacy style
will be removed and the new alignment method will be added.

Thanks to Andrew Nicols who provided a refactor for the Alignment
and style detection code.
2016-09-30 08:50:38 +01:00
Damyon Wiese 0d5d8ee56a MDL-45969 editpdf: The logic for showing a previous attempt is wrong
It originally was only ever going to show static pdfs for older versions,
but this doesn't make sense in the UI for 3.1.
2016-09-30 13:15:59 +08:00
Rajesh Taneja c72e9871f1 MDL-56210 behat: Ensure behat waits for dependancy manager 2016-09-30 10:33:00 +08:00
Dan Poltawski 1695f89400 MDL-55886 block_rss_client: fix oracle compatibility 2016-09-29 16:59:35 +01:00
Deepa Jayaprakash 7e90c19710 MDL-55861 course: Click drag&drop icon, incorrect activities shown 2016-09-29 16:48:54 +01:00
Dan Poltawski 33d6ef3266 MDL-55421 travis: check npm/grunt on multiple npm versions
This is a backport of the patch from MDL-55048

Check npm install and grunt execution on the higest and lowest node
versions. Included some minor tweaks along the way:

* Move the grunt execution into scripts part of the configuration (that way
  the grunt output is not collapsed and is easily visible in build output).

* Restructure the install section to be task based (thanks to Eloy for
  the suggestion) and as such, don't run composer install on the grunt
  task (speed up the build slightly).

* Switch around the grunt job to a matrix include so that every
  variation of grunt job doesn't need to be excluded.
  ( https://docs.travis-ci.com/user/customizing-the-build/#Explicity-Including-Jobs )
2016-09-29 16:42:54 +01:00
Dan Poltawski 1c4e222256 MDL-55421 js: add some global ignores to js files
This is to prevent linting to be extremely noisy about rollup related
problems.

Should not affect built files.
2016-09-29 16:42:54 +01:00
Dan Poltawski 4b70cdd356 MDL-55421 eslint: add config/package defintion
Partial backport of MDL-52127 to allow people to use eslint linting
in earlier branches than master.

This is an earlier version of eslint than in master beacuse of
node requirements being higer.
2016-09-29 16:42:54 +01:00
Eloy Lafuente (stronk7) cf2376cf00 MDL-56127 forms: multiple select dependencies fixed
This is a fix for a regressions introduced by MDL-54778. It
seems that escaped all our tests because there isn't any case
of such a dependency in core, but Daniele Cordella was facing
it within his surveypro module.
2016-09-29 16:52:59 +02:00
Dan Poltawski 049d20856c weekly release 3.1.2+ 2016-09-29 12:43:04 +01:00
Dan Poltawski 6e70e57a48 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-09-29 12:43:02 +01:00
David Mudrák f0ffb7824d MDL-56181 lang: Fix CI and CZ country short names to match ISO 3166 2016-09-29 11:52:40 +02:00
Eloy Lafuente (stronk7) dca5737751 Merge branch 'MDL-55804_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-09-29 01:14:41 +02:00
Eloy Lafuente (stronk7) 8eda39addc Merge branch 'MDL-56019-31' of git://github.com/dpalou/moodle into MOODLE_31_STABLE 2016-09-28 20:08:41 +02:00
Serge Gauthier bcf82800d1 MDL-55964 report_competency: Missing blocks in Competency breakdown
Fix also the breadcrumb
2016-09-28 13:27:50 -04:00
Dan Poltawski 1bfe4ed7a3 Merge branch 'MDL-56038-m31' of https://github.com/sammarshallou/moodle into MOODLE_31_STABLE 2016-09-28 14:36:49 +01:00
Eloy Lafuente (stronk7) 8c63e039d1 MDL-46946 user: Document user_not_fully_set_up() changes 2016-09-28 02:21:32 +02:00
Eloy Lafuente (stronk7) b9078cfe84 Merge branch 'MDL-46946-31-reqcusfield' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-09-28 02:19:46 +02:00
Rajesh Taneja 4b14b223c2 MDL-55957 behat: Set some text before selecting in Atto 2016-09-28 01:42:17 +02:00
Pau Ferrer Ocaña 15e9f2138f MDL-55951 output: Add errorcode to fatal_error when available 2016-09-28 00:10:04 +02:00
Tim Hunt 493f5d4851 MDL-56136 restore: better error handling copying file at start 2016-09-27 18:10:07 +01:00
AMOS bot d88b9544ff Automatically generated installer lang files 2016-09-28 00:04:44 +08:00
Dan Poltawski f808dbbafb Merge branch 'MDL-56040-31' of https://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-09-27 14:57:31 +01:00
Dan Poltawski 18b723fac1 Merge branch 'MDL-55987-31-grademem' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-09-27 11:23:49 +01:00
Dan Poltawski 965b398dd7 Merge branch 'MDL-54793-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-09-27 11:13:36 +01:00
Dan Poltawski 1557906329 Merge branch 'MDL-55957-31-workshopfiles' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-09-27 10:37:27 +01:00
Dan Poltawski caf5410257 Merge branch 'MDL-55760-31' of https://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-09-27 10:18:50 +01:00
David Monllao f7707b7196 MDL-55804 tool_uploadcourse: strftime only to user input
Default value already comes as a timestamp.
2016-09-27 08:12:08 +08:00
David Monllao 8b27687b5f MDL-55804 forms: Return exported data through _prepareValue 2016-09-27 08:12:08 +08:00
Dan Poltawski e5b39bdac5 Merge branch 'MDL-55472-assign-extend-ignored-validation-MOODLE_31_STABLE' of https://github.com/ilya-catalyst/moodle into MOODLE_31_STABLE 2016-09-26 15:32:26 +01:00
Dan Poltawski e1ce291e1a Merge branch 'wip-MDL-55519-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-09-26 15:23:15 +01:00
Juan Leyva 23460f7fdb MDL-55222 webservice: Apply external_format_string in course names 2016-09-26 12:42:20 +01:00
Ilya Tregubov ff45fa7435 MDL-55472 assign: Show userlist on extension form error page 2016-09-25 11:32:13 +10:00
AMOS bot ecff89d617 Automatically generated installer lang files 2016-09-24 00:04:36 +08:00
Issam Taboubi 7ace09de5f MDL-55760 tool_lp: Wrong rating display when more than one scale set 2016-09-23 11:03:58 -04:00
Jean-Philippe Gaudreau 1706cd5f1b MDL-56040 behat: Fixing missing "|" in tables 2016-09-23 09:19:33 -04:00
Eloy Lafuente (stronk7) 6aec209125 weekly release 3.1.2+ 2016-09-23 10:01:48 +02:00
Eloy Lafuente (stronk7) 8262bff81f Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-09-23 10:01:44 +02:00
AMOS bot 9f351dce88 Automatically generated installer lang files 2016-09-23 00:04:45 +08:00
Simey Lameze 10d480aefc MDL-54802 mod_quiz: Add validation to require passing grade greater than 0
This commit adds a form validation to prevent the creation of quizzes
using zero or null grade to pass when using require passing grade.
2016-09-22 08:54:51 +08:00
David Mudrák d82859b2c1 MDL-46946 user: Make missing required custom fields trigger profile edit
If there is a required custom field that the user can fill by editing
their profile, and that field is missing, the user should be considered
as not fully set up. Instead, we want to redirect them to edit their
profile first.

There are some exceptions when we want to fall back to the previous
behaviour and check just the name and email fields. These exceptional
cases include checking remote user data in incoming MNet request (no
user id, no custom fields supported) and calls to require_login() with
redirecting disabled (typically ajax filepicker requests on profile
editing page itself).

Additional plugins that call the function user_not_fully_set_up()
themselves, should perform the strict check in most/typical cases. So
the strict mode is enabled by default even if it changes the behaviour
slightly. In improbable case of additional plugins relying on the
previous behaviour of the function, they can use the $strict parameter
and keep performing the lax check. However, I am sure the correct fix in
that case will likely be to stop abusing this function.

Note that custom fields are not currently transferred during the MNet
roaming. So having custom fields configured as required on MNet service
provider site (where users can't edit their profiles) is expected to
display an error (as the site is considered as misconfigured).
2016-09-21 18:02:51 +02:00
Damyon Wiese 30c5f7d5e2 MDL-56052 block_settings: race condition
YUI events module must be loaded before global events can be used.
2016-09-21 12:22:16 +08:00
sam marshall 6b1e6b6beb MDL-56038 Web services: json_last_error_msg not in PHP 5.4 2016-09-20 14:55:02 +01:00
Marina Glancy d99f038262 MDL-55990 tags: remove unnecessary index creation 2016-09-20 09:31:03 +08:00
Adrian Greeve ca985c82b2 MDL-55519 activities: mform element shows correct maxgrade.
In certain circumstances the max grade value would revert
back to the default max grade value.
2016-09-20 09:29:58 +08:00
Andrew Nicols 6d26c2f7f6 Merge branch 'MDL-55876-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-09-20 09:11:10 +08:00
Simey Lameze 5ecce533f5 MDL-55876 core_course: prevent changes on front page course 2016-09-20 08:49:27 +08:00
Andrew Nicols be686d6c54 Merge branch 'MDL-55586-31' of https://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-09-20 08:19:30 +08:00
Ruslan Kabalin ac8ad1ae81 MDL-55776 enrol: Optimise enrolled users listing.
Here we optimise SQL queries for enrolled users list. Expensive subquery is
replaced with faster LEFT JOIN and the whole groups filtering component is
aded on demand.
2016-09-19 23:47:37 +02:00
Ruslan Kabalin 40e34b842b MDL-55776 enrol: Add unit tests for enrolment manager. 2016-09-19 23:47:27 +02:00
Issam Taboubi d82add23e6 MDL-55586 report_competency: Translation strings in competencies 2016-09-19 12:05:08 -04:00
Issam Taboubi 31ddf0fc3e MDL-55586 blocks_lp: Translation strings in competencies 2016-09-19 12:04:45 -04:00
AMOS bot 893391150b Automatically generated installer lang files 2016-09-20 00:04:39 +08:00
Dan Poltawski 0bfcf570e1 Merge branch 'wip-mdl-55117-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-09-19 11:39:42 +01:00
Dan Poltawski 613c9aa5c8 Merge branch 'm31_MDL-55820' of git://github.com/danmarsden/moodle into MOODLE_31_STABLE 2016-09-19 11:32:21 +01:00
Dan Poltawski f1cfb0d949 Merge branch 'MDL-55944_31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-09-19 11:28:40 +01:00
Eloy Lafuente (stronk7) 9095c382ff MDL-29332 versions: Force bump because patch ones were matching upstream 2016-09-19 12:01:20 +02:00
Eloy Lafuente (stronk7) 7e278251ee Merge branch 'wip-MDL-29332-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-09-19 11:59:01 +02:00
Dani Palou 95356cd73c MDL-56019 ws: Use itemid null when getting modules intro 2016-09-19 11:45:15 +02:00
David Monllao 23f9e0c40b Merge branch 'MDL-42041-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-09-19 15:09:29 +08:00
David Monllao e81330e2d4 Merge branch 'MDL-55602-m31' of https://github.com/mrmark/moodle into MOODLE_31_STABLE 2016-09-19 12:50:38 +08:00
Andrew Nicols 6f53b717ab Merge branch 'MDL-55932-31' of https://github.com/eberhardt/moodle into MOODLE_31_STABLE 2016-09-19 08:33:37 +08:00
AMOS bot 7c55c645c5 Automatically generated installer lang files 2016-09-17 00:04:48 +08:00
Russell Smith 6f38fa71a6 MDL-55602 session: Add redis handler with locking.
Backport of MDL-54606
2016-09-16 08:13:35 -07:00
David Mudrák d67c4d7856 MDL-55987 gradebook: Claim extra memory when updating final grades
As we experienced in a bigger moodle.org course (7500 users, 70 grade
items), the standard memory limit 256M may not be enough here. We were
not able to find any obvious memory leak in the processing. Requiring
extra memory helped in this particular case and it seems reasonable to
have it in the core.
2016-09-16 12:45:15 +02:00
AMOS bot 24e64853b0 Automatically generated installer lang files 2016-09-16 00:04:58 +08:00
Jan Eberhardt dac212419d MDL-55932 block_rss_client: Namespace fixes 2016-09-15 13:23:32 +00:00
Dan Poltawski c648d44c9b weekly release 3.1.2+ 2016-09-15 11:15:06 +01:00
Dan Poltawski 304588c980 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-09-15 11:15:05 +01:00
David Monllao efba8389e9 Merge branch 'MDL-55945-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-09-15 12:38:53 +08:00
Jake Dallimore 9c3cd30d97 MDL-55945 login: fix https support for forgot_password.php 2016-09-15 09:21:22 +08:00
AMOS bot 1809cb1adb Automatically generated installer lang files 2016-09-15 00:12:14 +08:00
David Mudrák 516350b791 MDL-55957 workshop: Add behat tests for embedded images
This tests basic functionality of the images embedded into the
instructions and conclusion fields.
2016-09-14 14:32:52 +02:00
David Mudrák d5aa0d54ae MDL-55957 workshop: Fix the embedded files serving
There was a bug with serving the files from the areas instructauthors,
instructreviewers and conclusion. These three areas should not use the
itemid in the plugininfo URLs. But they did use 0 as the itemid which
broke the file previews when browsing via server files repository.

The first part of the patch fixes all relevant calls to
file_rewrite_pluginfile_urls() so that null is now properly used instead
of zero.

The second part of the fix is that we no longer delete the first $args
element in the workshop_pluginfile() function - the itemid is not
supposed to appear there now.

The last part of the patch is that instead of repeating the same code
block copy&pasted for each file area in workshop_pluginfile(), we now
have a single block covering them all.
2016-09-14 12:40:26 +02:00
Rajesh Taneja 32935e9bf6 MDL-55117 behat: Re-initialise to ensure modified config is not used
As behat cli process is 1 run for features
Any modification in  will be reflected
in later runs on cli. In this case
- disabling enablebadges in block_badges.feature
- reflected while running cron in award_badges.feature
2016-09-14 10:46:55 +08:00
Russell Smith e4439947ac MDL-55944 testing: Reduce sleep usage.
Remove sleep() and replace with waiting for a second to roll over,
this results in a simpler call the guarantee time() has moved forward
2016-09-14 09:50:32 +10:00
Marina Glancy 9135f6347e MDL-55864 general: fix PHP7.1 strict warnings 2016-09-13 15:24:34 +01:00
Marina Glancy c9ce7bfb20 MDL-29332 question: calculated variables may differ in case only 2016-09-13 10:18:34 +08:00
Eloy Lafuente (stronk7) 0a7c6b8a57 Merge branch 'wip-MDL-55505-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-09-12 19:26:30 +02:00
Eloy Lafuente (stronk7) 5a44db7646 Merge branch 'wip-MDL-55654-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-09-12 19:15:55 +02:00
Eloy Lafuente (stronk7) bbe5329a3b Merge branch 'MDL-55632-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-09-12 19:12:19 +02:00
Eloy Lafuente (stronk7) 1a3c879c0d Merge branch 'MDL-55874-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-09-12 18:32:31 +02:00
AMOS bot dbb2268e46 Automatically generated installer lang files 2016-09-13 00:04:45 +08:00
Eloy Lafuente (stronk7) 2b4d17de5b Merge branch 'MDL-55725-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2016-09-12 17:55:11 +02:00
Eloy Lafuente (stronk7) a75d91bee3 Merge branch 'MDL-55755_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-09-12 17:35:08 +02:00
Dan Poltawski 0baf402c71 Merge branch 'wip-mdl-55353-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-09-12 11:49:37 +01:00
Dan Poltawski 0a7742edef Merge branch 'wip-MDL-55862-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-09-12 11:11:27 +01:00
Dan Poltawski d274298126 Merge branch 'wip-mdl-55610-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-09-12 10:18:18 +01:00
David Monllao cf80222fb1 Merge branch 'MDL-55626-M31' of git://github.com/lazydaisy/moodle into MOODLE_31_STABLE 2016-09-12 12:38:27 +08:00
David Monllao 36d5449df9 Merge branch 'MDL-55873-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-09-12 12:00:15 +08:00
Simey Lameze 58a0535a04 MDL-55873 login: change back username fields to use PARAM_RAW 2016-09-12 11:50:15 +08:00
David Monllao e2c8d6b17f Merge branch 'MDL-53893-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-09-12 10:29:33 +08:00
Eloy Lafuente (stronk7) f851201f58 Moodle release 3.1.2 2016-09-10 22:50:25 +02:00
lazydaisy fd029f3aae MDL-55626 theme_clean: Fixed clean theme missing desktop-first-column 2016-09-10 01:22:49 +01:00
Stephen Bourget e8924af84a MDL-55910 events: backport MDL-45753 dashboard events 2016-09-09 10:35:22 +01:00
Marina Glancy 30399fadb0 MDL-55654 user: apply format_string to field names 2016-09-09 14:32:32 +08:00
Rajesh Taneja a22a2b148d MDL-55353 behat: Ensure teacher edit activity at different time
Recent activity is showing activities which were
updated since user last logged in and first modification
done on the activity. So ensure update happens at different
time than activity created.
2016-09-09 10:16:34 +08:00
Simey Lameze 8adf00753c MDL-53893 core_badges: Behat for all selected roles award badges 2016-09-09 08:43:45 +08:00
Simey Lameze f7d2474907 MDL-53893 core_badges: Add strictness to manual badge criteria 2016-09-09 08:43:45 +08:00
David Monllao ab2a2d629f MDL-55755 search: Correct event link 2016-09-09 07:57:54 +08:00
Adrian Greeve 0489c3c878 MDL-55505 mod_assign: Editing previous attempt works correctly.
Editing a previous attempt keeps the current feedback and grades
as it should and does not override them.
2016-09-08 20:32:25 +08:00
Adrian Greeve ab95f66c2e MDL-55862 mod_data: Use proper name function for display.
The old method for displaying the name of a field was being
used. This meant that it was not possible to show a plugin's
name in view.php

Thanks to David Herney Bernal for providing a solution.
2016-09-08 20:28:52 +08:00
Dan Poltawski 8857a38fcf MDL-55874 report_particiption: fix invalid html
When messaging disabled.
2016-09-08 08:04:48 +01:00
David Monllao 2ab80152e2 weekly release 3.1.1+ 2016-09-08 13:56:42 +08:00
David Monllao 9bb75e570d Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-09-08 13:56:40 +08:00
Eric Merrill 937ddb9e5a MDL-55725 search: Index proper time modified with indexed files 2016-09-07 17:34:23 -04:00
Adrian Greeve e7e9d06bf3 MDL-41174 mod_workshop: Added workshop_refresh_events
This function was missing from this activity.
2016-09-07 15:20:11 +08:00
Jake Dallimore 8c42211e3f MDL-50803 login: Remove token from URL in forgot password process
Store the token value in the session and redirect to self, thus
removing the token from the URL and eliminating the problem where
the token is exposed via the http referer header.
2016-09-07 09:07:28 +08:00
Juan Leyva 468de02565 MDL-49026 webservice: Remove tokens on password change 2016-09-07 09:07:28 +08:00
Eloy Lafuente (stronk7) 5ef133e913 Merge branch 'wip-mdl-55764-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-09-07 03:06:34 +02:00
Eloy Lafuente (stronk7) 2a681ccd06 Merge branch 'MDL-55618-m31' of https://github.com/NeillM/moodle into MOODLE_31_STABLE 2016-09-06 16:20:41 +02:00
Eloy Lafuente (stronk7) 2a098c992a Merge branch 'wip-MDL-55844-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-09-06 16:08:23 +02:00
Eloy Lafuente (stronk7) 9f16f3bdcd Merge branch 'wip-MDL-55832-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-09-06 15:56:15 +02:00
Dan Poltawski 929a775579 MDL-42125 quiz stats: removal trivial additional phpdocs newline 2016-09-06 11:49:11 +01:00
Dan Poltawski 2516b865f2 Merge branch 'MDL-42125_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-09-06 11:48:52 +01:00
Dan Poltawski 1ec726e2a4 Merge branch 'wip-mdl-55749-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-09-06 08:45:44 +01:00
Andrew Nicols 0a6f9cf6d2 MDL-42041 mod_book: Add Turn Editing On to page body 2016-09-06 15:39:30 +08:00
Rajesh Taneja 9ce415860b MDL-55749 badges: define global before using it 2016-09-06 10:28:36 +08:00
David Monllao 009dcc16ae Merge branch 'MDL-55617-m31' of https://github.com/NeillM/moodle into MOODLE_31_STABLE 2016-09-06 10:18:16 +08:00
David Monllao bf80c7b9c1 Merge branch 'MDL-55587-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-09-06 10:07:11 +08:00
Rajesh Taneja b7fc4a06f1 MDL-55610 behat: Clear static file cache
php file cache might be out-of-sync
to ensure full directory is deleted
clear php file cache
2016-09-06 09:43:54 +08:00
Eloy Lafuente (stronk7) 36142e4ed6 Merge branch 'MDL-55663-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-09-05 18:07:16 +02:00
AMOS bot 3cb9eba870 Automatically generated installer lang files 2016-09-06 00:04:47 +08:00
Eloy Lafuente (stronk7) f3aeccb270 Merge branch 'MDL-55717_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-09-05 18:02:44 +02:00
Eloy Lafuente (stronk7) 28020ce31e Merge branch 'MDL-55724-m31' of https://github.com/sammarshallou/moodle into MOODLE_31_STABLE 2016-09-05 17:33:46 +02:00
Dan Poltawski 88e0275e29 Merge branch 'MDL-55627_31' of https://github.com/bostelm/moodle into MOODLE_31_STABLE 2016-09-05 14:09:16 +01:00
Dan Poltawski dd5a5b75e6 Merge branch 'MDL-55742-31' of https://github.com/xow/moodle into MOODLE_31_STABLE 2016-09-05 10:50:47 +01:00
Henning Bostelmann 9a6f6ee022 MDL-55627 filter_mathjaxloader: use correct string concatenation op 2016-09-05 11:48:33 +02:00
Dan Poltawski f641bde359 Merge branch 'MDL-55771_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-09-05 10:18:56 +01:00
Dan Poltawski 5a7ce1b2a2 Merge branch 'MDL-55815_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-09-05 08:57:36 +01:00
Dan Poltawski 51dd539322 Merge branch 'MDL-54113-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-09-05 07:53:07 +01:00
David Monllao d966b1b18d Merge branch 'wip-MDL-41174-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-09-05 13:45:46 +08:00
David Monllao 28181985df Merge branch 'MDL-55457-31' of https://github.com/xow/moodle into MOODLE_31_STABLE 2016-09-05 11:48:43 +08:00
David Monllao c527b281d7 Merge branch 'wip-MDL-55707-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-09-05 10:48:01 +08:00
Adrian Greeve 464890f58a MDL-41174 course: Module name change updates calendar. 2016-09-05 08:55:06 +08:00
Marina Glancy 8461e34f4d MDL-55844 profile: display formatted course name 2016-09-02 17:59:58 +08:00
John Okely 60df6ae90d MDL-55457 mod_lti: Support object icon_info in tool proxy 2016-09-02 09:45:42 +08:00
Marina Glancy 4ed5fc5efa MDL-55832 mod_feedback: apply filters to multichoice quesitons 2016-09-01 21:09:21 +08:00
Tim Hunt 603ee3605b MDL-42125 quiz stats: fix regression caused by MDL-51603 2016-09-01 12:39:01 +01:00
Tim Hunt ac32161ca6 MDL-42125 quiz stats: clearer message when manual grading required 2016-09-01 12:39:00 +01:00
Cameron Ball 9823b5c677 MDL-54793 webservice_xmlrpc: Don't treat GET and POST as arguments 2016-09-01 16:06:45 +08:00
Neill Magill 6130c2493f MDL-55617 backup: Possible fatal errors in backup and restore
The unserialize() function will not always return an object
especially when as can happen the controller field of a
record in the backup_controllers table is empty.

This change ensures that in this case the script will
not cause a fatal error, but instead throw an error.
2016-09-01 08:47:51 +01:00
Neill Magill 68cbd916a6 MDL-55618 backup: Header should not be output twice
Before this patch if the pre-check failed during
the final stage of an import a request for the
page header to be output was made for a second
time, this caused a coding_error to occur.

This change removes the second request to
output the page header, which will allow the user
to see the reasons the pre-check failed.
2016-09-01 08:46:32 +01:00
John Okely 7b55399004 MDL-55742 mod_lti: Remove support for get_magic_quotes_gpc
Thanks to Bishop Bettini for the original patch.
2016-09-01 14:59:50 +08:00
David Monllao c265709cab weekly release 3.1.1+ 2016-09-01 11:14:13 +08:00
David Monllao dae85c4658 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-09-01 11:14:11 +08:00
Adrian Greeve 396d0d5e1d MDL-55707 grades: Stop infinite loop when regrading. 2016-09-01 10:26:12 +08:00
Dan Marsden c39f5f8806 MDL-55820 scorm: use correct displayattempt default options 2016-09-01 13:28:17 +12:00
Tim Hunt 246677d537 MDL-55815 quiz review: after close should beat immediately after
This only arises in specific situations: student submitted less than 2
mintues before time close, or when a teacher previews after the close
date. However, in those cases, the old behaviour was confusing. Now,
'After the quiz is closed' takes priority.
2016-08-31 13:00:22 +01:00
Tim Hunt 1e53257bce MDL-55815 quiz: convert attempt state tests to a data provider 2016-08-31 13:00:20 +01:00
Eloy Lafuente (stronk7) b60bd5b7d0 Merge branch 'MDL-55237_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-08-30 12:54:53 +02:00
sam marshall 297486d1b7 MDL-55724 Glossary: Prevent infinite loop in trusttext_strip 2016-08-30 10:27:02 +01:00
Mark Nelson 18af7c0536 MDL-55771 core: added title attribute when using JS to render {{pix}} 2016-08-30 14:57:54 +08:00
Marina Glancy 0e611051a9 MDL-55581 htmlpurifier: test for attributes in video tag 2016-08-30 13:49:51 +08:00
David Monllao b514df00e1 Merge branch 'MDL-54873-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-08-30 12:52:48 +08:00
Andrew Nicols ebd8ffb4e1 MDL-54873 assign: Seed recordid to print_recent_activity 2016-08-30 11:57:42 +08:00
Andrew Nicols cb55cd8574 MDL-54873 assign: Add recordid fetching participants
get_submission_info_for_participants is primarily used by externallib.php
2016-08-30 11:49:29 +08:00
Andrew Nicols 4693e0ca86 MDL-54873 assign: Fetch mapping id for blind marking in cron 2016-08-30 11:49:29 +08:00
Andrew Nicols 91840654b1 MDL-54873 assign: Fetch mapping id for blind marking grading
This change modifies the grading table to pre-seed record ids where they
already exist.

Where they do not exist, they are still fetched.
2016-08-30 11:49:29 +08:00
Frederic Massart e4cbcf716b MDL-55663 filter: Filters could be incorrectly reported as inactive 2016-08-30 11:23:26 +08:00
David Monllao 0783a94d3e MDL-55237 core_component: Fix last namespace level matching
Thanks to Andreas Grabs for proposing a fix.
2016-08-30 11:16:20 +08:00
Rajesh Taneja 643b907d2f MDL-55764 behat: Reset static update db list
While running multiple suites we should
ensure static cli cache is also reset.
2016-08-30 08:01:24 +08:00
David Mudrák 0c3f40bd61 MDL-55660 tablelib: Fetch only a single row when auto defining columns
In a very rare cases where the columns are not declared explicitly, we
want to fetch single row only without a warning raised. This seems like
a valid use case for IGNORE_MULTIPLE flag.
2016-08-29 19:14:10 +02:00
AMOS bot 64e6f4e471 Automatically generated installer lang files 2016-08-30 00:04:56 +08:00
Eloy Lafuente (stronk7) 50eb83b357 Merge branch 'MDL-55667-31-participantslink' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-08-29 16:53:54 +02:00
Eloy Lafuente (stronk7) 5c6b292d93 Merge branch 'MDL-55741_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-08-29 14:08:47 +02:00
Cameron Ball 4d4df5a1b3 MDL-55587 core_media: Properly escape ampersand 2016-08-29 19:16:29 +08:00
David Mudrák afb949e087 MDL-55667 navigation: Do not display site participants link to students
The problem here was that user/index.php checks the system level
capability moodle/site:viewparticipants when the user is on the front
page, and the moodle/course:viewparticipants on non-front pages.

But the navigation displayed the link by mistake even in situations,
when the user has the capability moodle/course:viewparticipants on the
front page (typically when the default role for the front page is set to
student).

Added behat tests for reproducing the bug and also for checking the
basic functionality of the feature.
2016-08-29 12:11:59 +02:00
David Monllao e0434911f3 Merge branch 'wip-MDL-55581-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-29 16:53:56 +08:00
David Monllao 7e24044902 Merge branch 'MDL-55661-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-08-29 14:40:37 +08:00
David Monllao db78183e45 Merge branch 'MDL-55312_load_timeout_for_amd_modules_31' of https://github.com/gthomas2/moodle into MOODLE_31_STABLE 2016-08-29 14:31:50 +08:00
Marina Glancy 28108d5e08 MDL-55581 htmlpurifier: allow track tag in videos and audios 2016-08-29 13:26:14 +08:00
David Monllao 4472485ebf Merge branch 'wip-MDL-55708-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-29 11:19:08 +08:00
David Monllao 93611f5e2c Merge branch 'MDL-55477_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-08-29 11:14:28 +08:00
David Monllao 6f3590457e Merge branch 'MDL-55668-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-08-29 10:26:58 +08:00
Tim Hunt b2a5bd853b MDL-55741 phpunit: does not reset get_log_manager cache 2016-08-26 17:15:26 +01:00
AMOS bot 0cd3d67eac Automatically generated installer lang files 2016-08-27 00:04:51 +08:00
Helen Foster 59dacea6a6 MDL-55661 lang: Merge English strings from the en_fix language pack 2016-08-25 14:40:28 +02:00
Dan Poltawski 95839d65c7 weekly release 3.1.1+ 2016-08-25 12:09:45 +01:00
Dan Poltawski 846523c75b Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-08-25 12:09:44 +01:00
Mark Nelson 97e886c576 MDL-55717 core: add 'ignoredirty' class to inplace editable 2016-08-25 16:08:09 +08:00
Rajesh Taneja 01f32afad4 MDL-46514 behat: Get config value from db, to avoid cache 2016-08-25 10:37:24 +08:00
Marina Glancy c59eddd327 MDL-55708 mod_assign: display formatted acitvity names 2016-08-25 09:53:51 +08:00
AMOS bot d4f6d857bf Automatically generated installer lang files 2016-08-25 00:05:19 +08:00
Damyon Wiese 1fc7e6b184 MDL-55668 assign: Don't link to user profile if blind marking is enabled 2016-08-24 11:39:48 +01:00
Andrew Nicols b6e3abd875 MDL-54113 assign: Open files in new window
Open files in a new window when viewing to ensure that the form change
checker does not warn about the page reloading.
2016-08-24 11:34:21 +08:00
David Monllao 08f5c15f6e MDL-55604 cache: Updating comment according to code changes 2016-08-24 09:39:01 +08:00
David Monllao 6fa8232f32 Merge branch 'MDL-55604-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-08-24 09:36:36 +08:00
Russell Smith 6311ae6d29 MDL-55604 cache: Fix identifier and cacheable_object
When a cachable object is store in the static cache from
the backing store, it was incorrect serialised rather than
using the wake function.  This has been resolved and tests added.

During the investigation into cacheable_object, it was discovered
that set_identifiers never removes identifiers when you call it,
so set_identifiers(array('a')) and set_identifiers(array('b')) really
resulted in array('a','b') as the identifiers rather than 'b'.

The fix for this issue depends on the set_identifiers fix and
they have been coupled together as a result.
2016-08-24 11:25:53 +10:00
David Monllao 954881c187 Merge branch 'MDL-55385_31_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_31_STABLE 2016-08-24 08:24:42 +08:00
gthomas2 1df4dfe560 MDL-55312 requirejs: Fix timeouts with infinite waitSeconds 2016-08-23 17:40:03 +01:00
Dan Poltawski 868acab35c Merge branch 'MDL-55628-m31' of https://github.com/sammarshallou/moodle into MOODLE_31_STABLE 2016-08-23 15:48:11 +01:00
Dan Poltawski 1e5edb62a0 MDL-55423 tests: remove non-cross-db testcase
This isn't used in moodle core and is problematic on oracle, don't test
it.
2016-08-23 12:37:24 +01:00
Mark Johnson 9f95b657e2 MDL-55385 output: Support non-integer output_buffering values 2016-08-23 11:22:57 +01:00
Dan Poltawski db10a07def Merge branch 'wip-mdl-46514-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-08-23 08:59:41 +01:00
David Monllao 008dede307 Merge branch 'MDL-46654-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-08-23 15:31:12 +08:00
Rajesh Taneja 1278115963 MDL-46514 behat: section should be set before switch-case 2016-08-23 15:19:29 +08:00
Rajesh Taneja bb13f05a0e MDL-46514 behat: Catch php errors in shutdown hook
If error is not displayed in web browser then
it will be caught in shutdown hook, so we can
show it to user
2016-08-23 15:19:29 +08:00
Rajesh Taneja f7a8bc6378 MDL-46514 behat: Delete tablesupdatedbyscenario before suite
Delete tablesupdatedbyscenario before db reset to ensure
db is fully reset. In case user exits or process terminated
then the file will be left and can lead to wrong results
2016-08-23 15:19:29 +08:00
Rajesh Taneja 47f8aa9400 MDL-46514 behat: Catch errors shown by JS 2016-08-23 15:19:29 +08:00
David Monllao 8ea8024e35 Merge branch 'MDL-55391-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-08-23 13:00:42 +08:00
David Monllao 3a250bbae9 Merge branch 'MDL-54838-31' of https://github.com/nashtechdev01/moodle into MOODLE_31_STABLE 2016-08-23 12:44:08 +08:00
sam marshall 3226f39671 MDL-55628 Completion: Use simpledata for completion cache
The completion cache is currently not marked as simpledata. On the
course page it is frequently retrieved hundreds of times which results
in many calls to the slow unserialize function. By making a slight
change to the data format (using arrays instead of objects) we can
mark it as simpledata, which will avoid using unserialize.
2016-08-22 17:15:09 +01:00
Dan Poltawski 2f46fadb78 Merge branch 'MDL-55273-cookie-secure-default-MOODLE_31_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_31_STABLE 2016-08-22 15:25:38 +01:00
Jake Dallimore 4f424b7b0c MDL-55565 core_backup: Fix warning when restoring question categories
Fixed a call to get_records_sql, which was being used incorrectly in
restore_find_best_target_context to determine a unique contextid.
2016-08-22 14:23:18 +01:00
Dan Poltawski 5d27e53631 Merge branch 'MDL-55605-lesson-restore-bug-MOODLE_31_STABLE' of https://github.com/kenneth-hendricks/moodle into MOODLE_31_STABLE 2016-08-22 14:13:27 +01:00
Dan Poltawski d62cb5dd84 Merge branch 'MDL-55551_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-08-22 12:53:32 +01:00
Dan Poltawski bbc4dd5810 Merge branch 'MDL-55557_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-08-22 12:45:54 +01:00
Andrew Nicols b8ff0cd6e5 MDL-46654 mod_forum: Hide digestoptions when no subscription
Daily digest options should not be generated if the user cannot subscribe
to anything in the first place.
2016-08-22 19:12:52 +08:00
Dan Poltawski 64227b4233 Merge branch 'MDL_55423_31' of https://github.com/alexandru-elisei/moodle into MOODLE_31_STABLE 2016-08-22 09:57:21 +01:00
Tim Hunt 033edd6cf7 MDL-55477 quiz reports: all user fields should have repeats suppressed 2016-08-19 18:05:14 +01:00
Dan Poltawski 19660f1f0f MDL-55391 block_rss: fix typo preventing feed title display 2016-08-19 09:44:40 +01:00
Andrew Nicols fcc0c4c8c8 MDL-55632 mod_forum: Tidy up forum post messages 2016-08-19 09:57:28 +08:00
Kenneth Hendricks d56d575df9 MDL-55605 mod_lesson: Fix activitylinks restore bug 2016-08-18 16:38:20 +10:00
Adrian Greeve 2a6404aa68 MDL-22183 lib: More unit tests for next day start. 2016-08-18 10:21:06 +08:00
Adrian Greeve f65ff89e69 MDL-22183 lib: Cleanup of get_next functions. 2016-08-18 10:20:51 +08:00
Adrian Greeve 42490916b4 MDL-22183 lib: Time settings removed for stats cron.
Old settings that should be ignored have been removed from the
statistics cron code.
2016-08-18 10:20:31 +08:00
Alexandru Elisei e8d84901ca MDL-55423 accesslib: Prevent get_role_users() false debugging messages 2016-08-17 20:39:40 +03:00
Dan Poltawski e90dfb32ae weekly release 3.1.1+ 2016-08-17 14:47:20 +01:00
Andrew Nicols 1ea227df0c Merge branch 'wip-MDL-50586-31-fix' of https://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-17 13:33:12 +08:00
Marina Glancy 69ec2b9e95 MDL-50586 gradingform_rubric: 0-level warning during redirection 2016-08-17 13:00:04 +08:00
Dan Poltawski 5ec43185b2 Merge branch 'MDL-36713_m31v2' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-08-16 12:05:13 +01:00
Andrew Nicols b4b46d838d Merge branch 'MDL-55272-31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-08-16 15:10:06 +08:00
Brendan Heywood 5c2e284ac5 MDL-55273 admin: Change $CFG->cookiesecure default to on 2016-08-16 13:35:47 +10:00
Damyon Wiese 6abdc807a9 MDL-55520 forms: Properly format the grademax for the database 2016-08-16 11:21:43 +08:00
Russell Smith ffd1a26a0b MDL-55272 lib: Allow random_bytes() to return large values.
PHP has a recursion limit and random_bytes on PHP5.6 without openssl
will error if sent a large value.  Using a loop has lower overhead than
recursion as well.
2016-08-16 12:15:04 +10:00
Stephen Bourget e70c8017ee MDL-36713 Blog: Display accurate error when a guest views a user blog 2016-08-15 21:49:25 -04:00
Andrew Nicols 7d7db30389 Merge branch 'wip-MDL-50586-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-16 08:52:37 +08:00
Andrew Nicols aab047089d MDL-54647 tests: Clarify unoconv tests 2016-08-16 08:18:39 +08:00
Andrew Nicols 31b0497988 Merge branch 'MDL-54647-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-08-16 08:18:30 +08:00
Dan Poltawski 0ba31f0fd0 Merge branch 'wip-MDL-55494-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-15 13:14:41 +01:00
Dan Poltawski 22d7758077 MDL-52105 enrol_self: fix upgrade savepoint 2016-08-15 12:11:46 +01:00
Dan Poltawski 74d9779561 Merge branch 'wip-MDL-55366-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-08-15 11:43:46 +01:00
Dan Poltawski 57d60766f5 Merge branch 'wip-mdl-55380-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-08-15 11:38:34 +01:00
Dan Poltawski dbb90a1242 Merge branch 'wip-MDL-55397-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-15 11:35:37 +01:00
Dan Poltawski cc94a621e0 Merge branch 'MDL-52105-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-08-15 11:15:46 +01:00
Damyon Wiese 6659c61d2c MDL-54647 tests: Reverse order of expected and actual 2016-08-15 16:34:59 +08:00
Damyon Wiese e9365f3e44 MDL-54647 file_storage: Redo the test pdf every time it's viewed 2016-08-15 16:34:58 +08:00
Andrew Nicols a5ea66c91a Merge branch 'MDL-55513-31' of https://github.com/lucisgit/moodle into MOODLE_31_STABLE 2016-08-15 14:09:23 +08:00
Simey Lameze 63bf2d4d50 MDL-52105 enrol_self: Behat test for key holder feature 2016-08-15 12:50:22 +08:00
Simey Lameze 331488f381 MDL-52105 enrol_self: Fix wrong holdkey cap restriction for manager
This commit add an upgrade step to remove wrong CAP_PROHIBIT on enrol/self:holdkey for manager role.
Also remove the restriction from the self enrolment access file.
2016-08-15 12:50:21 +08:00
Andrew Nicols 432ed966ae Merge branch 'MDL-55229-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-08-15 12:40:43 +08:00
Andrew Nicols 30fdcea14c Merge branch 'MDL-55520-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-08-15 11:02:35 +08:00
Adrian Greeve c013c28561 MDL-55366 mod_lesson: Fix warning with TF page.
Having an image in the answer text would create a warning.
2016-08-15 10:19:32 +08:00
Stephen Bourget f9bdb59be6 MDL-55557 mod_wiki: Add missing MOODLE_INTERNAL checks 2016-08-13 21:44:01 -04:00
Stephen Bourget 4bbb0f5f9d MDL-55551 Blog: Add missing MOODLE_INTERNAL check. 2016-08-12 20:22:30 -04:00
Marina Glancy 7407be758e MDL-55494 report_eventlist: ignore only logstore_legacy 2016-08-12 13:56:23 +08:00
Marina Glancy c8e4ff2aa5 MDL-55494 tool_monitor: ignore only tool_monitor and logstore_legacy
previously any plugin type ending with _monitor or _legacy would be ignored
2016-08-12 13:56:22 +08:00
Marina Glancy c9958ef015 MDL-50586 gradingform_rubric: warn about missing 0-points levels 2016-08-12 13:26:40 +08:00
Rajesh Taneja af24b9d15f MDL-55380 behat: Fixed shared stats definition
Stats definition was being shared between
progress and moodle_progress format which
was causing double counting. Now they both
have there own stats counter definitions
2016-08-12 10:28:04 +08:00
Marina Glancy 2f38964de1 MDL-55397 block_site_main_menu: eliminate CSS conflict
CSS for '.path-admin .buttons' defines padding, border and background that affected how main menu looks on admin pages
2016-08-11 15:42:11 +08:00
Damyon Wiese e5775ef5b2 MDL-55520 assign: Behat test for rescaling max grades bug
Verify the max grade is not silently changed back to 100 when you visit
and save the assignment settings form.
2016-08-11 15:14:38 +08:00
Damyon Wiese 6037304fc1 MDL-55520 forms: Mod grade is changing values back to default
When a field is disabled in the page - no value is sent and modgrade is reverting
to the default. This change prevents the max grade from changing accidentally.
2016-08-11 14:44:13 +08:00
Tony Butler 0ae591c0bd MDL-55513 core_filestorage: Touch and test size instead of file_exists()
file_exists() can return false when file exists (in certain scenarios)
2016-08-11 07:16:51 +01:00
Tony Butler 1dd284107c MDL-55513 core_filestorage: Pass full path of temp dir to remove_dir() 2016-08-11 07:16:51 +01:00
Andrew Nicols bba74ca5ce weekly release 3.1.1+ 2016-08-11 13:17:21 +08:00
Andrew Nicols c4f61a09f1 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-08-11 13:17:18 +08:00
Andrew Nicols 6025c96e81 MDL-55333 mod_feedback: Correct constant name 2016-08-10 10:13:29 +08:00
Andrew Nicols 616638a3d8 Merge branch 'wip-MDL-55333-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-10 10:13:19 +08:00
Simey Lameze 369856e371 MDL-55229 course: Handle invisible course categories 2016-08-10 09:55:15 +08:00
AMOS bot 66de733a08 Automatically generated installer lang files 2016-08-10 00:04:51 +08:00
Dan Poltawski 6c906b7472 Merge branch 'wip-MDL-55425-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-09 10:58:41 +01:00
Dan Poltawski c349d5875f Merge branch 'MDL-55246_unoconv_31' of https://github.com/Syxton/moodle into MOODLE_31_STABLE 2016-08-09 10:11:14 +01:00
Dan Poltawski dde46ce38f Merge branch 'MDL-55390_31-fix' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-08-09 09:29:44 +01:00
Dan Poltawski 77d2baacb1 Merge branch 'MDL-55225-31' of git://github.com/dpalou/moodle into MOODLE_31_STABLE 2016-08-09 09:21:23 +01:00
Dan Poltawski 1556a6461a MDL-51078 report_log: use simpler/faster str_split over preg_split 2016-08-09 09:08:05 +01:00
Stephen Bourget 78d55507e7 MDL-51078 report_log: Allow filtering by all changes 2016-08-09 09:08:01 +01:00
David Monllao faafae96e9 MDL-55390 search: base class was in core_search\area 2016-08-09 15:35:15 +08:00
Andrew Nicols 39bb6831fc Merge branch 'wip-mdl-55329-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-08-09 14:27:49 +08:00
Andrew Nicols 362c7aa6bd Merge branch 'MDL-55480-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-08-09 13:54:29 +08:00
Andrew Nicols 350918e58d MDL-55390 core_search: Correct variable name 2016-08-09 13:44:36 +08:00
Devang Gaur 0474ba379e MDL-55390 core_search: check if a search area is real 2016-08-09 13:44:32 +08:00
Andrew Nicols 657fc14951 MDL-55274 mod_chat: Add unit tests for special commands 2016-08-09 10:49:34 +08:00
Andrew Nicols 466c31ba43 Merge branch 'MDL-55274-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-08-09 10:49:23 +08:00
Dan Poltawski a943c4cd4d Merge branch 'MDL-55398_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-08-08 10:40:47 +01:00
Dan Poltawski 50b5467ba1 Merge branch 'wip-MDL-55418-m31' of https://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-08 10:33:45 +01:00
Mark Nielsen 741d8abe84 MDL-55453 core_lib: Fix usage of js_send_uncached 2016-08-08 09:54:13 +01:00
Russell Smith cdb3a0e501 MDL-55292 performance: Allow Tideways profiler extension.
PHP7 doesn't have any default XHProf support and all other
investigated forks don't have stable PHP7.  Tideways is under
active development and is easy to install.  The data format
is compatible with XHProf so it is a drop-in replacement in that way.
2016-08-08 15:26:11 +08:00
Marina Glancy 837fb636d4 MDL-55333 mod_feedback: work around MySQL tables in join limit 2016-08-08 14:40:51 +08:00
Nick Phillips a27fe6be90 MDL-55274 mod_chat: regain beep and / command in mod_chat.
format_text cannot be called on the whole input text, but must be
called on user-supplied text that will be output into chats. This
means it cannot simply be called in one place, but must instead be
called on the relevant parts of text once commands have been matched.
2016-08-08 12:30:18 +08:00
fhuebler f14161532e MDL-55480 competency: Added missing closing tag 2016-08-08 11:01:04 +08:00
Andrew Nicols 30257f7959 Merge branch 'MDL-55454_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-08-08 10:03:53 +08:00
AMOS bot 80f687788d Automatically generated installer lang files 2016-08-06 00:04:58 +08:00
Matt Davidson c79398ea60 MDL-55246 assign: convert files with spaces
If a file is sent to unoconv with a filename that contains spaces,
unoconv will fail to produce the intended results.
2016-08-05 08:16:01 -04:00
Marina Glancy 9d98f9e1f4 MDL-55425 user: allow to update another user editor pref 2016-08-05 09:39:28 +08:00
Andrew Nicols 56394c8bd6 weekly release 3.1.1+ 2016-08-04 09:59:02 +08:00
Andrew Nicols 785ae8a346 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-08-04 09:58:59 +08:00
Rajesh Taneja ab70395d0b MDL-54656 behat: Skip test if db family is not mysql or postgres 2016-08-04 08:47:04 +08:00
Tim Hunt df546e9e3a MDL-55454 quiz: loses shufflequestion setting restoring old backups 2016-08-03 18:46:20 +01:00
Marina Glancy 174b641661 MDL-55418 behat: correct exception class name 2016-08-03 09:17:52 +08:00
Eloy Lafuente (stronk7) 6e4672f5ce Merge branch 'MDL-54656_m31v3' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-08-03 00:51:37 +02:00
Eloy Lafuente (stronk7) 418c1835a2 Merge branch 'MDL-55166-31-blocksettings' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-08-03 00:34:04 +02:00
Eloy Lafuente (stronk7) 8ac6adeaf8 Merge branch 'MDL-55322-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-08-03 00:14:41 +02:00
Dan Poltawski ad4fbd423f MDL-54847 tests: fix unused var 2016-08-02 20:13:56 +01:00
Cameron Ball 2c18b1321e MDL-54847 weblib: Test media attributes individually 2016-08-02 20:13:49 +01:00
Mark Nielsen 528a9d1a02 MDL-55314 mod_lti: Several fixes to lti_load_cartridge
* Fixed XML loading when there is an error
* Fixed exception thrown by lti_load_cartridge
* By default, don't allow LTI mod generator to
  use a toolurl as that results in a cURL call.
2016-08-02 17:40:46 +02:00
Eloy Lafuente (stronk7) 790b9eab79 Merge branch 'MDL-55315-M31' of https://github.com/mrmark/moodle into MOODLE_31_STABLE 2016-08-02 17:08:39 +02:00
Eloy Lafuente (stronk7) 67d51a5eff Merge branch 'MDL-55316-M31' of https://github.com/mrmark/moodle into MOODLE_31_STABLE 2016-08-02 17:02:43 +02:00
Eloy Lafuente (stronk7) 91071cffce Merge branch 'MDL-55348-31' of git://github.com/dpalou/moodle into MOODLE_31_STABLE 2016-08-02 16:48:57 +02:00
Dan Poltawski 311eae0213 Merge branch 'wip-MDL-33741-m31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-08-02 12:20:32 +01:00
Dan Poltawski 82e580d698 Merge branch 'MDL-55357_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-08-02 11:01:17 +01:00
Dan Poltawski 8cf6371521 Merge branch 'MDL-54847-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-08-02 11:00:34 +01:00
Cameron Ball 469aa911c1 MDL-54847 weblib: Support basic HTML media tags 2016-08-02 15:54:56 +08:00
Andrew Nicols 20eb9b3998 Merge branch 'MDL-54879-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-08-02 09:13:35 +08:00
Stephen Bourget 93375cb2f9 MDL-55398 mod_feedback: prevent direct script access to lib files. 2016-08-01 20:55:12 -04:00
Dan Poltawski 8025e88b87 Merge branch 'MDL-55360-31-workshopgradepass' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-08-01 18:55:08 +01:00
AMOS bot f1ef8b34df Automatically generated installer lang files 2016-08-02 00:04:26 +08:00
Dan Poltawski 3b753dc7ca MDL-55376 assign: trailing whitespace 2016-08-01 16:07:58 +01:00
Dan Poltawski 79315c0306 Merge branch 'MDL-55376-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-08-01 16:06:58 +01:00
Dan Poltawski 266e48893a Merge branch 'MDL-55323-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-08-01 13:58:21 +01:00
Dan Poltawski 32bc32736b Merge branch 'MDL-55374-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-08-01 13:50:40 +01:00
Andrew Nicols 55d3501159 Merge branch 'MDL-53152-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-08-01 15:07:23 +08:00
Jun Pataleta 2a07ee5c2a MDL-53152 theme: Add parentheses to variable calculations 2016-08-01 13:41:08 +08:00
Jake Dallimore 9e6ed38418 MDL-55322 assignfeedback_editpdf: Prevent scroll when moving comments
Prevent the default scroll behaviour when using gestures to move
comments on the mobile site.
2016-08-01 09:48:20 +08:00
Andrew Nicols 1335a27a0b Merge branch 'MDL-55289-31-exsubmission' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-08-01 09:29:12 +08:00
Marina Glancy 562593e9db MDL-33741 file_info: show courses in hidden categories
This also has a couple of bugfixes:
- file_info_context_system::get_children() was looking for courses with parent=0, it is impossible, block removed;
- file_info_context_coursecat::get_area_coursecat_description() was checking the wrong capability to view files in description
2016-08-01 09:17:03 +08:00
Marina Glancy d6a24b5794 MDL-33741 file_info: check capability when serving file in coursecat description 2016-08-01 09:16:59 +08:00
Cameron Ball 04ad26aa2a MDL-55376 mod_assign: Fix bug stopping admin from editing submissions 2016-07-29 19:08:58 +08:00
David Monllao b5b1eedaac MDL-55357 search: Contents include UTF8 characters, adding u modifier 2016-07-29 14:36:49 +08:00
Damyon Wiese 50cb7da5f9 MDL-55374 mod_assign: Force utf-8 for DOMDocument
This prevents charset issues on some sites.
2016-07-29 10:45:54 +08:00
AMOS bot 023bf2ed39 Automatically generated installer lang files 2016-07-29 00:05:49 +08:00
Dani Palou a44bee5f2d MDL-55348 wiki: Convert 'section' WS params to PARAM_RAW 2016-07-28 10:39:46 +02:00
David Mudrák 2b09881896 MDL-55360 workshop: Add tests for setting grades to pass via mod form
These scenarios should cover common cases of defining the grades to pass
pass via the workshop settings form. Note that behaviour of the fields
in terms of locale-specific decimals input (MDL-51806) is not covered
with these tests as I want to avoid installation of additional language
pack. Instead, I assume that functionality of unformat_float() is tested
separately in the core.
2016-07-28 09:54:45 +02:00
David Mudrák d3a636163f MDL-55360 workshop: Emptying grades to pass should set them to zero
When editing existing workshop with a grade to pass defined, when the
field is emptied, it should be interpreted as setting it to zero. This
was not happening because unformat_float replaces the field with null,
therefore effectively unsetting it.

By casting to float, we interpret all empty values (including null) as
zeros. This behaviour is consistent with how gradebook setup UI works.
2016-07-28 09:54:45 +02:00
David Mudrák 6b8511e8c5 MDL-55360 workshop: Allow creating workshops with empty grades to pass
As a regression of MDL-55360, it was not possible to create new
workshops if the field "Submission grade to pass" or "Assessment grade
to pass" was left empty. The validation failed with "You must enter a
number here".

The fields submissiongradepass and gradinggradepass are always present
as we explicitly define them in the mod form. So the isset() condition
in the validation was useless and it did not allow to submit the form
with these fields empty.

Additionally, the unformat_float() returns null only if it receives
empty value on the input. Which can't happen in our case so I am
removing this condition to improve the readability of the code.
2016-07-28 09:54:45 +02:00
David Mudrák a2e7fd18ee MDL-55289 workshop: Fix files processing in example submissions
While testing the issue MDL-55289 I realized that attaching files to
workshop example submissions does not work at all and throws an error.

The reason was that in MDL-50794 (996f7e82), the variables $contentopts
and $attachmentopts were replaced with the result of the methods
submission_content_options() and submission_attachment_options().
But I forgot to perform the full refactoring in exsubmission.php too.

Attached behat test should cover both issues on this branch.
2016-07-28 09:51:18 +02:00
David Mudrák badf4c1eef MDL-55289 workshop: Include repository/lib.php to use its constants
As a result of MDL-41556 (146893d6), the repository/lib.php was included
in submission.php so that its constant FILE_INTERNAL could be used in
field options. Recent development in MDL-50794 (996f7e8) moved the
options declaration to standalone methods but we forgot to check they
work in exsubmission.php too.

This patch moves the repository/lib.php inclusion to where the
library is actually needed.

Additionally it unifies how options are set for overall feedback content
and overall feedback attachment fields.
2016-07-28 09:51:18 +02:00
Jun Pataleta 1d991dcf32 MDL-55323 enrol_lti: Remove unused required parameter 2016-07-28 14:45:08 +08:00
Jun Pataleta fee48e90ad MDL-54879 mod_lti: Add fallback options for error message upon failure 2016-07-28 14:39:25 +08:00
David Monllao 2a9c12ce0b weekly release 3.1.1+ 2016-07-28 12:07:27 +08:00
David Mudrák f5a1aafa89 MDL-55166 admin: Fix display of misleading debug warning on manage block
Blocks can declare has_config() as true without actually using the
default node in the admin tree. Typical use case is when the block
injects its settings to other parts of the admin tree and it assigns
null to its $setting node in its settings.php file.

As Janek L.B. correctly spotted, this led to false debugging message
on admin/blocks.php as the code interpreted it as missing settings.php
file.

The patch adds explicit file existence test for this rare case.
2016-07-27 23:09:51 +02:00
Dani Palou f147248f5c MDL-55225 assign: Format assignment submission text in WS 2016-07-27 13:31:09 +02:00
Rajesh Taneja 85f20080a0 MDL-55329 behat: PyStrings should end with : (colon) 2016-07-27 07:02:09 +08:00
Tony Butler ab3894208a MDL-55245 assignfeedback_editpdf: Enable text in comments to be selected
Only move comment boxes if 'select' tool is selected, enabling users to
drag-select text within comments using the 'comment' tool.
2016-07-26 23:47:16 +02:00
Eloy Lafuente (stronk7) 34930b4115 Merge branch 'wip-MDL-51735-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-26 20:16:59 +02:00
Eloy Lafuente (stronk7) 5839f95f3a Merge branch 'MDL-54657_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-07-26 19:57:06 +02:00
Eloy Lafuente (stronk7) b5fc1b1f13 Merge branch 'wip-mdl-55337-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-26 13:27:03 +02:00
Rajesh Taneja 3eacb31527 MDL-55337 behat: Added 1 sec delay between post
Ensure post is created at different timestamp, else
returned posts will be different and test fails.
This will happen on a fast machine.
2016-07-26 19:01:15 +08:00
David Monllao ea634405d6 MDL-55183 atto: Fix whitespaces 2016-07-26 10:05:44 +08:00
David Monllao 2f905b06d7 Merge branch 'wip-MDL-55183-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE
Conflicts:
	lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
2016-07-26 09:56:52 +08:00
Adrian Greeve bc29b3920b MDL-55183 editor_atto: Fix requires error.
When using a different theme and removing an editor
plugin such as the equation plugin, atto will display
an error about a missing dependency.

A thank you to Anthony Forth for providing this patch.
2016-07-26 09:42:37 +08:00
David Monllao cf620188a7 Merge branch 'MDL-55283-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-07-26 05:04:21 +08:00
David Monllao e764c1bf72 Merge branch 'MDL-51242-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-07-26 02:41:06 +08:00
Mark Nielsen 73c218f4c5 MDL-55315 mod_lti: Fix Nginx 405 error
It appears that Nginx doesn't allow POST
to static files.  So rename the fixture from
a HTML file to a PHP file.
2016-07-25 09:23:14 -07:00
Mark Nielsen df93cb661b MDL-55316 core_completion: Expand fields for Behat
This only happens if you create the course with
one user and then try to enable completion
with another user.
2016-07-25 09:19:35 -07:00
Dan Poltawski f8b4522d35 Merge branch 'MDL-55284-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-07-25 15:53:39 +01:00
Dan Poltawski 929329f58c Merge branch 'wip-MDL-54796-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-25 10:28:29 +01:00
Stephen Bourget f6d310f0f7 MDL-55252 mod_chat: prevent direct script access to lib files. 2016-07-25 09:42:37 +01:00
Stephen Bourget 7e8203ec65 MDL-55253 mod_choice: prevent direct script access to lib files. 2016-07-25 09:40:43 +01:00
Stephen Bourget 180c475961 MDL-55255 mod_data: prevent direct script access to lib files. 2016-07-25 09:40:16 +01:00
An Pham Van 6358e71651 MDL-54838 workshop: Differentiate labels for each comment field.
In a Workshop activity, comment fields on Assessment forms do not properly link to the corresponding Aspect.
So screen reader users may find it difficult to complete the Assessment forms.
There should be a hidden label text for each comment field.
2016-07-25 14:16:27 +07:00
Adrian Greeve 8861612c52 MDL-51735 mod_lesson: A lesson with no content shows a message.
Before it would show an error.
2016-07-25 10:54:53 +08:00
Adrian Greeve 2f7b29a366 MDL-54796 forms: Editor restore event created.
The editor restore event is currently being subscribed
to by the change checkers to refresh their savedstate.
2016-07-25 10:45:30 +08:00
Eloy Lafuente (stronk7) 4eeb5e469b weekly release 3.1.1+ 2016-07-21 11:45:14 +02:00
Eloy Lafuente (stronk7) 9744164d37 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-07-21 11:45:10 +02:00
Damyon Wiese 2d2aaf36f3 MDL-55284 assign: Add missing webservice param 'onlyids'
Mod assign list_participants webservice is supposed to accept a param to limit the
returned data to only show user ids and not the full user details. It is missing
and so the full user records are fetched every time. This has a major impact on the
performance of the new assignment grading interface.
2016-07-20 15:18:18 +08:00
Andrew Nicols 15f8415fef MDL-55283 javascript: Check dir is readable before traversing them 2016-07-20 12:16:56 +08:00
AMOS bot 6837281309 Automatically generated installer lang files 2016-07-20 00:05:27 +08:00
Eloy Lafuente (stronk7) f97b4d2198 Merge branch 'MDL-55220-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-19 13:22:16 +02:00
Eloy Lafuente (stronk7) 3ca9d711e1 Merge branch 'wip-mdl-55258-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-19 12:13:10 +02:00
Dan Poltawski e731e849f7 Merge branch 'MDL-55206-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-07-19 10:52:35 +01:00
Dan Poltawski f6824dd82f Merge branch 'MDL-54915-31' of http://github.com/damyon/moodle into MOODLE_31_STABLE 2016-07-19 09:38:58 +01:00
Dan Poltawski f8e748dd4d Revert "Merge branch 'MDL-54915-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE"
This reverts commit f1ec07fe11, reversing
changes made to 1972614e16.
2016-07-19 09:37:18 +01:00
David Monllao ca8cef50d3 Merge branch 'MDL-55157_m31v6' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-07-19 08:42:07 +02:00
Damyon Wiese e2bae72003 MDL-54915 templates: Fix async rendering of js blocks
Mustache JS helper can overwrite JS blocks when using nested templates.

Each call to render should have it's own scope.
2016-07-19 13:00:59 +08:00
Rajesh Taneja 695df07228 MDL-55258 behat: Set focus on button before clicking it
Set the focus on button to ensure it is in
viewport before clicking on it.
2016-07-19 10:40:55 +08:00
Stephen Bourget 887eb290ba MDL-55157 mod_feedback: Course reset should update dates 2016-07-18 22:10:15 -04:00
Eloy Lafuente (stronk7) 539b53d611 MDL-52544 oracle: small tweaks
This commit just:

- Moves the null => '' to better place, restricting it to PHP >= 7.0
  (bug https://bugs.php.net/bug.php?id=72524)
- Adds a couple of notes here and there.
- Changes some small details to keep the file using the same coding.
2016-07-19 04:04:44 +02:00
Eloy Lafuente (stronk7) 70d4cfb9f7 Merge branch 'MDL-52544-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-07-19 04:04:40 +02:00
Eloy Lafuente (stronk7) d93247a237 Merge branch 'MDL-51410_m31v2' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-07-19 02:31:31 +02:00
David Monllao 923053d5a1 Merge branch 'MDL-55161-m31' of https://github.com/micaherne/moodle into MOODLE_31_STABLE 2016-07-18 20:02:22 +02:00
David Monllao 15f367ba1d Merge branch 'MDL-55163-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-18 19:45:08 +02:00
Dan Poltawski f825156be9 Merge branch 'wip-mdl-55174-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-18 14:49:52 +01:00
Dan Poltawski bcbc0b9f03 Merge branch 'MDL-55190-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2016-07-18 14:21:04 +01:00
Dan Poltawski 4dc180b05d Merge branch 'MDL-55012-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-07-18 13:57:41 +01:00
Dan Poltawski bff5af27de Merge branch 'MDL-54963_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-07-18 13:38:39 +01:00
Dan Poltawski 19722fbf92 Merge branch 'wip-mdl-54977-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-18 13:27:53 +01:00
Dan Poltawski 259c070a9d Merge branch 'MDL-55240-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-07-18 10:51:08 +01:00
Dan Poltawski f1ec07fe11 Merge branch 'MDL-54915-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-07-18 09:17:53 +01:00
Rajesh Taneja 5adea0017f MDL-55174 core_tests: Use proper itemid while creating file 2016-07-18 10:30:05 +08:00
AMOS bot b9aee5ae58 Automatically generated installer lang files 2016-07-16 00:05:39 +08:00
Jun Pataleta f4e03e2aa1 MDL-55206 admin: Some code cleanup
* Removed unnecessary TODOs.
* Changed message prompt case to sentence case.
2016-07-15 14:52:25 +08:00
Jun Pataleta 5e1291cf90 MDL-55206 admin: Remove div tags in password policy error message 2016-07-15 14:47:15 +08:00
Rajesh Taneja b62061f44a MDL-55174 core_testing: Use proper directory separator
While searching for existing files if directory
separator is not correct then original files
and directories will be deleted. So use DIRECTORY_SEPARATOR.
2016-07-15 13:53:10 +08:00
Damyon Wiese 7166d2ab48 MDL-55012 Atto: no style attrs on paste
Specifically on paste - we don't need all the random style attributes
from content on the clipboard. When you copy from a webpage - the browser
inlines all the styles from the page so that the pasted content will look
like the place it was copied from. But this is never what you want - you
want the content on paste, but with no special styling.
2016-07-15 13:36:50 +08:00
Jun Pataleta 7b1c27076b MDL-55240 editpdf: Revert changes in MDL-54772
* Revert rendering of annotations and comments back to the
  drawing region.
* Bind events to stamp annotation when editing only.
2016-07-15 10:37:48 +08:00
David Monllao 1972614e16 weekly release 3.1.1+ 2016-07-14 11:28:52 +02:00
David Monllao 379b194e3e Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-07-14 11:28:50 +02:00
Juan Leyva ab793a088d MDL-55220 forum: Add string filtering in WS
The following external functions now filter the discussion and post
name and subject.
- get_forum_discussions_paginated
- get_forum_discussion_posts
2016-07-14 09:14:48 +01:00
Stephen Bourget 237f52a9fb MDL-54657 Behat: Add tests for section_links block 2016-07-13 21:39:37 -04:00
Eric Merrill 5010e7aebd MDL-55190 search: Limit search to non-files if disabled 2016-07-13 06:06:05 -04:00
Michael Aherne e2c0f3ee50 MDL-55161 assign: Check for existence of gradebook feedback plugin 2016-07-13 09:02:42 +01:00
JD 9b81a977e1 MDL-54977 blocks_navigation: Use html_writer::random_id for id
uniqid() may returns the same id for faster machines (seen on iis)
so use html_writer::random_id(), to ensure id is different and
navigation don't break
2016-07-13 14:01:20 +08:00
Andrew Nicols 2f6241d030 Merge branch 'MDL-47371-31-fix' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-07-13 12:11:19 +08:00
Cameron Ball b5af9da5d3 MDL-47371 mod_book: Fix out of scope $unescapedtitle 2016-07-13 10:27:58 +08:00
Damyon Wiese fc9a1820e5 MDL-52544 oracle: Apply upstream pull request to AdoDB oracle driver
Upstream: https://github.com/ADOdb/ADOdb/pull/259

Prevent segfault with ocipo driver on php7.

The OCIFetchinto function is causing segfaults on php7 - probably because the fields array
is not initialised or it is optimised out. This fixes just changes to use the safer function
oci_fetch_array instead.
2016-07-13 08:46:01 +08:00
Stephen Bourget 3e02472261 MDL-51410 mod_survey: fix notifications when saving analysis 2016-07-12 20:08:51 -04:00
tunele 705b215b63 MDL-55083 admin: provide friendly error in case phpxml is missing 2016-07-13 00:09:42 +02:00
Eloy Lafuente (stronk7) 20474552ac MDL-53803 mod_choice: fix trailing whitespace 2016-07-12 18:06:21 +02:00
AMOS bot ad48cf4e28 Automatically generated installer lang files 2016-07-13 00:04:45 +08:00
Eloy Lafuente (stronk7) d5b38dfea1 Merge branch 'MDL-53803_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-07-12 18:02:59 +02:00
Eloy Lafuente (stronk7) 19b118ad42 Merge branch 'MDL-54892-MOODLE_31_STABLE' of https://github.com/tobiasreischmann/moodle into MOODLE_31_STABLE 2016-07-12 17:51:46 +02:00
Eloy Lafuente (stronk7) 8d1623b7ed Merge branch 'MDL-55136_dataobject_31' of git://github.com/davosmith/moodle into MOODLE_31_STABLE 2016-07-12 15:48:22 +02:00
David Monllao 0bf06fbee5 Merge branch 'MDL-54771-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-07-12 14:53:40 +02:00
Eloy Lafuente (stronk7) 3b9f7d90d0 MDL-37250 mod_lesson: Move conditions to queries for better performance
While this ony seems to affect MySQL, better put the filter/conditions
on every query so the temporary view/table does not need to handle
thousands of potentially unrelated records.
2016-07-12 13:32:46 +02:00
Eloy Lafuente (stronk7) 4de30cdce3 Merge branch 'wip-MDL-37250-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-12 13:32:36 +02:00
David Monllao a59d8bfdcb Merge branch 'MDL-55133-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-07-12 13:16:40 +02:00
David Monllao c4312f0ac7 Merge branch 'wip-MDL-55107-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-12 13:03:30 +02:00
Dan Poltawski 9770f74eda Merge branch 'MDL-47371-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-07-12 10:14:29 +01:00
David Monllao f7c1b3d776 Merge branch 'MDL-55170_M31' of https://github.com/nadavkav/moodle into MOODLE_31_STABLE 2016-07-12 10:30:42 +02:00
David Monllao cc145bf17b MDL-54963 search: Show no results 2016-07-12 10:23:52 +02:00
Dan Poltawski 3e159646ad Merge branch 'MDL-55007-m31' of https://github.com/dthies/moodle into MOODLE_31_STABLE 2016-07-12 09:21:06 +01:00
Adrian Greeve 0173297438 MDL-55107 gradebook: Unit tests for the new setting check. 2016-07-12 13:33:04 +08:00
Adrian Greeve d6f4093376 MDL-55107 gradebook: Improve the 57 letter boundary upgrade.
This fixes a setting not being checked before and also
reduces the number of false positives.
2016-07-12 13:32:53 +08:00
Cameron Ball a74908ae4c MDL-47371 mod_book: Don't double escape book titles 2016-07-12 10:34:01 +08:00
Cameron Ball 85f1d94f0b MDL-47371 block_navigation: Don't double escape course titles 2016-07-12 10:34:00 +08:00
Cameron Ball cbc6b9f475 MDL-47371 weblib: Add option to disable escaping 2016-07-12 10:33:58 +08:00
Andrew Nicols 36a9aba565 MDL-54915 core: JS Blocks must not used shared variables
The JS blocks in a template must _not_ use a shared variable as they can be
executed asynchronously and complete in any order.

Instead it is stored in the only local variable available - the current
context.

Since the context can be passed in from elsewhere, we namespace it to
reduce the chance of collission.
2016-07-12 09:54:42 +08:00
Daniel Thies 09b3ec720f MDL-5507 filter_mathjaxloader: Add commeents for regexes 2016-07-11 13:22:13 -05:00
Dan Poltawski 27f66455dc Merge branch 'MDL-54926-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2016-07-11 16:54:42 +01:00
Dan Poltawski cca0fe3e3a Merge branch 'MDL-55082-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2016-07-11 15:20:55 +01:00
David Monllao 200c2745e9 Merge branch 'wip-MDL-54962-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-11 16:15:56 +02:00
Dan Poltawski 2c089c2f72 Merge branch 'MDL-55112-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-07-11 14:42:14 +01:00
Dan Poltawski 46844a6b6e Merge branch 'MDL-55137-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-07-11 14:37:57 +01:00
Dan Poltawski 02848ae89f Merge branch 'MDL-55128-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-11 13:33:23 +01:00
Dan Poltawski c9ddcaff47 Merge branch 'wip-MDL-55154-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-11 13:31:25 +01:00
Juan Leyva 9eb1e017e1 MDL-55163 mod_assign: Fix mod_assign_copy_previous_attempts
- Not exposed via WS
- Have a bug when calling the api function
2016-07-11 10:33:23 +01:00
David Monllao 9fda3f17d0 Merge branch 'MDL-54832-31' of https://github.com/nashtechdev01/moodle into MOODLE_31_STABLE 2016-07-11 06:47:34 +02:00
Adrian Greeve f0c57645e5 MDL-37250 mod_lesson: All actual attempts on the lesson are displayed.
The lesson overview report now shows all attempts made including hitting
the page and immediately navigating away.
2016-07-11 08:19:23 +08:00
AMOS bot 820b5b2a46 Automatically generated installer lang files 2016-07-11 00:06:00 +08:00
Eloy Lafuente (stronk7) 47806ea17e Moodle release 3.1.1 2016-07-10 00:29:25 +02:00
Nadav Kavalerchik c4891ac771 MDL-55170 theme_bootstrapbase: Fix user enrollment dialog, RTL 2016-07-09 14:53:33 +03:00
Davo Smith 2a59561f7e MDL-55136 data_object: fix param handling in fetch_all_helper 2016-07-09 09:21:09 +01:00
Adrian Greeve 0e40fc6e85 MDL-54962 mod_data: Approval status is now translated.
It was using hardcoded English. Now it uses get_string.
2016-07-08 10:56:29 +08:00
Adrian Greeve 0f1ae159df MDL-55154 mod_lesson: Lesson numerical response shows images. 2016-07-08 09:52:10 +08:00
Daniel Thies 0b2b9e21dc MDL-55007 filter_mathjaxloader: Change unit test 2016-07-07 20:23:26 -05:00
Daniel Thies 6857304753 MDL-55007 filter_mathjaxloader: Wrap nolink around each expresssion 2016-07-07 20:22:56 -05:00
Eloy Lafuente (stronk7) a0473f798d weekly release 3.1+ 2016-07-07 10:20:09 +02:00
Eloy Lafuente (stronk7) b4e5db392e NOBUG: Fixed SVG browser compatibility 2016-07-07 10:20:05 +02:00
Eloy Lafuente (stronk7) b775dad6e6 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-07-07 10:20:04 +02:00
Damyon Wiese 75ff893a27 MDL-52544 oracle: php7 fixes for oci driver
These are our bugs actually - the oci docs are very clear that bound
params should be in-scope when oci_execute is called - and due to pass by value etc,
this was not true for our driver.

There is another bug that needed fixing - OCI barfs if null values are bound - this
can be avoided by setting them to '' which oci treats as null.

And finally - all our lob/clob/blob hacks were also binding to local "out-of-scope" vars.
2016-07-07 13:09:59 +08:00
Andrew Nicols 56d67f1a9d Merge branch 'wip-mdl-55043-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-07 11:29:14 +08:00
Rajesh Taneja e9f2e5bea7 MDL-55043 core_competency: Sort by id to ensure we get expected result. 2016-07-10 11:25:43 +08:00
Andrew Nicols 6416b84bd6 Merge branch 'MDL-54869-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-07 10:48:48 +08:00
Stephen Bourget 10120241ae MDL-53803 mod_choice: remove orphaned answers when removing options 2016-07-06 17:15:33 -04:00
Eloy Lafuente (stronk7) 4e4e8e1da9 Merge branch 'wip-MDL-46682-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-07-06 18:13:58 +02:00
Cameron Ball c7010e82ae MDL-54771 tool_recyclebin: Don't add temp course to recycle bin 2016-07-06 23:19:00 +08:00
Cameron Ball bd7cc14d6a MDL-54771 restore: Add deletesource to course object
Since deleting a course now triggers the pre_course_delete hook
it may be useful for hook implementations to know whether it was
a "true" course deletion, or one originating from a temporary
course created during a restore.
2016-07-06 23:19:00 +08:00
Cameron Ball 8bc112e645 MDL-55137: Update PHPDoc for external_format_text 2016-07-06 17:48:33 +08:00
Eloy Lafuente (stronk7) 2a55226144 MDL-54934 workshop: ensure "Current phase" is always separated
Apparently some readers can join 2 adjacent spans completely, simply
adding a whitespace between them prevents that, ensuring separation.,
2016-07-06 11:36:11 +02:00
Adrian Greeve 46672f08d6 MDL-46682 auth/db: Increase of chunk size and update change.
The update query was not checking the mnet auth id and could
have been updating the wrong entry.
2016-07-06 16:43:47 +08:00
Andrew Nicols 9563554a1a Merge branch 'MDL-54734-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-07-06 15:02:16 +08:00
Simey Lameze 73ad749ca0 MDL-54734 core_user: do not cache dummy user records 2016-07-06 13:44:27 +08:00
Andrew Nicols e1f29cf6e2 MDL-54734 user: Add tests to demonstrate multi-user issues 2016-07-06 13:44:27 +08:00
Andrew Nicols 40867c234a Merge branch 'MDL-54165-31' of git://github.com/ryanwyllie/moodle into MOODLE_31_STABLE 2016-07-06 12:02:31 +08:00
Ryan Wyllie 22861d00c7 MDL-54165 mod_assign: Fix doc in grading_events.js 2016-07-06 03:47:35 +00:00
Rajesh Taneja 5c280e9e1e MDL-54844 mod_glossary: Don't append AND as it's done later 2016-07-06 11:35:23 +08:00
Andrew Nicols 61453e1a79 Merge branch 'MDL-54165-31' of git://github.com/ryanwyllie/moodle into MOODLE_31_STABLE 2016-07-06 11:08:05 +08:00
Ryan Wyllie 30a9fe133a MDL-54165 mod_assign: Collapsible review and grade panel 2016-07-06 02:54:18 +00:00
Barbara Ramiro 879b5bb6fc MDL-54165 mod_assign: Layout icons for the new grading interface 2016-07-06 02:53:13 +00:00
Damyon Wiese 2c72d1b8b5 MDL-55133 javascript: Correctly use component names in requirejs
Core subsystems must use the 'core_' prefix always.
2016-07-06 10:26:58 +08:00
Jerome Mouneyrac b406f53662 MDL-46682 auth/db: IN clause crashes when too many users to sync 2016-07-06 10:06:03 +08:00
Adrian Greeve ec0edd25ac MDL-54844 mod_glossary: Limiting of glossary searching.
Searching of the glossary was returning results from all
glossaries on the site. It has now been returned to just
the glossary that you are currently viewing.
2016-07-06 09:20:31 +08:00
Eloy Lafuente (stronk7) 8d30e8370d Merge branch 'wip-mdl-55043-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-06 03:19:17 +02:00
Rajesh Taneja d49170cb14 MDL-55043 core_competency: Set proper sort order for each field 2016-07-06 08:18:33 +08:00
Eloy Lafuente (stronk7) c3001c7457 Merge branch 'wip-mdl-54860-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-07-06 01:42:50 +02:00
Rajesh Taneja 4f5a6e28ec MDL-54860 behat: Stop execution if setup problem found 2016-07-06 07:28:31 +08:00
Eloy Lafuente (stronk7) 395a315e9f Merge branch 'MDL-54934-31' of https://github.com/nashtechdev01/moodle into MOODLE_31_STABLE 2016-07-05 20:44:21 +02:00
Eloy Lafuente (stronk7) 501f7d53c6 Merge branch 'MDL-54867-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-05 20:27:28 +02:00
Eloy Lafuente (stronk7) a7a037ecde Merge branch 'MDL-49244-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-05 20:19:47 +02:00
Eloy Lafuente (stronk7) 967a7bc2ac Merge branch 'MDL-54795_31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-07-05 20:10:42 +02:00
Eloy Lafuente (stronk7) defc74db0d Merge branch 'MDL-29738-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-07-05 17:06:06 +02:00
Loc Nguyen d54b4cdfa1 MDL-54832 workshop: adding landmark for userplantable
Accessibility enhance: add an aria-label on the userplan table so
that it's accessible to me through my screen reader
2016-07-05 20:15:30 +07:00
Andrew Nicols 222e854a9e MDL-29738 file: Remove unused stylesheet functionality
This functionality was commented out in
78946b9bdb for MDL-20204 back in 2009.
Since then it has been wasting cycles performing utterly pointless
preg_match and preg_replace calls.
2016-07-05 19:03:39 +08:00
Andrew Nicols ccb97f2eef MDL-55114 chat: Remove commented-out variables 2016-07-05 12:46:46 +02:00
Eloy Lafuente (stronk7) cf3ac3f218 Merge branch 'MDL-55113-31' of git://github.com/dpalou/moodle into MOODLE_31_STABLE 2016-07-05 12:21:53 +02:00
Dan Poltawski c25d8efc47 Merge branch 'MDL-54928-31' of git://github.com/dpalou/moodle into MOODLE_31_STABLE 2016-07-05 11:20:08 +01:00
Dan Poltawski abc0cac40a Merge branch 'MDL-54841-31' of https://github.com/nashtechdev01/moodle into MOODLE_31_STABLE 2016-07-05 11:06:39 +01:00
Juan Leyva 9b7d5cd41b MDL-55128 course: Fix param type for shortname 2016-07-05 09:51:21 +01:00
Dani Palou eef85ddc40 MDL-54928 notifications: Add username to emailto users 2016-07-05 10:36:13 +02:00
Dani Palou b65a928372 MDL-54928 notifications: Retrieve username from DB if empty 2016-07-05 10:36:13 +02:00
Juan Leyva 47560d0eb0 MDL-54869 webservice: Fix core_user_add_user_private_files 2016-07-05 09:00:43 +01:00
Juan Leyva 068904f73b MDL-54869 files: Create new required functions
This was a complex change requiring three new functions:
file_merge_files_from_draft_area_into_filearea - To just add files from a draft area into a real one (just adding or updating, not deleting)
file_merge_draft_area_into_draft_area - To merge files from two draft areas, used by the latest for creating a draft area with all the original files plus the new ones.
file_overwrite_existing_draftfile - Required to update existing files not losing metadata or references.

The whole process is the following:

    User uploads a file (upload.php)
    Client gets a new draftid A containing the file only (return of upload.php)
    Client requests to merge that draftid in the user's private files (core_user_add_user_private_files)
    Server prepares a new UNUSED draftid B from existing area
    Server merges A into B
    Server saves the draft B into the final area
2016-07-05 09:00:43 +01:00
Andrew Nicols 767eaec731 MDL-51242 messageinbound: Guess the port from hostspec
Existing language strings for the host component suggest that the host can
be provided in the format hostname:port, but we previously did not support
this.

This patch explodes the string based on the colon character and assumes
that if there are two parts, that they are in the format hostname:port.

Note: This does not attempt to deal with full host specifications (e.g.
protocol://hostname:port), as this is beyond the scope of this change.
2016-07-05 14:54:08 +08:00
An Pham Van 65432b1b7b MDL-54841 workshop: Combine links for attachment icon and text.
In a workshop activity, on the view submission page where having attachment(s), there's an accessibility issue.
There're 2 separate links for the icon and text which causes an issue for keyboard and screen reader users.
So the text and icon should be combined in one link.
2016-07-05 13:26:55 +07:00
Jake Dallimore 8fba57e950 MDL-53431 tool_monitor: Access control for tool monitor subscriptions 2016-07-05 10:45:17 +08:00
Dan Poltawski a933f85a73 Merge branch 'MDL-55019-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-04 15:29:45 +01:00
Dan Poltawski 8cba7fda3a Merge branch 'MDL-54976-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-07-04 14:52:01 +01:00
Dan Poltawski f852010c6c Merge branch 'MDL-54994_31' of git://github.com/stronk7/moodle into MOODLE_31_STABLE 2016-07-04 14:18:20 +01:00
Dan Poltawski 2a5bb77321 Merge branch 'MDL-55032-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-07-04 13:28:49 +01:00
Dan Poltawski 2212fbf028 Merge branch 'MDL-55041_31_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_31_STABLE 2016-07-04 12:45:56 +01:00
Dan Poltawski 1a4184a396 Merge branch 'MDL-41945-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-07-04 12:39:37 +01:00
Marina Glancy d722da1bb4 MDL-55069 core: escape special characters in email headers 2016-07-04 12:28:02 +01:00
Dani Palou c58312fe82 MDL-55113 assign: Use PARAM_RAW in onlinetext text 2016-07-04 09:59:14 +02:00
Jun Pataleta bc795079f7 MDL-55112 mod_forum: Query all forum fields to avoid debug messages 2016-07-04 15:23:47 +08:00
Andrew Nicols cdea4ac6b9 Merge branch 'MDL-54953-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-07-04 15:18:59 +08:00
Andrew Nicols 6db40f889f Merge branch 'MDL-55049-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-07-04 14:22:19 +08:00
Andrew Nicols e0db9ee82f Merge branch 'MDL-55053-31' of git://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2016-07-04 14:14:52 +08:00
Davo Smith b3a751da05 MDL-55057 mod_scorm: fix handling of SCO identifiers with apostrophes 2016-07-04 13:14:27 +08:00
Andrew Nicols 388367917d Merge branch 'MDL-54877-31-clean-on-output' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-07-04 12:14:09 +08:00
Cameron Ball 3141d42c63 MDL-41945 mod_assign: Check if submission has been modified
This patch adds a check that stops a user submitting an assignment
if someone else has modified it in the meantime.
2016-07-04 12:11:08 +08:00
Andrew Nicols 0c725854e5 Merge branch 'MDL-55020-31-pluginzip' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-07-04 11:26:18 +08:00
Andrew Nicols 965b65b7fc Merge branch 'MDL-54968-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-07-04 10:32:50 +08:00
Andrew Nicols 759f83aa63 Merge branch 'MDL-53019_31' of git://github.com/stronk7/moodle into MOODLE_31_STABLE 2016-07-04 09:10:19 +08:00
AMOS bot d046221fba Automatically generated installer lang files 2016-07-02 00:05:12 +08:00
Mark Johnson ad1e11c2e4 MDL-55041 roles: Fix JSON parsing in permission manager 2016-07-01 15:02:02 +01:00
Loc Nguyen e1f14856da MDL-54934 workshop: indicate current phase
Indicate phase in page titles, current phase in userplan table
so that it's accessible to me through my screen reader
2016-07-01 18:51:31 +07:00
Eloy Lafuente (stronk7) 7d0add9d19 MDL-53019 environment: 3.2 requirements added
Changes:
 - PHP 5.6.5 required
2016-07-01 13:49:32 +02:00
Eloy Lafuente (stronk7) 7ef6433c2f MDL-54994 badges: Count correctly the number of external badges shown 2016-07-01 13:40:59 +02:00
Juan Leyva f80645cc48 MDL-54869 files: Fix file_save_draft_area_files documentation 2016-07-01 10:16:28 +01:00
Jun Pataleta 184a6e1647 MDL-54976 mod_scorm: Add validation for availability dates 2016-07-01 14:51:04 +08:00
Jake Dallimore 89ea16e44e MDL-54795 mod_assign: Fix Atto notify js error in grading interface 2016-07-01 13:52:38 +08:00
Marina Glancy 938a970d1f MDL-55032 tool_lp: check access when showing link to competencies
Also if course competencies page is accessed without capabilities do
redirect before starting output.
2016-07-01 13:45:46 +08:00
Andrew Nicols 6513308ba7 weekly release 3.1+ 2016-07-01 10:20:36 +08:00
Andrew Nicols 9c6b1e40e5 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-07-01 10:20:32 +08:00
David Mudrák 9ba44fa3fd MDL-55020 admin: Fix renaming of the plugin package root folder
There was a problem with core\update\code_manager::unzip_plugin_file()
if it was used to extract a plugin package into a non-empty target
directory and the plugin package root folder was being renamed at the
same time.

The problem was caused by the underlying helper method
rename_extracted_rootdir() that worked only for ZIPs extracted to an
empty temporary location. When the plugin was extracted to the actual
dirroot with other existing plugin folders present, the method failed
badly.

The solution in the patch is to always extract the ZIP into a temporary
empty location, perform the eventual root renaming there, and only then
move the extracted contents to the final destination. Additionally we
are changing the behaviour of the rename_extracted_rootdir() method so
that now it throws exception if the plugin package contains multiple
root folders (it should not happen in normal situations as such a plugin
would not pass the pre-install validation).

Unit tests did not catch this bug before because in the tests, the
target directory had been empty. Now we are adding a new directory
"aaa_another" to the target location to test in more realistic
environment. Tests for the new behaviour of the renaming method are
added, too.

p.s. I noticed that moodle_exception class was not imported into the
namespace and this is fixed now too (and covered with unit tests).
2016-07-01 01:11:36 +02:00
Eric Merrill c9e63147b9 MDL-55082 search: Update core areas to return results in time ASC order 2016-06-30 11:12:03 -04:00
Juan Leyva ddbd25d941 MDL-49244 course: Clean parameters in core_course_get_categories 2016-06-30 13:27:51 +01:00
Dan Poltawski 9c3b409079 MDL-32135 mod_choice: fix behat tests 2016-06-30 09:25:23 +01:00
Stephen Bourget 161cb17822 MDL-32135 mod_choice: update behat tests 2016-06-30 09:25:23 +01:00
Andrew Nicols c944c35cff Merge branch 'MDL-54610_31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-06-30 09:25:22 +01:00
Dan Poltawski 31ba691136 Merge branch 'MDL-55022-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-30 09:25:22 +01:00
Dan Poltawski 6f8f5068f2 Merge branch 'MDL-55027_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-06-30 09:25:21 +01:00
Dan Poltawski 2a1401d20f Merge branch 'MDL-54993-31' of https://github.com/sk-unikent/moodle into MOODLE_31_STABLE 2016-06-30 09:25:21 +01:00
Dan Poltawski a1b8fc6ab7 Merge branch 'MDL-32135_m31v2' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-06-30 09:25:20 +01:00
Jun Pataleta 3d152bc38e MDL-54877 mod_lti: Clean LTI tool type name and description on output
* Use clean_param() for name and description when displaying the tool type.
    Basically in the following functions:
    - serialise_tool_type()
    - lti_get_configured_types()
* Changed name and description's type from PARAM_TEXT to PARAM_RAW
    in tool update parameters.
* Changed name and description's type from PARAM_TEXT to PARAM_RAW
   in mod_lti_external::tool_type_return_structure()
2016-06-30 15:59:37 +08:00
AMOS bot 640c427b68 Automatically generated installer lang files 2016-06-30 00:04:50 +08:00
Eric Merrill 9a4c8f1c1a MDL-55053 search: Display search areas in alphabetical order 2016-06-28 17:19:35 -04:00
Eric Merrill 124baf197a MDL-54926 search: Reduce over-escaping in results 2016-06-28 16:34:02 -04:00
Juan Leyva 19a7ed9484 MDL-55049 webservice: Scan for viruses in webservice/upload.php 2016-06-28 16:15:09 +01:00
Dan Poltawski 27733ee4d0 Merge branch 'MDL-54868-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-06-28 09:19:50 +01:00
Dan Poltawski 5a1ead041a Merge branch 'MDL-55002-31-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_31_STABLE 2016-06-28 09:06:10 +01:00
Andrew Nicols 04bb5da9de Merge branch 'MDL-54991-31' of git://github.com/crazyserver/moodle into MOODLE_31_STABLE 2016-06-28 15:32:24 +08:00
Andrew Nicols 25a4f6c2d6 Merge branch 'MDL-54909-31' of git://github.com/crazyserver/moodle into MOODLE_31_STABLE 2016-06-28 15:21:42 +08:00
Cameron Ball 3078a3b7a1 MDL-54868 webservice_xmlrpc: Don't escape non-ascii characters 2016-06-28 14:49:29 +08:00
Andrew Nicols 82f52c19fa Merge branch 'MDL-54910_m31v2' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-06-28 12:57:23 +08:00
Andrew Nicols 143e3dc11c Merge branch 'MDL-54911_m31v3' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-06-28 12:40:10 +08:00
Andrew Nicols 7403d5ea59 MDL-54755 core: Correct behat language 2016-06-28 10:01:26 +08:00
Andrew Nicols a1a562fbbe Merge branch 'MDL-54755_moodle31' of https://github.com/StudiUM/moodle into MOODLE_31_STABLE 2016-06-28 09:55:08 +08:00
Andrew Nicols e31f0fdf7e Merge branch 'MDL-54935-31' of git://github.com/ryanwyllie/moodle into MOODLE_31_STABLE 2016-06-28 09:40:19 +08:00
Andrew Nicols b228a7cf40 Merge branch 'MDL-54964-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-06-28 08:47:42 +08:00
Andrew Nicols e9ae977cb8 Merge branch 'wip-mdl-54974-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-06-28 08:33:10 +08:00
David Mudrák 31a5f2a08c MDL-55002 lang: Fix behat scenarios using modified strings 2016-06-27 23:04:40 +02:00
Helen Foster f9bca6404e MDL-55002 lang: Merge English strings from the en_fix language pack 2016-06-27 23:02:41 +02:00
Eloy Lafuente (stronk7) 78c703bc12 Merge branch 'MDL-55028-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-27 22:13:55 +02:00
Eloy Lafuente (stronk7) f1198d7998 Merge branch 'MDL-54997-31' of git://github.com/damyon/moodle into MOODLE_31_STABLE 2016-06-27 20:22:20 +02:00
Eloy Lafuente (stronk7) 29cc92c86f Merge branch 'MDL-54707_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-06-27 20:00:56 +02:00
Eloy Lafuente (stronk7) 2ac06ec994 Merge branch 'MDL-54900-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-06-27 19:03:25 +02:00
AMOS bot 4c19da2a1e Automatically generated installer lang files 2016-06-28 00:05:48 +08:00
Eloy Lafuente (stronk7) ac081697da Merge branch 'MDL-52887-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-06-27 16:13:37 +02:00
Gilles-Philippe Leblanc 97b0761cdf MDL-54755 core: Incorrect redirection after password change 2016-06-27 08:21:31 -04:00
Eloy Lafuente (stronk7) 54b80ab68d Merge branch 'MDL-54663-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-06-27 13:26:42 +02:00
Juan Leyva 4ec683ac2f MDL-54964 tool_mobile: Fix tests to make it work with non-core plugins 2016-06-27 09:46:33 +01:00
Pau Ferrer Ocaña 41931b749d MDL-54991 assign: Invalid submissiongroup when not using groups 2016-06-27 09:28:14 +02:00
Marina Glancy 79796a1590 MDL-54968 user: change query for resetting dashboard
In case of inconsistent data the fatal error could have happen.
Also improve performance by joining several queries into one.
2016-06-27 15:09:12 +08:00
Rajesh Taneja 793d92aa86 MDL-54974 behat: Handle interupts on PHP7
As https://bugs.php.net/bug.php?id=71448 is
not going to get fixed, we need to declare tick
2016-06-27 14:32:22 +08:00
Andrew Nicols e0b8d7864f Merge branch 'MDL-53111_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-06-27 14:18:36 +08:00
Jun Pataleta a8bab41277 MDL-55028 webservice_soap: Use strlen for setting Content-Length header 2016-06-27 14:02:04 +08:00
Mark Nelson 20ede33d61 MDL-55027 enrol_lti: avoid invalid image URL causing an exception 2016-06-27 13:29:17 +08:00
Andrew Nicols cd7cc95637 Merge branch 'MDL-54924-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-27 13:15:37 +08:00
Marina Glancy 1348e21d66 MDL-54900 mod_choice: correctly count number of answered users 2016-06-27 12:48:30 +08:00
Jun Pataleta 99e7d66fba MDL-55022 mod_lti: Fix undefined variable 2016-06-27 11:41:50 +08:00
Andrew Nicols d53a433b6f Merge branch 'MDL-54785-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-06-27 09:20:55 +08:00
David Monllao 3a71830435 MDL-54707 search: Add user context to get_areas_user_accesses 2016-06-26 21:22:28 +02:00
Damyon Wiese 862792e1a1 MDL-54997 competencies: Fix random unit test fail
Sorting on timecreated is not unique enough to
guarantee a predictable ordering.
2016-06-25 08:05:26 -07:00
Damyon Wiese 80d2c7cfb0 MDL-54997 competencies: Listing evidence contexts
When listing the evidence for a user competency in a course,
the query is missing evidences for sub-contexts in the course.
2016-06-25 07:19:20 -07:00
Juan Leyva b36b4f05c7 MDL-55019 webservice: Course summary text should not be cleaned 2016-06-24 13:34:22 +01:00
Jake Dallimore 063bf930f9 MDL-54610 mod_lti: Fix cartridge support for admin tool add/edit forms 2016-06-24 14:28:12 +08:00
Stephen Bourget fdc9faed62 MDL-54911 mod_feedback: start date should be before the end date 2016-06-23 17:41:48 -04:00
Stephen Bourget 2d0bbd3b6e MDL-54910 mod_data: Open dates should be before close dates 2016-06-23 17:33:32 -04:00
Stephen Bourget dd171628ea MDL-32135 mod_choice: Open time should be before close time 2016-06-23 17:22:02 -04:00
Pau Ferrer Ocaña a11180570f MDL-54909 assign: Style editpdf background to differ from page bg 2016-06-23 15:07:09 +02:00
Andrew Nicols eb36cfcbb6 weekly release 3.1+ 2016-06-23 14:49:48 +08:00
Andrew Nicols 7f2fd69024 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-06-23 14:49:45 +08:00
Frederic Massart 97bf703346 MDL-54785 files: Deprecate the support for $usepost and related 2016-06-23 12:40:51 +08:00
Frederic Massart 89bacb163f Revert "MDL-44626 files: Show the PHP max upload size instead of 'unlimited'"
This reverts commit 6f0768618a.
2016-06-23 12:33:04 +08:00
Frederic Massart f31567294d Revert "Merge branch 'MDL-54110_master' of https://github.com/marxjohnson/moodle"
This reverts commit 016e0abfbc, reversing
changes made to 58a2f0ac40.
2016-06-23 12:33:04 +08:00
Frederic Massart 055bf3ca61 Revert "MDL-54110 repositories: Whitespace, Typo + unit test fixes"
This reverts commit 7e4d43e1a2.
2016-06-23 12:33:04 +08:00
Andrew Nicols e9019af21d Merge branch 'MDL-54948-31-fix2' of https://github.com/lameze/moodle into MOODLE_31_STABLE 2016-06-23 11:01:49 +08:00
Stephen Bourget df221cbf8d MDL-54935 Survey: Remove duplicate event trigger 2016-06-23 03:01:28 +00:00
Simey Lameze e4f4a7c353 MDL-54948 core_files: return false if theres no output from unoconv 2016-06-23 08:37:56 +08:00
AMOS bot 1036d079c1 Automatically generated installer lang files 2016-06-23 00:06:41 +08:00
Skylar Kelty f000a6635b MDL-54993 search: Provide areaid parts to template 2016-06-22 14:53:59 +01:00
Juan Leyva 479b269fe9 MDL-54867 webservice: Document webservice/upload.php deprecation
The 'private' file area is not supported anymore, only 'draft' is
supported right now.
2016-06-22 09:27:05 +01:00
Cameron Ball 6ba23735ab MDL-35104 auth: Always allow editing username for new users 2016-06-22 14:59:55 +08:00
Andrew Nicols 988b11c4da Merge branch 'MDL-54948-31-fix' of https://github.com/lameze/moodle into MOODLE_31_STABLE 2016-06-22 14:49:05 +08:00
Simey Lameze 1b43a5372c MDL-54948 core_upgrade: fix check_unoconv_version logic 2016-06-22 13:54:29 +08:00
Marina Glancy cbe10ace43 MDL-52887 mod_choice: backup allowmultiple option 2016-06-22 13:52:12 +08:00
Andrew Nicols de854b05c3 MDL-54663 forum: Correct digest link to forum preferences 2016-06-22 13:12:20 +08:00
Marina Glancy 465db5bd7c MDL-54953 mod_chat: remove Safari hack
This hack was introduced in MDL-16878 and is not needed in modern Safari versions
but it was reported that it can breaks chat in IE
2016-06-22 12:22:23 +08:00
Eloy Lafuente (stronk7) 2579f5f1fa Merge branch 'wip-mdl-54589-m31' of https://github.com/rajeshtaneja/moodle into MOODLE_31_STABLE 2016-06-22 01:42:05 +02:00
Eloy Lafuente (stronk7) 50804bc956 MDL-54778 form: Make it all js style (eslint) compliant
The changes in this commit should not be problematic, just:

- different whitespace.
- some docs.
- 1 variable to camelCase.

And then, less trivial, but safe enough IMO:

- a change to camelCase some identifiers and their calculation.
2016-06-22 01:30:06 +02:00
Eloy Lafuente (stronk7) 6b90efd076 Merge branch 'MDL-54778-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-06-22 01:30:01 +02:00
AMOS bot 64995b83fc Automatically generated installer lang files 2016-06-22 00:06:21 +08:00
Rajesh Taneja 041e40cf1b MDL-54940 behat: No need to press save
Previous step press save button, so no need to press again
2016-06-21 19:01:22 +08:00
Eloy Lafuente (stronk7) e2dee6f3cd Merge branch 'MDL-54948-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-06-21 11:47:11 +02:00
Tobias Reischmann e23d29dc91 MDL-54892 core: Pass proper parameter for plugin uninstall queries 2016-06-21 09:14:48 +02:00
Andrew Nicols afee01ac2f Merge branch 'MDL-54920-m31' of https://github.com/sammarshallou/moodle into MOODLE_31_STABLE 2016-06-21 14:19:09 +08:00
Andrew Nicols f4d1b3ec40 Merge branch 'MDL-54894-31' of git://github.com/crazyserver/moodle into MOODLE_31_STABLE 2016-06-21 12:10:20 +08:00
Andrew Nicols d5088c4ef5 Merge branch 'MDL-54940-31' of https://github.com/LukeCarrier/moodle into MOODLE_31_STABLE 2016-06-21 11:54:00 +08:00
Andrew Nicols cbcbf005fb Merge branch 'MDL-54881_31' of https://github.com/mr-russ/moodle into MOODLE_31_STABLE 2016-06-21 11:32:19 +08:00
Andrew Nicols 4e1af2ead5 Merge branch 'MDL-35104-31-2' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-06-21 11:22:52 +08:00
Cameron Ball 34d728d3e9 MDL-35104 auth: Don't allow modification of username
Presently it is either unreliable, or not possible to change
the username of a user created with an authentication plugin.
In some cases it is even hard coded to fail. Ideally we would
sync the username, and the issue MDL-21928 exists to address
that. However, in the mean time we should not allow the
username of an external user to be modified.
2016-06-21 11:16:06 +08:00
Andrew Nicols cb2844dc40 Merge branch 'MDL-51505-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-06-21 10:30:46 +08:00
Simey Lameze ccddc71ecb MDL-54948 core_upgrade: fix unoconv check on the environment page 2016-06-21 09:40:08 +08:00
Simey Lameze 9759072f4f MDL-54948 core_files: make the check consistent on unoconv test page 2016-06-21 09:40:07 +08:00
Andrew Nicols 56fb03794c MDL-54778 form: Fix lots of issues with form dependencies
The original issue here was that each loop of the named values did not
check for prototypal properties. As a result, if there were input fields
with names such as 'sort', 'valueOf', 'constructor', etc. these would
return their prototypal functions instead of a falsy value, and be treated
as though they are array - hence the 'Cannot push to Function' type error.

Following on from this I discovered that the data stores were being created
as arrays, but used as objects. This can also cause issues with some form
input names -- e.g. if they are numeric.

These two issues were resolved together by correctly storing them in
objects, and checking that those objects had real properties
(hasOwnProperty). This itself has to use the prototypal function to cater
for the potential of a field name called 'hasOwnProperty'.

I also found that the instance value stores were being initialised in the
prototype (and therefore shared), which meant that there were numerous
issues if two forms were present on the same page, or one form replaced an
existing one (e.g. forms initialised in JS).

In addition, it also became apparant that several values were being used
outside of scope, or in the wrong scope. This caused further issues when
creating multiple forms on a page.
2016-06-21 08:08:03 +08:00
Russell Smith 9b1232cb59 MDL-54881 quiz: Ensure user attempts are deterministic for testing. 2016-06-21 08:32:42 +10:00
AMOS bot 1e0b57f90d Automatically generated installer lang files 2016-06-21 00:05:30 +08:00
AMOS bot b1ab556419 Automatically generated installer lang files 2016-06-21 00:05:30 +08:00
Rajesh Taneja 6bf8caa573 MDL-54589 behat: Update composer to point to new tag 2016-06-20 16:03:12 +08:00
Rajesh Taneja 9d2e2a80be MDL-54589 behat: Fixed failures for phantomjs standalone 2016-06-20 16:03:12 +08:00
Rajesh Taneja 315c9ba2d4 MDL-54589 behat: Don't allow floating headers for behat 2016-06-20 16:03:12 +08:00
Rajesh Taneja 86e079521b MDL-54589 behat: Added hack for some OS/browsers 2016-06-20 16:03:11 +08:00
Jun Pataleta b25610f206 MDL-54924 tool_lp: Make the url property optional 2016-06-20 15:05:34 +08:00
Pau Ferrer Ocaña 0e31c8f92b MDL-54894 comments: Get course from context if not informed 2016-06-20 09:02:15 +02:00
Rajesh Taneja 8e6783526e MDL-54589 group: ensure loader is available before remobing 2016-06-20 10:00:00 +08:00
Rajesh Taneja 5f738b0be5 MDL-54589 behat: Trigger change event after selecting option
After selecting option, some browsers need
explicit change event
2016-06-20 09:59:59 +08:00
Luke Carrier 0bca566c04 MDL-54940 behat: use the fixed step 2016-06-19 17:24:59 +01:00
Luke Carrier 2cfe2ecee6 MDL-54940 behat: rectify section edit regression in MDL-53381 2016-06-19 17:24:59 +01:00
AMOS bot 0ab99aa340 Automatically generated installer lang files 2016-06-20 00:04:58 +08:00
AMOS bot e12f32dcda Automatically generated installer lang files 2016-06-19 00:06:21 +08:00
Eloy Lafuente (stronk7) a7221c5f19 weekly release 3.1+ 2016-06-16 17:01:46 +02:00
Eloy Lafuente (stronk7) 940fe6f99c NOBUG: Fixed SVG browser compatibility 2016-06-16 17:01:42 +02:00
sam marshall 143f3624cf MDL-54920 Behat: Allow viewport size to be set consistently
Provides a new Behat step

And I set viewport size to "800x600"
2016-06-15 15:26:42 +01:00
Nicholas Hoobin bdcc0dd59f MDL-53788 multilangupgrade: fix aggressive course cache rebuilding 2016-06-15 09:12:20 +08:00
Nicholas Hoobin b77709ca67 MDL-53788 user: fix aggressive course cache rebuilding 2016-06-15 09:12:20 +08:00
Nicholas Hoobin 557ca0146d MDL-53788 mod_lti: fix aggressive course cache rebuilding 2016-06-15 09:12:19 +08:00
Andrew Nicols 261eb32955 Merge branch 'MDL-54559-int-31' of https://github.com/merrill-oakland/moodle into MOODLE_31_STABLE 2016-06-15 08:24:42 +08:00
Eric Merrill 28ac27c0c2 MDL-54559 theme: Recenter search box 2016-06-14 11:01:02 -04:00
Andrew Nicols 894ed0c657 Merge branch 'MDL-54712-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-14 16:06:09 +08:00
Andrew Nicols 07c8765f2b Merge branch 'MDL-54559-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-14 14:30:20 +08:00
Andrew Nicols c4c826305d Merge branch 'MDL-54797_31' of git://github.com/aolley/moodle into MOODLE_31_STABLE 2016-06-14 13:27:10 +08:00
Andrew Nicols cff883d5a1 Merge branch 'MDL-54787-31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-06-14 11:54:19 +08:00
jogarcia b5882aa15c MDL-54576 theme: Redirect to show confirmation
After selecting a new theme, save the new configs
then redirect to show the confirmation and the new
theme's read me.  This prevents any odd behavior
from the old theme bleeding into the display of
the confirmation.
2016-06-14 11:44:23 +08:00
Andrew Nicols e744a082e1 Merge branch 'MDL-54859_31' of git://github.com/dmonllao/moodle into MOODLE_31_STABLE 2016-06-14 11:01:31 +08:00
Eloy Lafuente (stronk7) 23bba6e190 Merge branch 'MDL-54890-31' of git://github.com/danpoltawski/moodle into MOODLE_31_STABLE 2016-06-13 20:07:24 +02:00
Joby Harding f9a6276f42 MDL-51505 tool_templatelibrary: Prevent jumping when selecting template 2016-06-13 17:07:57 +08:00
Dan Poltawski 5f9e0cd58b Merge branch 'MDL-51683-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-06-13 09:48:52 +01:00
Dan Poltawski 082a4b6b6c Merge branch 'MDL-54772-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-13 09:35:52 +01:00
David Monllao 50b19dc897 MDL-54562 mod_data: Add activities info to search 2016-06-13 09:18:11 +01:00
Dan Poltawski beb50de63d Merge branch 'MDL-54837-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-06-13 08:51:58 +01:00
Jun Pataleta 3863f17ffe MDL-54712 mod_lti: Remove markup from LTI admin notification messages 2016-06-13 10:08:59 +08:00
Jun Pataleta 233231def7 MDL-54772 mod_assign: Fixes for PDF editor
* Render the annotations and comments within the drawing canvas, not in
the drawing region.
* Remove edit-related event bindings for stamp annotations.
2016-06-13 09:59:33 +08:00
Stephen Bourget f20a35754f MDL-54656 Behat: Additional tests for advanced search 2016-06-12 21:07:06 -04:00
Stephen Bourget b43d3fbdcb MDL-54656 Behat: Add tests for search_forums block 2016-06-12 21:06:59 -04:00
Jake Dallimore 9685d369ad MDL-54787 mod_quiz: Fix notification error on regrade 2016-06-10 18:32:49 +08:00
Dan Poltawski d991bbefe9 MDL-54890 course: remove erranous duplicated switch label
Detected by eslint rule 'no-duplicate-case'
2016-06-10 10:08:23 +01:00
Dan Poltawski ba7a9b6b9c MDL-54890 assignfeedback_editpdf: Fix missing semicolon
Detected by eslint rule 'semi'
2016-06-10 10:08:23 +01:00
Jun Pataleta edc4a0af61 MDL-54842 core_renderer: Hide additional body HTML in embedded layout 2016-06-10 14:47:54 +08:00
Stephen Bourget a3bc32d4e9 MDL-53111 Lesson: Allow "end reached" criteria to be disabled 2016-06-09 12:21:33 -04:00
Dan Poltawski 0563e83290 weekly release 3.1+ 2016-06-09 11:25:27 +01:00
Dan Poltawski ec82991b97 Merge branch 'install_31_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_31_STABLE 2016-06-09 11:25:25 +01:00
Andrew Nicols bf98b7fe3b MDL-54853 weblib: Specify version and fixed encoding 2016-06-09 09:54:41 +08:00
Andrew Nicols 2331a70c89 Merge branch 'MDL-54853-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-06-09 09:54:37 +08:00
Cameron Ball 63ba15c7db MDL-54853 weblib: Properly specify encoding for blanktarget 2016-06-08 18:29:42 +08:00
David Monllao 2398d9160a MDL-54859 mod_wiki: Client rules only when fields are visible 2016-06-08 16:46:54 +08:00
Andrew Nicols a72a8de00c Merge branch 'MDL-53947-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-08 08:46:51 +08:00
Dan Poltawski 490b6ff9ea MDL-46721 assign: clarify ternerary statement 2016-06-07 12:15:50 +01:00
Dan Poltawski 7512e4d33c Merge branch 'MDL-46721-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-06-07 12:12:37 +01:00
Frederic Massart adaf294a75 MDL-48756 editor_atto: Bulk atto autosave queries 2016-06-07 11:49:49 +01:00
Dan Poltawski 906c52ee96 MDL-54729 mod_forum: clarify static variable usage
After some time discussing with integrators, we decided that this
slightly yukky solution probably fits safely, so just making its usage
better explained and speciifc.
2016-06-07 10:48:07 +01:00
Adrian Greeve 8dc6bb8591 MDL-54729 mod_forum: Deep link highlighting works in IE. 2016-06-07 10:47:51 +01:00
Dan Poltawski 5043e4c31c Merge branch 'MDL-54765-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-07 09:41:34 +01:00
David Monllao dbc6c12766 Merge branch 'MDL-54180_31_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_31_STABLE 2016-06-07 16:17:19 +08:00
Eric Merrill 8abe0e83ee MDL-54559 theme: Fix padding that pushes navbar down 2016-06-07 14:58:40 +08:00
Skylar Kelty 318ff4acd7 MDL-53947 memcached: Fix memcached session warning on PHP7 2016-06-07 10:27:18 +08:00
Marina Glancy e9ada19fbb MDL-54837 tags: allow to specify static function as callback 2016-06-07 09:06:44 +08:00
Marina Glancy af8fc4c11d MDL-54837 tags: fixed bug when collection is locked
also fixed fatal error for upgraded plugins that did not pass tag
component to the tag form element
2016-06-07 09:06:44 +08:00
AMOS bot a2ae2c665f Automatically generated installer lang files 2016-06-07 06:28:19 +08:00
Eloy Lafuente (stronk7) e7bb6f945c Merge branch 'MDL-54739-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE 2016-06-07 00:16:39 +02:00
Eloy Lafuente (stronk7) aa6fa3a56e Merge branch 'MDL-54769-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-06-06 23:56:51 +02:00
Eloy Lafuente (stronk7) 94f5d8a803 Merge branch 'MDL-54805-31-test' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-06-06 18:08:41 +02:00
Dan Poltawski 162dbe8d8c Merge branch 'wip-MDL-50824-MOODLE_31_STABLE' of https://github.com/cdsmith-umn/moodle into MOODLE_31_STABLE 2016-06-06 15:07:02 +01:00
Dan Poltawski 5761f5831b Merge branch 'MDL-54820-31' of git://github.com/jleyva/moodle into MOODLE_31_STABLE 2016-06-06 14:12:24 +01:00
Dan Poltawski d4e14393b4 Merge branch 'MDL-54702_31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-06-06 13:41:47 +01:00
Dan Poltawski 76c2a5dfbd Merge branch 'MDL-53392_31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-06-06 13:21:10 +01:00
Dan Poltawski 5bb6def595 Merge branch 'MDL-54557-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-06-06 13:17:11 +01:00
Dan Poltawski 1b6d059624 Merge branch 'wip-MDL-49852-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-06-06 11:59:44 +01:00
Eloy Lafuente (stronk7) f0043725b5 Merge branch 'MDL-41922-31-c' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-06-06 11:51:40 +02:00
Juan Leyva c8f3dfd3af MDL-54820 webservice: Fix regression in core_course_search_courses
Regression caused by MDL-51324
2016-06-03 13:04:00 +02:00
Mike Churchward bbe5d6c827 MDL-54805 portfolio_download: Adding a 'require' of necessary library file 2016-06-03 16:53:10 +08:00
Jun Pataleta 34d3e68c0d MDL-54765 mod_assign: Use selectedIndex for setting page selection
Set the 'selectedIndex' attribute of the page selection element instead of
the 'value' attribute since YUI is having trouble with this in IE.
2016-06-03 14:55:27 +08:00
Frederic Massart fa46696e27 MDL-41922 mod_quiz: Don't report quiz due when an attempt was finished 2016-06-03 14:53:08 +08:00
Andrew Nicols 30062d5a8e weekly release 3.1+ 2016-06-03 12:01:53 +08:00
Simey Lameze cbf3b1db5e MDL-54739 blocks: fix activity chooser link alignment 2016-06-03 10:44:18 +08:00
Clement Smith 599293befd MDL-50824 message/externallib.php: Fix get_string call
This fixes the get_string call by adding the intended recipient's
fullname as the third argument when a user tries to message the
recipient, the recipient is blocking non-contacts from messaging
them, and the user is not in the recipient's contact list.
2016-06-02 07:22:04 -05:00
Adam Olley 7141480e85 MDL-54797 course: Add indexed field to condition of delete query
Deleting records from the course_completion_criteria table goes much
faster when we include the indexed course field in the delete query.
2016-06-02 15:52:07 +09:30
Marina Glancy 32e79050f8 MDL-54557 course: treat section summary as contents 2016-06-02 12:57:10 +08:00
Andrew Nicols b0f7923ff0 MDL-54722 javascript: Add YUI depend wrapper to global event 2016-06-02 10:09:31 +08:00
Frederic Massart b30e4fd68d MDL-48248 enrol_manual: Handle durations more precise than int days 2016-06-01 15:57:45 +08:00
Andrew Nicols eb17d699ab Merge branch 'MDL-54722-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-06-01 12:24:32 +08:00
Cameron Ball 4f66e19b09 MDL-54722 navigation: Properly overflow expanded nav trees 2016-06-01 10:16:46 +08:00
Jake Dallimore 1b27eacc4a MDL-54702 mod_lti: Support standard cartridge icons in LTI import 2016-06-01 09:48:13 +08:00
Marina Glancy 88ed1fab62 MDL-54769 backup: add missing error language string 2016-06-01 09:45:42 +08:00
Andrew Nicols 328bc43039 Merge branch 'MDL-53598-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-06-01 08:25:26 +08:00
Mark Johnson 6862093122 MDL-54180 Behat: Handle exceptions from driver when saving screenshot 2016-05-31 12:34:58 +01:00
Marina Glancy 9fb7f10fc5 MDL-53598 block_glossary_random: do not fail if glossary was deleted
This commit refactors how associated glossary is searched for and removes
unnecessary DB queries. Also prevents from situations when the global glossary or course have
been deleted
2016-05-31 15:31:40 +08:00
David Monllao 50e4de2385 Merge branch 'MDL-54065-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-05-31 15:27:53 +08:00
Andrew Nicols 347cab92be Merge branch 'MDL-54655_m31v1' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-05-31 13:50:17 +08:00
David Monllao 86d0cd25c4 Merge branch 'MDL-54667-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-05-31 13:09:46 +08:00
David Monllao b1d6b851c0 Merge branch 'MDL-54763_m31' of git://github.com/markn86/moodle into MOODLE_31_STABLE 2016-05-31 12:31:47 +08:00
David Monllao 9ec8754e68 Merge branch 'MDL-53851-31' of https://github.com/blckct/moodle into MOODLE_31_STABLE 2016-05-31 11:46:25 +08:00
David Monllao 117b5cb9a3 Merge branch 'MDL-53938_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-05-31 11:42:53 +08:00
David Monllao 035cc9e043 Merge branch 'MDL-54605_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-05-31 11:32:49 +08:00
Stephen Bourget b42e0d4465 MDL-54579 Behat: tests for the private_files block 2016-05-31 11:18:59 +08:00
Barbara Ramiro 6294da8660 MDL-51683 design: New icon for competencies 2016-05-31 10:47:13 +08:00
Jakub Kania 88e39d3fdd MDL-54667 core_lib: Fix the param name in edit profile link 2016-05-30 16:35:42 +08:00
Cameron Ball 8a101cc06d MDL-37138 weblib: Document blanktarget in upgrade.txt 2016-05-30 16:12:51 +08:00
David Monllao eb61d44fec Merge branch 'MDL_54002_m31v3' of https://github.com/sbourget/moodle into MOODLE_31_STABLE 2016-05-30 16:09:14 +08:00
David Monllao 44ed5d73f2 Merge branch 'MDL-54010-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-05-30 16:04:37 +08:00
David Monllao 5f14cedd3a Merge branch 'MDL-54577-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-05-30 15:45:58 +08:00
David Monllao c32dd85426 Merge branch 'MDL-29905-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-05-30 15:40:56 +08:00
David Monllao 502a3013ce Merge branch 'MDL-54116-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-05-30 15:36:14 +08:00
David Monllao fdf8bf0793 Merge branch 'MDL-49943-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-05-30 15:29:33 +08:00
Andrew Nicols 78792b028f Merge branch 'MDL-54756_31' of git://github.com/timhunt/moodle into MOODLE_31_STABLE 2016-05-30 15:19:35 +08:00
David Monllao c183e31da0 Merge branch 'MDL-37138-31-2' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-05-30 15:02:30 +08:00
Andrew Nicols 6381f3bfe0 Merge branch 'MDL-54567-31-build' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-05-30 14:41:48 +08:00
Marina Glancy 73cf33aad4 MDL-49943 mod_choice: display multiple answers in complete report 2016-05-30 14:18:06 +08:00
Jun Pataleta 49634dadc9 MDL-53425 blocklib: Raise execution time for dashboard reset process 2016-05-30 14:12:38 +08:00
Andrew Nicols f14ddb2a8c Merge branch 'MDL-35987-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-05-30 13:40:56 +08:00
David Monllao 245aed199b Merge branch 'MDL-53425-31-delete-by-chunks' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-05-30 13:35:37 +08:00
Andrew Nicols 87e2b6154c MDL-54567 backup: Fixtures for legacy grade value rewrite 2016-05-30 13:34:04 +08:00
Frederic Massart c2235a04bf MDL-54567 backup: Process the calculations_freeze item upon restore 2016-05-30 13:34:04 +08:00
Mark Nelson 3574cae7ff MDL-54763 tool_lp: fixed typo in HTML tag 2016-05-30 13:32:04 +08:00
Cameron Ball 11c59cb6b4 MDL-37138 chat: Use blanktarget option for chat text 2016-05-30 13:18:17 +08:00
Cameron Ball 89b2e4fb30 MDL-37138 message: Use blanktarget option for message text 2016-05-30 13:18:17 +08:00
Cameron Ball 5a2228cf82 MDL-37138 weblib: Add blanktarget option to format_text 2016-05-30 13:18:17 +08:00
David Monllao 6898e4da78 Merge branch 'MDL-48248-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-05-30 13:02:56 +08:00
Frederic Massart 83350ad075 MDL-29905 question: Auto remove stale questions upon category deletion 2016-05-30 12:26:41 +08:00
Eric Merrill cfb0491dad MDL-29905 question: Try to delete unused hidden/random questions
Before going to display the warning about moving in use questions,
try to delete unused Random qtype questions, as well as 'hidden'
questions (these are questions that were deleted from the category),
but were in use at the time.
2016-05-30 12:26:40 +08:00
Jun Pataleta 54720d454f MDL-53425 blocklib: Perform deletion of block instances by chunk 2016-05-30 11:24:36 +08:00
David Monllao 4c5ab56a33 Merge branch 'MDL-54721-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-05-30 11:15:45 +08:00
David Monllao fd52a9fbe2 Merge branch 'MDL-43887-31' of git://github.com/cameron1729/moodle into MOODLE_31_STABLE 2016-05-30 11:09:05 +08:00
David Monllao 849b9e71b0 Merge branch 'MDL-51806_31' of https://github.com/snake/moodle into MOODLE_31_STABLE 2016-05-30 10:51:53 +08:00
Jake Dallimore 1b383c0177 MDL-51806 mod_workshop: Add locale support for grade values. 2016-05-30 10:49:39 +08:00
David Monllao 3077735595 Merge branch 'wip-MDL-45427-31' of git://github.com/abgreeve/moodle into MOODLE_31_STABLE 2016-05-30 10:19:41 +08:00
Marina Glancy 8b374f593c MDL-54065 gradebook: correctly display module icon 2016-05-30 10:08:33 +08:00
Stephen Bourget 0995a547d9 MDL-54655 Behat: Tests for the online_users block 2016-05-27 18:24:18 -04:00
Tim Hunt 330216eb8a MDL-54756 moodle_url: remove dangerous trim from make_file_url
This was a regression caused by MDL-50268. It broke qtype_stack.
2016-05-27 21:30:34 +01:00
Tim Hunt fb91edbe50 MDL-54605 quiz regrading: incorrect DB query
There were two issues. With groups, the $params array was wrong
due to PHP + vs array_merge sillyness.

Also, the first column in the SQL was not necessarily unique,
so we need to use a recordset rather than get_records.
2016-05-27 21:28:59 +01:00
Tim Hunt 6760e6db34 MDL-53938 qformat_gift: handle multi-choice MR with one 100% choice 2016-05-27 21:28:46 +01:00
Adrian Greeve 66da5c76b3 MDL-49852 mod_assign: Unit tests for activity completion. 2016-05-27 14:16:04 +08:00
Steve Bader 782aa36c34 MDL-49852 mod_assign: Fix group assignment completion tracking
Fixes completion tracking for group assignments where either only
one student is required to click Submit when submitting the
assignment for grading, all students are required to submit,
or no students are required to click submit (meaning that simply
uploading submits for grading).
2016-05-27 13:06:58 +08:00
Cameron Ball 1ad3ddcd24 MDL-43887 formslib: Allow not set date field
Previously if the date field was not enabled it would
be treated as having value 0. A bug would allow this 0
to pass through and save the date as 1 January 1970
2016-05-27 01:53:24 +08:00
Frederic Massart d30f466a17 MDL-54721 report_competency: Do not ignore the first user selection 2016-05-26 17:55:29 +08:00
Jake Dallimore f7a5f1c835 MDL-53392 mod_assign: Remove old Grade Max warning string references 2016-05-26 17:13:51 +08:00
Cameron Ball 93f06a35dd MDL-54010 roles: Specify encoding for escaped export data 2016-05-26 10:32:01 +08:00
Nigel Cunningham 9efa43c6a9 MDL-54010 roles: Fix missing HTMLspecialchars in role export code.
Role name and description fields are currently not escaped when
exporting a role. This results in an unusable file when characters
such as ampersands are used in a name or description. Fix this by
using htmlspecialchars on both fields.

Signed-off-by: Nigel Cunningham <nigelc@catalyst-au.net>
2016-05-26 10:32:00 +08:00
Stephen Bourget 80d33cde74 MDL-54577 Behat: Add tests for messages block 2016-05-26 10:22:05 +08:00
Marina Glancy 89fba73a45 MDL-54116 block_comments: warnings when commenting outside of a course 2016-05-26 10:20:13 +08:00
Stephen Bourget 95b82c9dcf MDL-54116 block_comments: behat test 2016-05-26 10:20:12 +08:00
Eloy Lafuente (stronk7) b1b097e2b6 weekly release 3.1+ 2016-05-26 02:14:18 +02:00
Adrian Greeve d7f63b7499 MDL-45427 mod_data: Inserting tags into templates.
Allows tags to be inserted into the editor without
having to touch Atto at all.
2016-05-25 15:28:40 +08:00
Frederic Massart 9cfc039669 MDL-35987 qtype_multianswer: Prevent restore failure due to bad sequence 2016-05-25 12:24:23 +08:00
Andrew Nicols f60b424d82 MDL-54059 testing: Add grunt test 2016-05-25 10:53:19 +08:00
Andrew Nicols f5cd3cb44d MDL-54059 testing: Simplify travis output 2016-05-25 10:53:19 +08:00
Frederic Massart 14b4959d75 MDL-48248 enrol_manual: Ensure that the default value is always selected 2016-05-25 10:17:31 +08:00
Eloy Lafuente (stronk7) 5d2f086eea Merge branch 'MDL-54714-31' of git://github.com/andrewnicols/moodle into MOODLE_31_STABLE 2016-05-24 22:23:41 +02:00
Stephen Bourget 5cd7c8e84f MDL-54002 Behat: tests for recent blogs block 2016-05-24 12:49:06 -04:00
Cameron Ball 2e458712c8 MDL-46721 assign: Make blind marking participant numbers match
Previously emails were setting the "From" header to the incorrect
participant number.
2016-05-24 18:25:25 +08:00
Andrew Nicols 87ae1417bf Merge branch 'MDL-54715-31' of git://github.com/marinaglancy/moodle into MOODLE_31_STABLE 2016-05-24 14:53:56 +08:00
Marina Glancy 01fbf70982 MDL-54715 core_question: fixed bug when importing questions with tags
Thanks to WangYang for original patch
2016-05-24 14:38:38 +08:00
David Monllao fad41516de Merge branch 'MDL-54675-forum-highlight-MOODLE_31_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_31_STABLE 2016-05-24 14:20:26 +08:00
Brendan Heywood 1987b771ad MDL-54675 forum: Fixed bug with multiple adjacent hash anchors 2016-05-24 16:07:46 +10:00
Andrew Nicols 0761279e9e MDL-54714 testing: Correct fetch branch for .travis.yml 2016-05-24 13:34:23 +08:00
Tim Hunt f073424c08 MDL-54582 accesslib: improve performance of load_course_context
The new query is logically equivalen, but much, much faster, at
least on Postgred. (15ms, instead of 700ms, in one example I tried
on the database for the OU's main Moodle site.)
2016-05-24 11:18:01 +08:00
Andrew Nicols 7b6cb91d6c MDL-53687 core_media: Comment fix 2016-05-24 09:06:40 +08:00
Andrew Nicols 98e4407615 Merge branch 'MDL-53687-31' of git://github.com/FMCorz/moodle into MOODLE_31_STABLE 2016-05-24 09:06:35 +08:00
Jakub Kania 4f92858527 MDL-53851 news block: Display news from all the accessible groups 2016-05-23 17:23:43 +02:00
Frederic Massart 025e98434d MDL-53687 core_media: Edge does not yet support WebM and OGG 2016-05-23 16:25:47 +08:00
Ryan Wyllie 48e08145e2 MDL-54642 tool_lp: Fix learning plan button layout in FF
The learning plan buttons are floating left but the table below it wasn't
clearning floating elements so it was appearing on the same line.
2016-05-23 14:53:18 +08:00
Frederic Massart 0f365eb0b2 MDL-46934 webservice_rest: Fixed undefined index on XML output 2016-05-23 14:39:00 +08:00
David Monllao d0adf43eec Merge branch 'MDL-54661-31' of git://github.com/junpataleta/moodle into MOODLE_31_STABLE 2016-05-23 14:24:18 +08:00
Jun Pataleta 4ac0e2d5e1 MDL-54661 mod_assign: Unescape course name in grading nav template 2016-05-23 12:12:42 +08:00
Jun Pataleta dabfdc2c6c MDL-54664 blocks_lp: Set the layout of to review pages to standard 2016-05-23 09:51:29 +08:00
Eloy Lafuente (stronk7) 1f010acdd0 MDL-54677 upgrade: add 3.1.0 separation line to all upgrade scripts 2016-05-23 01:32:56 +02:00
24031 changed files with 800833 additions and 2440007 deletions
+3
View File
@@ -0,0 +1,3 @@
--errors=errors,duplicate-properties
--warnings=known-properties,display-property-grouping,empty-rules,important
--exclude-list=vendor/,lib/editor/tinymce/,lib/yuilib/,theme/bootstrapbase/style/
+17
View File
@@ -0,0 +1,17 @@
*/**/yui/src/*/meta/
*/**/build/
node_modules/
vendor/
lib/editor/atto/yui/src/rangy/js/
lib/editor/tinymce/plugins/pdw/tinymce/
lib/editor/tinymce/tiny_mce/
lib/requirejs/
lib/yuilib/
lib/jquery/
lib/htmlpurifier/
lib/flowplayer/
lib/xhprof/
lib/amd/src/loglevel.js
lib/amd/src/mustache.js
theme/bootstrapbase/javascript/html5shiv.js
theme/bootstrapbase/amd/src/bootstrap.js
+5 -145
View File
@@ -1,15 +1,6 @@
{
'plugins': [
'babel',
'promise',
'jsdoc',
],
'env': {
'browser': true,
// Enable ES6+ features by default.
// See http://eslint.org/docs/user-guide/configuring#specifying-environments
// Note: The YUI override must exactly match this when disabling the ES6+ version because those features are not supported by Shifter.
'es2020': true,
'amd': true
},
'globals': {
@@ -22,7 +13,6 @@
// === Possible Errors ===
'comma-dangle': 'off',
'no-compare-neg-zero': 'error',
'no-cond-assign': 'error',
'no-console': 'error',
'no-constant-condition': 'error',
@@ -41,6 +31,7 @@
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-prototype-builtins': 'off',
'no-regex-spaces': 'error',
@@ -48,7 +39,6 @@
'no-unexpected-multiline': 'error',
'no-unreachable': 'warn',
'no-unsafe-finally': 'error',
'no-unsafe-negation': 'error',
'use-isnan': 'error',
'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
'valid-typeof': 'error',
@@ -73,7 +63,7 @@
'no-extra-bind': 'warn',
'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
'no-global-assign': 'warn',
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
@@ -81,13 +71,13 @@
'no-loop-func': 'error',
'no-multi-spaces': 'warn',
'no-multi-str': 'error',
'no-native-reassign': 'warn',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-restricted-globals': ['error', { 'name': 'Notification' }],
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
@@ -113,13 +103,11 @@
'block-spacing': 'warn',
'brace-style': ['warn', '1tbs'],
'camelcase': 'warn',
'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
'comma-spacing': ['warn', { 'before': false, 'after': true }],
'comma-style': ['warn', 'last'],
'computed-property-spacing': 'error',
'consistent-this': 'off',
'eol-last': 'off',
'func-call-spacing': ['warn', 'never'],
'func-names': 'off',
'func-style': 'off',
// indent currently not doing well with our wrapping style, so disabled.
@@ -152,7 +140,7 @@
'no-nested-ternary': 'warn',
'no-new-object': 'off',
'no-plusplus': 'off',
'no-tabs': 'error',
'no-spaced-func': 'warn',
'no-ternary': 'off',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
@@ -180,133 +168,5 @@
'spaced-comment': 'warn',
'unicode-bom': 'error',
'wrap-regex': 'off',
// === Promises ===
'promise/always-return': 'warn',
'promise/no-return-wrap': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail']}],
'promise/no-native': 'warn',
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
// === Deprecations ===
"no-restricted-properties": ['warn', {
'object': 'M',
'property': 'str',
'message': 'Use AMD module "core/str" or M.util.get_string()'
}],
},
overrides: [
{
files: ["**/yui/src/**/*.js"],
'env': {
// Disable ES6+ for YUI files.
'es2020': false,
},
// Disable some rules which we can't safely define for YUI rollups.
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off',
// === JSDocs ===
"jsdoc/check-access": 'off',
"jsdoc/check-alignment": 'off',
"jsdoc/check-param-names": 'off',
"jsdoc/check-property-names": 'off',
"jsdoc/empty-tags": 'off',
"jsdoc/implements-on-classes": 'off',
"jsdoc/multiline-blocks": 'off',
"jsdoc/require-jsdoc": 'off',
"jsdoc/require-param": 'off',
"jsdoc/require-param-name": 'off',
"jsdoc/require-param-type": 'off',
"jsdoc/require-property": 'off',
"jsdoc/require-property-name": 'off',
"jsdoc/require-property-type": 'off',
}
},
{
files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile.js", ".grunt/*.js", ".grunt/tasks/*.js", "jsdoc.conf.js"],
// We're using babel transpiling so use their parser
// for linting.
parser: '@babel/eslint-parser',
// 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',
// === JSDocs ===
"jsdoc/check-access": [
'error',
],
"jsdoc/check-alignment": 1, // Recommended.
"jsdoc/check-param-names": [
'error',
],
"jsdoc/check-property-names": [
'error',
],
"jsdoc/empty-tags": [
'error',
],
"jsdoc/implements-on-classes": [
'error',
],
"jsdoc/multiline-blocks": [
'error',
],
"jsdoc/require-jsdoc": [
'error',
],
"jsdoc/require-param": [
'error',
],
"jsdoc/require-param-name": [
'error',
],
"jsdoc/require-param-type": [
'error',
],
"jsdoc/require-property": [
'error',
],
"jsdoc/require-property-name": [
'error',
],
"jsdoc/require-property-type": [
'error',
],
},
parserOptions: {
'sourceType': 'module',
'requireConfigFile': false,
}
}
]
}
}
-24
View File
@@ -1,24 +0,0 @@
{
"indentation": ["on",{
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"example": 6,
"Step": 4,
"given": 4,
"and": 4
}],
"no-dupe-feature-names": "on",
"no-dupe-scenario-names": "off",
"no-empty-file": "on",
"no-files-without-scenarios": "on",
"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"]
}
+2 -1
View File
@@ -1,3 +1,4 @@
**/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');
-124
View File
@@ -1,124 +0,0 @@
name: Core
on:
push:
branches-ignore:
- master
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.2
jobs:
Grunt:
runs-on: ubuntu-22.04
steps:
- name: Checking out code
uses: actions/checkout@v3
- name: Configuring node & npm
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- 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:
# MySQL builds always run with the lowest PHP supported version.
- os: ubuntu-22.04
php: 8.0
extensions:
db: mysqli
# PostgreSQL builds always run with the highest PHP supported version.
- os: ubuntu-22.04
php: 8.2
db: pgsql
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: moodlehq/mysql-action@v1
with:
collation server: utf8mb4_bin
mysql version: 8.0
mysql database: test
mysql user: test
mysql password: test
use tmpfs: true
tmpfs size: '1024M'
extra conf: --skip-log-bin
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 13
postgresql db: test
postgresql user: test
postgresql password: test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v3
- 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 }}
phpunit_options: ${{ secrets.phpunit_options }}
run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
-149
View File
@@ -1,149 +0,0 @@
name: Windows Testing
on:
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.2
jobs:
Grunt:
runs-on: windows-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checking out code
uses: actions/checkout@v3
- name: Configuring node & npm
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Installing node stuff
run: npm ci
- 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 }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
php: 8.2
# Ideally we should use mysql/mariadb, but they are 4x slower without tweaks and configuration
# so let's run only postgres (1.5h vs 6h) only, If some day we want to improve the mysql runs,
# this is the place to enable them.
# db: mysqli
db: pgsql
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
- os: windows-latest
php: 8.0
db: pgsql
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: 8.0
user: test
password: test
- name: Creating DB mysql
if: ${{ matrix.db == 'mysqli' }}
run: mysql --host 127.0.0.1 -utest -ptest -e 'CREATE DATABASE IF NOT EXISTS test COLLATE = utf8mb4_bin;';
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
run: |
# TODO: Remove these conf. modifications when php74 or php80 are lowest.
# Change to old md5 auth, because php73 does not support it.
# #password_encryption = scram-sha-256
(Get-Content "$env:PGDATA\postgresql.conf"). `
replace('#password_encryption = scram-sha-256', 'password_encryption = md5') | `
Set-Content "$env:PGDATA\postgresql.conf"
(Get-Content "$env:PGDATA\pg_hba.conf"). `
replace('scram-sha-256', 'md5') | `
Set-Content "$env:PGDATA\pg_hba.conf"
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
& $env:PGBIN\psql --command="CREATE USER test PASSWORD 'test'" --command="\du"
- name: Creating DB pgsql
if: ${{ matrix.db == 'pgsql' }}
run: |
& $env:PGBIN\createdb --owner=test test
$env:PGPASSWORD = 'test'
& $env:PGBIN\psql --username=test --host=localhost --list test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v3
# Needs to be done after php is available, git configured and Moodle checkout has happened.
- name: Setting up moodle-exttests service
run: |
git clone https://github.com/moodlehq/moodle-exttests.git
nssm install php-built-in C:\tools\php\php.exe -S localhost:8080 -t D:\a\moodle\moodle\moodle-exttests
nssm start php-built-in
- name: Setting up redis service
run: |
choco install redis-64 --version 3.0.503 --no-progress
nssm install redis redis-server
nssm start redis
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
shell: bash
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
php admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
phpunit_options: ${{ secrets.phpunit_options }}
run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
+3 -22
View File
@@ -9,23 +9,15 @@
#
# See gitignore(5) man page for more details
#
# Swap files (vim)
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Temporary files including undo
*~
#
/config.php
/lib/editor/tinymce/extra/tools/temp/
*~
*.swp
/tags
/TAGS
/cscope.*
/.patches/
/.idea/
.phpstorm.*
/nbproject/
CVS
.DS_Store
@@ -33,7 +25,6 @@ CVS
/.project
/.buildpath
/.cache
.phpunit.result.cache
phpunit.xml
# Composer support. Do not ignore composer.json, or composer.lock. These should be shipped by us.
composer.phar
@@ -45,13 +36,3 @@ composer.phar
/lib/yuilib/*/*/*-coverage.js
atlassian-ide-plugin.xml
/node_modules/
/.vscode/
moodle-plugin-ci.phar
.eslintignore
.stylelintignore
/jsdoc
/admin/tool/componentlibrary/docs
/admin/tool/componentlibrary/hugo/site/data/my-index.json
.hugo_build.lock
phpcs.xml
jsconfig.json
-169
View File
@@ -1,169 +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/>.
/**
* This is a babel plugin to add the Moodle module names to the AMD modules
* as part of the transpiling process.
*
* In addition it will also add a return statement for the default export if the
* module is using default exports. This is a highly specific Moodle thing because
* we're transpiling to AMD and none of the existing Babel 7 plugins work correctly.
*
* This will fix the issue where an ES6 module using "export default Foo" will be
* transpiled into an AMD module that returns {default: Foo}; Instead it will now
* just simply return Foo.
*
* Note: This means all other named exports in that module are ignored and won't be
* exported.
*
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
module.exports = ({template, types}) => {
const fs = require('fs');
const path = require('path');
const cwd = process.cwd();
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
/**
* Search the list of components that match the given file name
* and return the Moodle component for that file, if found.
*
* Throw an exception if no matching component is found.
*
* @throws {Error}
* @param {string} searchFileName The file name to look for.
* @return {string} Moodle component
*/
function getModuleNameFromFileName(searchFileName) {
searchFileName = fs.realpathSync(searchFileName);
const relativeFileName = searchFileName.replace(`${cwd}${path.sep}`, '').replace(/\\/g, '/');
const [componentPath, file] = relativeFileName.split('/amd/src/');
const fileName = file.replace('.js', '');
// Check subsystems first which require an exact match.
const componentName = ComponentList.getComponentFromPath(componentPath);
if (componentName) {
return `${componentName}/${fileName}`;
}
// This matches the previous PHP behaviour that would throw an exception
// if it couldn't parse an AMD file.
throw new Error(`Unable to find module name for ${searchFileName} (${componentPath}::${file}}`);
}
/**
* This is heavily inspired by the babel-plugin-add-module-exports plugin.
* See: https://github.com/59naga/babel-plugin-add-module-exports
*
* This is used when we detect a module using "export default Foo;" to make
* sure the transpiled code just returns Foo directly rather than an object
* with the default property (i.e. {default: Foo}).
*
* Note: This means that we can't support modules that combine named exports
* with a default export.
*
* @param {String} path
* @param {String} exportObjectName
*/
function addModuleExportsDefaults(path, exportObjectName) {
const rootPath = path.findParent(path => {
return path.key === 'body' || !path.parentPath;
});
// HACK: `path.node.body.push` instead of path.pushContainer(due doesn't work in Plugin.post).
// This is hardcoded to work specifically with AMD.
rootPath.node.body.push(template(`return ${exportObjectName}.default`)());
}
return {
pre() {
this.seenDefine = false;
this.addedReturnForDefaultExport = false;
},
visitor: {
// Plugin ordering is only respected if we visit the "Program" node.
// See: https://babeljs.io/docs/en/plugins.html#plugin-preset-ordering
//
// We require this to run after the other AMD module transformation so
// let's visit the "Program" node.
Program: {
exit(path) {
path.traverse({
CallExpression(path) {
// If we find a "define" function call.
if (!this.seenDefine && path.get('callee').isIdentifier({name: 'define'})) {
// We only want to modify the first instance of define that we find.
this.seenDefine = true;
// Get the Moodle component for the file being processed.
var moduleName = getModuleNameFromFileName(this.file.opts.filename);
// The function signature of `define()` is:
// define = function (name, deps, callback) {...}
// Ensure that if the moduel supplied its own name that it is replaced.
if (path.node.arguments.length > 0) {
// Ensure that there is only one name.
if (path.node.arguments[0].type === 'StringLiteral') {
// eslint-disable-next-line
console.log(`Replacing module name '${path.node.arguments[0].extra.rawValue}' with ${moduleName}`);
path.node.arguments.shift();
}
}
// Add the module name as the first argument to the define function.
path.node.arguments.unshift(types.stringLiteral(moduleName));
// Add a space after the define function in the built file so that previous versions
// of Moodle will not try to add the module name to the file when it's being served
// by PHP. This forces the regex in PHP to not match for this file.
path.node.callee.name = 'define ';
}
// Check for any Object.defineProperty('exports', 'default') calls.
if (!this.addedReturnForDefaultExport && path.get('callee').matchesPattern('Object.defineProperty')) {
const [identifier, prop] = path.get('arguments');
const objectName = identifier.get('name').node;
const propertyName = prop.get('value').node;
if ((objectName === 'exports' || objectName === '_exports') && propertyName === 'default') {
addModuleExportsDefaults(path, objectName);
this.addedReturnForDefaultExport = true;
}
}
},
AssignmentExpression(path) {
// Check for an exports.default assignments.
if (
!this.addedReturnForDefaultExport &&
(
path.get('left').matchesPattern('exports.default') ||
path.get('left').matchesPattern('_exports.default')
)
) {
const objectName = path.get('left.object.name').node;
addModuleExportsDefaults(path, objectName);
this.addedReturnForDefaultExport = true;
}
}
}, this);
}
}
}
};
};
-394
View File
@@ -1,394 +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 component paths.
*
* @param {string} relativeTo
* @returns {array}
*/
const getComponentPaths = (relativeTo = '') => fetchComponentData().pathList.map(componentPath => {
return componentPath.replace(relativeTo, '');
});
/**
* 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();
};
/**
* Get the list of thirdparty library paths.
*
* @returns {array}
*/
const getThirdPartyPaths = () => {
const DOMParser = require('@xmldom/xmldom').DOMParser;
const fs = require('fs');
const path = require('path');
const xpath = require('xpath');
const thirdpartyfiles = getThirdPartyLibsList(fs.realpathSync('./'));
const libs = ['node_modules/', 'vendor/'];
const addLibToList = lib => {
if (!lib.match('\\*') && fs.statSync(lib).isDirectory()) {
// Ensure trailing slash on dirs.
lib = lib.replace(/\/?$/, '/');
}
// Look for duplicate paths before adding to array.
if (libs.indexOf(lib) === -1) {
libs.push(lib);
}
};
thirdpartyfiles.forEach(function(file) {
const dirname = path.dirname(file);
const xmlContent = fs.readFileSync(file, 'utf8');
const doc = new DOMParser().parseFromString(xmlContent);
const nodes = xpath.select("/libraries/library/location/text()", doc);
nodes.forEach(function(node) {
let lib = path.posix.join(dirname, node.toString());
addLibToList(lib);
});
});
return libs;
};
/**
* 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;
};
/**
* Get the latest tag in a remote GitHub repository.
*
* @param {string} url The remote repository.
* @returns {Array}
*/
const getRepositoryTags = async(url) => {
const gtr = require('git-tags-remote');
try {
const tags = await gtr.get(url);
if (tags !== undefined) {
return tags;
}
} catch (error) {
return [];
}
return [];
};
/**
* Get the list of thirdparty libraries that could be upgraded.
*
* @returns {Array}
*/
const getThirdPartyLibsUpgradable = async() => {
const libraries = getThirdPartyLibsData().filter((library) => !!library.repository);
const upgradableLibraries = [];
const versionCompare = (a, b) => {
if (a === b) {
return 0;
}
const aParts = a.split('.');
const bParts = b.split('.');
for (let i = 0; i < Math.min(aParts.length, bParts.length); i++) {
const aPart = parseInt(aParts[i], 10);
const bPart = parseInt(bParts[i], 10);
if (aPart > bPart) {
// 1.1.0 > 1.0.9
return 1;
} else if (aPart < bPart) {
// 1.0.9 < 1.1.0
return -1;
} else {
// Same version.
continue;
}
}
if (aParts.length > bParts.length) {
// 1.0.1 > 1.0
return 1;
}
// 1.0 < 1.0.1
return -1;
};
for (let library of libraries) {
upgradableLibraries.push(
getRepositoryTags(library.repository).then((tagMap) => {
library.version = library.version.replace(/^v/, '');
const currentVersion = library.version.replace(/moodle-/, '');
const currentMajorVersion = library.version.split('.')[0];
const tags = [...tagMap]
.map((tagData) => tagData[0])
.filter((tag) => !tag.match(/(alpha|beta|rc)/))
.map((tag) => tag.replace(/^v/, ''))
.sort((a, b) => versionCompare(b, a));
if (!tags.length) {
library.warning = "Unable to find any comparable tags.";
return library;
}
library.latestVersion = tags[0];
tags.some((tag) => {
if (!tag) {
return false;
}
// See if the version part matches.
const majorVersion = tag.split('.')[0];
if (majorVersion === currentMajorVersion) {
library.latestSameMajorVersion = tag;
return true;
}
return false;
});
if (versionCompare(currentVersion, library.latestVersion) > 0) {
// Moodle somehow has a newer version than the latest version.
library.warning = `Newer version found: ${currentVersion} > ${library.latestVersion} for ${library.name}`;
return library;
}
if (library.version !== library.latestVersion) {
// Delete version and add it again at the end of the array. That way, current and new will stay closer.
delete library.version;
library.version = currentVersion;
return library;
}
return null;
})
);
}
return (await Promise.all(upgradableLibraries)).filter((library) => !!library);
};
/**
* Get the list of thirdparty libraries.
*
* @returns {Array}
*/
const getThirdPartyLibsData = () => {
const DOMParser = require('@xmldom/xmldom').DOMParser;
const fs = require('fs');
const xpath = require('xpath');
const path = require('path');
const libraryList = [];
const libraryFields = [
'location',
'name',
'version',
'repository',
];
const thirdpartyfiles = getThirdPartyLibsList(fs.realpathSync('./'));
thirdpartyfiles.forEach(function(libraryPath) {
const xmlContent = fs.readFileSync(libraryPath, 'utf8');
const doc = new DOMParser().parseFromString(xmlContent);
const libraries = xpath.select("/libraries/library", doc);
for (const library of libraries) {
const libraryData = [];
for (const field of libraryFields) {
libraryData[field] = xpath.select(`${field}/text()`, library)?.toString();
}
libraryData.location = path.join(path.dirname(libraryPath), libraryData.location);
libraryList.push(libraryData);
}
});
return libraryList.sort((a, b) => a.location.localeCompare(b.location));
};
module.exports = {
fetchComponentData,
getAmdSrcGlobList,
getComponentFromPath,
getComponentPaths,
getOwningComponentDirectory,
getYuiSrcGlobList,
getThirdPartyLibsList,
getThirdPartyPaths,
getThirdPartyLibsUpgradable,
};
-19
View File
@@ -1,19 +0,0 @@
# Moodle JavaScript Documentation
```
.-..-.
_____ | || |
/____/-.---_ .---. .---. .-.| || | .---.
| | _ _ |/ _ \/ _ \/ _ || |/ __ \
* | | | | | || |_| || |_| || |_| || || |___/
|_| |_| |_|\_____/\_____/\_____||_|\_____)
Moodle - the world's open source learning platform
```
## About
This generated documentation includes API documentation for JavaScript written in the AMD and ES2015 module formats within Moodle.
## Related information
See [https://moodledev.io](https://moodledev.io) for other related Developer Documentation.
-131
View File
@@ -1,131 +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 */
// Do not include any plugins as stanard.
const plugins = [];
plugins.push('plugins/markdown');
/**
* Get the source configuration.
*
* @return {Object}
*/
const getSource = () => {
const glob = require('glob');
const path = require('path');
const ComponentList = require(path.resolve('.grunt/components.js'));
const thirdPartyPaths = ComponentList.getThirdPartyPaths();
const source = {
include: [],
includePattern: ".+\\.js$",
};
let includeList = [];
ComponentList.getAmdSrcGlobList().forEach(async pattern => {
includeList.push(...glob.sync(pattern));
});
const cwdLength = process.cwd().length + 1;
includeList.forEach(path => {
if (source.include.indexOf(path) !== -1) {
// Ensure no duplicates.
return;
}
const relPath = path.substring(cwdLength);
if (thirdPartyPaths.indexOf(relPath) !== -1) {
return;
}
source.include.push(path);
});
source.include.push('.grunt/jsdoc/README.md');
return source;
};
const tags = {
// Allow the use of unknown tags.
// We have a lot of legacy uses of these.
allowUnknownTags: true,
// We make use of jsdoc and closure dictionaries as standard.
dictionaries: [
'jsdoc',
'closure',
],
};
// Template configuraiton.
const templates = {
cleverLinks: false,
monospaceLinks: false,
};
module.exports = {
opts: {
destination: "./jsdoc/",
template: "node_modules/docdash",
},
plugins,
recurseDepth: 10,
source: getSource(),
sourceType: 'module',
tags,
templates,
docdash: {
collapse: true,
search: true,
sort: true,
sectionOrder: [
"Namespaces",
"Modules",
"Events",
"Classes",
"Externals",
"Mixins",
"Tutorials",
"Interfaces"
],
"menu": {
"Developer Docs": {
href: "https://moodledev.io",
target: "_blank",
"class": "menu-item",
id: "devdocs"
},
"MDN Docs": {
href: "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
target: "_blank",
"class": "menu-item",
id: "mdndocs",
},
},
typedefs: true,
},
};
-142
View File
@@ -1,142 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* Component Library build tasks.
*
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Get a child path of the component library.
*
* @param {string} path
* @returns {string}
*/
const getCLPath = path => `admin/tool/componentlibrary/${path}`;
/**
* Get a spawn handler.
*
* This is a generic function to write the spawn output, and then to exit if required and mark the async task as
* complete.
*
* @param {Promise} done
* @returns {function}
*/
const getSpawnHandler = done => (error, result, code) => {
grunt.log.write(result);
if (error) {
grunt.log.error(result.stdout);
process.exit(code);
}
done();
};
/**
* Spawn a function against Node with the provided args.
*
* @param {array} args
* @returns {object}
*/
const spawnNodeCall = (args) => grunt.util.spawn({
cmd: 'node',
args,
}, getSpawnHandler(grunt.task.current.async()));
/**
* Build the docs using Hugo.
*
* @returns {Object} Reference to the spawned task
*/
const docsBuild = () => spawnNodeCall([
'node_modules/hugo-bin/cli.js',
'--config', getCLPath('config.yml'),
'--cleanDestinationDir',
]);
/**
* Build the docs index using the hugo-lunr-indexer.
*
* @returns {Object} Reference to the spawned task
*/
const indexBuild = () => spawnNodeCall([
'node_modules/hugo-lunr-indexer/bin/hli.js',
'-i', getCLPath('content/**'),
'-o', getCLPath('hugo/site/data/my-index.json'),
'-l', 'yaml',
'-d', '---',
]);
/**
* Build the hugo CSS.
*
* @returns {Object} Reference to the spawned task
*/
const cssBuild = () => spawnNodeCall([
'node_modules/sass/sass.js',
'--style', 'expanded',
'--source-map',
'--embed-sources',
'--precision', 6,
'--load-path', process.cwd(),
getCLPath('hugo/scss/docs.scss'),
getCLPath('hugo/dist/css/docs.css'),
]);
// Register the various component library tasks.
grunt.registerTask('componentlibrary:docsBuild', 'Build the component library', docsBuild);
grunt.registerTask('componentlibrary:cssBuild', 'Build the component library', cssBuild);
grunt.registerTask('componentlibrary:indexBuild', 'Build the component library', indexBuild);
grunt.registerTask('componentlibrary', 'Build the component library', [
'componentlibrary:docsBuild',
'componentlibrary:cssBuild',
'componentlibrary:indexBuild',
]);
grunt.config.merge({
watch: {
componentLibraryDocs: {
files: [
getCLPath('content/**/*.md'),
getCLPath('hugo'),
],
tasks: ['componentlibrary:docsBuild', 'componentlibrary:indexBuild'],
},
componentLibraryCSS: {
files: [
getCLPath('hugo/scss/**/*.scss'),
'hugo',
],
tasks: ['componentlibrary:cssBuild'],
},
},
});
// Add the 'componentlibrary' task as a startup task.
grunt.moodleEnv.startupTasks.push('componentlibrary');
return {
docsBuild,
cssBuild,
indexBuild,
};
};
-64
View File
@@ -1,64 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
const files = grunt.moodleEnv.files;
// Project configuration.
grunt.config.merge({
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)
},
// Check AMD src files.
amd: {src: files ? files : grunt.moodleEnv.amdSrc},
// Check YUI module source files.
yui: {src: files ? files : grunt.moodleEnv.yuiSrc},
},
});
grunt.loadNpmTasks('grunt-eslint');
// 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).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('eslint.amd.src', files);
grunt.config('eslint.yui.src', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', (action, filepath) => {
changedFiles[filepath] = action;
onChange();
});
};
-92
View File
@@ -1,92 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Get the list of feature files to pass to the gherkin linter.
*
* @returns {Array}
*/
const getGherkinLintTargets = () => {
if (grunt.moodleEnv.files) {
// Specific files were requested. Only check these.
return grunt.moodleEnv.files;
}
if (grunt.moodleEnv.inComponent) {
return [`${grunt.moodleEnv.runDir}/tests/behat/*.feature`];
}
return ['**/tests/behat/*.feature'];
};
const handler = function() {
const done = this.async();
const 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
};
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', handler);
grunt.config.set('gherkinlint', {
options: {
files: getGherkinLintTargets(),
}
});
grunt.config.merge({
watch: {
gherkinlint: {
files: [grunt.moodleEnv.inComponent ? 'tests/behat/*.feature' : '**/tests/behat/*.feature'],
tasks: ['gherkinlint'],
},
},
});
// Add the 'gherkinlint' task as a startup task.
grunt.moodleEnv.startupTasks.push('gherkinlint');
return handler;
};
-100
View File
@@ -1,100 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate the PHPCS configuration.
*
* @param {Object} thirdPartyPaths
*/
const phpcsIgnore = (thirdPartyPaths) => {
const {toXML} = require('jstoxml');
const config = {
_name: 'ruleset',
_attrs: {
name: "MoodleCore",
},
_content: [
{
rule: {
_attrs: {
ref: './phpcs.xml.dist',
},
},
},
],
};
thirdPartyPaths.forEach(library => {
config._content.push({
'exclude-pattern': library,
});
});
grunt.file.write('phpcs.xml', toXML(config, {
header: true,
indent: ' ',
}) + "\n");
};
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
const handler = function() {
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// An array of paths to third party directories.
const thirdPartyPaths = ComponentList.getThirdPartyPaths();
// Generate .eslintignore.
const eslintIgnores = [
'# Generated by "grunt ignorefiles"',
// Do not ignore the .grunt directory.
'!/.grunt',
// Ignore all yui/src meta directories and build directories.
'*/**/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',
'jsdoc/styles/*.css',
'admin/tool/componentlibrary/hugo/dist/css/docs.css',
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n') + '\n');
phpcsIgnore(thirdPartyPaths);
};
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', handler);
return handler;
};
-227
View File
@@ -1,227 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Function to generate the destination for the uglify task
* (e.g. build/file.min.js). This function will be passed to
* the rename property of files array when building dynamically:
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
*
* @param {String} destPath the current destination
* @param {String} srcPath the matched src path
* @return {String} The rewritten destination path.
*/
const babelRename = function(destPath, srcPath) {
destPath = srcPath.replace(`amd/src`, `amd/build`);
destPath = destPath.replace(/\.js$/, '.min.js');
return destPath;
};
module.exports = grunt => {
// Load the Ignorefiles tasks.
require('./ignorefiles')(grunt);
// Load the Shifter tasks.
require('./shifter')(grunt);
// Load ESLint.
require('./eslint')(grunt);
// Load jsconfig.
require('./jsconfig')(grunt);
// Load JSDoc.
require('./jsdoc')(grunt);
const path = require('path');
// Register JS tasks.
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'rollup']);
grunt.registerTask('js', ['amd', 'yui']);
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rollup');
const babelTransform = require('@babel/core').transform;
const babel = (options = {}) => {
return {
name: 'babel',
transform: (code, id) => {
grunt.log.debug(`Transforming ${id}`);
options.filename = id;
const transformed = babelTransform(code, options);
return {
code: transformed.code,
map: transformed.map
};
}
};
};
// Note: We have to use a rate limit plugin here because rollup runs all tasks asynchronously and in parallel.
// When we kick off a full run, if we kick off a rollup of every file this will fork-bomb the machine.
// To work around this we use a concurrent Promise queue based on the number of available processors.
const rateLimit = () => {
const queue = [];
let queueRunner;
const startQueue = () => {
if (queueRunner) {
return;
}
queueRunner = setTimeout(() => {
const limit = Math.max(1, require('os').cpus().length / 2);
grunt.log.debug(`Starting rollup with queue size of ${limit}`);
runQueue(limit);
}, 100);
};
// The queue runner will run the next `size` items in the queue.
const runQueue = (size = 1) => {
queue.splice(0, size).forEach(resolve => {
resolve();
});
};
return {
name: 'ratelimit',
// The options hook is run in parallel.
// We can return an unresolved Promise which is queued for later resolution.
options: async() => {
return new Promise(resolve => {
queue.push(resolve);
startQueue();
});
},
// When an item in the queue completes, start the next item in the queue.
buildEnd: () => {
runQueue();
},
};
};
const terser = require('rollup-plugin-terser').terser;
grunt.config.merge({
rollup: {
options: {
format: 'esm',
dir: 'output',
sourcemap: true,
treeshake: false,
context: 'window',
plugins: [
rateLimit(),
babel({
sourceMaps: true,
comments: false,
compact: 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('.grunt/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: [
['@babel/preset-env', {
targets: {
browsers: [
">0.3%",
"last 2 versions",
"not ie >= 0",
"not op_mini all",
"not Opera > 0",
"not dead"
]
},
modules: false,
useBuiltIns: false
}]
]
}),
terser({
// Do not mangle variables.
// Makes debugging easier.
mangle: false,
}),
],
},
dist: {
files: [{
expand: true,
src: grunt.moodleEnv.files ? grunt.moodleEnv.files : grunt.moodleEnv.amdSrc,
rename: babelRename
}],
},
},
});
grunt.config.merge({
watch: {
amd: {
files: grunt.moodleEnv.inComponent
? ['amd/src/*.js', 'amd/src/**/*.js']
: ['**/amd/src/**/*.js'],
tasks: ['amd']
},
},
});
// Add the 'js' task as a startup task.
grunt.moodleEnv.startupTasks.push('js');
// 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).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('rollup.dist.files', [{expand: true, src: files, rename: babelRename}]);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function(action, filepath) {
changedFiles[filepath] = action;
onChange();
});
return {
babelRename,
};
};
-53
View File
@@ -1,53 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
const configuration = {
compilerOptions: {
baseUrl: ".",
paths: {
},
target: "es2015",
allowSyntheticDefaultImports: false,
},
exclude: [
"node_modules",
],
include: [],
};
module.exports = (grunt) => {
const handler = () => {
const jsconfigData = Object.assign({}, configuration);
const path = require('path');
const {fetchComponentData} = require(path.join(process.cwd(), '.grunt', 'components.js'));
const componentData = fetchComponentData().components;
for (const [thisPath, component] of Object.entries(componentData)) {
jsconfigData.compilerOptions.paths[`${component}/*`] = [`${thisPath}/amd/src/*`];
jsconfigData.include.push(`${thisPath}/amd/src/**/*`);
}
grunt.file.write('jsconfig.json', JSON.stringify(jsconfigData, null, " ") + "\n");
};
grunt.registerTask('jsconfig', 'Generate a jsconfig configuration compatible with the LSP', handler);
};
-36
View File
@@ -1,36 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
// Project configuration.
grunt.config.merge({
jsdoc: {
dist: {
options: {
configure: ".grunt/jsdoc/jsdoc.conf.js",
},
},
},
});
grunt.loadNpmTasks('grunt-jsdoc');
};
-40
View File
@@ -1,40 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
grunt.loadNpmTasks('grunt-sass');
grunt.config.merge({
sass: {
dist: {
files: {
"theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss",
"theme/classic/style/moodle.css": "theme/classic/scss/classicgrunt.scss"
}
},
options: {
implementation: require('sass'),
includePaths: ["theme/boost/scss/", "theme/classic/scss/"]
}
},
});
};
-155
View File
@@ -1,155 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/* eslint-env node */
module.exports = grunt => {
/**
* Shifter task. Is configured with a path to a specific file or a directory,
* in the case of a specific file it will work out the right module to be built.
*
* Note that this task runs the invidiaul shifter jobs async (becase it spawns
* so be careful to to call done().
*/
const handler = function() {
const done = this.async();
const options = grunt.config('shifter.options');
const async = require('async');
const path = require('path');
// Run the shifter processes one at a time to avoid confusing output.
async.eachSeries(options.paths, function(src, filedone) {
var args = [];
args.push(path.normalize(process.cwd() + '/node_modules/shifter/bin/shifter'));
// Always ignore the node_modules directory.
args.push('--excludes', 'node_modules');
// Determine the most appropriate options to run with based upon the current location.
if (grunt.file.isMatch('**/yui/**/*.js', src)) {
// When passed a JS file, build our containing module (this happen with
// watch).
grunt.log.debug('Shifter passed a specific JS file');
src = path.dirname(path.dirname(src));
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src', src)) {
// When in a src directory --walk all modules.
grunt.log.debug('In a src directory');
args.push('--walk');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*', src)) {
// When in module, only build our module.
grunt.log.debug('In a module directory');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*/js', src)) {
// When in module src, only build our module.
grunt.log.debug('In a source directory');
src = path.dirname(src);
options.recursive = false;
}
if (grunt.option('watch')) {
grunt.fail.fatal('The --watch option has been removed, please use `grunt watch` instead');
}
// Add the stderr option if appropriate
if (grunt.option('verbose')) {
args.push('--lint-stderr');
}
if (grunt.option('no-color')) {
args.push('--color=false');
}
var execShifter = function() {
grunt.log.ok("Running shifter on " + src);
grunt.util.spawn({
cmd: "node",
args: args,
opts: {cwd: src, stdio: 'inherit', env: process.env}
}, function(error, result, code) {
if (code) {
grunt.fail.fatal('Shifter failed with code: ' + code);
} else {
grunt.log.ok('Shifter build complete.');
filedone();
}
});
};
// Actually run shifter.
if (!options.recursive) {
execShifter();
} else {
// Check that there are yui modules otherwise shifter ends with exit code 1.
if (grunt.file.expand({cwd: src}, '**/yui/src/**/*.js').length > 0) {
args.push('--recursive');
execShifter();
} else {
grunt.log.ok('No YUI modules to build.');
filedone();
}
}
}, done);
};
// Register the shifter task.
grunt.registerTask('shifter', 'Run Shifter against the current directory', handler);
// Configure it.
grunt.config.set('shifter', {
options: {
recursive: true,
// Shifter takes a relative path.
paths: grunt.moodleEnv.files ? grunt.moodleEnv.files : [grunt.moodleEnv.runDir]
}
});
grunt.config.merge({
watch: {
yui: {
files: grunt.moodleEnv.inComponent
? ['yui/src/*.json', 'yui/src/**/*.js']
: ['**/yui/src/**/*.js'],
tasks: ['yui']
},
},
});
// 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).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('shifter.options.paths', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', (action, filepath) => {
changedFiles[filepath] = action;
onChange();
});
return handler;
};
-46
View File
@@ -1,46 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
const handler = function() {
const path = require('path');
// Are we in a YUI directory?
if (path.basename(path.resolve(grunt.moodleEnv.cwd, '../../')) == 'yui') {
grunt.task.run('yui');
// Are we in an AMD directory?
} else if (grunt.moodleEnv.inAMD) {
grunt.task.run('amd');
} else {
// Run all of the requested startup tasks.
grunt.moodleEnv.startupTasks.forEach(taskName => grunt.task.run(taskName));
}
};
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', handler);
return handler;
};
-35
View File
@@ -1,35 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
// Load the ignorefiles tasks.
require('./ignorefiles')(grunt);
// Load the Style Lint tasks.
require('./stylelint')(grunt);
// Load the SASS tasks.
require('./sass')(grunt);
// Add the 'css' task as a startup task.
grunt.moodleEnv.startupTasks.push('css');
};
-183
View File
@@ -1,183 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
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,
},
},
};
};
/**
* Register any stylelint tasks.
*
* @param {Object} grunt
* @param {Array} files
* @param {String} fullRunDir
*/
const registerStyleLintTasks = () => {
const glob = require('glob');
// The stylelinters do not handle the case where a configuration was provided but no files were included.
// Keep track of whether any files were found.
let hasCss = false;
let hasScss = false;
// The stylelint processors do not take a path argument. They always check all provided values.
// As a result we must check through each glob and determine if any files match the current directory.
const scssFiles = [];
const cssFiles = [];
const requestedFiles = grunt.moodleEnv.files;
if (requestedFiles) {
// Grunt was called with a files argument.
// Check whether each of the requested files matches either the CSS or SCSS source file list.
requestedFiles.forEach(changedFilePath => {
let matchesGlob;
// Check whether this watched path matches any watched SCSS file.
matchesGlob = grunt.moodleEnv.scssSrc.some(watchedPathGlob => {
return glob.sync(watchedPathGlob).indexOf(changedFilePath) !== -1;
});
if (matchesGlob) {
scssFiles.push(changedFilePath);
hasScss = true;
}
// Check whether this watched path matches any watched CSS file.
matchesGlob = grunt.moodleEnv.cssSrc.some(watchedPathGlob => {
return glob.sync(watchedPathGlob).indexOf(changedFilePath) !== -1;
});
if (matchesGlob) {
cssFiles.push(changedFilePath);
hasCss = true;
}
});
} else {
// Grunt was called without a list of files.
// The start directory (runDir) may be a child dir of the project.
// Check each scssSrc file to see if it's in the start directory.
// This means that we can lint just mod/*/styles.css if started in the mod directory.
grunt.moodleEnv.scssSrc.forEach(path => {
if (path.startsWith(grunt.moodleEnv.runDir)) {
scssFiles.push(path);
hasScss = true;
}
});
grunt.moodleEnv.cssSrc.forEach(path => {
if (path.startsWith(grunt.moodleEnv.runDir)) {
cssFiles.push(path);
hasCss = true;
}
});
}
// Register the tasks.
const scssTasks = ['sass'];
if (hasScss) {
grunt.config.merge(getScssConfigForFiles(scssFiles));
scssTasks.unshift('stylelint:scss');
}
scssTasks.unshift('ignorefiles');
const cssTasks = ['ignorefiles'];
if (hasCss) {
grunt.config.merge(getCssConfigForFiles(cssFiles));
cssTasks.push('stylelint:css');
}
// The tasks must be registered, even if empty to ensure a consistent command list.
// They jsut won't run anything.
grunt.registerTask('scss', scssTasks);
grunt.registerTask('rawcss', cssTasks);
};
// Register CSS tasks.
grunt.loadNpmTasks('grunt-stylelint');
// Register the style lint tasks.
registerStyleLintTasks();
grunt.registerTask('css', ['scss', 'rawcss']);
const getCoreThemeMatches = () => {
const scssMatch = 'scss/**/*.scss';
if (grunt.moodleEnv.inTheme) {
return [scssMatch];
}
if (grunt.moodleEnv.runDir.startsWith('theme')) {
return [`*/${scssMatch}`];
}
return [`theme/*/${scssMatch}`];
};
// Add the watch configuration for rawcss, and scss.
grunt.config.merge({
watch: {
rawcss: {
files: [
'**/*.css',
],
excludes: [
'**/moodle.css',
'**/editor.css',
'jsdoc/styles/*.css',
],
tasks: ['rawcss']
},
scss: {
files: getCoreThemeMatches(),
tasks: ['scss']
},
},
});
};
-42
View File
@@ -1,42 +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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2023 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate upgradable third-party libraries (utilising thirdpartylibs.xml data)
*/
grunt.registerTask('upgradablelibs', 'Generate upgradable third-party libraries', async function() {
const done = this.async();
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// An array of third party libraries that have a newer version in their repositories.
const thirdPartyLibs = await ComponentList.getThirdPartyLibsUpgradable({progress: true});
for (let library of thirdPartyLibs) {
grunt.log.ok(JSON.stringify(Object.assign({}, library), null, 4));
}
done();
});
};
-272
View File
@@ -1,272 +0,0 @@
/**
* 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.
*/
/* eslint-env node */
module.exports = 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.
*/
const watchHandler = function() {
const async = require('async');
const watchTaskDone = this.async();
let watchInitialised = false;
let watchTaskQueue = {};
let processingQueue = false;
const watchman = require('fb-watchman');
const watchmanClient = new watchman.Client();
// 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: grunt.moodleEnv.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 = grunt.moodleEnv.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(grunt.moodleEnv.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', grunt.moodleEnv.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 ' + grunt.moodleEnv.fullRunDir);
});
});
});
};
// Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
grunt.renameTask('watch', 'watch-grunt');
// Register the new watch handler.
grunt.registerTask('watch', 'Run tasks on file changes', watchHandler);
grunt.config.merge({
watch: {
options: {
nospawn: true // We need not to spawn so config can be changed dynamically.
},
},
});
return watchHandler;
};
-2
View File
@@ -1,2 +0,0 @@
**/amd/**
/*.js
-3
View File
@@ -1,6 +1,3 @@
// NOTE: We use eslint now. This file is used only by shifter. We keep the configuration
// here because shifter uses jshint after modules have been concating. Eslint can't
// currently do this.
{
"asi": false,
"bitwise": true,
-1
View File
@@ -1 +0,0 @@
lts/gallium
-95
View File
@@ -1,95 +0,0 @@
{
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true,
"at-rule-empty-line-before": [ "always",
{"except": [ "blockless-after-blockless"], ignore: ["after-comment", "inside-block"]}
],
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-no-unknown": null, # Enabled for non-scss in grunt.
"at-rule-semicolon-newline-after": "always",
"at-rule-semicolon-space-before": "never",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-case": ["lower", { "severity": "warning" }],
"color-hex-length": ["short", { "severity": "warning" }],
"color-no-invalid-hex": true,
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-no-important": true,
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-url-scheme-blacklist": ["data"],
"function-whitespace-after": "always",
"indentation": 4,
"keyframe-declaration-no-important": true,
"length-zero-no-unit": [true, { "severity": "warning" }],
"max-empty-lines": 2,
"max-line-length": [132, { "severity": "warning" }],
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-empty-source": true,
"no-eol-whitespace": true,
"no-extra-semicolons": [true, { "severity": "warning" }],
"no-invalid-double-slash-comments": true,
"no-unknown-animations": true,
"property-case": "lower",
"property-no-unknown": true,
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-list-comma-newline-after": "always",
"selector-list-comma-space-before": "never",
"selector-max-empty-lines": 0,
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower",
"selector-type-no-unknown": true,
"string-no-newline": true,
"time-min-milliseconds": 100,
"unit-blacklist": ["pt"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": ["lower", {"ignoreKeywords": ["/(@|$)/"]}],
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
}
}
+264
View File
@@ -0,0 +1,264 @@
# PLEASE NOTE: Travis is not currently utilised by the Moodle core integration
# process (which uses our internal CI system) this file is here for the benefit
# of community developers git clones - see MDL-51458.
sudo: false
# We currently disable Travis notifications entirely until https://github.com/travis-ci/travis-ci/issues/4976
# is fixed.
notifications:
email: false
language: php
php:
# We only run the highest and lowest supported versions to reduce the load on travis-ci.org.
- 7.0
# - 5.6
# - 5.5
- 5.4
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 5.6, 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:
# Run grunt/npm install on lowest supported npm version
- php: 7
env: DB=none TASK=GRUNT NVM_VERSION='0.10'
# Run grunt/npm install on highest version ('node' is an alias for the latest node.js version.)
- php: 7
env: DB=none TASK=GRUNT NVM_VERSION='node'
exclude:
# MySQL - it's just too slow.
# Exclude it on all versions except for 7.0
# - env: DB=mysqli TASK=PHPUNIT
# php: 5.6
#
# - env: DB=mysqli TASK=PHPUNIT
# php: 5.5
- env: DB=mysqli TASK=PHPUNIT
php: 5.4
- env: DB=none TASK=GRUNT
php: 5.4
# Moodle 2.7 is not compatible with PHP 7 for the upgrade test.
- env: DB=pgsql TASK=UPGRADE
php: 7.0
cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm
install:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
if [ -n "$GITHUB_APITOKEN" ]; then
composer config github-oauth.github.com $GITHUB_APITOKEN;
echo 'auth.json' >> .git/info/exclude
fi
# Install composer dependencies.
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
# Typically it should be able to use the Composer cache if any other job has already completed before we started here.
travis_retry composer install --prefer-dist --no-interaction;
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
nvm install $NVM_VERSION ;
nvm use $NVM_VERSION ;
fi
before_script:
- phpenv config-rm xdebug.ini
- >
if [ "$TASK" = 'PHPUNIT' -o "$TASK" = 'UPGRADE' ];
then
# Copy generic configuration in place.
cp config-dist.php config.php ;
# Create the moodledata directory.
mkdir -p "$HOME"/roots/base
# The database name and password.
sed -i \
-e "s%= 'moodle'%= 'travis_ci_test'%" \
-e "s%= 'password'%= ''%" \
config.php ;
# The wwwroot and dataroot.
sed -i \
-e "s%http://example.com/moodle%http://localhost%" \
-e "s%/home/example/moodledata%/home/travis/roots/base%" \
config.php ;
if [ "$DB" = 'pgsql' ];
then
# Postgres-specific setup.
sed -i \
-e "s%= 'username'%= 'postgres'%" \
config.php ;
psql -c 'CREATE DATABASE travis_ci_test;' -U postgres;
fi
if [ "$DB" = 'mysqli' ];
then
# MySQL-specific setup.
sed -i \
-e "s%= 'pgsql'%= 'mysqli'%" \
-e "s%= 'username'%= 'travis'%" \
-e "s%=> 'utf8mb4_unicode_ci'%=> 'utf8mb4_bin'%" \
config.php;
mysql -u root -e 'SET GLOBAL innodb_file_format=barracuda;' ;
mysql -u root -e 'SET GLOBAL innodb_file_per_table=ON;' ;
mysql -u root -e 'SET GLOBAL innodb_large_prefix=ON;' ;
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;' ;
fi
fi
- >
if [ "$TASK" = 'PHPUNIT' ];
then
# Create a directory for the phpunit dataroot.
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
npm install --no-spin;
npm install --no-spin -g grunt ;
fi
########################################################################
# CI Tests
########################################################################
- >
if [ "$TASK" = 'CITEST' ];
then
# Note - this is deliberately placed in the script section as we
# should not add any code until after phpunit has run.
# The following repositories are required.
# The local_ci repository does the actual checking.
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci
# We need the official upstream for comparison
git remote add upstream https://github.com/moodle/moodle.git;
git fetch upstream MOODLE_31_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`
# Variables required by our linter.
export gitcmd=`which git`;
export gitdir="$TRAVIS_BUILD_DIR";
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 27 STABLE branch.
git fetch upstream MOODLE_27_STABLE;
git checkout MOODLE_27_STABLE;
# Perform the upgrade
php admin/cli/install_database.php --agree-license --adminpass=Password --adminemail=admin@example.com --fullname="Upgrade test" --shortname=Upgrade;
# Return to the previous commit
git checkout -;
# Perform the upgrade
php admin/cli/upgrade.php --non-interactive --allow-unstable ;
# The local_ci repository can be used to check upgrade savepoints.
git clone https://github.com/moodlehq/moodle-local_ci.git local/ci ;
fi
script:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit;
fi
- >
if [ "$TASK" = 'CITEST' ];
then
bash local/ci/php_lint/php_lint.sh;
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
grunt ;
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
git add . ;
git diff --cached --exit-code ;
fi
########################################################################
# Upgrade test
########################################################################
- >
if [ "$TASK" = 'UPGRADE' ];
then
cp local/ci/check_upgrade_savepoints/check_upgrade_savepoints.php ./check_upgrade_savepoints.php
result=`php check_upgrade_savepoints.php`;
# Check if there are problems
count=`echo "$result" | grep -P "ERROR|WARN" | wc -l` ;
if (($count > 0));
then
echo "$result"
exit 1 ;
fi
fi
+3 -3
View File
@@ -6,7 +6,7 @@ of developers, designers, teachers, testers, translators and other users. We
work in universities, schools, companies and other places. You are very welcome
to join us and contribute to the project.
See <https://moodledev.io/general/community/contribute> for the many ways you
See <https://docs.moodle.org/dev/Contributing_to_Moodle> for the many ways you
can help, not only with coding.
Moodle is open to community contributions to core, though all code must go
@@ -35,7 +35,7 @@ submitted patches has evolved.
* New features are developed on the master branch. Bug fixes are also
backported to currently supported maintenance (stable) branches.
For further details, see <https://moodledev.io/general/development/process>.
For further details, see <https://docs.moodle.org/dev/Process>.
Moodle plugins
--------------
@@ -53,4 +53,4 @@ be easily installed and updated via the Moodle administration interface.
the plugins directory. We do not pull from your code repository; you must do
it explicitly.
For further details, see <https://moodledev.io/general/community/plugincontribution>.
For further details, see <https://docs.moodle.org/dev/Plugin_contribution>.
+215 -227
View File
@@ -13,254 +13,242 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* Grunt configuration for Moodle.
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Setup the Grunt Moodle environment.
*
* @param {Grunt} grunt
* @returns {Object}
* Grunt configuration
*/
const setupMoodleEnvironment = grunt => {
const fs = require('fs');
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
const getAmdConfiguration = () => {
// 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 ..
let inAMD = !path.relative(`${componentDirectory}/amd`, cwd).startsWith('..');
// Globbing pattern for matching all AMD JS source files.
let amdSrc = [];
if (inComponent) {
amdSrc.push(
componentDirectory + "/amd/src/*.js",
componentDirectory + "/amd/src/**/*.js"
);
} else {
amdSrc = ComponentList.getAmdSrcGlobList();
}
return {
inAMD,
amdSrc,
};
};
const getYuiConfiguration = () => {
let yuiSrc = [];
if (inComponent) {
yuiSrc.push(componentDirectory + "/yui/src/**/*.js");
} else {
yuiSrc = ComponentList.getYuiSrcGlobList(gruntFilePath + '/');
}
return {
yuiSrc,
};
};
const getStyleConfiguration = () => {
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// Build the cssSrc and scssSrc.
// Valid paths are:
// [component]/styles.css; and either
// [theme/[themename]]/scss/**/*.scss; or
// [theme/[themename]]/style/*.css.
//
// If a theme has scss, then it is assumed that the style directory contains generated content.
let cssSrc = [];
let scssSrc = [];
const checkComponentDirectory = componentDirectory => {
const isTheme = componentDirectory.startsWith('theme/');
if (isTheme) {
const scssDirectory = `${componentDirectory}/scss`;
if (fs.existsSync(scssDirectory)) {
// This theme has an SCSS directory.
// Include all scss files within it recursively, but do not check for css files.
scssSrc.push(`${scssDirectory}/*.scss`);
scssSrc.push(`${scssDirectory}/**/*.scss`);
} else {
// This theme has no SCSS directory.
// Only hte CSS files in the top-level directory are checked.
cssSrc.push(`${componentDirectory}/style/*.css`);
}
} else {
// This is not a theme.
// All other plugin types are restricted to a single styles.css in their top level.
cssSrc.push(`${componentDirectory}/styles.css`);
}
};
if (inComponent) {
checkComponentDirectory(componentDirectory);
} else {
ComponentList.getComponentPaths(`${gruntFilePath}/`).forEach(componentPath => {
checkComponentDirectory(componentPath);
});
}
return {
cssSrc,
scssSrc,
};
};
/**
* Calculate the cwd, taking into consideration the `root` option (for Windows).
*
* @param {Object} grunt
* @returns {String} The current directory as best we can determine
*/
const getCwd = grunt => {
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;
};
// 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 inTheme = !!componentDirectory && componentDirectory.startsWith('theme/');
const runDir = inComponent ? componentDirectory : relativeCwd;
const fullRunDir = fs.realpathSync(gruntFilePath + path.sep + runDir);
const {inAMD, amdSrc} = getAmdConfiguration();
const {yuiSrc} = getYuiConfiguration();
const {cssSrc, scssSrc} = getStyleConfiguration();
let files = null;
if (grunt.option('files')) {
// Accept a comma separated list of files to process.
files = grunt.option('files').split(',');
}
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}`);
}
return {
amdSrc,
componentDirectory,
cwd,
cssSrc,
files,
fullRunDir,
gruntFilePath,
inAMD,
inComponent,
inTheme,
relativeCwd,
runDir,
scssSrc,
yuiSrc,
};
};
/**
* Verify tha tthe current NodeJS version matches the required version in package.json.
*
* @param {Grunt} grunt
*/
const verifyNodeVersion = grunt => {
const semver = require('semver');
// Verify the node version is new enough.
var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
var actual = semver.valid(process.version);
if (!semver.satisfies(actual, expected)) {
grunt.fail.fatal('Node version not satisfied. Require ' + expected + ', version installed: ' + actual);
}
};
/**
* Grunt configuration.
*
* @param {Grunt} grunt
*/
module.exports = function(grunt) {
// Verify that the Node version meets our requirements.
verifyNodeVersion(grunt);
var path = require('path'),
tasks = {},
cwd = process.env.PWD || process.cwd();
// Setup the Moodle environemnt within the Grunt object.
grunt.moodleEnv = setupMoodleEnvironment(grunt);
// Windows users can't run grunt in a subdirectory, so allow them to set
// the root by passing --root=path/to/dir.
if (grunt.option('root')) {
var root = grunt.option('root');
if (grunt.file.exists(__dirname, root)) {
cwd = path.join(__dirname, root);
grunt.log.ok('Setting root to '+cwd);
} else {
grunt.fail.fatal('Setting root to '+root+' failed - path does not exist');
}
}
var inAMD = path.basename(cwd) == 'amd';
// Globbing pattern for matching all AMD JS source files.
var amdSrc = [inAMD ? cwd + '/src/*.js' : '**/amd/src/*.js'];
/**
* Add the named task.
* Function to generate the destination for the uglify task
* (e.g. build/file.min.js). This function will be passed to
* the rename property of files array when building dynamically:
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
*
* @param {string} name
* @param {Grunt} grunt
* @param {String} destPath the current destination
* @param {String} srcPath the matched src path
* @return {String} The rewritten destination path.
*/
const addTask = (name, grunt) => {
const path = require('path');
const taskPath = path.resolve(`./.grunt/tasks/${name}.js`);
grunt.log.debug(`Including tasks for ${name} from ${taskPath}`);
require(path.resolve(`./.grunt/tasks/${name}.js`))(grunt);
var uglify_rename = function (destPath, srcPath) {
destPath = srcPath.replace('src', 'build');
destPath = destPath.replace('.js', '.min.js');
destPath = path.resolve(cwd, destPath);
return destPath;
};
// Startup tasks.
grunt.moodleEnv.startupTasks = [];
// Project configuration.
grunt.initConfig({
jshint: {
options: {jshintrc: '.jshintrc'},
amd: { src: amdSrc }
},
uglify: {
amd: {
files: [{
expand: true,
src: amdSrc,
rename: uglify_rename
}]
}
},
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: true
}
}
},
watch: {
options: {
nospawn: true // We need not to spawn so config can be changed dynamically.
},
amd: {
files: ['**/amd/src/**/*.js'],
tasks: ['amd']
},
bootstrapbase: {
files: ["theme/bootstrapbase/less/**/*.less"],
tasks: ["less:bootstrapbase"]
},
yui: {
files: ['**/yui/src/**/*.js'],
tasks: ['shifter']
},
},
shifter: {
options: {
recursive: true,
paths: [cwd]
}
}
});
// Add Moodle task configuration.
addTask('gherkinlint', grunt);
addTask('ignorefiles', grunt);
/**
* Shifter task. Is configured with a path to a specific file or a directory,
* in the case of a specific file it will work out the right module to be built.
*
* Note that this task runs the invidiaul shifter jobs async (becase it spawns
* so be careful to to call done().
*/
tasks.shifter = function() {
var async = require('async'),
done = this.async(),
options = grunt.config('shifter.options');
addTask('javascript', grunt);
addTask('style', grunt);
addTask('componentlibrary', grunt);
// Run the shifter processes one at a time to avoid confusing output.
async.eachSeries(options.paths, function (src, filedone) {
var args = [];
args.push( path.normalize(__dirname + '/node_modules/shifter/bin/shifter'));
addTask('watch', grunt);
addTask('startup', grunt);
// Always ignore the node_modules directory.
args.push('--excludes', 'node_modules');
addTask('upgradablelibs', grunt);
// Determine the most appropriate options to run with based upon the current location.
if (grunt.file.isMatch('**/yui/**/*.js', src)) {
// When passed a JS file, build our containing module (this happen with
// watch).
grunt.log.debug('Shifter passed a specific JS file');
src = path.dirname(path.dirname(src));
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src', src)) {
// When in a src directory --walk all modules.
grunt.log.debug('In a src directory');
args.push('--walk');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*', src)) {
// When in module, only build our module.
grunt.log.debug('In a module directory');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*/js', src)) {
// When in module src, only build our module.
grunt.log.debug('In a source directory');
src = path.dirname(src);
options.recursive = false;
}
if (grunt.option('watch')) {
grunt.fail.fatal('The --watch option has been removed, please use `grunt watch` instead');
}
// Add the stderr option if appropriate
if (grunt.option('verbose')) {
args.push('--lint-stderr');
}
if (grunt.option('no-color')) {
args.push('--color=false');
}
var execShifter = function() {
grunt.log.ok("Running shifter on " + src);
grunt.util.spawn({
cmd: "node",
args: args,
opts: {cwd: src, stdio: 'inherit', env: process.env}
}, function (error, result, code) {
if (code) {
grunt.fail.fatal('Shifter failed with code: ' + code);
} else {
grunt.log.ok('Shifter build complete.');
filedone();
}
});
};
// Actually run shifter.
if (!options.recursive) {
execShifter();
} else {
// Check that there are yui modules otherwise shifter ends with exit code 1.
if (grunt.file.expand({cwd: src}, '**/yui/src/**/*.js').length > 0) {
args.push('--recursive');
execShifter();
} else {
grunt.log.ok('No YUI modules to build.');
filedone();
}
}
}, done);
};
tasks.startup = function() {
// Are we in a YUI directory?
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
grunt.task.run('shifter');
// Are we in an AMD directory?
} else if (inAMD) {
grunt.task.run('amd');
} else {
// Run them all!.
grunt.task.run('css');
grunt.task.run('js');
}
};
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
var changedFiles = Object.create(null);
var onChange = grunt.util._.debounce(function() {
var files = Object.keys(changedFiles);
grunt.config('jshint.amd.src', files);
grunt.config('uglify.amd.files', [{ expand: true, src: files, rename: uglify_rename }]);
grunt.config('shifter.options.paths', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function(action, filepath) {
changedFiles[filepath] = action;
onChange();
});
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
// Register JS tasks.
grunt.registerTask('shifter', 'Run Shifter against the current directory', tasks.shifter);
grunt.registerTask('amd', ['jshint', 'uglify']);
grunt.registerTask('js', ['amd', 'shifter']);
// Register CSS taks.
grunt.registerTask('css', ['less:bootstrapbase']);
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', tasks.startup);
// Register the default task.
grunt.registerTask('default', ['startup']);
+1 -1
View File
@@ -20,7 +20,7 @@ Moodle is widely used around the world by universities, schools, companies and
all manner of organisations and individuals.
Moodle is provided freely as open source software, under the GNU General Public
License <https://moodledev.io/general/license>.
License <https://docs.moodle.org/dev/License>.
Moodle is written in PHP and JavaScript and uses an SQL database for storing
the data.
+35 -53
View File
@@ -1,66 +1,48 @@
MOODLE TRADEMARKS POLICY
========================
The Moodle Trademark
--------------------
The word "Moodle" is trademarked in many countries around the world. The word
was originally an acronym: Modular Object-Oriented Dynamic Learning
Environment. The trademark is owned by Martin Dougiamas, Founder and Director
of Moodle.
The brand and word "Moodle" has trade mark protection in many countries around
the world. Various Moodle™ trade marks are owned by either Moodle Pty Ltd or
one of its associated entities. The law obligates trade mark owners to police
their trade marks and prevent the use of confusingly similar names by
third parties.
The law obligates trademark owners to police their marks and prevent the use of
confusingly similar names by third parties. Through this policy wed like to
make it clear how Moodle-related projects, organisations, and people can use
the Moodle trademark. Wed also like to be clear about how use of the word is
restricted when used to promote commercial Moodle services. We do this to
protect the very business model that allows us to continue developing Moodle
for you.
We have created a more concise and thorough set of Trademark Guidelines
(https://moodle.com/wp-content/uploads/2023/02/Moodle-Trademark-Guidelines-2023-4.pdf)
to help you understand how to comply with Moodle's trade mark requirements.
The Trademark Guidelines will also assist our Moodle Certified Partners and the
community to understand some of the principles that inform Moodle's stance
whenever potential infringement has been detected by us or our community.
Allowed uses
------------
We need to be clear about use of the word "Moodle" and how we restrict its use
when promoting commercial Moodle™ branded services. The proper use of
trade marks reliably assures consumers about the quality of the associated
products or services and where they have been derived from. Because the
Moodle LMS is made available under the open source GNU General Public License'
that permits you to modify the copyrighted software, the distribution of such
modified software in combination with Moodle trade marks can potentially
mislead others in the community. To be clear, the GNU GPL does not include an
implied right or licence to use Moodle's trade marks.
The following uses dont require any permission at all:
We do all this to protect the very business model that allows us to continue
developing various Moodle software solutions for you.
Allowed uses of "Moodle"
------------------------
The following uses don't require any permission at all:
* Referring to the software or the Moodle project as the "Moodle™ software"
or the "Moodle™ project"
* Describing your own implementation of the Moodle™ software platform
(including within corporate settings).
* Referring to the software or the Moodle project.
* Describing your own Moodle implementation (including within corporate
settings).
* Describing a Moodle-based community hub.
* Describing certain software you've made that integrates with Moodle
branded software (e.g. a Moodle integration feature on another system).
* Describing some software youve made that integrates with Moodle
(eg a Moodle integration feature on another system).
Restricted uses of "Moodle"
---------------------------
Restricted uses
---------------
The following uses are generally prohibited without explicit and direct
permission being granted to you by Moodle Pty Ltd. We do this to protect the
Moodle project from software and sites which could confuse people. If in
doubt, reach out for clarification at <trademarks@moodle.com>
Moodle project from software and sites which could confuse people. Please
contact us to ask for permission in writing.
* You can't use the word "Moodle" or any Moodle logos for commercial purposes
without prior written permission from Moodle HQ.
* You can't use "Moodle" in the name of your software (including Mobile apps).
* You can't use "Moodle" in your company name.
* You can't use "Moodle" in your domain name.
* You can't use "Moodle" in advertising-related keywords (such as Adsense).
* You can't use "Moodle" to describe services around Moodle
(such as hosting, training, support, consulting, course creation services,
theme development, customisation, installation, integration, analytics
and certification) that cause consumers to be confused that you are
associated with Moodle HQ if you are not.
This applies even if you do not charge for the services.
Note that usually only Moodle Partners have this permission.
* You cant use "Moodle" in the name of your software (including Mobile apps)
* You cant use "Moodle" in your company name
* You cant use "Moodle" in your domain name
* You cant use "Moodle" in advertising-related keywords (such as Adsense)
* You cant use "Moodle" to describe services around Moodle (such as hosting,
training, support, consulting, course creation services, theme development,
customisation, installation, integration and certification). This applies
even if you do not charge for the services. Note that usually only Moodle
Partners have this permission.
For information about the Moodle Partner Certification Mark as well as for how
to contact us, please see <https://moodle.com/trademarks/>.
-3
View File
@@ -1,3 +0,0 @@
define("core_admin/block_management_table",["exports","./plugin_management_table","core_table/dynamic","core/ajax","core/pending","core/notification"],(function(_exports,_plugin_management_table,_dynamic,_ajax,_pending,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_plugin_management_table=_interopRequireDefault(_plugin_management_table),_pending=_interopRequireDefault(_pending);class _default extends _plugin_management_table.default{constructor(){super(),this.addClickHandler(this.handleBlockProtectToggle)}setBlockProtectState(plugin,state){return(0,_ajax.call)([{methodname:"core_admin_set_block_protection",args:{plugin:plugin,state:state}}])[0]}async handleBlockProtectToggle(tableRoot,e){const stateToggle=e.target.closest('[data-action="toggleprotectstate"]');if(stateToggle){e.preventDefault();const pendingPromise=new _pending.default("core_table/dynamic:processAction");await this.setBlockProtectState(stateToggle.dataset.plugin,"1"===stateToggle.dataset.targetState?1:0);const[updatedRoot]=await Promise.all([(0,_dynamic.refreshTableContent)(tableRoot),(0,_notification.fetchNotifications)()]);updatedRoot.querySelector('[data-action="toggleprotectstate"][data-plugin="'.concat(stateToggle.dataset.plugin,'"]')).focus(),pendingPromise.resolve()}}}return _exports.default=_default,_exports.default}));
//# sourceMappingURL=block_management_table.min.js.map
@@ -1 +0,0 @@
{"version":3,"file":"block_management_table.min.js","sources":["../src/block_management_table.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\nimport PluginManagementTable from './plugin_management_table';\nimport {refreshTableContent} from 'core_table/dynamic';\nimport {call as fetchMany} from 'core/ajax';\nimport Pending from 'core/pending';\nimport {fetchNotifications} from 'core/notification';\n\nexport default class extends PluginManagementTable {\n constructor() {\n super();\n this.addClickHandler(this.handleBlockProtectToggle);\n }\n\n /**\n * Set the block protection state.\n *\n * @param {string} plugin\n * @param {number} state\n * @returns {Promise}\n */\n setBlockProtectState(plugin, state) {\n return fetchMany([{\n methodname: 'core_admin_set_block_protection',\n args: {\n plugin,\n state,\n },\n }])[0];\n }\n\n /**\n * Handle toggling of block protection.\n *\n * @param {HTMLElement} tableRoot\n * @param {Event} e\n */\n async handleBlockProtectToggle(tableRoot, e) {\n const stateToggle = e.target.closest('[data-action=\"toggleprotectstate\"]');\n if (stateToggle) {\n e.preventDefault();\n const pendingPromise = new Pending('core_table/dynamic:processAction');\n\n await this.setBlockProtectState(\n stateToggle.dataset.plugin,\n stateToggle.dataset.targetState === '1' ? 1 : 0\n );\n\n const [updatedRoot] = await Promise.all([\n refreshTableContent(tableRoot),\n fetchNotifications(),\n ]);\n\n // Refocus on the link that as pressed in the first place.\n updatedRoot.querySelector(`[data-action=\"toggleprotectstate\"][data-plugin=\"${stateToggle.dataset.plugin}\"]`).focus();\n pendingPromise.resolve();\n }\n }\n}\n"],"names":["PluginManagementTable","constructor","addClickHandler","this","handleBlockProtectToggle","setBlockProtectState","plugin","state","methodname","args","tableRoot","e","stateToggle","target","closest","preventDefault","pendingPromise","Pending","dataset","targetState","updatedRoot","Promise","all","querySelector","focus","resolve"],"mappings":"uhBAqB6BA,iCACzBC,2BAESC,gBAAgBC,KAAKC,0BAU9BC,qBAAqBC,OAAQC,cAClB,cAAU,CAAC,CACdC,WAAY,kCACZC,KAAM,CACFH,OAAAA,OACAC,MAAAA,UAEJ,kCASuBG,UAAWC,SAChCC,YAAcD,EAAEE,OAAOC,QAAQ,yCACjCF,YAAa,CACbD,EAAEI,uBACIC,eAAiB,IAAIC,iBAAQ,0CAE7Bd,KAAKE,qBACPO,YAAYM,QAAQZ,OACgB,MAApCM,YAAYM,QAAQC,YAAsB,EAAI,SAG3CC,mBAAqBC,QAAQC,IAAI,EACpC,gCAAoBZ,YACpB,wCAIJU,YAAYG,wEAAiEX,YAAYM,QAAQZ,cAAYkB,QAC7GR,eAAeS"}
-3
View File
@@ -1,3 +0,0 @@
define("core_admin/plugin_management_table",["exports","core_table/dynamic","core_table/local/dynamic/selectors","core/ajax","core/pending","core/notification"],(function(_exports,_dynamic,Selectors,_ajax,_pending,_notification){var obj;function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Selectors=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Selectors),_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};let watching=!1;return _exports.default=class{constructor(){!function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value}(this,"clickHandlers",[]),this.addClickHandler(this.handleStateToggle),this.addClickHandler(this.handleMoveUpDown),this.registerEventListeners()}static init(){watching||(watching=!0,new this)}addClickHandler(handler){this.clickHandlers.push(handler.bind(this))}registerEventListeners(){document.addEventListener("click",function(e){const tableRoot=this.getTableRoot(e);tableRoot&&this.clickHandlers.forEach((handler=>handler(tableRoot,e)))}.bind(this))}getTableRoot(e){const tableRoot=e.target.closest(Selectors.main.region);return tableRoot||!1}setPluginState(methodname,plugin,state){return(0,_ajax.call)([{methodname:methodname,args:{plugin:plugin,state:state}}])[0]}setPluginOrder(methodname,plugin,direction){return(0,_ajax.call)([{methodname:methodname,args:{plugin:plugin,direction:direction}}])[0]}async handleStateToggle(tableRoot,e){const stateToggle=e.target.closest('[data-action="togglestate"][data-toggle-method]');if(stateToggle){e.preventDefault();const pendingPromise=new _pending.default("core_table/dynamic:togglestate");await this.setPluginState(stateToggle.dataset.toggleMethod,stateToggle.dataset.plugin,"1"===stateToggle.dataset.state?0:1);const[updatedRoot]=await Promise.all([(0,_dynamic.refreshTableContent)(tableRoot),(0,_notification.fetchNotifications)()]);updatedRoot.querySelector('[data-action="togglestate"][data-plugin="'.concat(stateToggle.dataset.plugin,'"]')).focus(),pendingPromise.resolve()}}async handleMoveUpDown(tableRoot,e){const actionLink=e.target.closest('[data-action="move"][data-method][data-direction]');if(!actionLink)return;e.preventDefault();const pendingPromise=new _pending.default("core_table/dynamic:processAction");await this.setPluginOrder(actionLink.dataset.method,actionLink.dataset.plugin,"up"===actionLink.dataset.direction?-1:1);const[updatedRoot]=await Promise.all([(0,_dynamic.refreshTableContent)(tableRoot),(0,_notification.fetchNotifications)()]),exactMatch=updatedRoot.querySelector('[data-action="move"][data-plugin="'.concat(actionLink.dataset.plugin,'"][data-direction="').concat(actionLink.dataset.direction,'"]'));var _updatedRoot$querySel;exactMatch?exactMatch.focus():null===(_updatedRoot$querySel=updatedRoot.querySelector('[data-action="move"][data-plugin="'.concat(actionLink.dataset.plugin,'"]')))||void 0===_updatedRoot$querySel||_updatedRoot$querySel.focus();pendingPromise.resolve()}},_exports.default}));
//# sourceMappingURL=plugin_management_table.min.js.map
File diff suppressed because one or more lines are too long
-72
View File
@@ -1,72 +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/>.
import PluginManagementTable from './plugin_management_table';
import {refreshTableContent} from 'core_table/dynamic';
import {call as fetchMany} from 'core/ajax';
import Pending from 'core/pending';
import {fetchNotifications} from 'core/notification';
export default class extends PluginManagementTable {
constructor() {
super();
this.addClickHandler(this.handleBlockProtectToggle);
}
/**
* Set the block protection state.
*
* @param {string} plugin
* @param {number} state
* @returns {Promise}
*/
setBlockProtectState(plugin, state) {
return fetchMany([{
methodname: 'core_admin_set_block_protection',
args: {
plugin,
state,
},
}])[0];
}
/**
* Handle toggling of block protection.
*
* @param {HTMLElement} tableRoot
* @param {Event} e
*/
async handleBlockProtectToggle(tableRoot, e) {
const stateToggle = e.target.closest('[data-action="toggleprotectstate"]');
if (stateToggle) {
e.preventDefault();
const pendingPromise = new Pending('core_table/dynamic:processAction');
await this.setBlockProtectState(
stateToggle.dataset.plugin,
stateToggle.dataset.targetState === '1' ? 1 : 0
);
const [updatedRoot] = await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
// Refocus on the link that as pressed in the first place.
updatedRoot.querySelector(`[data-action="toggleprotectstate"][data-plugin="${stateToggle.dataset.plugin}"]`).focus();
pendingPromise.resolve();
}
}
}
-179
View File
@@ -1,179 +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/>.
import {refreshTableContent} from 'core_table/dynamic';
import * as Selectors from 'core_table/local/dynamic/selectors';
import {call as fetchMany} from 'core/ajax';
import Pending from 'core/pending';
import {fetchNotifications} from 'core/notification';
let watching = false;
export default class {
/**
* @property {function[]} clickHandlers a list of handlers to call on click.
*/
clickHandlers = [];
constructor() {
this.addClickHandler(this.handleStateToggle);
this.addClickHandler(this.handleMoveUpDown);
this.registerEventListeners();
}
/**
* Initialise an instance of the class.
*
* This is just a way of making it easier to initialise an instance of the class from PHP.
*/
static init() {
if (watching) {
return;
}
watching = true;
new this();
}
/**
* Add a click handler to the list of handlers.
*
* @param {Function} handler A handler to call on a click event
*/
addClickHandler(handler) {
this.clickHandlers.push(handler.bind(this));
}
/**
* Register the event listeners for this instance.
*/
registerEventListeners() {
document.addEventListener('click', function(e) {
const tableRoot = this.getTableRoot(e);
if (!tableRoot) {
return;
}
this.clickHandlers.forEach((handler) => handler(tableRoot, e));
}.bind(this));
}
/**
* Get the table root from an event.
*
* @param {Event} e
* @returns {HTMLElement|bool}
*/
getTableRoot(e) {
const tableRoot = e.target.closest(Selectors.main.region);
if (!tableRoot) {
return false;
}
return tableRoot;
}
/**
* Set the plugin state (enabled or disabled)
*
* @param {string} methodname The web service to call
* @param {string} plugin The name of the plugin to set the state for
* @param {number} state The state to set
* @returns {Promise}
*/
setPluginState(methodname, plugin, state) {
return fetchMany([{
methodname,
args: {
plugin,
state,
},
}])[0];
}
setPluginOrder(methodname, plugin, direction) {
return fetchMany([{
methodname,
args: {
plugin,
direction,
},
}])[0];
}
/**
* Handle state toggling.
*
* @param {HTMLElement} tableRoot
* @param {Event} e
*/
async handleStateToggle(tableRoot, e) {
const stateToggle = e.target.closest('[data-action="togglestate"][data-toggle-method]');
if (stateToggle) {
e.preventDefault();
const pendingPromise = new Pending('core_table/dynamic:togglestate');
await this.setPluginState(
stateToggle.dataset.toggleMethod,
stateToggle.dataset.plugin,
stateToggle.dataset.state === '1' ? 0 : 1
);
const [updatedRoot] = await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
// Refocus on the link that as pressed in the first place.
updatedRoot.querySelector(`[data-action="togglestate"][data-plugin="${stateToggle.dataset.plugin}"]`).focus();
pendingPromise.resolve();
}
}
async handleMoveUpDown(tableRoot, e) {
const actionLink = e.target.closest('[data-action="move"][data-method][data-direction]');
if (!actionLink) {
return;
}
e.preventDefault();
const pendingPromise = new Pending('core_table/dynamic:processAction');
await this.setPluginOrder(
actionLink.dataset.method,
actionLink.dataset.plugin,
actionLink.dataset.direction === 'up' ? -1 : 1,
);
const [updatedRoot] = await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
// Refocus on the link that as pressed in the first place.
const exactMatch = updatedRoot.querySelector(
`[data-action="move"][data-plugin="${actionLink.dataset.plugin}"][data-direction="${actionLink.dataset.direction}"]`
);
if (exactMatch) {
exactMatch.focus();
} else {
// The move link is not present anymore, so we need to focus on the other one.
updatedRoot.querySelector(`[data-action="move"][data-plugin="${actionLink.dataset.plugin}"]`)?.focus();
}
pendingPromise.resolve();
}
}
+9 -16
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";
@@ -54,19 +55,18 @@ if (!confirm_sesskey()) {
redirect($returnurl);
}
$needsupdate = false;
switch ($action) {
case 'disable':
// Remove from enabled list.
$class = \core_plugin_manager::resolve_plugininfo_class('antivirus');
$class::enable_plugin($antivirus, false);
$key = array_search($antivirus, $activeantiviruses);
unset($activeantiviruses[$key]);
break;
case 'enable':
// Add to enabled list.
if (!in_array($antivirus, $activeantiviruses)) {
$class = \core_plugin_manager::resolve_plugininfo_class('antivirus');
$class::enable_plugin($antivirus, true);
$activeantiviruses[] = $antivirus;
$activeantiviruses = array_unique($activeantiviruses);
}
break;
@@ -79,7 +79,6 @@ switch ($action) {
$fsave = $activeantiviruses[$key];
$activeantiviruses[$key] = $activeantiviruses[$key + 1];
$activeantiviruses[$key + 1] = $fsave;
$needsupdate = true;
}
}
break;
@@ -93,7 +92,6 @@ switch ($action) {
$fsave = $activeantiviruses[$key];
$activeantiviruses[$key] = $activeantiviruses[$key - 1];
$activeantiviruses[$key - 1] = $fsave;
$needsupdate = true;
}
}
break;
@@ -102,12 +100,7 @@ switch ($action) {
break;
}
if ($needsupdate) {
$new = implode(',', $activeantiviruses);
add_to_config_log('antiviruses', $CFG->antiviruses, $new, 'core');
set_config('antiviruses', $new);
core_plugin_manager::reset_caches();
}
set_config('antiviruses', implode(',', $activeantiviruses));
core_plugin_manager::reset_caches();
redirect ($returnurl);
redirect ($returnurl);
+29 -16
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'));
@@ -28,7 +29,7 @@ if (empty($CFG->auth)) {
}
if (!empty($auth) and !exists_auth_plugin($auth)) {
throw new \moodle_exception('pluginnotinstalled', 'auth', $returnurl, $auth);
print_error('pluginnotinstalled', 'auth', $returnurl, $auth);
}
////////////////////////////////////////////////////////////////////////////////
@@ -40,31 +41,43 @@ if (!confirm_sesskey()) {
switch ($action) {
case 'disable':
// Remove from enabled list.
$class = \core_plugin_manager::resolve_plugininfo_class('auth');
$class::enable_plugin($auth, false);
// remove from enabled list
$key = array_search($auth, $authsenabled);
if ($key !== false) {
unset($authsenabled[$key]);
set_config('auth', implode(',', $authsenabled));
}
if ($auth == $CFG->registerauth) {
set_config('registerauth', '');
}
\core\session\manager::gc(); // Remove stale sessions.
core_plugin_manager::reset_caches();
break;
case 'enable':
// Add to enabled list.
$class = \core_plugin_manager::resolve_plugininfo_class('auth');
$class::enable_plugin($auth, true);
// add to enabled list
if (!in_array($auth, $authsenabled)) {
$authsenabled[] = $auth;
$authsenabled = array_unique($authsenabled);
set_config('auth', implode(',', $authsenabled));
}
\core\session\manager::gc(); // Remove stale sessions.
core_plugin_manager::reset_caches();
break;
case 'down':
$key = array_search($auth, $authsenabled);
// check auth plugin is valid
if ($key === false) {
throw new \moodle_exception('pluginnotenabled', 'auth', $returnurl, $auth);
print_error('pluginnotenabled', 'auth', $returnurl, $auth);
}
// move down the list
if ($key < (count($authsenabled) - 1)) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key + 1];
$authsenabled[$key + 1] = $fsave;
$value = implode(',', $authsenabled);
add_to_config_log('auth', $CFG->auth, $value, 'core');
set_config('auth', $value);
set_config('auth', implode(',', $authsenabled));
}
break;
@@ -72,16 +85,14 @@ switch ($action) {
$key = array_search($auth, $authsenabled);
// check auth is valid
if ($key === false) {
throw new \moodle_exception('pluginnotenabled', 'auth', $returnurl, $auth);
print_error('pluginnotenabled', 'auth', $returnurl, $auth);
}
// move up the list
if ($key >= 1) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key - 1];
$authsenabled[$key - 1] = $fsave;
$value = implode(',', $authsenabled);
add_to_config_log('auth', $CFG->auth, $value, 'core');
set_config('auth', $value);
set_config('auth', implode(',', $authsenabled));
}
break;
@@ -90,3 +101,5 @@ switch ($action) {
}
redirect($returnurl);
+189
View File
@@ -0,0 +1,189 @@
<?php
/**
* Edit configuration for an individual auth plugin
*/
require_once '../config.php';
require_once $CFG->libdir.'/adminlib.php';
$auth = required_param('auth', PARAM_PLUGIN);
$PAGE->set_pagetype('admin-auth-' . $auth);
admin_externalpage_setup('authsetting'.$auth);
$authplugin = get_auth_plugin($auth);
$err = array();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
// save configuration changes
if ($frm = data_submitted() and confirm_sesskey()) {
$authplugin->validate_form($frm, $err);
if (count($err) == 0) {
// save plugin config
if ($authplugin->process_config($frm)) {
// save field lock configuration
foreach ($frm as $name => $value) {
if (preg_match('/^lockconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
$name = $matches[1];
set_config($name, $value, $plugin);
}
}
redirect($returnurl);
exit;
}
} else {
foreach ($err as $key => $value) {
$focus = "form.$key";
}
}
} else {
$frmlegacystyle = get_config('auth/'.$auth);
$frmnewstyle = get_config('auth_'.$auth);
$frm = (object)array_merge((array)$frmlegacystyle, (array)$frmnewstyle);
}
$user_fields = $authplugin->userfields;
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
/// Get the auth title (from core or own auth lang files)
$authtitle = $authplugin->get_title();
/// Get the auth descriptions (from core or own auth lang files)
$authdescription = $authplugin->get_description();
// output configuration form
echo $OUTPUT->header();
// choose an authentication method
echo "<form id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
// HACK to prevent browsers from automatically inserting the user's password into the wrong fields.
echo prevent_form_autofill_password();
// auth plugin description
echo $OUTPUT->box_start();
echo $OUTPUT->heading($authtitle);
echo $OUTPUT->box_start('informationbox');
echo $authdescription;
echo $OUTPUT->box_end();
echo "<hr />\n";
$authplugin->config_form($frm, $err, $user_fields);
echo $OUTPUT->box_end();
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
echo "</div>\n";
echo "</form>\n";
$PAGE->requires->string_for_js('unmaskpassword', 'core_form');
$PAGE->requires->yui_module('moodle-auth-passwordunmask', 'M.auth.passwordunmask');
echo $OUTPUT->footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////
// Good enough for most auth plugins
// but some may want a custom one if they are offering
// other options
// Note: lockconfig_ fields have special handling.
function print_auth_lock_options($auth, $user_fields, $helptext, $retrieveopts, $updateopts, $customfields = array()) {
global $DB, $OUTPUT;
echo '<tr><td colspan="3">';
if ($retrieveopts) {
echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth'));
} else {
echo $OUTPUT->heading(get_string('auth_fieldlocks', 'auth'));
}
echo '</td></tr>';
$lockoptions = array ('unlocked' => get_string('unlocked', 'auth'),
'unlockedifempty' => get_string('unlockedifempty', 'auth'),
'locked' => get_string('locked', 'auth'));
$updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'),
'onlogin' => get_string('update_onlogin', 'auth'));
$updateextoptions = array('0' => get_string('update_never', 'auth'),
'1' => get_string('update_onupdate', 'auth'));
$pluginconfig = get_config("auth/$auth");
// Helptext is on a field with rowspan.
if (empty($helptext)) {
$helptext = '&nbsp;';
}
// If we have custom fields then merge them with user fields.
if (!empty($customfields)) {
$user_fields = array_merge($user_fields, $customfields);
}
if (!empty($customfields)) {
$customfieldname = $DB->get_records('user_info_field', null, '', 'shortname, name');
}
foreach ($user_fields as $field) {
// Define some vars we'll work with.
if (!isset($pluginconfig->{"field_map_$field"})) {
$pluginconfig->{"field_map_$field"} = '';
}
if (!isset($pluginconfig->{"field_updatelocal_$field"})) {
$pluginconfig->{"field_updatelocal_$field"} = '';
}
if (!isset($pluginconfig->{"field_updateremote_$field"})) {
$pluginconfig->{"field_updateremote_$field"} = '';
}
if (!isset($pluginconfig->{"field_lock_$field"})) {
$pluginconfig->{"field_lock_$field"} = '';
}
// Define the fieldname we display to the user.
$fieldname = $field;
if ($fieldname === 'lang') {
$fieldname = get_string('language');
} elseif (!empty($customfields) && in_array($field, $customfields)) {
// If custom field then pick name from database.
$fieldshortname = str_replace('profile_field_', '', $fieldname);
$fieldname = $customfieldname[$fieldshortname]->name;
} elseif ($fieldname == 'url') {
$fieldname = get_string('webpage');
} else {
$fieldname = get_string($fieldname);
}
if ($retrieveopts) {
$varname = 'field_map_' . $field;
echo '<tr valign="top"><td align="right">';
echo '<label for="lockconfig_'.$varname.'">'.$fieldname.'</label>';
echo '</td><td>';
echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\" />";
echo '<div style="text-align: right">';
echo '<label for="menulockconfig_field_updatelocal_'.$field.'">'.get_string('auth_updatelocal', 'auth') . '</label>&nbsp;';
echo html_writer::select($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, false);
echo '<br />';
if ($updateopts) {
echo '<label for="menulockconfig_field_updateremote_'.$field.'">'.get_string('auth_updateremote', 'auth') . '</label>&nbsp;';
echo html_writer::select($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, false);
echo '<br />';
}
echo '<label for="menulockconfig_field_lock_'.$field.'">'.get_string('auth_fieldlock', 'auth') . '</label>&nbsp;';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
echo '</div>';
} else {
echo '<tr valign="top"><td align="right">';
echo '<label for="menulockconfig_field_lock_'.$field.'">'.$fieldname.'</label>';
echo '</td><td>';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
}
echo '</td>';
if (!empty($helptext)) {
echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
$helptext = '';
}
echo '</tr>';
}
}
+242 -79
View File
@@ -1,94 +1,257 @@
<?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 configure blocks (hide/show, uninstall and configure)
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Allows the admin to configure blocks (hide/show, uninstall and configure)
require_once('../config.php');
require_once("{$CFG->libdir}/adminlib.php");
require_once("{$CFG->libdir}/blocklib.php");
require_once("{$CFG->libdir}/tablelib.php");
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('manageblocks');
admin_externalpage_setup('manageblocks');
$plugin = optional_param('plugin', '', PARAM_PLUGIN);
$action = optional_param('action', '', PARAM_ALPHA);
$unprotect = optional_param('unprotect', 0, PARAM_PLUGIN);
$protect = optional_param('protect', 0, PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$unprotect = optional_param('unprotect', 0, PARAM_INT);
$protect = optional_param('protect', 0, PARAM_INT);
$strmanageblocks = get_string('manageblocks');
/// Print headings
// If data submitted, then process and store.
if (!empty($plugin) && !empty($action) && confirm_sesskey()) {
$manager = \core_plugin_manager::resolve_plugininfo_class('block');
$pluginname = get_string('pluginname', "block_{$plugin}");
$strmanageblocks = get_string('manageblocks');
$struninstall = get_string('uninstallplugin', 'core_admin');
$strversion = get_string('version');
$strhide = get_string('hide');
$strshow = get_string('show');
$strsettings = get_string('settings');
$strcourses = get_string('blockinstances', 'admin');
$strname = get_string('name');
$strshowblockcourse = get_string('showblockcourse');
$strprotecthdr = get_string('blockprotect', 'admin'). $OUTPUT->help_icon('blockprotect','admin');
$strprotect = get_string('blockprotect', 'admin');
$strunprotect = get_string('blockunprotect', 'admin');
if ($action === 'disable' && $manager::enable_plugin($plugin, 0)) {
\core\notification::add(
get_string('plugin_disabled', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
// Settings not required - only pages.
admin_get_root(true, false);
} else if ($action === 'enable' && $manager::enable_plugin($plugin, 1)) {
\core\notification::add(
get_string('plugin_enabled', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
/// If data submitted, then process and store.
// Settings not required - only pages.
admin_get_root(true, false);
if (!empty($hide) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$hide))) {
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '0', array('id'=>$block->id)); // Hide block
add_to_config_log('block_visibility', $block->visible, '0', $block->name);
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
}
// Redirect back to the page with out any params.
redirect(new moodle_url('/admin/blocks.php'));
}
if (!empty($show) && confirm_sesskey() ) {
if (!$block = $DB->get_record('block', array('id'=>$show))) {
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '1', array('id'=>$block->id)); // Show block
add_to_config_log('block_visibility', $block->visible, '1', $block->name);
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($protect) && confirm_sesskey()) {
block_manager::protect_block($protect);
$pluginname = get_string('pluginname', "block_{$protect}");
\core\notification::add(
get_string('blockprotected', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
// Settings not required - only pages.
admin_get_root(true, false);
}
if (!isset($CFG->undeletableblocktypes) || (!is_array($CFG->undeletableblocktypes) && !is_string($CFG->undeletableblocktypes))) {
$undeletableblocktypes = array('navigation', 'settings');
} else if (is_string($CFG->undeletableblocktypes)) {
$undeletableblocktypes = explode(',', $CFG->undeletableblocktypes);
} else {
$undeletableblocktypes = $CFG->undeletableblocktypes;
}
if (!empty($unprotect) && confirm_sesskey()) {
block_manager::unprotect_block($unprotect);
$pluginname = get_string('pluginname', "block_{$unprotect}");
\core\notification::add(
get_string('blockunprotected', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
// Settings not required - only pages.
admin_get_root(true, false);
}
if (!empty($protect) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$protect))) {
print_error('blockdoesnotexist', 'error');
}
if (!in_array($block->name, $undeletableblocktypes)) {
$undeletableblocktypes[] = $block->name;
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
add_to_config_log('block_protect', $unprotect, $protect, $block->name);
}
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($unprotect) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$unprotect))) {
print_error('blockdoesnotexist', 'error');
}
if (in_array($block->name, $undeletableblocktypes)) {
$undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
add_to_config_log('block_protect', $unprotect, $protect, $block->name);
}
admin_get_root(true, false); // settings not required - only pages
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
if (!$blocks = $DB->get_records('block', array(), 'name ASC')) {
print_error('noblocks', 'error'); // Should never happen
}
$incompatible = array();
/// Print the table of all blocks
$table = new flexible_table('admin-blocks-compatible');
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'settings', 'uninstall'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strsettings, $struninstall));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'admintable blockstable generaltable');
$table->set_attribute('id', 'compatibleblockstable');
$table->setup();
$tablerows = array();
// Sort blocks using current locale.
$blocknames = array();
foreach ($blocks as $blockid=>$block) {
$blockname = $block->name;
if (file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blocknames[$blockid] = get_string('pluginname', 'block_'.$blockname);
} else {
$blocknames[$blockid] = $blockname;
}
}
core_collator::asort($blocknames);
foreach ($blocknames as $blockid=>$strblockname) {
$block = $blocks[$blockid];
$blockname = $block->name;
$dbversion = get_config('block_'.$block->name, 'version');
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$strblockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new stdClass();
$plugin->version = $dbversion;
} else {
$plugin = new stdClass();
$plugin->version = '???';
if (file_exists("$CFG->dirroot/blocks/$blockname/version.php")) {
include("$CFG->dirroot/blocks/$blockname/version.php");
}
if (!$blockobject = block_instance($block->name)) {
$incompatible[] = $block;
continue;
}
}
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_'.$blockname, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $struninstall);
} else {
$uninstall = '';
}
$settings = ''; // By default, no configuration
if ($blockobject and $blockobject->has_config()) {
$blocksettings = admin_get_root()->locate('blocksetting' . $block->name);
if ($blocksettings instanceof admin_externalpage) {
$settings = '<a href="' . $blocksettings->url . '">' . get_string('settings') . '</a>';
} else if ($blocksettings instanceof admin_settingpage) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else if (!file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
// If the block's settings node was not found, we check that the block really provides the settings.php file.
// Note that blocks can inject their settings to other nodes in the admin tree without using the default locations.
// This can be done by assigning null to $setting in settings.php and it is a valid case.
debugging('Warning: block_'.$block->name.' returns true in has_config() but does not provide a settings.php file',
DEBUG_DEVELOPER);
}
}
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
// and it should not show up on course search page
$totalcount = $DB->count_records('block_instances', array('blockname'=>$blockname));
$count = $DB->count_records('block_instances', array('blockname'=>$blockname, 'pagetypepattern'=>'course-view-*'));
if ($count>0) {
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&amp;sesskey=".sesskey()."\" ";
$blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
}
else {
$blocklist = "$totalcount";
}
$class = ''; // Nothing fancy, by default
if (!$blockobject) {
// ignore
$visible = '';
} else if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strhide.'">'.
'<img src="'.$OUTPUT->pix_url('t/hide') . '" class="iconsmall" alt="'.$strhide.'" /></a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strshow.'">'.
'<img src="'.$OUTPUT->pix_url('t/show') . '" class="iconsmall" alt="'.$strshow.'" /></a>';
$class = 'dimmed_text';
}
if ($dbversion == $plugin->version) {
$version = $dbversion;
} else {
$version = "$dbversion ($plugin->version)";
}
if (!$blockobject) {
// ignore
$undeletable = '';
} else if (in_array($blockname, $undeletableblocktypes)) {
$undeletable = '<a href="blocks.php?unprotect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strunprotect.'">'.
'<img src="'.$OUTPUT->pix_url('t/unlock') . '" class="iconsmall" alt="'.$strunprotect.'" /></a>';
} else {
$undeletable = '<a href="blocks.php?protect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strprotect.'">'.
'<img src="'.$OUTPUT->pix_url('t/lock') . '" class="iconsmall" alt="'.$strprotect.'" /></a>';
}
$row = array(
$strblockname,
$blocklist,
$version,
$visible,
$undeletable,
$settings,
$uninstall,
);
$table->add_data($row, $class);
}
$table->print_html();
if (!empty($incompatible)) {
echo $OUTPUT->heading(get_string('incompatibleblocks', 'blockstable', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'uninstall'));
$table->define_headers(array($strname, $struninstall));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
$table->setup();
foreach ($incompatible as $block) {
if ($uninstallurl = core_plugin_manager::instance()->get_uninstall_url('block_'.$block->name, 'manage')) {
$uninstall = html_writer::link($uninstallurl, $struninstall);
} else {
$uninstall = '';
}
$table->add_data(array(
$block->name,
$uninstall,
));
}
$table->print_html();
}
echo $OUTPUT->footer();
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
echo $OUTPUT->notification(get_string('noteunneededblocks', 'admin'), 'info', false);
// Print the table of all blocks.
$table = new \core_admin\table\block_management_table();
$table->out();
echo $OUTPUT->footer();
+23 -28
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));
@@ -41,34 +42,26 @@ $adminroot = admin_get_root(); // need all settings
$settingspage = $adminroot->locate($category, true);
if (empty($settingspage) or !($settingspage instanceof admin_category)) {
throw new \moodle_exception('categoryerror', 'error', "$CFG->wwwroot/$CFG->admin/");
print_error('categoryerror', 'admin', "$CFG->wwwroot/$CFG->admin/");
}
if (!($settingspage->check_access())) {
throw new \moodle_exception('accessdenied', 'admin');
print_error('accessdenied', 'admin');
}
$hassiteconfig = has_capability('moodle/site:config', $PAGE->context);
if ($hassiteconfig) {
$PAGE->add_header_action($OUTPUT->render_from_template('core_admin/header_search_input', [
'action' => new moodle_url('/admin/search.php'),
]));
}
$statusmsg = '';
$errormsg = '';
if ($data = data_submitted() and confirm_sesskey()) {
$count = admin_write_settings($data);
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
}
if (empty($adminroot->errors)) {
// No errors. Did we change any setting? If so, then indicate success.
if ($count) {
$statusmsg = get_string('changessaved');
} else {
switch ($return) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
switch ($return) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
} else {
$errormsg = get_string('errorwithsettings', 'admin');
@@ -80,8 +73,8 @@ if ($data = data_submitted() and confirm_sesskey()) {
if ($PAGE->user_allowed_editing() && $adminediting != -1) {
$USER->editing = $adminediting;
}
$buttons = null;
if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) {
if ($PAGE->user_allowed_editing()) {
$url = clone($PAGE->url);
if ($PAGE->user_is_editing()) {
$caption = get_string('blockseditoff');
@@ -127,15 +120,14 @@ foreach ($settingspage->children as $childpage) {
}
if ($savebutton) {
$outputhtml .= html_writer::start_tag('div', array('class' => 'form-buttons'));
$outputhtml .= html_writer::empty_tag('input', array('class' => 'btn btn-primary form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
$outputhtml .= html_writer::empty_tag('input', array('class' => 'form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
$outputhtml .= html_writer::end_tag('div');
}
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $settingspage->visiblepath));
$visiblepathtosection = array_reverse($settingspage->visiblepath);
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
if ($buttons) {
$PAGE->set_button($buttons);
}
$PAGE->set_button($buttons);
echo $OUTPUT->header();
@@ -145,7 +137,13 @@ if ($errormsg !== '') {
echo $OUTPUT->notification($statusmsg, 'notifysuccess');
}
echo $OUTPUT->heading(get_string('admincategory', 'admin', $settingspage->visiblename), 2);
$path = array_reverse($settingspage->visiblepath);
if (is_array($path)) {
$visiblename = join(' / ', $path);
} else {
$visiblename = $path;
}
echo $OUTPUT->heading(get_string('admincategory', 'admin', $visiblename), 2);
echo html_writer::start_tag('form', array('action' => '', 'method' => 'post', 'id' => 'adminsettings'));
echo html_writer::start_tag('div');
@@ -157,7 +155,4 @@ echo $outputhtml;
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
// Add the form change checker.
$PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['adminsettings']);
echo $OUTPUT->footer();
@@ -1,127 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\admin;
use admin_setting;
use core_plugin_manager;
use core_text;
/**
* Admin setting plugin manager.
*
* @package core_admin
* @subpackage admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_plugin_manager extends admin_setting {
/** @var core_plugin_manager The plugin manager instance */
protected core_plugin_manager $pluginmanager;
/** @var string The plugintype that this manager covers */
protected string $plugintype;
/** @var string The class of the management table to use */
protected string $tableclass;
public function __construct(
string $plugintype,
string $tableclass,
string $name,
string $visiblename,
string $description = '',
string $defaultsetting = '',
) {
$this->nosave = true;
$this->pluginmanager = core_plugin_manager::instance();
$this->plugintype = $plugintype;
$this->tableclass = $tableclass;
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
/**
* Always returns true, does nothing
*
* @return true
*/
public function get_setting(): bool {
return true;
}
/**
* Always returns true, does nothing
*
* @return true
*/
public function get_defaultsetting(): bool {
return true;
}
/**
* Always returns '', does not write anything
*
* @return string Always returns ''
*/
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
public function write_setting($data): string {
// Do not write any setting.
return '';
}
/**
* Checks if $query is one of the available editors
*
* @param string $query The string to search for
* @return bool Returns true if found, false if not
*/
public function is_related($query) {
if (parent::is_related($query)) {
return true;
}
$plugins = $this->pluginmanager->get_installed_plugins($this->plugintype);
foreach (array_keys($plugins) as $plugin) {
$plugin = "{$this->plugintype}_{$plugin}";
if (str_contains($plugin, $query)) {
return true;
}
$pluginname = get_string('pluginname', $plugin);
if (strpos(core_text::strtolower($pluginname), $query) !== false) {
return true;
}
}
return false;
}
/**
* Builds the XHTML to display the control
*
* @param string $data Unused
* @param string $query
* @return string
*/
public function output_html($data, $query = ''): string {
$table = new $this->tableclass();
if (!($table instanceof \core_admin\table\plugin_management_table)) {
throw new \coding_exception("{$this->tableclass} must be an instance of \\core_admin\\table\\plugin_management_table");
}
return highlight($query, $table->get_content());
}
}
-97
View File
@@ -1,97 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\external;
use block_manager;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
/**
* Web Service to control the state of a plugin.
*
* @package core_admin
* @category external
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class set_block_protection extends external_api {
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters([
'plugin' => new external_value(PARAM_PLUGIN, 'The name of the plugin', VALUE_REQUIRED),
'state' => new external_value(PARAM_INT, 'The target state', VALUE_REQUIRED),
]);
}
/**
* Set the block protection state.
*
* @param string $plugin The name of the plugin
* @param int $state The target state
* @return null
*/
public static function execute(
string $plugin,
int $state,
): array {
[
'plugin' => $plugin,
'state' => $state,
] = self::validate_parameters(self::execute_parameters(), [
'plugin' => $plugin,
'state' => $state,
]);
$context = \context_system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[, $pluginname] = explode('_', \core_component::normalize_componentname($plugin), 2);
$displayname = get_string('pluginname', $plugin);
if ($state) {
block_manager::protect_block($pluginname);
\core\notification::add(
get_string('blockprotected', 'core_admin', $displayname),
\core\notification::SUCCESS
);
} else {
block_manager::unprotect_block($pluginname);
\core\notification::add(
get_string('blockunprotected', 'core_admin', $displayname),
\core\notification::SUCCESS
);
}
return [];
}
/**
* Describe the return structure of the external service.
*
* @return external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([]);
}
}
-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/>.
namespace core_admin\external;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
/**
* Web Service to control the order of a plugin.
*
* @package core_admin
* @category external
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class set_plugin_order extends external_api {
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters([
'plugin' => new external_value(PARAM_PLUGIN, 'The name of the plugin', VALUE_REQUIRED),
'direction' => new external_value(PARAM_INT, 'The direction to move', VALUE_REQUIRED),
]);
}
/**
* Set the plugin state.
*
* @param string $plugin The name of the plugin
* @param int $direction The direction to move the plugin
* @return array
*/
public static function execute(
string $plugin,
int $direction,
): array {
[
'plugin' => $plugin,
'direction' => $direction,
] = self::validate_parameters(self::execute_parameters(), [
'plugin' => $plugin,
'direction' => $direction,
]);
$context = \context_system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[$plugintype, $pluginname] = explode('_', \core_component::normalize_componentname($plugin), 2);
$manager = \core_plugin_manager::resolve_plugininfo_class($plugintype);
$manager::change_plugin_order($pluginname, $direction);
return [];
}
/**
* Describe the return structure of the external service.
*
* @return external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([]);
}
}
-98
View File
@@ -1,98 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\external;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
/**
* Web Service to control the state of a plugin.
*
* @package core_admin
* @category external
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class set_plugin_state extends external_api {
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters([
'plugin' => new external_value(PARAM_PLUGIN, 'The name of the plugin', VALUE_REQUIRED),
'state' => new external_value(PARAM_INT, 'The target state', VALUE_REQUIRED),
]);
}
/**
* Set the plugin state.
*
* @param string $plugin The name of the plugin
* @param int $state The target state
* @return null
*/
public static function execute(
string $plugin,
int $state,
): array {
[
'plugin' => $plugin,
'state' => $state,
] = self::validate_parameters(self::execute_parameters(), [
'plugin' => $plugin,
'state' => $state,
]);
$context = \context_system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[$plugintype, $pluginname] = explode('_', \core_component::normalize_componentname($plugin), 2);
$manager = \core_plugin_manager::resolve_plugininfo_class($plugintype);
$displayname = get_string('pluginname', $plugin);
if ($manager::enable_plugin($pluginname, $state)) {
if (!empty($state)) {
\core\notification::add(
get_string('plugin_enabled', 'core_admin', $displayname),
\core\notification::SUCCESS
);
} else {
\core\notification::add(
get_string('plugin_disabled', 'core_admin', $displayname),
\core\notification::SUCCESS
);
}
}
return [];
}
/**
* Describe the return structure of the external service.
*
* @return external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([]);
}
}
-76
View File
@@ -1,76 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Form for selective purging of caches.
*
* @package core
* @copyright 2018 The Open University
* @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');
/**
* Form for selecting which caches to purge on admin/purgecaches.php
*
* @package core
* @copyright 2018 The Open University
* @author Mark Johnson <mark.johnson@open.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class purge_caches extends \moodleform {
/**
* Define a "Purge all caches" button, and a fieldset with checkboxes for selectively purging separate caches.
*/
public function definition() {
$mform = $this->_form;
$mform->addElement('hidden', 'returnurl', $this->_customdata['returnurl']);
$mform->setType('returnurl', PARAM_LOCALURL);
$mform->addElement('submit', 'all', get_string('purgecaches', 'admin'));
$mform->addElement('header', 'purgecacheheader', get_string('purgeselectedcaches', 'admin'));
$checkboxes = [
$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'))
];
$mform->addGroup($checkboxes, 'purgeselectedoptions');
$mform->addElement('submit', 'purgeselectedcaches', get_string('purgeselectedcaches', 'admin'));
}
/**
* If the "Purge selected caches" button was pressed, ensure at least one cache was selected.
*
* @param array $data
* @param array $files
* @return array Error messages
*/
public function validation($data, $files) {
$errors = [];
if (isset($data['purgeselectedcaches']) && empty(array_filter($data['purgeselectedoptions']))) {
$errors['purgeselectedoptions'] = get_string('purgecachesnoneselected', 'admin');
}
return $errors;
}
}
@@ -1,92 +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', 'autocomplete' => 'email'];
$mform->addElement('text', 'recipient', get_string('testoutgoingmailconf_toemail', 'admin'), $options);
$mform->setType('recipient', PARAM_EMAIL);
$mform->addRule('recipient', get_string('required'), 'required');
// From user.
$options = ['maxlength' => '100', 'size' => '25'];
$mform->addElement('text', 'from', get_string('testoutgoingmailconf_fromemail', 'admin'), $options);
$mform->setType('from', PARAM_TEXT);
$mform->addHelpButton('from', 'testoutgoingmailconf_fromemail', 'admin');
// Additional subject text.
$options = ['size' => '25'];
$mform->addElement('text', 'additionalsubject', get_string('testoutgoingmailconf_subjectadditional', 'admin'), $options);
$mform->setType('additionalsubject', PARAM_TEXT);
$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');
}
/**
* Validate Form field, should be a valid email format or a username that matches with a Moodle user.
*
* @param array $data
* @param array $files
* @return array
* @throws \dml_exception|\coding_exception
*/
public function validation($data, $files): array {
$errors = parent::validation($data, $files);
if (isset($data['from']) && $data['from']) {
$userfrom = \core_user::get_user_by_username($data['from']);
if (!$userfrom && !validate_email($data['from'])) {
$errors['from'] = get_string('testoutgoingmailconf_fromemail_invalid', 'admin');
}
}
return $errors;
}
}
@@ -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/>.
/**
* External admin page class that allows a callback to be provided to determine whether page can be accessed
*
* @package core_admin
* @copyright 2019 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\externalpage;
use admin_externalpage;
defined('MOODLE_INTERNAL') || die();
require_once("{$CFG->libdir}/adminlib.php");
/**
* Admin externalpage class
*
* @package core_admin
* @copyright 2019 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class accesscallback extends admin_externalpage {
/** @var callable $accesscheckcallback */
protected $accesscheckcallback;
/**
* Class constructor
*
* @param string $name
* @param string $visiblename
* @param string $url
* @param callable $accesscheckcallback The callback method that will be executed to check whether user has access to
* this page. The setting instance ($this) is passed as an argument to the callback. Should return boolean value
* @param bool $hidden
*/
public function __construct(string $name, string $visiblename, string $url, callable $accesscheckcallback,
bool $hidden = false) {
$this->accesscheckcallback = $accesscheckcallback;
parent::__construct($name, $visiblename, $url, [], $hidden);
}
/**
* Determines if the current user has access to this external page based on access callback
*
* @return bool
*/
public function check_access() {
return ($this->accesscheckcallback)($this);
}
}
@@ -1,206 +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/>.
/**
* Auto complete admin setting.
*
* @package core_admin
* @copyright 2020 The Open University
* @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');
/**
* Auto complete setting class.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright 2020 The Open University
*/
class autocomplete extends \admin_setting_configmultiselect {
/** @var boolean Should we allow typing new entries to the field? */
protected $tags = false;
/** @var string Name of an AMD module to send/process ajax requests. */
protected $ajax = '';
/** @var string Placeholder text for an empty list. */
protected $placeholder = '';
/** @var bool Whether the search has to be case-sensitive. */
protected $casesensitive = false;
/** @var bool Show suggestions by default - but this can be turned off. */
protected $showsuggestions = true;
/** @var string String that is shown when there are no selections. */
protected $noselectionstring = '';
/** @var string Delimiter to store values in database. */
protected $delimiter = ',';
/** @var string Should be multiple choices? */
protected $multiple = true;
/** @var string The link to manage choices. */
protected $manageurl = true;
/** @var string The text to display in manage link. */
protected $managetext = true;
/**
* 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
* @param string $description long localised info
* @param array $defaultsetting array of selected items
* @param array $choices options for autocomplete field
* @param array $attributes settings for autocomplete field
*/
public function __construct($name, $visiblename, $description, $defaultsetting, $choices, $attributes = null) {
if ($attributes === null) {
$attributes = [];
}
$this->placeholder = get_string('search');
$this->noselectionstring = get_string('noselection', 'form');
$defaultattributes = [
'tags',
'showsuggestions',
'placeholder',
'noselectionstring',
'ajax',
'casesensitive',
'delimiter',
'multiple',
'manageurl',
'managetext'
];
foreach ($defaultattributes as $attributename) {
if (isset($attributes[$attributename])) {
$this->$attributename = $attributes[$attributename];
}
}
parent::__construct($name, $visiblename, $description, $defaultsetting, $choices);
}
/**
* Returns the select setting(s)
*
* @return mixed null or array. Null if no settings else array of setting(s)
*/
public function get_setting() {
$result = $this->config_read($this->name);
if (is_null($result)) {
return null;
}
if ($result === '') {
return [];
}
return explode($this->delimiter, $result);
}
/**
* Saves setting(s) provided through $data
*
* @param array $data
*/
public function write_setting($data) {
if (!is_array($data)) {
return ''; // Ignore it.
}
if (!$this->load_choices() || empty($this->choices)) {
return '';
}
unset($data['xxxxx']);
$save = [];
foreach ($data as $value) {
if (!array_key_exists($value, $this->choices)) {
continue; // Ignore it.
}
$save[] = $value;
}
return ($this->config_write($this->name, implode($this->delimiter, $save)) ? '' : get_string('errorsetting', 'admin'));
}
/**
* Returns XHTML autocomplete field
*
* @param array $data Array of values to select by default
* @param string $query
* @return string XHTML autocomplete field
*/
public function output_html($data, $query = '') {
global $OUTPUT;
if (!$this->load_choices() or empty($this->choices)) {
return '';
}
$default = $this->get_defaultsetting();
if (empty($default)) {
$default = [];
}
if (is_null($data)) {
$data = [];
}
$context = [
'id' => $this->get_id(),
'name' => $this->get_full_name()
];
$defaults = [];
$options = [];
$template = 'core_admin/local/settings/autocomplete';
foreach ($this->choices as $value => $name) {
if (in_array($value, $default)) {
$defaults[] = $name;
}
$options[] = [
'value' => $value,
'text' => $name,
'selected' => in_array($value, $data),
'disabled' => false
];
}
$context['options'] = $options;
$context['tags'] = $this->tags;
$context['placeholder'] = $this->placeholder;
$context['casesensitive'] = $this->casesensitive;
$context['multiple'] = $this->multiple;
$context['showsuggestions'] = $this->showsuggestions;
$context['manageurl'] = $this->manageurl;
$context['managetext'] = $this->managetext;
if (is_null($default)) {
$defaultinfo = null;
} if (!empty($defaults)) {
$defaultinfo = implode(', ', $defaults);
} else {
$defaultinfo = get_string('none');
}
$element = $OUTPUT->render_from_template($template, $context);
return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $defaultinfo, $query);
}
}
-197
View File
@@ -1,197 +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, 0);
}
/**
* 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;
}
$bytes = intval($bytes);
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');
}
// Calculate size in bytes, ensuring we don't overflow PHP_INT_MAX.
$bytes = $data['v'] * $data['u'];
$result = (is_int($bytes) && $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);
}
}
@@ -1,37 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* A settings page which can be viewed with a link directly.
*
* @package core_admin
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
use moodle_url;
interface linkable_settings_page {
/**
* Get the URL to view this settings page.
*
* @return moodle_url
*/
public function get_settings_page_url(): moodle_url;
}
@@ -1,74 +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/>.
/**
* Payment gateway admin setting.
*
* @package core_admin
* @copyright 2020 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
/**
* Generic class for managing plugins in a table that allows re-ordering and enable/disable of each plugin.
*/
class manage_payment_gateway_plugins extends \admin_setting_manage_plugins {
/**
* Get the admin settings section title (use get_string).
*
* @return string
*/
public function get_section_title() {
return get_string('type_paygw_plural', 'plugin');
}
/**
* Get the type of plugin to manage.
*
* @return string
*/
public function get_plugin_type() {
return 'paygw';
}
/**
* Get the name of the second column.
*
* @return string
*/
public function get_info_column_name() {
return get_string('supportedcurrencies', 'core_payment');
}
/**
* Get the type of plugin to manage.
*
* @param plugininfo The plugin info class.
* @return string
*/
public function get_info_column($plugininfo) {
$codes = $plugininfo->get_supported_currencies();
$currencies = [];
foreach ($codes as $c) {
$currencies[$c] = new \lang_string($c, 'core_currencies');
}
return implode(get_string('listsep', 'langconfig') . ' ', $currencies);
}
}
@@ -1,121 +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/>.
/**
* Admin setting to show current scheduled task's status.
*
* @package core
* @copyright 2021 Universitat Rovira i Virgili
* @author Jordi Pujol-Ahulló <jpahullo@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/moodlelib.php');
use admin_setting_description;
use core\task\manager;
use core\task\scheduled_task;
use html_writer;
use lang_string;
use moodle_url;
use stdClass;
/**
* This admin setting tells whether a given scheduled task is enabled, providing a link to its configuration page.
*
* The goal of this setting is to help contextualizing the configuration settings with related scheduled task status,
* providing the big picture of that part of the system.
*
* @package core
* @copyright 2021 Universitat Rovira i Virgili
* @author Jordi Pujol-Ahulló <jpahullo@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class setting_scheduled_task_status extends admin_setting_description {
/**
* @var string fully qualified class name of a scheduled task.
*/
private $classname;
/**
* @var string additional text to append to the description.
*/
private $extradescription;
/**
* setting_scheduled_task_status constructor.
* @param string $name unique setting name.
* @param string $scheduledtaskclassname full classpath class name of the scheduled task.
* @param string $extradescription extra detail to append to the scheduled task status to add context in the setting
* page.
*/
public function __construct(string $name, string $scheduledtaskclassname, string $extradescription = '') {
$visiblename = new lang_string('task_status', 'admin');
$this->classname = $scheduledtaskclassname;
$this->extradescription = $extradescription;
parent::__construct($name, $visiblename, '');
}
/**
* Calculates lazily the content of the description.
* @param mixed $data nothing expected in this case.
* @param string $query nothing expected in this case.
* @return string the HTML content to print for this setting.
*/
public function output_html($data, $query = ''): string {
if (empty($this->description)) {
$this->description = $this->get_task_description();
}
return parent::output_html($data, $query);
}
/**
* Returns the HTML to print as the description.
* @return string description to be printed.
*/
private function get_task_description(): string {
$task = manager::get_scheduled_task($this->classname);
if ($task->is_enabled()) {
$taskenabled = get_string('enabled', 'admin');
} else {
$taskenabled = get_string('disabled', 'admin');
}
$taskenabled = strtolower($taskenabled);
$gotourl = new moodle_url(
'/admin/tool/task/scheduledtasks.php',
[],
scheduled_task::get_html_id($this->classname)
);
if (!empty($this->extradescription)) {
$this->extradescription = '<br />' . $this->extradescription;
}
$taskdetail = new stdClass();
$taskdetail->class = $this->classname;
$taskdetail->name = $task->get_name();
$taskdetail->status = $taskenabled;
$taskdetail->gotourl = $gotourl->out(false);
$taskdetail->extradescription = $this->extradescription;
return html_writer::tag('p', get_string('task_status_desc', 'admin', $taskdetail));
}
}
-41
View File
@@ -1,41 +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/>.
/**
* Privacy Subsystem implementation for core_admin.
*
* @package core_admin
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for core_admin implementing null_provider.
*
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason() : string {
return 'privacy:metadata';
}
}
@@ -1,117 +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/>.
declare(strict_types=1);
namespace core_admin\reportbuilder\datasource;
use core_admin\reportbuilder\local\entities\task_log;
use core_reportbuilder\datasource;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\filters\select;
/**
* Task logs datasource
*
* @package core_admin
* @copyright 2022 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_logs extends datasource {
/**
* Return user friendly name of the report source
*
* @return string
*/
public static function get_name(): string {
return get_string('tasklogs', 'core_admin');
}
/**
* Initialise report
*/
protected function initialise(): void {
$tasklogentity = new task_log();
$tasklogalias = $tasklogentity->get_table_alias('task_log');
$this->set_main_table('task_log', $tasklogalias);
$this->add_entity($tasklogentity);
// Join the user entity to represent the associated user.
$userentity = new user();
$useralias = $userentity->get_table_alias('user');
$this->add_entity($userentity->add_join("
LEFT JOIN {user} {$useralias}
ON {$useralias}.id = {$tasklogalias}.userid")
);
// Add report elements from each of the entities we added to the report.
$this->add_all_from_entities();
}
/**
* Return the columns that will be added to the report upon creation
*
* @return string[]
*/
public function get_default_columns(): array {
return [
'task_log:name',
'task_log:starttime',
'task_log:duration',
'task_log:result',
];
}
/**
* Return the filters that will be added to the report upon creation
*
* @return string[]
*/
public function get_default_filters(): array {
return [
'task_log:timestart',
'task_log:result',
];
}
/**
* Return the conditions that will be added to the report upon creation
*
* @return string[]
*/
public function get_default_conditions(): array {
return [
'task_log:type',
'task_log:timestart',
'task_log:result',
];
}
/**
* Return the condition values that will be set for the report upon creation
*
* @return array
*/
public function get_default_condition_values(): array {
return [
'task_log:type_operator' => select::EQUAL_TO,
'task_log:type_value' => \core\task\database_logger::TYPE_SCHEDULED,
];
}
}
@@ -1,427 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\reportbuilder\local\entities;
use core_reportbuilder\local\filters\date;
use core_reportbuilder\local\filters\duration;
use core_reportbuilder\local\filters\number;
use core_reportbuilder\local\filters\select;
use core_reportbuilder\local\filters\text;
use core_reportbuilder\local\filters\autocomplete;
use core_reportbuilder\local\helpers\format;
use lang_string;
use core_reportbuilder\local\entities\base;
use core_reportbuilder\local\report\column;
use core_reportbuilder\local\report\filter;
use stdClass;
use core_collator;
/**
* Task log entity class implementation
*
* @package core_admin
* @copyright 2021 David Matamoros <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_log extends base {
/** @var int Result success */
protected const SUCCESS = 0;
/** @var int Result failed */
protected const FAILED = 1;
/**
* Database tables that this entity uses and their default aliases
*
* @return array
*/
protected function get_default_table_aliases(): array {
return ['task_log' => 'tl'];
}
/**
* The default title for this entity in the list of columns/conditions/filters in the report builder
*
* @return lang_string
*/
protected function get_default_entity_title(): lang_string {
return new lang_string('entitytasklog', 'admin');
}
/**
* Initialise the entity
*
* @return base
*/
public function initialise(): base {
$columns = $this->get_all_columns();
foreach ($columns as $column) {
$this->add_column($column);
}
// All the filters defined by the entity can also be used as conditions.
$filters = $this->get_all_filters();
foreach ($filters as $filter) {
$this
->add_filter($filter)
->add_condition($filter);
}
return $this;
}
/**
* Returns list of all available columns
*
* @return column[]
*/
protected function get_all_columns(): array {
global $DB;
$tablealias = $this->get_table_alias('task_log');
// Name column.
$columns[] = (new column(
'name',
new lang_string('name'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("$tablealias.classname")
->set_is_sortable(true)
->add_callback(static function(string $classname): string {
$output = '';
if (class_exists($classname)) {
$task = new $classname;
if ($task instanceof \core\task\task_base) {
$output = $task->get_name();
}
}
$output .= \html_writer::tag('div', "\\{$classname}", [
'class' => 'small text-muted',
]);
return $output;
});
// Component column.
$columns[] = (new column(
'component',
new lang_string('plugin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("{$tablealias}.component")
->set_is_sortable(true);
// Type column.
$columns[] = (new column(
'type',
new lang_string('tasktype', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("{$tablealias}.type")
->set_is_sortable(true)
->add_callback(static function($value): string {
if (\core\task\database_logger::TYPE_SCHEDULED === (int) $value) {
return get_string('task_type:scheduled', 'admin');
}
return get_string('task_type:adhoc', 'admin');
});
// Start time column.
$columns[] = (new column(
'starttime',
new lang_string('task_starttime', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TIMESTAMP)
->add_field("{$tablealias}.timestart")
->set_is_sortable(true)
->add_callback([format::class, 'userdate'], get_string('strftimedatetimeshortaccurate', 'core_langconfig'));
// End time column.
$columns[] = (new column(
'endtime',
new lang_string('task_endtime', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TIMESTAMP)
->add_field("{$tablealias}.timeend")
->set_is_sortable(true)
->add_callback([format::class, 'userdate'], get_string('strftimedatetimeshortaccurate', 'core_langconfig'));
// Duration column.
$columns[] = (new column(
'duration',
new lang_string('task_duration', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_FLOAT)
->add_field("{$tablealias}.timeend - {$tablealias}.timestart", 'duration')
->set_is_sortable(true)
->add_callback(static function(float $value): string {
$duration = round($value, 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);
});
// Hostname column.
$columns[] = (new column(
'hostname',
new lang_string('hostname', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("$tablealias.hostname")
->set_is_sortable(true);
// PID column.
$columns[] = (new column(
'pid',
new lang_string('pid', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_field("{$tablealias}.pid")
->set_is_sortable(true)
// Although this is an integer column, it doesn't make sense to perform numeric aggregation on it.
->set_disabled_aggregation(['avg', 'count', 'countdistinct', 'max', 'min', 'sum']);
// Database column.
$columns[] = (new column(
'database',
new lang_string('task_dbstats', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_fields("{$tablealias}.dbreads, {$tablealias}.dbwrites")
->set_is_sortable(true, ["{$tablealias}.dbreads", "{$tablealias}.dbwrites"])
->add_callback(static function(int $value, stdClass $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;
})
// Although this is an integer column, it doesn't make sense to perform numeric aggregation on it.
->set_disabled_aggregation(['avg', 'count', 'countdistinct', 'max', 'min', 'sum']);
// Database reads column.
$columns[] = (new column(
'dbreads',
new lang_string('task_dbreads', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_fields("{$tablealias}.dbreads")
->set_is_sortable(true);
// Database writes column.
$columns[] = (new column(
'dbwrites',
new lang_string('task_dbwrites', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_fields("{$tablealias}.dbwrites")
->set_is_sortable(true);
// Result column.
$columns[] = (new column(
'result',
new lang_string('task_result', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_BOOLEAN)
// For accurate aggregation, we need to return boolean success = true by xor'ing the field value.
->add_field($DB->sql_bitxor("{$tablealias}.result", 1), 'success')
->set_is_sortable(true)
->add_callback(static function(bool $success): string {
if (!$success) {
return get_string('task_result:failed', 'admin');
}
return get_string('success');
});
return $columns;
}
/**
* Return list of all available filters
*
* @return filter[]
*/
protected function get_all_filters(): array {
global $DB;
$tablealias = $this->get_table_alias('task_log');
// Name filter (Filter by classname).
$filters[] = (new filter(
autocomplete::class,
'name',
new lang_string('classname', 'tool_task'),
$this->get_entity_name(),
"{$tablealias}.classname"
))
->add_joins($this->get_joins())
->set_options_callback(static function(): array {
global $DB;
$classnames = $DB->get_fieldset_sql('SELECT DISTINCT classname FROM {task_log} ORDER BY classname ASC');
$options = [];
foreach ($classnames as $classname) {
if (class_exists($classname)) {
$task = new $classname;
$options[$classname] = $task->get_name();
}
}
core_collator::asort($options);
return $options;
});
// Component filter.
$filters[] = (new filter(
text::class,
'component',
new lang_string('plugin'),
$this->get_entity_name(),
"{$tablealias}.component"
))
->add_joins($this->get_joins());
// Type filter.
$filters[] = (new filter(
select::class,
'type',
new lang_string('tasktype', 'admin'),
$this->get_entity_name(),
"{$tablealias}.type"
))
->add_joins($this->get_joins())
->set_options([
\core\task\database_logger::TYPE_ADHOC => new lang_string('task_type:adhoc', 'admin'),
\core\task\database_logger::TYPE_SCHEDULED => new lang_string('task_type:scheduled', 'admin'),
]);
// Output filter (Filter by task output).
$filters[] = (new filter(
text::class,
'output',
new lang_string('task_logoutput', 'admin'),
$this->get_entity_name(),
$DB->sql_cast_to_char("{$tablealias}.output")
))
->add_joins($this->get_joins());
// Start time filter.
$filters[] = (new filter(
date::class,
'timestart',
new lang_string('task_starttime', 'admin'),
$this->get_entity_name(),
"{$tablealias}.timestart"
))
->add_joins($this->get_joins())
->set_limited_operators([
date::DATE_ANY,
date::DATE_RANGE,
date::DATE_PREVIOUS,
date::DATE_CURRENT,
]);
// End time.
$filters[] = (new filter(
date::class,
'timeend',
new lang_string('task_endtime', 'admin'),
$this->get_entity_name(),
"{$tablealias}.timeend"
))
->add_joins($this->get_joins())
->set_limited_operators([
date::DATE_ANY,
date::DATE_RANGE,
date::DATE_PREVIOUS,
date::DATE_CURRENT,
]);
// Duration filter.
$filters[] = (new filter(
duration::class,
'duration',
new lang_string('task_duration', 'admin'),
$this->get_entity_name(),
"{$tablealias}.timeend - {$tablealias}.timestart"
))
->add_joins($this->get_joins());
// Database reads.
$filters[] = (new filter(
number::class,
'dbreads',
new lang_string('task_dbreads', 'admin'),
$this->get_entity_name(),
"{$tablealias}.dbreads"
))
->add_joins($this->get_joins());
// Database writes.
$filters[] = (new filter(
number::class,
'dbwrites',
new lang_string('task_dbwrites', 'admin'),
$this->get_entity_name(),
"{$tablealias}.dbwrites"
))
->add_joins($this->get_joins());
// Result filter.
$filters[] = (new filter(
select::class,
'result',
new lang_string('task_result', 'admin'),
$this->get_entity_name(),
"{$tablealias}.result"
))
->add_joins($this->get_joins())
->set_options([
self::SUCCESS => get_string('success'),
self::FAILED => get_string('task_result:failed', 'admin'),
]);
return $filters;
}
}
@@ -1,159 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\reportbuilder\local\systemreports;
use context_system;
use core_admin\reportbuilder\local\entities\task_log;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\report\action;
use lang_string;
use moodle_url;
use pix_icon;
use core_reportbuilder\system_report;
/**
* Task logs system report class implementation
*
* @package core_admin
* @copyright 2021 David Matamoros <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_logs extends system_report {
/**
* Initialise report, we need to set the main table, load our entities and set columns/filters
*/
protected function initialise(): void {
// Our main entity, it contains all of the column definitions that we need.
$entitymain = new task_log();
$entitymainalias = $entitymain->get_table_alias('task_log');
$this->set_main_table('task_log', $entitymainalias);
$this->add_entity($entitymain);
// Any columns required by actions should be defined here to ensure they're always available.
$this->add_base_fields("{$entitymainalias}.id");
// We can join the "user" entity to our "main" entity and use the fullname column from the user entity.
$entityuser = new user();
$entituseralias = $entityuser->get_table_alias('user');
$this->add_entity($entityuser->add_join(
"LEFT JOIN {user} {$entituseralias} ON {$entituseralias}.id = {$entitymainalias}.userid"
));
// Now we can call our helper methods to add the content we want to include in the report.
$this->add_columns();
$this->add_filters();
$this->add_actions();
// Set if report can be downloaded.
$this->set_downloadable(true, get_string('tasklogs', 'admin'));
}
/**
* Validates access to view this report
*
* @return bool
*/
protected function can_view(): bool {
return has_capability('moodle/site:config', context_system::instance());
}
/**
* Get the visible name of the report
*
* @return string
*/
public static function get_name(): string {
return get_string('entitytasklog', 'admin');
}
/**
* Adds the columns we want to display in the report
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*/
public function add_columns(): void {
$columns = [
'task_log:name',
'task_log:type',
'user:fullname',
'task_log:starttime',
'task_log:duration',
'task_log:hostname',
'task_log:pid',
'task_log:database',
'task_log:result',
];
$this->add_columns_from_entities($columns);
// It's possible to override the display name of a column, if you don't want to use the value provided by the entity.
if ($column = $this->get_column('user:fullname')) {
$column->set_title(new lang_string('user', 'admin'));
}
// It's possible to set a default initial sort direction for one column.
$this->set_initial_sort_column('task_log:starttime', SORT_DESC);
}
/**
* Adds the filters we want to display in the report
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*/
protected function add_filters(): void {
$filters = [
'task_log:name',
'task_log:type',
'task_log:output',
'task_log:result',
'task_log:timestart',
'task_log:duration',
];
$this->add_filters_from_entities($filters);
}
/**
* Add the system report actions. An extra column will be appended to each row, containing all actions added here
*
* Note the use of ":id" placeholder which will be substituted according to actual values in the row
*/
protected function add_actions(): void {
// Action to view individual task log on a popup window.
$this->add_action((new action(
new moodle_url('/admin/tasklogs.php', ['logid' => ':id']),
new pix_icon('e/search', ''),
[],
true,
new lang_string('view'),
)));
// Action to download individual task log.
$this->add_action((new action(
new moodle_url('/admin/tasklogs.php', ['logid' => ':id', 'download' => true]),
new pix_icon('t/download', ''),
[],
false,
new lang_string('download'),
)));
}
}
@@ -1,118 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\table;
use core_plugin_manager;
use dml_exception;
use html_writer;
use moodle_url;
use stdClass;
/**
* Activity Module admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class activity_management_table extends plugin_management_table {
public function setup() {
$this->set_attribute('id', 'modules');
$this->set_attribute('class', 'admintable generaltable');
parent::setup();
}
protected function get_table_id(): string {
return 'module-administration-table';
}
protected function get_plugintype(): string {
return 'mod';
}
public function guess_base_url(): void {
$this->define_baseurl(
new moodle_url('/admin/modules.php')
);
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/modules.php', $params);
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
return array_merge(
array_slice($columns, 0, 1, true),
['activities' => get_string('activities')],
array_slice($columns, 1, null, true),
);
}
protected function col_name(stdClass $row): string {
global $OUTPUT;
$status = $row->plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
return html_writer::span(
get_string('pluginmissingfromdisk', 'core', $row->plugininfo),
'notifyproblem'
);
}
return html_writer::span(
html_writer::img(
$OUTPUT->image_url('monologo', $row->plugininfo->name),
'',
[
'class' => 'icon',
],
) . get_string('modulename', $row->plugininfo->name)
);
}
/**
* Show the number of activities present, with a link to courses containing activity if relevant.
*
* @param mixed $row
* @return string
*/
protected function col_activities(stdClass $row): string {
global $DB, $OUTPUT;
try {
$count = $DB->count_records_select($row->plugininfo->name, "course <> 0");
} catch (dml_exception $e) {
$count = -1;
}
if ($count > 0) {
return $OUTPUT->action_link(
new moodle_url('/course/search.php', [
'modulelist' => $row->plugininfo->name,
]),
$count,
null,
['title' => get_string('showmodulecourse')]
);
} else if ($count < 0) {
return get_string('error');
} else {
return $count;
}
}
}
@@ -1,153 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\table;
use html_writer;
use moodle_url;
use stdClass;
/**
* Tiny admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_management_table extends \core_admin\table\plugin_management_table {
/** @var plugininfo[] A list of blocks which cannot be deleted */
protected array $undeletableblocktypes;
/** @var stdClass[] A list of basic block data */
protected array $blockdata;
/** @var array<string,int> A list of course counts */
protected array $courseblocks;
public function __construct() {
global $DB;
parent::__construct();
$this->undeletableblocktypes = \block_manager::get_undeletable_block_types();
$sql = 'SELECT b.name,
b.id,
COUNT(DISTINCT binst.id) as totalcount
FROM {block} b
LEFT JOIN {block_instances} binst ON binst.blockname = b.name
GROUP BY b.id,
b.name
ORDER BY b.name ASC';
$this->blockdata = $DB->get_records_sql($sql);
$sql = "SELECT blockname
FROM {block_instances}
WHERE pagetypepattern = 'course-view-*'
GROUP BY blockname";
$this->courseblocks = $DB->get_records_sql($sql);
}
protected function get_plugintype(): string {
return 'block';
}
public function guess_base_url(): void {
$this->define_baseurl(
new moodle_url('/admin/blocks.php')
);
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/blocks.php', $params);
}
protected function get_table_js_module(): string {
return 'core_admin/block_management_table';
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
return array_merge(
array_slice($columns, 0, 1, true),
['instances' => get_string('blockinstances', 'admin')],
array_slice($columns, 1, 2, true),
['protect' => get_string('blockprotect', 'admin')],
array_slice($columns, 3, null, true),
);
}
protected function get_columns_with_help(): array {
return [
'protect' => new \help_icon('blockprotect', 'admin'),
];
}
/**
* Render the instances column
* @param stdClass $row
* @return string
*/
protected function col_instances(stdClass $row): string {
$blockdata = $this->blockdata[$row->plugininfo->name];
if (array_key_exists($blockdata->name, $this->courseblocks)) {
return html_writer::link(
new moodle_url('/course/search.php', [
'blocklist' => $blockdata->id,
]),
$blockdata->totalcount,
);
}
return $blockdata->totalcount;
}
/**
* Render the protect column.
*
* @param stdClass $row
* @return string
*/
protected function col_protect(stdClass $row): string {
global $OUTPUT;
$params = [
'sesskey' => sesskey(),
];
$protected = in_array($row->plugininfo->name, $this->undeletableblocktypes);
$pluginname = $row->plugininfo->displayname;
if ($protected) {
$params['unprotect'] = $row->plugininfo->name;
$icon = $OUTPUT->pix_icon('t/unlock', get_string('blockunprotectblock', 'admin', $pluginname));
} else {
$params['protect'] = $row->plugininfo->name;
$icon = $OUTPUT->pix_icon('t/lock', get_string('blockprotectblock', 'admin', $pluginname));
}
return html_writer::link(
$this->get_action_url($params),
$icon,
[
'data-action' => 'toggleprotectstate',
'data-plugin' => $row->plugin,
'data-target-state' => $protected ? 0 : 1,
],
);
return '';
}
}
@@ -1,63 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\table;
use moodle_url;
/**
* Tiny admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class editor_management_table extends \core_admin\table\plugin_management_table {
protected function get_plugintype(): string {
return 'editor';
}
public function guess_base_url(): void {
$this->define_baseurl(
new moodle_url('/admin/settings.php', ['section' => 'manageeditors'])
);
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/editors.php', $params);
}
protected function order_plugins(array $plugins): array {
global $CFG;
// The Editor list is stored in an ordered string.
$activeeditors = explode(',', $CFG->texteditors);
$sortedplugins = [];
foreach ($activeeditors as $editor) {
if (isset($plugins[$editor])) {
$sortedplugins[$editor] = $plugins[$editor];
unset($plugins[$editor]);
}
}
$otherplugins = parent::order_plugins($plugins);
return array_merge(
$sortedplugins,
$otherplugins
);
}
}
@@ -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/>.
namespace core_admin\table;
use moodle_url;
use stdClass;
/**
* Media plugin admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class media_management_table extends \core_admin\table\plugin_management_table {
/** @var array The list of used extensions */
protected array $usedextensions = [];
protected function get_plugintype(): string {
return 'media';
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/media.php', $params);
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
return array_merge(
array_slice($columns, 0, 1, true),
['supports' => get_string('supports', 'core_media')],
array_slice($columns, 1, null, true),
);
}
protected function col_name(stdClass $row): string {
global $OUTPUT, $PAGE;
$name = $row->plugininfo->name;
if ($PAGE->theme->resolve_image_location('icon', 'media_' . $name, false)) {
$icon = $OUTPUT->pix_icon('icon', '', "media_{$name}", ['class' => 'icon pluginicon']);
} else {
$icon = $OUTPUT->pix_icon('spacer', '', 'moodle', ['class' => 'icon pluginicon noicon']);
}
$help = '';
if (get_string_manager()->string_exists('pluginname_help', 'media_' . $name)) {
$help = '&nbsp;' . $OUTPUT->help_icon('pluginname', 'media_' . $name);
}
return $icon . $row->plugininfo->displayname . $help;
}
protected function col_supports(stdClass $row): string {
return $row->plugininfo->supports($this->usedextensions);
}
}
@@ -1,503 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\table;
use context_system;
use core_plugin_manager;
use core_table\dynamic as dynamic_table;
use flexible_table;
use html_writer;
use moodle_url;
use stdClass;
defined('MOODLE_INTERNAL') || die();
require_once("{$CFG->libdir}/tablelib.php");
/**
* Plugin Management table.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class plugin_management_table extends flexible_table implements dynamic_table {
/** @var \core\plugininfo\base[] The plugin list */
protected array $plugins = [];
/** @var int The number of enabled plugins of this type */
protected int $enabledplugincount = 0;
/** @var core_plugin_manager */
protected core_plugin_manager $pluginmanager;
/** @var string The plugininfo class for this plugintype */
protected string $plugininfoclass;
public function __construct() {
global $CFG;
parent::__construct($this->get_table_id());
require_once($CFG->libdir . '/adminlib.php');
// Fetch the plugininfo class.
$this->pluginmanager = core_plugin_manager::instance();
$this->plugininfoclass = $this->pluginmanager::resolve_plugininfo_class($this->get_plugintype());
$this->guess_base_url();
$this->plugins = $this->get_sorted_plugins();
$this->enabledplugincount = count(array_filter($this->plugins, function ($plugin) {
return $plugin->is_enabled();
}));
$this->setup_column_configuration();
$this->set_filterset(new plugin_management_table_filterset());
$this->setup();
}
/**
* Get the list of sorted plugins.
*
* @return \core\plugininfo\base[]
*/
protected function get_sorted_plugins(): array {
if ($this->plugininfoclass::plugintype_supports_ordering()) {
return $this->plugininfoclass::get_sorted_plugins();
} else {
$plugins = $this->pluginmanager->get_plugins_of_type($this->get_plugintype());
return self::sort_plugins($plugins);
}
}
/**
* Sort the plugins list.
*
* Note: This only applies to plugins which do not support ordering.
*
* @param \core\plugininfo\base[] $plugins
* @return \core\plugininfo\base[]
*/
protected function sort_plugins(array $plugins): array {
// The asort functions work by reference.
\core_collator::asort_objects_by_property($plugins, 'displayname');
return $plugins;
}
/**
* Set up the column configuration for this table.
*/
protected function setup_column_configuration(): void {
$columnlist = $this->get_column_list();
$this->define_columns(array_keys($columnlist));
$this->define_headers(array_values($columnlist));
$columnswithhelp = $this->get_columns_with_help();
$columnhelp = array_map(function (string $column) use ($columnswithhelp): ?\renderable {
if (array_key_exists($column, $columnswithhelp)) {
return $columnswithhelp[$column];
}
return null;
}, array_keys($columnlist));
$this->define_help_for_headers($columnhelp);
}
/**
* Set the standard order of the plugins.
*
* @param array $plugins
* @return array
*/
protected function order_plugins(array $plugins): array {
uasort($plugins, function ($a, $b) {
if ($a->is_enabled() && !$b->is_enabled()) {
return -1;
} else if (!$a->is_enabled() && $b->is_enabled()) {
return 1;
}
return strnatcasecmp($a->name, $b->name);
});
return $plugins;
}
/**
* Get the plugintype for this table.
*
* @return string
*/
abstract protected function get_plugintype(): string;
/**
* Get the action URL for this table.
*
* The action URL is used to perform all actions when JS is not available.
*
* @param array $params
* @return moodle_url
*/
abstract protected function get_action_url(array $params = []): moodle_url;
/**
* Provide a default implementation for guessing the base URL from the action URL.
*/
public function guess_base_url(): void {
$this->define_baseurl($this->get_action_url());
}
/**
* Get the web service method used to toggle state.
*
* @return null|string
*/
protected function get_toggle_service(): ?string {
return 'core_admin_set_plugin_state';
}
/**
* Get the web service method used to order plugins.
*
* @return null|string
*/
protected function get_sortorder_service(): ?string {
return 'core_admin_set_plugin_order';
}
/**
* Get the ID of the table.
*
* @return string
*/
protected function get_table_id(): string {
return 'plugin_management_table-' . $this->get_plugintype();
}
/**
* Get a list of the column titles
* @return string[]
*/
protected function get_column_list(): array {
$columns = [
'name' => get_string('name', 'core'),
'version' => get_string('version', 'core'),
];
if ($this->supports_disabling()) {
$columns['enabled'] = get_string('pluginenabled', 'core_plugin');
}
if ($this->supports_ordering()) {
$columns['order'] = get_string('order', 'core');
}
$columns['settings'] = get_string('settings', 'core');
$columns['uninstall'] = get_string('uninstallplugin', 'core_admin');
return $columns;
}
protected function get_columns_with_help(): array {
return [];
}
/**
* Get the context for this table.
*
* @return context_system
*/
public function get_context(): context_system {
return context_system::instance();
}
/**
* Get the table content.
*/
public function get_content(): string {
ob_start();
$this->out();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/**
* Print the table.
*/
public function out(): void {
$plugintype = $this->get_plugintype();
foreach ($this->plugins as $plugininfo) {
$plugin = "{$plugintype}_{$plugininfo->name}";
$rowdata = (object) [
'plugin' => $plugin,
'plugininfo' => $plugininfo,
'name' => $plugininfo->displayname,
'version' => $plugininfo->versiondb,
];
$this->add_data_keyed(
$this->format_row($rowdata),
$this->get_row_class($rowdata)
);
}
$this->finish_output(false);
}
/**
* This table is not downloadable.
* @param bool $downloadable
* @return bool
*/
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
public function is_downloadable($downloadable = null): bool {
return false;
}
/**
* Show the name column content.
*
* @param stdClass $row
* @return string
*/
protected function col_name(stdClass $row): string {
$status = $row->plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
return html_writer::span(
get_string('pluginmissingfromdisk', 'core', $row->plugininfo),
'notifyproblem'
);
}
if ($row->plugininfo->is_installed_and_upgraded()) {
return $row->plugininfo->displayname;
}
return html_writer::span(
$row->plugininfo->displayname,
'notifyproblem'
);
}
/**
* Show the enable/disable column content.
*
* @param stdClass $row
* @return string
*/
protected function col_enabled(stdClass $row): string {
global $OUTPUT;
$enabled = $row->plugininfo->is_enabled();
$params = [
'sesskey' => sesskey(),
'plugin' => $row->plugininfo->name,
'action' => $enabled ? 'disable' : 'enable',
];
if ($enabled) {
$icon = $OUTPUT->pix_icon('t/hide', get_string('disableplugin', 'core_admin', $row->plugininfo->displayname));
} else {
$icon = $OUTPUT->pix_icon('t/show', get_string('enableplugin', 'core_admin', $row->plugininfo->displayname));
}
return html_writer::link(
$this->get_action_url($params),
$icon,
[
'data-toggle-method' => $this->get_toggle_service(),
'data-action' => 'togglestate',
'data-plugin' => $row->plugin,
'data-state' => $enabled ? 1 : 0,
],
);
}
protected function col_order(stdClass $row): string {
global $OUTPUT;
if (!$this->supports_ordering()) {
return '';
}
if (!$row->plugininfo->is_enabled()) {
return '';
}
if ($this->enabledplugincount <= 1) {
// There is only one row.
return '';
}
$hasup = true;
$hasdown = true;
if (empty($this->currentrow)) {
// This is the top row.
$hasup = false;
}
if ($this->currentrow === ($this->enabledplugincount - 1)) {
// This is the last row.
$hasdown = false;
}
if ($this->supports_ordering()) {
$dataattributes = [
'data-method' => $this->get_sortorder_service(),
'data-action' => 'move',
'data-plugin' => $row->plugin,
];
} else {
$dataattributes = [];
}
if ($hasup) {
$upicon = html_writer::link(
$this->get_action_url([
'sesskey' => sesskey(),
'action' => 'up',
'plugin' => $row->plugininfo->name,
]),
$OUTPUT->pix_icon('t/up', get_string('moveup')),
array_merge($dataattributes, ['data-direction' => 'up']),
);
} else {
$upicon = $OUTPUT->spacer();
}
if ($hasdown) {
$downicon = html_writer::link(
$this->get_action_url([
'sesskey' => sesskey(),
'action' => 'down',
'plugin' => $row->plugininfo->name,
]),
$OUTPUT->pix_icon('t/down', get_string('movedown')),
array_merge($dataattributes, ['data-direction' => 'down']),
);
} else {
$downicon = $OUTPUT->spacer();
}
// For now just add the up/down icons.
return html_writer::span($upicon . $downicon);
}
/**
* Show the settings column content.
*
* @param stdClass $row
* @return string
*/
protected function col_settings(stdClass $row): string {
if ($settingsurl = $row->plugininfo->get_settings_url()) {
return html_writer::link($settingsurl, get_string('settings'));
}
return '';
}
/**
* Show the Uninstall column content.
*
* @param stdClass $row
* @return string
*/
protected function col_uninstall(stdClass $row): string {
$status = $row->plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
return get_string('status_new', 'core_plugin');
}
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
$uninstall = get_string('status_missing', 'core_plugin') . '<br/>';
} else {
$uninstall = '';
}
if ($uninstallurl = $this->pluginmanager->get_uninstall_url($row->plugin)) {
$uninstall .= html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'));
}
return $uninstall;
}
/**
* Get the JS module used to manage this table.
*
* This should be a class which extends 'core_admin/plugin_management_table'.
*
* @return string
*/
protected function get_table_js_module(): string {
return 'core_admin/plugin_management_table';
}
/**
* Add JS specific to this implementation.
*
* @return string
*/
protected function get_dynamic_table_html_end(): string {
global $PAGE;
$PAGE->requires->js_call_amd($this->get_table_js_module(), 'init');
return parent::get_dynamic_table_html_end();
}
/**
* Get any class to add to the row.
*
* @param mixed $row
* @return string
*/
protected function get_row_class($row): string {
$plugininfo = $row->plugininfo;
if ($plugininfo->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
return '';
}
if (!$plugininfo->is_enabled()) {
return 'dimmed_text';
}
return '';
}
public static function get_filterset_class(): string {
return self::class . '_filterset';
}
/**
* Whether this plugin type supports the disabling of plugins.
*
* @return bool
*/
protected function supports_disabling(): bool {
return $this->plugininfoclass::plugintype_supports_disabling();
}
/**
* Whether this table should show ordering fields.
*
* @return bool
*/
protected function supports_ordering(): bool {
return $this->plugininfoclass::plugintype_supports_ordering();
}
}
@@ -1,27 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace core_admin\table;
/**
* This file contains the dynamic interface.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plugin_management_table_filterset extends \core_table\local\filter\filterset {
}
@@ -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/>.
namespace core_admin\table;
use moodle_url;
/**
* Admin tool settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_plugin_management_table extends \core_admin\table\plugin_management_table {
protected function get_plugintype(): string {
return 'tool';
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
unset($columns['settings']);
return $columns;
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/settings.php', array_merge(['section' => 'toolsmanagement'], $params));
}
}
-174
View File
@@ -1,174 +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");
list($options, $unrecognized) = cli_get_params(
[
'help' => false,
'showsql' => false,
'showdebugging' => false,
'execute' => false,
'keep-alive' => 0,
'ignorelimits' => false,
'force' => false,
'id' => null,
'classname' => null,
'taskslimit' => null,
'failed' => false,
], [
'h' => 'help',
'e' => 'execute',
'k' => 'keep-alive',
'i' => 'ignorelimits',
'f' => 'force',
'c' => 'classname',
'l' => 'taskslimit',
]
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$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
-f, --force Run even if cron is disabled
--id Run (failed) task with id
-c, --classname Run tasks with a certain classname (FQN)
-l, --taskslimit=N Run at most N tasks
--failed Run only tasks that failed, ie those with a fail delay
Run all queued tasks:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --execute
Run all queued tasks of specific class:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --classname=\\\\core_course\\\\task\\\\course_delete_modules
Double backslash for the shell escape reasons.
Run a specific task:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --id=123456
Run a specific task with debugging:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --id=123456 --showsql --showdebugging
To profile a long running task:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --taskslimit=1 --classname='\\some\\class\\name' --ignorelimits
EOT;
if ($options['help']) {
echo $help;
exit(0);
}
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 (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
// Common debugging options.
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
$DB->set_debug(true);
}
if (!empty($CFG->showcronsql)) {
$DB->set_debug(true);
}
if (!empty($CFG->showcrondebugging)) {
set_debugging(DEBUG_DEVELOPER, true);
}
// Process params.
core_php_time_limit::raise();
// Increase memory limit.
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
\core\cron::setup_user();
\core\local\cli\shutdown::script_supports_graceful_exit();
$humantimenow = date('r', time());
mtrace("Server Time: {$humantimenow}\n");
$classname = $options['classname'];
// Run a single adhoc task only, if requested.
if (!empty($options['id'])) {
$taskid = (int) $options['id'];
\core\cron::run_adhoc_task($taskid);
exit(0);
}
// Run all failed tasks.
if (!empty($options['failed'])) {
\core\cron::run_failed_adhoc_tasks($classname);
exit(0);
}
// Examine params and determine if we should run.
$execute = (bool) $options['execute'];
$keepalive = empty($options['keep-alive']) ? 0 : (int) $options['keep-alive'];
$taskslimit = empty($options['taskslimit']) ? null : (int) $options['taskslimit'];
$checklimits = empty($options['ignorelimits']);
if ($classname || $keepalive || $taskslimit) {
$execute = true;
}
// Output the help text if no criteria for running the adhoc tasks are given.
if (!$execute) {
echo $help;
exit(0);
}
\core\cron::run_adhoc_tasks(time(), $keepalive, $checklimits, null, $taskslimit, $classname);
+6 -5
View File
@@ -28,8 +28,9 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
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),
@@ -79,10 +80,10 @@ if (!empty($CFG->showcrondebugging)) {
$starttime = microtime();
// Emulate normal session.
\core\cron::setup_user();
/// emulate normal session
cron_setup_user();
// Start output log.
/// Start output log
$timenow = time();
mtrace("Server Time: ".date('r',$timenow)."\n\n");
@@ -95,4 +96,4 @@ backup_cron_automated_helper::run_automated_backup(backup_cron_automated_helper:
mtrace("Automated cron backups completed correctly");
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
mtrace("Execution took ".$difftime." seconds");
+1 -1
View File
@@ -25,7 +25,7 @@
define('CLI_SCRIPT', 1);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
-119
View File
@@ -1,119 +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/>.
/**
* Build and store theme CSS.
*
* @package core
* @subpackage cli
* @copyright 2017 Ryan Wyllie <ryan@moodle.com>
* @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/csslib.php");
require_once("$CFG->libdir/outputlib.php");
$longparams = [
'themes' => null,
'direction' => null,
'help' => false,
'verbose' => false
];
$shortmappings = [
't' => 'themes',
'd' => 'direction',
'h' => 'help',
'v' => 'verbose'
];
// Get CLI params.
list($options, $unrecognized) = cli_get_params($longparams, $shortmappings);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
echo
"Compile the CSS for one or more installed themes.
Existing CSS caches will replaced.
By default all themes will be recompiled unless otherwise specified.
Options:
-t, --themes A comma separated list of themes to be compiled
-d, --direction Only compile a single direction (either ltr or rtl)
-v, --verbose Print info comments to stdout
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/build_theme_css.php --themes=boost --direction=ltr
";
die;
}
if (empty($options['verbose'])) {
$trace = new null_progress_trace();
} else {
$trace = new text_progress_trace();
}
cli_heading('Build theme css');
// Determine which themes we need to build.
$themenames = [];
if (is_null($options['themes'])) {
$trace->output('No themes specified. Finding all installed themes.');
$themenames = array_keys(core_component::get_plugin_list('theme'));
} else {
if (is_string($options['themes'])) {
$themenames = explode(',', $options['themes']);
} else {
cli_error('--themes must be a comma separated list of theme names');
}
}
$trace->output('Checking that each theme is correctly installed...');
$themeconfigs = [];
foreach ($themenames as $themename) {
if (is_null(theme_get_config_file_path($themename))) {
cli_error("Unable to find theme config for {$themename}");
}
// Load the config for the theme.
$themeconfigs[] = theme_config::load($themename);
}
$directions = ['ltr', 'rtl'];
if (!is_null($options['direction'])) {
if (!in_array($options['direction'], $directions)) {
cli_error("--direction must be either ltr or rtl");
}
$directions = [$options['direction']];
}
$trace->output('Building CSS for themes: ' . implode(', ', $themenames));
theme_build_css_for_themes($themeconfigs, $directions);
exit(0);
-185
View File
@@ -1,185 +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 allowing to get and set config values.
*
* This is technically just a thin wrapper for {@link get_config()} and
* {@link set_config()} functions.
*
* @package core
* @subpackage cli
* @copyright 2017 David Mudrák <david@moodle.com>
* @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');
$usage = "Displays the current value of the given site setting. Allows to set it to the given value, too.
Usage:
# php cfg.php [--component=<componentname>] [--json] [--shell-arg]
# php cfg.php --name=<configname> [--component=<componentname>] [--shell-arg] [--no-eol]
# php cfg.php --name=<configname> [--component=<componentname>] --set=<value>
# php cfg.php --name=<configname> [--component=<componentname>] --unset
# php cfg.php [--help|-h]
Options:
-h --help Print this help.
--component=<frankenstyle> Name of the component the variable is part of. Defaults to core.
--name=<configname> Name of the configuration variable to get/set. If missing, print all
configuration variables of the given component.
--set=<value> Set the given variable to this value.
--unset Unset the given variable.
--shell-arg Escape output values so that they can be directly used as shell script arguments.
--json Encode output list of values using JSON notation.
--no-eol Do not include the trailing new line character when printing the value.
The list of all variables of the given component can be printed as
tab-separated list (default) or JSON object (--json). Particular values are
printed as raw text values, optionally escaped so that they can be directly
used as shell script arguments (--shell-arg). Single values are displayed with
trailing new line by default, unless explicitly disabled (--no-eol).
In the read mode, the script exits with success status 0 if the requested value
is found. If the requested variable is not set, the script exits with status 3.
When listing all variables of the component, the exit status is always 0 even
if no variables for the given component are found. When setting/unsetting a
value, the exit status is 0. When attempting to set/unset a value that has
already been hard-set in config.php, the script exits with error status 4. In
case of unexpected error, the script exits with error status 1.
Examples:
# php cfg.php
Prints tab-separated list of all core configuration variables and their values.
# php cfg.php --json
Prints list of all core configuration variables and their values as a JSON object.
# php cfg.php --name=release
Prints the given configuration variable - e.g. \$CFG->release in this case.
# php cfg.php --component=tool_recyclebin
# Prints tab-separated list of the plugin's configuration variables.
# export DATAROOT=\$(php cfg.php --name=dataroot --shell-arg --no-eol)
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
Sets the given configuration variable to the given value.
# php cfg.php --name=noemailever --unset
Unsets the previously configured variable.
";
list($options, $unrecognised) = cli_get_params([
'help' => false,
'component' => null,
'name' => null,
'set' => null,
'unset' => false,
'shell-arg' => false,
'json' => false,
'no-eol' => false,
], [
'h' => 'help'
]);
if ($unrecognised) {
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
}
if ($options['help']) {
cli_writeln($usage);
exit(2);
}
if ($options['unset'] || $options['set'] !== null) {
// Unset the variable or set it to the given value.
if (empty($options['name'])) {
cli_error('Missing configuration variable name', 2);
}
// Check that the variable is not hard-set in the main config.php already.
$component = $options['component'];
if (!empty($component)) {
$componentsettings = $CFG->forced_plugin_settings[$component] ?? [];
$settinginconfig = array_key_exists($options['name'], $componentsettings);
} else {
$settinginconfig = array_key_exists($options['name'], $CFG->config_php_settings);
}
if ($settinginconfig) {
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']);
}
exit(0);
}
if ($options['name'] === null) {
// List all variables provided by the component (defaults to core).
$got = get_config($options['component']);
if ($options['json']) {
cli_writeln(json_encode($got));
} else {
foreach ($got as $name => $value) {
if ($options['shell-arg']) {
$value = escapeshellarg($value);
}
cli_writeln($name."\t".$value);
}
}
exit(0);
} else {
// Display the value of a single variable.
$got = get_config($options['component'], $options['name']);
if ($got === false) {
cli_error('No such configuration variable found.', 3);
}
if ($options['shell-arg']) {
$got = escapeshellarg($got);
}
if ($options['json']) {
$got = json_encode($got);
}
if ($options['no-eol']) {
cli_write($got);
} else {
cli_writeln($got);
}
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);
+10 -135
View File
@@ -1,4 +1,5 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -29,32 +30,13 @@
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// Now get cli option.
[$options, $unrecognized] = cli_get_params(
[
'help' => false,
'stop' => false,
'list' => false,
'force' => false,
'enable' => false,
'disable' => false,
'disable-wait' => false,
'keep-alive' => null,
],
[
'h' => 'help',
's' => 'stop',
'l' => 'list',
'f' => 'force',
'e' => 'enable',
'd' => 'disable',
'w' => 'disable-wait',
'k' => 'keep-alive',
]
);
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -63,19 +45,10 @@ if ($unrecognized) {
if ($options['help']) {
$help =
"Execute periodic cron actions.
"Execute periodic cron actions.
Options:
-h, --help Print out this help
-s, --stop Notify all other running cron processes to stop after the current task
-l, --list Show the list of currently running tasks and how long they have been running
-f, --force Execute task even if cron is disabled
-e, --enable Enable cron
-d, --disable Disable cron
-w, --disable-wait=600 Disable cron and wait until all tasks finished or fail after N seconds (optional param)
-k, --keep-alive=N Keep this script alive for N seconds and poll for new tasks
The default value can be set by administrators in:
Site administration > Server > Tasks > Task processing > Keep alive time
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/cron.php
@@ -85,102 +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;
}
if ($options['enable']) {
set_config('cron_enabled', 1);
mtrace('Cron has been enabled for the site.');
exit(0);
}
if ($options['disable']) {
set_config('cron_enabled', 0);
\core\task\manager::clear_static_caches();
mtrace('Cron has been disabled for the site.');
exit(0);
}
if ($options['list']) {
$tasks = \core\task\manager::get_running_tasks();
mtrace('The list of currently running tasks:');
$format = "%7s %-12s %-9s %-20s %-52s\n";
printf(
$format,
'PID',
'HOST',
'TYPE',
'TIME',
'CLASSNAME'
);
foreach ($tasks as $task) {
printf(
$format,
$task->pid,
substr($task->hostname, 0, 12),
$task->type,
format_time(time() - $task->timestarted),
substr($task->classname, 0, 52)
);
}
exit(0);
}
if ($wait = $options['disable-wait']) {
$started = time();
if (true === $wait) {
// Default waiting time.
$waitsec = 600;
} else {
$waitsec = $wait;
$wait = true;
}
set_config('cron_enabled', 0);
\core\task\manager::clear_static_caches();
mtrace('Cron has been disabled for the site.');
mtrace('Allocating ' . format_time($waitsec) . ' for the tasks to finish.');
$lastcount = 0;
while ($wait) {
$tasks = \core\task\manager::get_running_tasks();
if (count($tasks) == 0) {
mtrace('');
mtrace('All scheduled and adhoc tasks finished.');
exit(0);
}
if (time() - $started >= $waitsec) {
mtrace('');
mtrace('Wait time (' . format_time($waitsec) . ') elapsed, but ' . count($tasks) . ' task(s) still running.');
mtrace('Exiting with code 1.');
exit(1);
}
if (count($tasks) !== $lastcount) {
mtrace('');
mtrace(count($tasks) . " tasks currently running.", '');
$lastcount = count($tasks);
} else {
mtrace('.', '');
}
sleep(1);
}
}
if (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
\core\local\cli\shutdown::script_supports_graceful_exit();
$keepalive = $options['keep-alive'];
\core\cron::run_main_process($keepalive);
cron_run();
-65
View File
@@ -1,65 +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 reset dashboards.
*
* @package core
* @subpackage cli
* @copyright 2021 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');
require_once($CFG->dirroot.'/my/lib.php');
list($options, $unrecognized) = cli_get_params([
'help' => false,
'execute' => false,
], [
'h' => 'help',
'e' => 'execute',
]);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
}
if (!$options['execute']) {
$help = <<<EOF
Resets Moodle dashboards for all users
Options:
-h, --help Print out this help
-e, --execute Actually run the reset
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/dashboard_reset.php -e
EOF;
echo $help;
exit(0);
}
$progressbar = new progress_bar();
$progressbar->create();
my_reset_page_for_all_users(MY_PAGE_PRIVATE, 'my-index', $progressbar);
-123
View File
@@ -1,123 +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 delete a course.
*
* @package core
* @subpackage cli
* @author Mikhail Golenkov <mikhailgolenkov@catalyst-au.net>
* @copyright 2022 Catalyst IT
* @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');
list($options, $unrecognized) = cli_get_params(
[
'courseid' => false,
'help' => false,
'showsql' => false,
'showdebugging' => false,
'disablerecyclebin' => false,
'non-interactive' => false,
], [
'c' => 'courseid',
'h' => 'help',
]
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] || empty($options['courseid'])) {
$help = <<<EOT
CLI script to delete a course.
Options:
-h, --help Print out this help
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
--disablerecyclebin Skip backing up the course
--non-interactive No interactive questions or confirmations
-c, --courseid Course id to be deleted
Example:
\$sudo -u www-data /usr/bin/php admin/cli/delete_course.php --courseid=123456
\$sudo -u www-data /usr/bin/php admin/cli/delete_course.php --courseid=123456 --showdebugging
\$sudo -u www-data /usr/bin/php admin/cli/delete_course.php --courseid=123456 --disablerecyclebin
EOT;
echo $help;
die;
}
$interactive = empty($options['non-interactive']);
if ($options['showdebugging']) {
mtrace('Enabling debugging...');
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
mtrace('Enabling SQL debugging...');
$DB->set_debug(true);
}
if (CLI_MAINTENANCE) {
cli_error('CLI maintenance mode active, CLI execution suspended');
}
if (moodle_needs_upgrading()) {
cli_error('Moodle upgrade pending, CLI execution suspended');
}
$course = $DB->get_record('course', array('id' => $options['courseid']));
if (empty($course)) {
cli_error('Course not found');
}
mtrace('Deleting course id ' . $course->id);
mtrace('Course name: ' . $course->fullname);
mtrace('Short name: ' . $course->shortname);
if ($interactive) {
mtrace('');
$input = cli_input('Are you sure you wish to delete this course? (y/N)', 'N', ['y', 'Y', 'n', 'N']);
if (strtolower($input) != 'y') {
exit(0);
}
}
if ($options['disablerecyclebin']) {
mtrace('Disabling recycle bin...');
$overrideconfig = ['tool_recyclebin' => ['coursebinenable' => false, 'categorybinenable' => false]];
$CFG->forced_plugin_settings = array_merge($CFG->forced_plugin_settings, $overrideconfig);
}
core_php_time_limit::raise();
delete_course($course);
mtrace('Updating course count in categories...');
fix_course_sortorder();
mtrace('Done!');
-209
View File
@@ -1,209 +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 script allows you to view and change the emailstop flag of any user.
*
* @package core
* @subpackage cli
* @copyright 2023 Stephan Robotta (stephan.robotta@bfh.ch)
* @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');
// Define the input options.
$longparams = [
'email' => '',
'help' => false,
'id' => '',
'quiet' => false,
'stop' => '',
'username' => '',
];
$shortparams = [
'e' => 'email',
'h' => 'help',
'i' => 'id',
'q' => 'quiet',
's' => 'stop',
'u' => 'username',
];
// Define exit codes.
$exitsuccess = 0;
$exitunknownoption = 1;
$exitmissinguserarg = 2;
$exittoomanyuserarg = 3;
$exitnosearchargs = 4;
$exitnousersfound = 5;
$exitinvalidstopflag = 6;
$exiterrordb = 7;
// Now get cli options that are set by the caller.
list($options, $unrecognized) = cli_get_params($longparams, $shortparams);
$verbose = empty($options['quiet']);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
if ($verbose) {
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), $exitunknownoption);
}
exit($exitunknownoption);
}
if ($options['help']) {
$help =
"Set/unset or show status of emailstop flag for a user, identified by username or email.
There are no security checks here because anybody who is able to
execute this file may execute any PHP too.
Options:
-h, --help Print out this help
-e, --email=email Specify user by email, separate many users by comma
-i, --id=id Specify user by id, separate many users by comma
-q, --quiet No output to stdout
-s, --stop=0|1|off|on Set new value for emailstop flag
-u, --username=username Specify user by username, separate many users by comma
Example:
\$sudo -u www-data /usr/bin/php admin/cli/emailstop.php --email=student1@example.com --stop=1
\$sudo -u www-data /usr/bin/php admin/cli/emailstop.php --email=student1@example.com,student2@example.com
\$sudo -u www-data /usr/bin/php admin/cli/emailstop.php --u=student1,student2 -s=on
";
echo $help;
exit($exitsuccess);
}
$cntempty = 0;
$cntfilled = 0;
$searchargs = [];
// Try to find out which option is used to fetch the users from. Also do sanitize etc.
foreach (['email', 'username', 'id'] as $option) {
if (empty($options[$option])) {
$cntempty++;
} else {
$cntfilled++;
$argname = $option;
// The search args must be: split by the comma, trimmed, and empty elements filtered out.
$searchargs = array_flip(array_filter(
array_map(
function ($item) {
return trim($item);
},
explode(',', $options[$option])
),
function ($item) {
return $item !== '';
}
));
}
}
if ($cntempty === 3) {
if ($verbose) {
cli_error('One of username, email, or id must be set.', $exitmissinguserarg);
}
exit($exitmissinguserarg);
}
if ($cntfilled > 1) {
if ($verbose) {
cli_error('Only one of email, username, or id can be set to identify a user.', $exittoomanyuserarg);
}
exit($exittoomanyuserarg);
}
if (empty($searchargs)) {
if ($verbose) {
cli_error('No values are provided for users.', $exitnosearchargs);
}
exit($exitnosearchargs);
}
try {
$users = $DB->get_records_list('user', $argname, array_keys($searchargs));
} catch (Exception $e) {
if ($verbose) {
cli_error("Could not fetch data from db by {$argname}: '{$options[$argname]}'.", $exiterrordb);
}
exit($exiterrordb);
}
if (empty($users)) {
if ($verbose) {
cli_error("Can not find any user by {$argname}: '{$options[$argname]}'.", $exitnousersfound);
}
exit($exitnousersfound);
}
// No stop flag set, then just print the user and the current emailstop flag state.
if ($options['stop'] === '') {
foreach ($users as $user) {
if ($verbose) {
echo 'user=' . $user->{$argname} . ' - emailstop=' . (int)$user->emailstop . PHP_EOL;
unset($searchargs[$user->{$argname}]);
}
}
if ($verbose) {
foreach (array_keys($searchargs) as $arg) {
echo 'user=' . $arg . ' - not found' . PHP_EOL;
}
}
exit($exitsuccess);
}
// Allowed values for the stop flag enabled are 1 and on, for disabled are 0 and off.
$validvalues = ['0', '1', 'off', 'on'];
$stopflag = strtolower($options['stop']);
if (!in_array($stopflag, $validvalues)) {
if ($verbose) {
cli_error('Value for the emailstop flag must be one of: ' . implode(', ', $validvalues) . '.', $exitinvalidstopflag);
}
exit($exitinvalidstopflag);
}
foreach ($validvalues as $value) {
if ($value === $stopflag) {
$stopflag = ($value === '1' || $value === 'on') ? 1 : 0;
break;
}
}
// Update each user with the stop flag to be set if it is necessary.
foreach ($users as $user) {
$line = 'Update user ' . $user->{$argname} . ($argname !== 'id' ? ' (' . $user->id . ')' : '') . ' - ';
if ((int)$user->emailstop !== $stopflag) {
$DB->set_field('user', 'emailstop', $stopflag, ['id' => $user->id]);
$line .= 'ok';
} else {
$line .= 'already done';
}
if ($verbose) {
echo $line . PHP_EOL;
unset($searchargs[$user->{$argname}]);
}
}
if ($verbose) {
foreach (array_keys($searchargs) as $arg) {
echo 'user=' . $arg . ' - not found' . PHP_EOL;
}
}
exit($exitsuccess);
-1
View File
@@ -73,7 +73,6 @@ foreach ($rs as $user) {
echo "Redeleting user $user->id: $user->username ($user->email)\n";
delete_user($user);
}
$rs->close();
cli_heading('Deleting all leftovers');
-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.");
}
-79
View File
@@ -1,79 +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/>.
/**
* Generates a secure key for the current server (presuming it does not already exist).
*
* @package core_admin
* @copyright 2020 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use \core\encryption;
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
// Get cli options.
[$options, $unrecognized] = cli_get_params(
['help' => false, 'method' => null],
['h' => 'help']);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
// TODO: MDL-71421 - Remove the openssl alternative once sodium becomes a requirement in Moodle 4.2.
if ($options['help']) {
echo "Generate secure key
This script manually creates a secure key within the secret data root folder (configured in
config.php as \$CFG->secretdataroot). You must run it using an account with access to write
to that folder.
In normal use Moodle automatically creates the key; this script is intended when setting up
a new Moodle system, for cases where the secure folder is not on shared storage and the key
may be manually installed on multiple servers.
Options:
-h, --help Print out this help
--method <method> Generate key for specified encryption method instead of default.
* sodium
* openssl-aes-256-ctr
Example:
php admin/cli/generate_key.php
";
exit;
}
$method = $options['method'];
if (encryption::key_exists($method)) {
echo 'Key already exists: ' . encryption::get_key_file($method) . "\n";
exit;
}
// Creates key with default permissions (no chmod).
echo "Generating key...\n";
encryption::create_key($method, false);
echo "\nKey created: " . encryption::get_key_file($method) . "\n\n";
echo "If the key folder is not shared storage, then key files should be copied to all servers.\n";
+195 -238
View File
@@ -74,8 +74,6 @@ Options:
--adminpass=PASSWORD Password for the moodle admin account,
required in non-interactive mode.
--adminemail=STRING Email address for the moodle admin account.
--sitepreset=STRING Admin site preset to be applied during the installation process.
--supportemail=STRING Email address for support and help.
--upgradekey=STRING The upgrade key to be set in the config.php, leave empty to not set it.
--non-interactive No interactive questions, installation fails if any
problem encountered.
@@ -92,7 +90,7 @@ Example:
// distro specific customisation
$distrolibfile = __DIR__.'/../../install/distrolib.php';
$distrolibfile = dirname(dirname(dirname(__FILE__))).'/install/distrolib.php';
$distro = null;
if (file_exists($distrolibfile)) {
require_once($distrolibfile);
@@ -102,7 +100,7 @@ if (file_exists($distrolibfile)) {
}
// Nothing to do if config.php exists
$configfile = __DIR__.'/../../config.php';
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
if (file_exists($configfile)) {
require($configfile);
require_once($CFG->libdir.'/clilib.php');
@@ -148,15 +146,20 @@ define('PHPUNIT_TEST', false);
define('IGNORE_COMPONENT_CACHE', true);
// Check that PHP is of a sufficient version as soon as possible.
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
moodle_require_minimum_php_version();
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.4.4") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}
// set up configuration
global $CFG;
$CFG = new stdClass();
$CFG->lang = 'en';
$CFG->dirroot = dirname(dirname(__DIR__));
$CFG->dirroot = dirname(dirname(dirname(__FILE__)));
$CFG->libdir = "$CFG->dirroot/lib";
$CFG->wwwroot = "http://localhost";
$CFG->httpswwwroot = $CFG->wwwroot;
@@ -169,7 +172,7 @@ $CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = true;
$CFG->debugdeveloper = true;
$parts = explode('/', str_replace('\\', '/', dirname(__DIR__)));
$parts = explode('/', str_replace('\\', '/', dirname(dirname(__FILE__))));
$CFG->admin = array_pop($parts);
//point pear include path to moodles lib/pear so that includes and requires will search there for files before anywhere else
@@ -217,11 +220,11 @@ 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'),
'sqlsrv' => moodle_database::get_driver_instance('sqlsrv', 'native'), // MS SQL*Server PHP driver
'mssql' => moodle_database::get_driver_instance('mssql', 'native'), // FreeTDS driver
);
foreach ($databases as $type=>$database) {
if ($database->driver_installed() !== true) {
@@ -241,7 +244,7 @@ list($options, $unrecognized) = cli_get_params(
'chmod' => isset($distro->directorypermissions) ? sprintf('%04o',$distro->directorypermissions) : '2777', // let distros set dir permissions
'lang' => $CFG->lang,
'wwwroot' => '',
'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(__DIR__))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro
'dataroot' => empty($distro->dataroot) ? str_replace('\\', '/', dirname(dirname(dirname(dirname(__FILE__)))).'/moodledata'): $distro->dataroot, // initialised later after including libs or by distro
'dbtype' => empty($distro->dbtype) ? $defaultdb : $distro->dbtype, // let distro skip dbtype selection
'dbhost' => empty($distro->dbhost) ? 'localhost' : $distro->dbhost, // let distros set dbhost
'dbname' => 'moodle',
@@ -256,8 +259,6 @@ list($options, $unrecognized) = cli_get_params(
'adminuser' => 'admin',
'adminpass' => '',
'adminemail' => '',
'sitepreset' => '',
'supportemail' => '',
'upgradekey' => '',
'non-interactive' => false,
'agree-license' => false,
@@ -271,7 +272,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);
@@ -280,12 +280,6 @@ if (array_key_exists($lang, $languages)) {
$CFG->lang = $lang;
}
// Set up site admin preset.
$sitepreset = clean_param($options['sitepreset'], PARAM_RAW);
if (!empty($sitepreset)) {
$CFG->setsitepresetduringinstall = $sitepreset;
}
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
@@ -403,6 +397,7 @@ if ($interactive) {
$CFG->wwwroot = $wwwroot;
$CFG->httpswwwroot = $CFG->wwwroot;
//We need dataroot before lang download
$CFG->dataroot = $options['dataroot'];
if ($interactive) {
@@ -453,7 +448,6 @@ if ($interactive) {
}
}
$CFG->tempdir = $CFG->dataroot.'/temp';
$CFG->backuptempdir = $CFG->tempdir.'/backup';
$CFG->cachedir = $CFG->dataroot.'/cache';
$CFG->localcachedir = $CFG->dataroot.'/localcache';
@@ -525,105 +519,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 {
@@ -631,132 +620,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');
}
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 {
if ((empty($options['adminpass']) or $options['adminpass'] === 'admin')) {
$a = (object)['option' => 'adminpass', 'value' => $options['adminpass']];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
$prompt = get_string('clitypevalue', 'admin');
}
// 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['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 the support email address.
if ($interactive) {
cli_separator();
cli_heading(get_string('clisupportemail', 'install'));
$prompt = get_string('clitypevaluedefault', 'admin', $options['supportemail']);
$options['supportemail'] = cli_input($prompt, $options['supportemail']);
// 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');
}
// Validate that the support email address provided is valid.
if (!empty($options['supportemail']) && !validate_email($options['supportemail'])) {
$a = (object)['option' => 'supportemail', 'value' => $options['supportemail']];
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();
@@ -775,27 +742,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
@@ -843,14 +806,8 @@ 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.
// This will build a cached version of the current theme for the user
// to immediately start browsing the site.
require_once($CFG->libdir.'/upgradelib.php');
upgrade_themes();
} else {
echo get_string('cliskipdatabase', 'install')."\n";
}
+14 -34
View File
@@ -56,20 +56,23 @@ Options:
--agree-license Indicates agreement with software license.
--fullname=STRING Name of the site
--shortname=STRING Name of the site
--summary=STRING The summary to be displayed on the front page
--supportemail=STRING Email address for support and help.
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/install_database.php --lang=cs --adminpass=soMePass123 --agree-license
";
// Check that PHP is of a sufficient version as soon as possible.
require_once(__DIR__.'/../../lib/phpminimumversionlib.php');
moodle_require_minimum_php_version();
// Check that PHP is of a sufficient version
if (version_compare(phpversion(), "5.4.4") < 0) {
$phpversion = phpversion();
// do NOT localise - lang strings would not work here and we CAN NOT move it after installib
fwrite(STDERR, "Moodle 2.7 or later requires at least PHP 5.4.4 (currently using version $phpversion).\n");
fwrite(STDERR, "Please upgrade your server software or install older Moodle version.\n");
exit(1);
}
// Nothing to do if config.php does not exist
$configfile = __DIR__.'/../../config.php';
$configfile = dirname(dirname(dirname(__FILE__))).'/config.php';
if (!file_exists($configfile)) {
fwrite(STDERR, 'config.php does not exist, can not continue'); // do not localize
fwrite(STDERR, "\n");
@@ -84,6 +87,11 @@ require_once($CFG->libdir.'/installlib.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/componentlib.class.php');
// make sure no tables are installed yet
if ($DB->get_tables() ) {
cli_error(get_string('clitablesexist', 'install'));
}
$CFG->early_install_lang = true;
get_string_manager(true);
@@ -98,8 +106,6 @@ list($options, $unrecognized) = cli_get_params(
'adminemail' => '',
'fullname' => '',
'shortname' => '',
'summary' => '',
'supportemail' => '',
'agree-license' => false,
'help' => false
),
@@ -108,22 +114,12 @@ list($options, $unrecognized) = cli_get_params(
)
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
// We show help text even if tables are installed.
if ($options['help']) {
echo $help;
die;
}
// Make sure no tables are installed yet.
if ($DB->get_tables() ) {
cli_error(get_string('clitablesexist', 'install'));
}
if (!$options['agree-license']) {
cli_error('You have to agree to the license. --help prints out the help'); // TODO: localize
}
@@ -138,15 +134,6 @@ if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
// Validate that the supportemail provided was an e-mail address.
if (!empty($options['supportemail']) && !validate_email($options['supportemail'])) {
$a = (object) [
'option' => 'supportemail',
'value' => $options['supportemail']
];
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
}
$options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR);
if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
$options['lang'] = 'en';
@@ -196,12 +183,5 @@ if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed)) {
install_cli_database($options, true);
// This needs to happen at the end to ensure it occurs after all caches
// have been purged for the last time.
// This will build a cached version of the current theme for the user
// to immediately start browsing the site.
require_once($CFG->libdir.'/upgradelib.php');
upgrade_themes();
echo get_string('cliinstallfinished', 'install')."\n";
exit(0); // 0 means success
-55
View File
@@ -1,55 +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 kill all user sessions without asking for confirmation.
*
* @package core
* @subpackage cli
* @copyright 2017 Alexander Bias <alexander.bias@uni-ulm.de>
* @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');
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
}
if ($options['help']) {
$help =
"Kill all Moodle sessions
Options:
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/kill_all_sessions.php
";
echo $help;
exit(0);
}
\core\session\manager::kill_all_sessions();
exit(0);
+11 -47
View File
@@ -24,7 +24,7 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
if ($DB->get_dbfamily() !== 'mysql') {
@@ -53,7 +53,7 @@ Options:
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci
";
if (!empty($options['collation'])) {
@@ -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) {
@@ -145,25 +145,12 @@ if (!empty($options['collation'])) {
$skipped++;
} else {
try {
$DB->change_database_structure("ALTER TABLE `$table->name` CONVERT TO CHARACTER SET $charset COLLATE $collation");
echo "CONVERTED\n";
$converted++;
} catch (ddl_exception $e) {
$result = mysql_set_row_format($table->name, $charset, $collation, $engine);
if ($result) {
echo "CONVERTED\n";
$converted++;
} else {
// We don't know what the problem is. Stop the conversion.
cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this
table and try again.");
die();
}
}
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
echo "CONVERTED\n";
$converted++;
}
$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 +168,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,18 +179,18 @@ 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";
$DB->change_database_structure($sql);
} else {
echo "ERROR (unknown column type: $column->type)\n";
$errors++;
$error++;
continue;
}
echo "CONVERTED\n";
@@ -303,26 +290,3 @@ function mysql_get_column_collations($tablename) {
$rs->close();
return $collations;
}
function mysql_set_row_format($tablename, $charset, $collation, $engine) {
global $DB;
$sql = "SELECT row_format
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND table_name = ?";
$rs = $DB->get_record_sql($sql, array($tablename));
if ($rs) {
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");
} else {
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
return false;
}
} else {
return false;
}
return true;
}
+3 -3
View File
@@ -25,7 +25,7 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(__FILE__).'/../../config.php');
require_once($CFG->libdir . '/clilib.php');
if ($DB->get_dbfamily() !== 'mysql') {
@@ -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);
+180
View File
@@ -0,0 +1,180 @@
<?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/>.
/**
* MySQL engine conversion tool.
*
* @package core
* @subpackage cli
* @copyright 2009 Petr Skoda (http://skodak.org)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
if ($DB->get_dbfamily() !== 'mysql') {
cli_error('This function is designed for MySQL databases only!');
}
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false, 'list'=>false, 'engine'=>false, 'available'=>false),
array('h'=>'help', 'l'=>'list', 'a'=>'available'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$help =
"MySQL engine conversions script.
It is recommended to stop the web server before the conversion.
Do not use MyISAM if possible, because it is not ACID compliant
and does not support transactions.
Options:
--engine=ENGINE Convert MySQL tables to different engine
-l, --list Show table information
-a, --available Show list of available engines
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB
";
if (!empty($options['engine'])) {
$engines = mysql_get_engines();
$engine = clean_param($options['engine'], PARAM_ALPHA);
if (!isset($engines[strtoupper($engine)])) {
cli_error("Error: engine '$engine' is not available on this server!");
}
echo "Converting tables to '$engine' for $CFG->wwwroot:\n";
$prefix = $DB->get_prefix();
$prefix = str_replace('_', '\\_', $prefix);
$sql = "SHOW TABLE STATUS WHERE Name LIKE BINARY '$prefix%'";
$rs = $DB->get_recordset_sql($sql);
$converted = 0;
$skipped = 0;
$errors = 0;
foreach ($rs as $table) {
if (strtoupper($table->engine) === strtoupper($engine)) {
$newengine = mysql_get_table_engine($table->name);
echo str_pad($table->name, 40). " - NO CONVERSION NEEDED ($newengine)\n";
$skipped++;
continue;
}
echo str_pad($table->name, 40). " - ";
try {
$DB->change_database_structure("ALTER TABLE {$table->name} ENGINE = $engine");
$newengine = mysql_get_table_engine($table->name);
if (strtoupper($newengine) !== strtoupper($engine)) {
echo "ERROR ($newengine)\n";
$errors++;
continue;
}
echo "DONE ($newengine)\n";
$converted++;
} catch (moodle_exception $e) {
echo $e->getMessage()."\n";
$errors++;
continue;
}
}
$rs->close();
echo "Converted: $converted, skipped: $skipped, errors: $errors\n";
exit(0); // success
} else if (!empty($options['list'])) {
echo "List of tables for $CFG->wwwroot:\n";
$prefix = $DB->get_prefix();
$prefix = str_replace('_', '\\_', $prefix);
$sql = "SHOW TABLE STATUS WHERE Name LIKE BINARY '$prefix%'";
$rs = $DB->get_recordset_sql($sql);
$counts = array();
foreach ($rs as $table) {
if (isset($counts[$table->engine])) {
$counts[$table->engine]++;
} else {
$counts[$table->engine] = 1;
}
echo str_pad($table->engine, 10);
echo $table->name . "\n";
}
$rs->close();
echo "\n";
echo "Table engines summary for $CFG->wwwroot:\n";
foreach ($counts as $engine => $count) {
echo "$engine: $count\n";
}
exit(0); // success
} else if (!empty($options['available'])) {
echo "List of available MySQL engines for $CFG->wwwroot:\n";
$engines = mysql_get_engines();
foreach ($engines as $engine) {
echo " $engine\n";
}
die;
} else {
echo $help;
die;
}
// ========== Some functions ==============
function mysql_get_engines() {
global $DB;
$sql = "SHOW Engines";
$rs = $DB->get_recordset_sql($sql);
$engines = array();
foreach ($rs as $engine) {
if (strtoupper($engine->support) !== 'YES' and strtoupper($engine->support) !== 'DEFAULT') {
continue;
}
$engines[strtoupper($engine->engine)] = $engine->engine;
if (strtoupper($engine->support) === 'DEFAULT') {
$engines[strtoupper($engine->engine)] .= ' (default)';
}
}
$rs->close();
return $engines;
}
function mysql_get_table_engine($tablename) {
global $DB;
$engine = null;
$sql = "SHOW TABLE STATUS WHERE Name = '$tablename'"; // no special chars expected here
$rs = $DB->get_recordset_sql($sql);
if ($rs->valid()) {
$record = $rs->current();
$engine = $record->engine;
}
$rs->close();
return $engine;
}
+8 -31
View File
@@ -15,8 +15,6 @@
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* CLI script to purge caches without asking for confirmation.
*
* @package core
* @subpackage cli
* @copyright 2011 David Mudrak <david@moodle.com>
@@ -25,19 +23,10 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php');
$longoptions = [
'help' => false,
'muc' => false,
'theme' => false,
'lang' => false,
'js' => false,
'filter' => false,
'other' => false
];
list($options, $unrecognized) = cli_get_params($longoptions, ['h' => 'help']);
list($options, $unrecognized) = cli_get_params(array('help' => false), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -45,32 +34,20 @@ if ($unrecognized) {
}
if ($options['help']) {
// The indentation of this string is "wrong" but this is to avoid a extra whitespace in console output.
$help = <<<EOF
Invalidates Moodle internal caches
Specific caches can be defined (alone or in combination) using arguments. If none are specified,
all caches will be purged.
$help =
"Invalidates all Moodle internal caches
Options:
-h, --help Print out this help
--muc Purge all MUC caches (includes lang cache)
--theme Purge theme cache
--lang Purge language string cache
--js Purge JavaScript cache
--filter Purge text filter cache
--other Purge all file caches and other miscellaneous caches (may include MUC
if using cachestore_file).
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/purge_caches.php
EOF;
\$sudo -u www-data /usr/bin/php admin/cli/purge_caches.php
";
echo $help;
exit(0);
}
purge_caches(array_filter($options));
purge_all_caches();
exit(0);
exit(0);
+11 -38
View File
@@ -26,26 +26,13 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
// Define the input options.
$longparams = array(
'help' => false,
'username' => '',
'password' => '',
'ignore-password-policy' => false
);
$shortparams = array(
'h' => 'help',
'u' => 'username',
'p' => 'password',
'i' => 'ignore-password-policy'
);
// now get cli options
list($options, $unrecognized) = cli_get_params($longparams, $shortparams);
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -60,43 +47,29 @@ There are no security checks here because anybody who is able to
execute this file may execute any PHP too.
Options:
-h, --help Print out this help
-u, --username=username Specify username to change
-p, --password=newpassword Specify new password
--ignore-password-policy Ignore password policy when setting password
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php --username=rosaura --password=jiu3jiu --ignore-password-policy
";
echo $help;
die;
}
if ($options['username'] == '' ) {
cli_heading('Password reset');
$prompt = "Enter username (manual authentication only)";
$username = cli_input($prompt);
} else {
$username = $options['username'];
}
cli_heading('Password reset');
$prompt = "Enter username (manual authentication only)";
$username = cli_input($prompt);
if (!$user = $DB->get_record('user', array('auth'=>'manual', 'username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
cli_error("Can not find user '$username'");
}
if ($options['password'] == '' ) {
$prompt = "Enter new password";
$password = cli_input($prompt);
} else {
$password = $options['password'];
}
$prompt = "Enter new password";
$password = cli_input($prompt);
$errmsg = '';//prevent eclipse warning
if (!$options['ignore-password-policy'] ) {
if (!check_password_policy($password, $errmsg, $user)) {
cli_error(html_to_text($errmsg, 0));
}
if (!check_password_policy($password, $errmsg)) {
cli_error(html_to_text($errmsg, 0));
}
$hashedpassword = hash_internal_user_password($password);
-109
View File
@@ -1,109 +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 script allows to restore a course from CLI.
*
* @package core
* @subpackage cli
* @copyright 2020 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', 1);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require_once($CFG->dirroot . "/backup/util/includes/restore_includes.php");
list($options, $unrecognized) = cli_get_params([
'file' => '',
'categoryid' => '',
'showdebugging' => false,
'help' => false,
], [
'f' => 'file',
'c' => 'categoryid',
's' => 'showdebugging',
'h' => 'help',
]);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] || !($options['file']) || !($options['categoryid'])) {
$help = <<<EOL
Restore backup into provided category.
Options:
-f, --file=STRING Path to the backup file.
-c, --categoryid=INT ID of the category to restore too.
-s, --showdebugging Show developer level debugging information
-h, --help Print out this help.
Example:
\$sudo -u www-data /usr/bin/php admin/cli/restore_backup.php --file=/path/to/backup/file.mbz --categoryid=1\n
EOL;
echo $help;
exit(0);
}
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if (!$admin = get_admin()) {
throw new \moodle_exception('noadmins');
}
if (!file_exists($options['file'])) {
throw new \moodle_exception('filenotfound');
}
if (!$category = $DB->get_record('course_categories', ['id' => $options['categoryid']], 'id')) {
throw new \moodle_exception('invalidcategoryid');
}
$backupdir = restore_controller::get_tempdir_name(SITEID, $USER->id);
$path = make_backup_temp_directory($backupdir);
cli_heading(get_string('extractingbackupfileto', 'backup', $path));
$fp = get_file_packer('application/vnd.moodle.backup');
$fp->extract_to_pathname($options['file'], $path);
cli_heading(get_string('preprocessingbackupfile'));
try {
list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoringcourse', 'backup'),
get_string('restoringcourseshortname', 'backup'));
$courseid = restore_dbops::create_new_course($fullname, $shortname, $category->id);
$rc = new restore_controller($backupdir, $courseid, backup::INTERACTIVE_NO,
backup::MODE_GENERAL, $admin->id, backup::TARGET_NEW_COURSE);
$rc->execute_precheck();
$rc->execute_plan();
$rc->destroy();
} catch (Exception $e) {
cli_heading(get_string('cleaningtempdata'));
fulldelete($path);
throw new \moodle_exception('generalexceptionmessage', 'error', '', $e->getMessage());
}
cli_heading(get_string('restoredcourseid', 'backup', $courseid));
exit(0);
-167
View File
@@ -1,167 +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");
list($options, $unrecognized) = cli_get_params(
[
'help' => false,
'list' => false,
'execute' => false,
'showsql' => false,
'showdebugging' => false,
'force' => false,
], [
'h' => 'help',
'f' => 'force',
]
);
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
-f, --force Execute task even if cron is disabled
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'] || !empty($CFG->showcrondebugging)) {
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql'] || !empty($CFG->showcronsql)) {
$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);
}
if (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
\core\task\manager::scheduled_task_starting($task);
// Increase memory limit.
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
\core\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);
}
\core\cron::run_inner_scheduled_task($task);
}
-183
View File
@@ -1,183 +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.
--showsql Show sql queries before they are executed.
--showdebugging Show developer level debugging information.
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,
'showsql' => false,
'showdebugging' => 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);
}
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
$DB->set_debug(true);
}
$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);
+28 -156
View File
@@ -38,7 +38,7 @@ if (function_exists('opcache_reset') and !isset($_SERVER['REMOTE_ADDR'])) {
define('CLI_SCRIPT', true);
define('CACHE_DISABLE_ALL', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php'); // various admin-only functions
require_once($CFG->libdir.'/upgradelib.php'); // general upgrade/install related functions
require_once($CFG->libdir.'/clilib.php'); // cli only functions
@@ -48,16 +48,10 @@ require_once($CFG->libdir.'/environmentlib.php');
$lang = isset($SESSION->lang) ? $SESSION->lang : $CFG->lang;
list($options, $unrecognized) = cli_get_params(
array(
'allow-unstable' => false,
'help' => false,
'is-maintenance-required' => false,
'is-pending' => false,
'lang' => $lang,
'maintenance' => true,
'non-interactive' => false,
'set-ui-upgrade-lock' => false,
'unset-ui-upgrade-lock' => false,
'verbose-settings' => false,
'non-interactive' => false,
'allow-unstable' => false,
'help' => false,
'lang' => $lang
),
array(
'h' => 'help'
@@ -83,35 +77,14 @@ Please note you must execute this script with the same uid as apache!
Site defaults may be changed via local/defaults.php.
Options:
--allow-unstable Upgrade even if the version is not marked as stable yet,
required in non-interactive mode.
-h, --help Print out this help.
--is-maintenance-required Returns exit code 2 if the upgrade requires maintenance mode.
Returns exit code 3 if no maintenance is required for the upgrade.
--is-pending Exit with error code 2 if an upgrade is required.
--lang=CODE Set preferred language for CLI output. Defaults to the
site language if not set. Defaults to 'en' if the lang
parameter is invalid or if the language pack is not
installed.
--maintenance Sets whether this upgrade will use maintenance mode.
If not possible, the upgrade will not happen and the script will exit.
WARNING: Caches (except theme) will be STALE and MUST be purged after upgrading.
DO NOT USE if the upgrade contains known breaking changes to the way data
and the database interact.
RECOMMENDED for lightweight deployments, to allow for a graceful purge and
rebuild of the cache.
--non-interactive No interactive questions or confirmations.
--set-ui-upgrade-lock Sets the upgrade to CLI only and unable to be triggered from the frontend.
If called with --maintenance=false, the lock WILL NOT be released when the
upgrade finishes, and MUST be manually removed.
If called with --is-maintenance-required before an upgrade,
The lock WILL be released when the upgrade finishes.
--unset-ui-upgrade-lock Removes the frontend upgrade lock, if the lock exists.
Useful when an error during the upgrade leaves the upgrade locked,
or there is need to control the time where the unlock happens.
--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.
--non-interactive No interactive questions or confirmations
--allow-unstable Upgrade even if the version is not marked as stable yet,
required in non-interactive mode.
--lang=CODE Set preferred language for CLI output. Defaults to the
site language if not set. Defaults to 'en' if the lang
parameter is invalid or if the language pack is not
installed.
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/upgrade.php
@@ -135,60 +108,10 @@ if ($version < $CFG->version) {
$oldversion = "$CFG->release ($CFG->version)";
$newversion = "$release ($version)";
if ($options['unset-ui-upgrade-lock']) {
// Unconditionally unset this config if requested.
set_config('outagelessupgrade', false);
cli_writeln(get_string('cliupgradeunsetlock', 'admin'));
}
$allhash = core_component::get_all_component_hash();
// Initialise allcomponent hash if not set. It will be correctly set after upgrade.
$CFG->allcomponenthash = $CFG->allcomponenthash ?? '';
if (!$options['maintenance']) {
if ($allhash !== $CFG->allcomponenthash) {
// Throw an error here, we can't proceed, this needs to set maintenance.
cli_error(get_string('cliupgrademaintenancerequired', 'core_admin'), 2);
}
// Set a constant to stop any upgrade var from being set during processing.
// This protects against the upgrade setting timeouts and maintenance during the upgrade.
define('CLI_UPGRADE_RUNNING', true);
// This database control is the control to block the GUI from doing upgrade related actions.
set_config('outagelessupgrade', true);
}
// We should ignore all upgrade locks here.
if (!moodle_needs_upgrading(false)) {
if (!moodle_needs_upgrading()) {
cli_error(get_string('cliupgradenoneed', 'core_admin', $newversion), 0);
}
// Handle exit based options for outputting upgrade state.
if ($options['is-pending'] || $options['is-maintenance-required']) {
// If we aren't doing a maintenance check, plain pending check.
if (!$options['is-maintenance-required']) {
cli_error(get_string('cliupgradepending', 'core_admin'), 2);
}
// Can we do this safely with no maintenance/outage? Detect if there is a schema or other application state change.
if ($allhash !== $CFG->allcomponenthash) {
// State change here, we need to do this in maintenance.
cli_writeln(get_string('cliupgradepending', 'core_admin'));
cli_error(get_string('cliupgrademaintenancerequired', 'core_admin'), 2);
}
// If requested, we should always set the upgrade lock here, so this cannot be run from frontend.
if ($options['set-ui-upgrade-lock']) {
set_config('outagelessupgrade', true);
cli_writeln(get_string('cliupgradesetlock', 'admin'));
}
// We can do an upgrade without maintenance!
cli_writeln(get_string('cliupgradepending', 'core_admin'));
cli_error(get_string('cliupgrademaintenancenotrequired', 'core_admin'), 3);
}
// Test environment first.
list($envstatus, $environment_results) = check_moodle_environment(normalize_version($release), ENV_SELECT_RELEASE);
if (!$envstatus) {
@@ -201,27 +124,17 @@ if (!$envstatus) {
exit(1);
}
// Make sure there are no files left over from previous versions.
if (upgrade_stale_php_files_present()) {
cli_problem(get_string('upgradestalefiles', 'admin'));
// Stale file info contains HTML elements which aren't suitable for CLI.
$upgradestalefilesinfo = get_string('upgradestalefilesinfo', 'admin', get_docs_url('Upgrading'));
cli_error(strip_tags($upgradestalefilesinfo));
}
// 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'));
}
$a = new stdClass();
$a->oldversion = $oldversion;
$a->newversion = $newversion;
if ($interactive) {
$a = new stdClass();
$a->oldversion = $oldversion;
$a->newversion = $newversion;
echo cli_heading(get_string('databasechecking', '', $a)) . PHP_EOL;
}
@@ -253,18 +166,12 @@ if ($interactive) {
}
if ($version > $CFG->version) {
// Only purge caches if this is a plain upgrade.
// In the case of a no-outage upgrade, we will gracefully roll caches after upgrade.
if ($options['maintenance']) {
// We purge all of MUC's caches here.
// Caches are disabled for upgrade by CACHE_DISABLE_ALL so we must set the first arg to true.
// This ensures a real config object is loaded and the stores will be purged.
// This is the only way we can purge custom caches such as memcache or APC.
// Note: all other calls to caches will still used the disabled API.
cache_helper::purge_all(true);
}
// We purge all of MUC's caches here.
// Caches are disabled for upgrade by CACHE_DISABLE_ALL so we must set the first arg to true.
// This ensures a real config object is loaded and the stores will be purged.
// This is the only way we can purge custom caches such as memcache or APC.
// Note: all other calls to caches will still used the disabled API.
cache_helper::purge_all(true);
upgrade_core($version, true);
}
set_config('release', $release);
@@ -276,44 +183,9 @@ upgrade_noncore(true);
// log in as admin - we need doanything permission when applying defaults
\core\session\manager::set_user(get_admin());
// Apply default settings and output those that have changed.
cli_heading(get_string('cliupgradedefaultheading', 'admin'));
$settingsoutput = admin_apply_default_settings(null, false);
foreach ($settingsoutput as $setting => $value) {
if ($options['verbose-settings']) {
$stringvlaues = array(
'name' => $setting,
'defaultsetting' => var_export($value, true) // Expand objects.
);
echo get_string('cliupgradedefaultverbose', 'admin', $stringvlaues) . PHP_EOL;
} else {
echo get_string('cliupgradedefault', 'admin', $setting) . PHP_EOL;
}
}
// This needs to happen at the end to ensure it occurs after all caches
// have been purged for the last time.
// This will build a cached version of the current theme for the user
// to immediately start browsing the site.
upgrade_themes();
echo get_string('cliupgradefinished', 'admin', $a)."\n";
if (!$options['maintenance']) {
cli_writeln(get_string('cliupgradecompletenomaintenanceupgrade', 'admin'));
// Here we check if upgrade lock has not been specifically set during this upgrade run.
// This supports wider server orchestration actions happening, which should call with no-maintenance AND set-ui-upgrade-lock,
// such as a new docker container deployment, of which the moodle upgrade is only a component.
if (!$options['set-ui-upgrade-lock']) {
// In this case we should release the lock now, as the upgrade is finished.
// We weren't told to keep the lock with set-ui-upgrade-lock, so release.
set_config('outagelessupgrade', false);
}
}
// apply all default settings, just in case do it twice to fill all defaults
admin_apply_default_settings(NULL, false);
admin_apply_default_settings(NULL, false);
echo get_string('cliupgradefinished', 'admin')."\n";
exit(0); // 0 means success
-87
View File
@@ -1,87 +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])) {
throw new \moodle_exception('contenttypenotfound', 'error', $return, $name);
}
switch ($action) {
case 'disable':
if ($plugins[$name]->is_enabled()) {
$class = \core_plugin_manager::resolve_plugininfo_class('contenttype');
$class::enable_plugin($name, false);
}
break;
case 'enable':
if (!$plugins[$name]->is_enabled()) {
$class = \core_plugin_manager::resolve_plugininfo_class('contenttype');
$class::enable_plugin($name, true);
}
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));
core_plugin_manager::reset_caches();
}
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));
core_plugin_manager::reset_caches();
}
break;
}
$cache = cache::make('core', 'contentbank_enabled_extensions');
$cache->purge();
$cache = cache::make('core', 'contentbank_context_extensions');
$cache->purge();
redirect($return);
-79
View File
@@ -1,79 +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/>.
/**
* Reset course indentation
*
* @copyright 2023 Amaia Anabitarte <amaia@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../../config.php');
require_admin();
$format = required_param('format', PARAM_PLUGIN);
$confirm = optional_param('confirm', false, PARAM_BOOL);
$backurl = new moodle_url('/admin/settings.php', ['section' => 'formatsetting'.$format]);
$PAGE->set_url('/admin/course/resetindentation.php', ['format' => $format]);
$PAGE->set_context(context_system::instance());
if ($confirm) {
require_sesskey();
$courses = $DB->get_records('course', ['format' => $format], 'id', 'id');
if (!empty($courses)) {
$courseids = array_keys($courses);
list($courseinsql, $courseparams) = $DB->get_in_or_equal($courseids, SQL_PARAMS_NAMED, 'course');
$DB->set_field_select('course_modules', 'indent', '0', "course $courseinsql AND indent <> 0", $courseparams);
rebuild_course_cache(0, true);
}
redirect(
$backurl,
get_string('resetindentationsuccess', 'admin'),
null,
\core\output\notification::NOTIFY_SUCCESS
);
}
$strtitle = get_string('resetindentation', 'admin');
$PAGE->set_title($strtitle);
$PAGE->set_heading($strtitle);
navigation_node::override_active_url(new moodle_url(
'/admin/course/resetindentation.php',
['action' => 'confirm', 'format' => $format]
));
echo $OUTPUT->header();
$displayoptions = ['confirmtitle' => get_string('resetindentation_title', 'admin')];
$confirmbutton = new single_button(
new moodle_url('/admin/course/resetindentation.php', ['confirm' => 1, 'format' => $format, 'sesskey' => sesskey()]),
get_string('resetindentation', 'admin'),
'post',
single_button::BUTTON_DANGER
);
$cancelbutton = new single_button($backurl, get_string('cancel'));
echo $OUTPUT->confirm(
get_string('resetindentation_help', 'admin', ['format' => get_string('pluginname', 'format_'.$format)]),
$confirmbutton,
$cancelbutton,
$displayoptions
);
echo $OUTPUT->footer();
+10 -6
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'));
@@ -41,20 +42,23 @@ $formatplugins = core_plugin_manager::instance()->get_plugins_of_type('format');
$sortorder = array_flip(array_keys($formatplugins));
if (!isset($formatplugins[$formatname])) {
throw new \moodle_exception('courseformatnotfound', 'error', $return, $formatname);
print_error('courseformatnotfound', 'error', $return, $formatname);
}
switch ($action) {
case 'disable':
if ($formatplugins[$formatname]->is_enabled()) {
$class = \core_plugin_manager::resolve_plugininfo_class('format');
$class::enable_plugin($formatname, false);
if (get_config('moodlecourse', 'format') === $formatname) {
print_error('cannotdisableformat', 'error', $return);
}
set_config('disabled', 1, 'format_'. $formatname);
core_plugin_manager::reset_caches();
}
break;
case 'enable':
if (!$formatplugins[$formatname]->is_enabled()) {
$class = \core_plugin_manager::resolve_plugininfo_class('format');
$class::enable_plugin($formatname, true);
unset_config('disabled', 'format_'. $formatname);
core_plugin_manager::reset_caches();
}
break;
case 'up':
+9 -8
View File
@@ -1,4 +1,5 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -35,7 +36,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// phpcs:ignoreFile moodle.Files.MoodleInternal.MoodleInternalGlobalState
if (defined('STDIN')) {
fwrite(STDERR, "ERROR: This script no longer supports CLI, please use admin/cli/cron.php instead\n");
@@ -49,7 +49,8 @@ define('WEB_CRON_EMULATED_CLI', 'defined'); // ugly ugly hack, do not use elsewh
define('NO_OUTPUT_BUFFERING', true);
require('../config.php');
require_once($CFG->libdir . '/clilib.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->libdir.'/cronlib.php');
// extra safety
\core\session\manager::write_close();
@@ -57,7 +58,7 @@ require_once($CFG->libdir . '/clilib.php');
// check if execution allowed
if (!empty($CFG->cronclionly)) {
// This script can only be run via the cli.
throw new \moodle_exception('cronerrorclionly', 'admin');
print_error('cronerrorclionly', 'admin');
exit;
}
// This script is being called via the web, so check the password if there is one.
@@ -65,16 +66,16 @@ if (!empty($CFG->cronremotepassword)) {
$pass = optional_param('password', '', PARAM_RAW);
if ($pass != $CFG->cronremotepassword) {
// wrong password.
throw new \moodle_exception('cronerrorpassword', 'admin');
print_error('cronerrorpassword', 'admin');
exit;
}
}
// Send mime type and encoding.
// send mime type and encoding
@header('Content-Type: text/plain; charset=utf-8');
// We do not want html markup in emulated CLI.
// we do not want html markup in emulated CLI
@ini_set('html_errors', 'off');
// Execute the cron, disabling keepalive.
\core\cron::run_main_process(0);
// execute the cron
cron_run();

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