Compare commits

..

285 Commits

Author SHA1 Message Date
Jun Pataleta becbdd847d Moodle release 3.11.11 2022-11-12 12:55:28 +08:00
Sara Arjona 6ac3dd457c weekly release 3.11.10+ 2022-11-11 15:02:00 +01:00
Sara Arjona cd97da9c5c NOBUG: Fixed file access permissions 2022-11-11 15:01:59 +01:00
Mathew May 759b2670a0 MDL-71920 libraries: Migrate LTI lib away from pure curl 2022-11-11 12:54:45 +08:00
Mathew May 3f90e29e39 MDL-71920 core: update filelib opt name definition 2022-11-11 12:54:45 +08:00
Jake Dallimore 257a8126ad Merge branch 'MDL-75872-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-11-11 11:45:57 +08:00
Jun Pataleta d32320beac Merge branch 'MDL-63037-311' of https://github.com/snake/moodle into MOODLE_311_STABLE 2022-11-11 10:42:11 +08:00
Sara Arjona 1352a23354 Merge branch 'MDL-71951-311' of https://github.com/stevandoMoodle/moodle into MOODLE_311_STABLE 2022-11-10 16:37:42 +01:00
Sara Arjona 46a8a3bb75 Merge branch 'MOODLE_311_MDL-75874' of https://github.com/matheusot/moodle into MOODLE_311_STABLE 2022-11-10 16:22:22 +01:00
Sara Arjona 79d1331384 Merge branch 'MDL-74606-311-support-multilang-group-names-in-mod_assign' of https://github.com/krostas1983/moodle into MOODLE_311_STABLE 2022-11-10 16:04:45 +01:00
Matheus Rodrigues cd72578917 MDL-75874 aiken_html: correctly display HTML chars for Aiken questions
Updates the Aiken Format class to process answers correctly, enabling
support for special HTML characteres such as <, >, and &.

Co-authored-by: Leticia Luz <leticia.adrielli.luz@gmail.com>
2022-11-10 10:00:48 -03:00
Sara Arjona 72e9f115ab Merge branch 'MDL-75448-MOODLE_311' of https://github.com/golenkovm/moodle into MOODLE_311_STABLE 2022-11-10 13:19:48 +01:00
Paul Holden 01011e49dd Merge branch 'MDL-68550-311' of https://github.com/rezaies/moodle into MOODLE_311_STABLE 2022-11-10 12:00:22 +00:00
Sara Arjona fcf7d12a4b Merge branch 'MDL-75974-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-11-10 12:51:43 +01:00
Paul Holden f44d6ba340 Merge branch 'MDL-76011-311' of https://github.com/abgreeve/moodle into MOODLE_311_STABLE 2022-11-10 11:50:07 +00:00
Sara Arjona 15632be78d Merge branch 'MDL-75876-MOODLE_311_STABLE' of https://github.com/praxisdigital/moodle into MOODLE_311_STABLE 2022-11-10 12:47:21 +01:00
Sara Arjona 53a0fbecd2 Merge branch 'MDL-76167-311' of https://github.com/davewoloszyn/moodle into MOODLE_311_STABLE 2022-11-10 12:42:25 +01:00
Paul Holden 832261f49b Merge branch 'MDL-76224-311' of https://github.com/justusdieckmann/moodle into MOODLE_311_STABLE 2022-11-10 08:54:20 +00:00
Paul Holden 2378fc0117 MDL-75862 backup: omit sesskey for continue buttons using get method.
It's automatically added by the rendered single_button instance when
using post method, so no need to add it unconditionally.
2022-11-10 10:17:35 +08:00
Shamim Rezaie cd754d3b44 MDL-68550 tablelib: Use aria-role=button
Use the aria-role=button for:
- show/hide links
- sort links
- reset table preferences link
2022-11-10 06:22:54 +11:00
Shamim Rezaie 8307ce8f18 MDL-68550 output: Improve accessibility of the initials bar
- The current item should be focusable otherwise the focus will be lost
  as soon as a user clicks on an item in the initials bar
- Modified behat tests to not mistakenly click on the 'All' link
- The currently selected item is specified by aria-current
- Useed aria-current=true rather than =page because the links of each
  item in the initials bar is missing the pagination information
2022-11-10 06:21:52 +11:00
Shamim Rezaie 4225940caa MDL-68550 output: Improve accessibility of the paging bar
The use of aria-current is based on the example at
https://design-system.w3.org/components/pagination.html
2022-11-10 06:21:52 +11:00
Shamim Rezaie 2ce1ed7247 MDL-68550 theme: Not showing the gap in the initial bar
The gap issue was a regression from MDL-66670.
2022-11-10 06:21:52 +11:00
Paul Holden f21c892997 MDL-75872 mod_lesson: allow unlimited attempts default value.
Related change in 252e85be added a similar value per activity, we
should also allow it to be chosen as a default for the site.
2022-11-09 18:54:14 +00:00
Sara Arjona 0b8ab4fcef Merge branch 'MDL-50935-311-2' of https://github.com/junpataleta/moodle into MOODLE_311_STABLE 2022-11-09 16:01:30 +01:00
Justus Dieckmann 8ec49b09e5 MDL-76224 Resource: Set correct page url in /mod/label/view.php 2022-11-09 15:50:48 +01:00
Meirza fd9ab3efbd MDL-76131 core_user: encode social profile fields data. 2022-11-09 15:49:53 +01:00
Jun Pataleta acdca038df Merge branch 'MDL-76185-311' of https://github.com/mihailges/moodle into MOODLE_311_STABLE 2022-11-09 21:52:04 +08:00
Jun Pataleta dd6f0debcc Merge branch 'MDL-76054_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-11-09 20:08:56 +08:00
Sara Arjona 8f93e88387 Merge branch 'MDL-75889-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-11-09 12:36:55 +01:00
Sara Arjona 17fccfcf64 Merge branch 'MDL-76059-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-11-09 12:31:46 +01:00
David Woloszyn 0cdb9169cb MDL-76091 lib: Add additional check to local URLs params 2022-11-09 19:24:42 +08:00
Sara Arjona a110b34a5a Merge branch 'MDL-75766-311' of https://github.com/aanabit/moodle into MOODLE_311_STABLE 2022-11-09 11:57:38 +01:00
Sara Arjona 252d0faac1 Merge branch 'MDL-74201-311' of https://github.com/aanabit/moodle into MOODLE_311_STABLE 2022-11-09 11:49:44 +01:00
Jun Pataleta 1802410629 Merge branch 'MDL-76170-311' of https://github.com/snake/moodle into MOODLE_311_STABLE 2022-11-09 15:44:39 +08:00
Jake Dallimore 89cba33e91 MDL-76170 enrol_lti: fix missing secret in enrol_lti_users
If member sync runs before the user launches the tool, a partial record
is created, without consumer secret. Subsequent launches of the tool by
that member don't resolve this and this results in grade sync failing
for any affected users. This patch:
- data fixes the existing affected rows
- fixes the launch code, ensuring secret is recorded on launch,
irrespective of whether the user info record has been created already
or not.
2022-11-09 10:04:39 +08:00
Frédéric Massart b86162544d MDL-74201 backup: Restore reference to content bank files 2022-11-08 20:20:21 +01:00
Eloy Lafuente (stronk7) 2135ff7c19 MDL-76054 environment: Remove the php-xmlrpc extension check
For Moodle 4.1 and up, the php-xmlrpc is not needed anymore:
- All the MNet stuff has been moved to use php library (MDL-76055).
- The webservice/xmlrpc has been moved from core to contrib (MDL-76052).

So we just remove the check here. Starting with 4.1, it's not
needed for any core functionality.

No lang string changes in this branch, only in master (4.1dev).
2022-11-08 16:46:26 +01:00
Stevani Andolo d0e63f5a60 MDL-75278 VideoJS: Update VideoJS to use validation helper 2022-11-08 13:54:20 +00:00
Víctor Déniz ec65857de0 weekly release 3.11.10+ 2022-11-08 13:44:52 +00:00
Jake Dallimore d34d35d2b6 MDL-63037 mnet: fix hostexists string usage 2022-11-08 17:05:48 +08:00
Jun Pataleta 0742fb7b44 Merge branch 'MDL-76113-311' of https://github.com/snake/moodle into MOODLE_311_STABLE 2022-11-08 12:01:47 +08:00
Jake Dallimore 0e7caf93b5 Merge branch 'MDL-76071-311' of https://github.com/laurentdavid/moodle into MOODLE_311_STABLE 2022-11-08 11:44:34 +08:00
Jake Dallimore e876654d1f Merge branch 'MDL-72882-311-3' of https://github.com/junpataleta/moodle into MOODLE_311_STABLE 2022-11-08 11:32:25 +08:00
Jun Pataleta a11e590324 Merge branch 'MDL-76207-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-11-08 10:25:22 +08:00
Paul Holden 5ff8f06f64 MDL-75974 tool_customlang: check out language pack in CLI import. 2022-11-07 22:41:07 +00:00
Paul Holden 8a1c8f8bb3 MDL-75889 core: compare domain names in a case-insensitive manner.
As per https://www.rfc-editor.org/rfc/rfc1035#section-3.1
2022-11-07 22:37:00 +00:00
Andrew Nicols 671849b2db Merge branch 'MDL-75880_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-11-07 21:57:32 +08:00
Andrew Nicols 8341244903 Merge branch 'MDL-73624-311' of https://github.com/meirzamoodle/moodle into MOODLE_311_STABLE 2022-11-07 21:52:25 +08:00
Víctor Déniz 02d251294c Merge branch 'm311_MDL-74912_Fix_RegExp_Word_Boundaries_On_MySQL8' of https://github.com/scara/moodle into MOODLE_311_STABLE 2022-11-07 10:22:00 +00:00
Jun Pataleta b490d511d6 MDL-50935 atto_equation: Add upgrade step to fix existing sites 2022-11-07 15:15:40 +08:00
Jun Pataleta 2d08d7d2c0 MDL-50935 atto_equation: Fix display of matrix template
Thanks to Geoffrey Rowland's fix suggestion.
2022-11-07 15:13:07 +08:00
Andrew Nicols 016d123034 MDL-76207 contentbank: Switch to opened window 2022-11-06 21:00:09 +08:00
Matteo Scaramuccia 2e4c5f9c12 MDL-74912 dml: Fix PHP coding style problems 2022-11-05 10:09:04 +01:00
Matteo Scaramuccia e7b463af6d MDL-74912 dml: Fix missing nullable marker 2022-11-05 10:09:04 +01:00
Matteo Scaramuccia 314c9671fc MDL-74912 mod_forum: Fix regexp word boundaries markers in MySQL 8 2022-11-05 10:09:04 +01:00
anisa kusumadewi b8c4c975e0 MDL-75766 core_h5p: Added index for pathnamehash to h5p table 2022-11-04 16:55:54 +01:00
Eloy Lafuente (stronk7) f3952dc29f MDL-75880 phpunit: fix all @coversDefaultClass missing @covers
Because @coversDefaultClass doesn't indicate any coverage (it's
just an alias to avoid having to write the class name in @covers),
this commit fixes all the files that were using that annotation
and missing any @covers.

Basically, replacing one by the other and done.
2022-11-04 16:51:30 +01:00
Sara Arjona 71841556aa weekly release 3.11.10+ 2022-11-04 14:52:07 +01:00
Sara Arjona 575fabe57a Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2022-11-04 14:52:03 +01:00
Jun Pataleta 5cf3b78855 Merge branch 'MDL-76103-311' of https://github.com/junpataleta/moodle into MOODLE_311_STABLE 2022-11-04 11:34:28 +08:00
Marina Glancy a84b1f1307 MDL-76103 search: skip solr behat tests if solr is not installed 2022-11-04 11:22:20 +08:00
Jun Pataleta c435b7896f Merge branch 'MDL-76072-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2022-11-04 10:37:34 +08:00
AMOS bot e740fa9c3b Automatically generated installer lang files 2022-11-04 00:07:31 +00:00
David Woloszyn 243eb04a85 MDL-76167 installer: Corrected dockblock param types 2022-11-04 10:48:03 +11:00
Víctor Déniz 88c757cef0 Merge branch 'MDL-70071-311' of https://github.com/Chocolate-lightning/moodle into MOODLE_311_STABLE 2022-11-03 20:38:58 +00:00
Sara Arjona 8f06e62409 Merge branch 'MDL-76169-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-11-03 17:06:22 +01:00
Mihail Geshoski 0eda72ec4f MDL-76185 mod_glossary: Remove separator in continuous display format 2022-11-03 23:54:23 +08:00
Andrew Nicols 68ff5f0ce0 MDL-70071 forum: Convert post threshold warnings to info 2022-11-03 15:04:48 +08:00
Jun Pataleta deb5150786 MDL-72882 tool_langimport: Set default language when deleting lang pack
* When the language pack being deleted is
  - the same as the site default language, we must set the site default
    language to 'en'.
  - fix the user's current language to the default site language.
2022-11-03 14:01:06 +08:00
Jun Pataleta 15521655a3 MDL-72882 core: Use default site lang when user lang no longer available
* Check that the lang attribute for the output HTML exists. If not,
use the default site language.
* Also fix the current language for the user.
2022-11-03 14:01:06 +08:00
Andrew Nicols 3a2703c9f5 Merge branch 'MDL-75904-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-11-03 13:48:11 +08:00
Andrew Nicols f48d31f0d4 MDL-76169 behat: Normalise exception message in should (not) steps
These steps have accepted a NodeElement instance as an argument for some
time, but were trying to cast it to string when formulating exception
messages, making it harder to debug and, in the case of the 'should see'
step, not work at all.

This patch introduces a new function to produce a consistent naming for
them.
2022-11-03 13:28:51 +08:00
Andrew Nicols 38da2c3a61 MDL-76169 behat: Add improved steps for using action menus
This commit adds new steps related to action menus to support:
* Choosing an item in a named action menu
* Choosing an item in a named action menu within a container
* Confirming that an action menu item does or does not exist in a named
  action menu
* Confirming that an action menu item does or does not exist in a named
  action menu within a container

The existing action menu steps were insufficient as they assume that
there is only one action menu within he container, which is not
necessarily the case.

The existing action menu steps are not non-JS friendly and will error if
JS is disabled, without providing any fallback when one is easily
available.

Unfortunately these steps cannot be used to replace the existing steps
without manual intervention.
2022-11-03 13:28:51 +08:00
Simey Lameze 583b655e37 MDL-76072 tool_lp: only init inlineGrader module if user can grade 2022-11-03 11:42:10 +08:00
Jake Dallimore 28f06c0f27 MDL-76113 enrol_lti: Fix secret on lti user for LTI 2.0 consumers
Fixes the enrol_lti_users.consumersecret field for LTI 2.0 users.
This field erroneously contained the tool secret and not the consumer
secret needed for service requests when used with LTI 2.0 consumers,
which resulted in complete grade sync failure for LTI 2.0 consumers.
This patch:
- adds an upgrade step to address existing incorrect secrets for LTI
2.0 launched users. It sets these to the correct consumer secret.
- fixes the way the secret is first set during a launch, ensuring
this->consumer->secret is used, which properly captures either the
tool secret (for 1.1 launches) or the consumer secret (for 2.0
launches).
2022-11-02 17:06:04 +08:00
Sara Arjona 4e1e916ca6 Merge branch 'MDL-61880-311' of https://github.com/snake/moodle into MOODLE_311_STABLE 2022-11-02 08:30:59 +01:00
Jake Dallimore 0c2426d207 MDL-61880 tool_oauth2: don't rely on discovery when editing issuers
Adjusts the testing scenarios so that we don't rely on endpoint
discovery being run during an issuer edit, which is no longer the case.
For scenarios that need a userinfo endpoint, set this manually.
2022-11-02 11:12:40 +08:00
Jake Dallimore 3f17ea00e7 MDL-61880 core: don't clear issuer fields not present in form data
In cases where we have an id, load the persistent and then set new data
before saving. This ensures we don't delete fields which are missing in
the form data.
2022-11-02 11:12:40 +08:00
Yannick Forget 565fe67086 MDL-61880 core: Retain OAuth 2.0 user field mappings after issuer update 2022-11-02 11:12:34 +08:00
Ilya Tregubov 97f67db36d weekly release 3.11.10+ 2022-11-01 15:00:04 +03:00
Andrew Nicols e2b085c81b Merge branch '311-mdl-75010' of https://github.com/danmarsden/moodle into MOODLE_311_STABLE 2022-11-01 11:52:57 +08:00
Jun Pataleta 91bb1805d9 Merge branch 'MDL-76108-311' of https://github.com/aanabit/moodle into MOODLE_311_STABLE 2022-10-31 16:49:07 +08:00
Dan Marsden 4d36e008dd MDL-75010 core: Prevent user last access update on user key login 2022-10-31 14:20:23 +13:00
Víctor Déniz e57d9506af Merge branch 'MDL-68437-311' of https://github.com/mihailges/moodle into MOODLE_311_STABLE 2022-10-28 18:28:48 +01:00
Amaia Anabitarte 779cd5b40c MDL-76108 mod_lesson: improving count call for PHP8.0 2022-10-28 18:18:05 +02:00
Sara Arjona 98fd15d75b weekly release 3.11.10+ 2022-10-28 14:09:22 +02:00
Jake Dallimore 552ec1b547 MDL-68943 assignfeedback_editpdf: fix version numbers 2022-10-28 12:09:10 +08:00
Jake Dallimore 977cbaf239 Merge branch 'MDL-68943-311' of https://github.com/cameron1729/moodle into MOODLE_311_STABLE 2022-10-28 11:50:14 +08:00
Cameron Ball a68be3c7fa MDL-68943 assignfeedback_editpdf: Upgrade step for stale conversions 2022-10-28 11:26:43 +08:00
Cameron Ball a123645de3 MDL-68943 assignfeedback_editpdf: Reconvert updated files 2022-10-28 11:26:43 +08:00
Víctor Déniz 29191eeff2 Merge branch 'MDL-75969-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-27 15:45:27 +01:00
Meirza b9701a8bb8 MDL-73624 lib_spout: encode output file name 2022-10-27 17:09:57 +07:00
Adrian Greeve 1fe901e1ab MDL-76011 lib: Updated the zip writer to retain the modified date. 2022-10-27 15:08:40 +08:00
Jun Pataleta 24bc7e9a19 weekly release 3.11.10+ 2022-10-25 17:17:15 +08:00
Jun Pataleta c352ec94a8 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2022-10-25 17:17:12 +08:00
Laurent David 91c7b05b05 MDL-76071 mod_choice: fix choice display on graphs
* The setting "Display mode" modifies the choices alignment of radio choice button
from horizontally to vertically. It should also display the list of choices in
the graph in the same directions.
2022-10-25 10:42:49 +02:00
Stevani Andolo a9e12e1d84 MDL-71951 calendar: Accessbility issue fix 2022-10-25 13:07:33 +08:00
Andrew Nicols 33eaae5569 Merge branch 'MDL-76049_311' of https://github.com/timhunt/moodle into MOODLE_311_STABLE 2022-10-25 11:50:10 +08:00
Andrew Nicols aaedf21a31 Merge branch 'MDL-74911-311' of https://github.com/matthewhilton/moodle into MOODLE_311_STABLE 2022-10-24 22:23:14 +08:00
Sara Arjona 658c7e9ef5 Merge branch 'MDL-73030-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-10-24 15:47:31 +02:00
Jun Pataleta 7ef51203c6 Merge branch 'MDL-75936-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-24 15:57:58 +08:00
Andrew Nicols 6591971e8a MDL-75936 core_message: Drawer must be ready before firing drawer events
This commit addresses a race condition when showing the message drawer
and opening the settings page from the Message preferences page.

In that situation, the message/edit.php page calls the
message_drawer_helper.showSettings function, which publishes a request
to show the drawer.

In some conditions (notably faster machines, or after MDL-66107) this
event is fired before the message_drawer.init has listened to it.

The solution here is to delay firing of the event until the drawer
announces itself as ready.

This ensures that the event is subscribed to before it is fired.
2022-10-24 14:30:32 +08:00
Matthew Hilton 58bc68b0bc MDL-74911 assignfeedback_editpdf: unlock session when polling conversion
Polling conversions will run the document conversion immediately if the
conversion has not already been completed.

Releasing the session lock while doing this ensures large conversions
do not unnecessarily hold the users session.
2022-10-24 12:58:31 +10:00
Matthew Hilton 93c53ea726 MDL-74911 assignfeedback_editpdf: per-assignment conversion poll lock
The lock ensures that multiple conversions do not happen for the same
assignment submission.

Otherwise, subsequent conversions will fail when trying to save the
converted file.
2022-10-24 12:58:29 +10:00
AMOS bot 73eec5d12d Automatically generated installer lang files 2022-10-23 00:08:12 +00:00
Paul Holden ee36b4146f MDL-75904 admin: ignore $CFG->allowcategorythemes during installation. 2022-10-21 23:22:37 +01:00
Paul Holden 6180b175d4 MDL-76059 forms: graceful early exit for invalid button elements.
Ensure login form tries to capture guest button only if it exists.
2022-10-21 19:40:33 +01:00
Sara Arjona e083dae38e Merge branch 'MDL-72828-311' of https://github.com/davewoloszyn/moodle into MOODLE_311_STABLE 2022-10-21 16:24:54 +02:00
Ilya Tregubov 42be9c33eb weekly release 3.11.10+ 2022-10-21 15:33:52 +03:00
David Woloszyn 8ba4d8be17 MDL-72828 js: get_strings supports jquery objects 2022-10-21 15:03:10 +11:00
Tim Hunt 78910334ff MDL-76049 quiz generator: update calendar events for new overrides 2022-10-20 23:45:13 +01:00
Víctor Déniz 6af53fa8c0 Merge branch 'MDL-75907-311' of https://github.com/golenkovm/moodle into MOODLE_311_STABLE 2022-10-20 10:47:02 +01:00
Jun Pataleta d0b8656cb5 Merge branch 'MDL-75497-311' of https://github.com/raortegar/moodle into MOODLE_311_STABLE 2022-10-20 17:28:58 +08:00
Jun Pataleta 9c93fbe3a4 Merge branch 'MDL-75599-311' of https://github.com/laurentdavid/moodle into MOODLE_311_STABLE 2022-10-20 17:25:55 +08:00
raortegar a97f8d6720 MDL-75497 mod_data: Review Check existence of field.class.php 2022-10-20 10:03:12 +02:00
Andrew Nicols 7ceb1466e9 Merge branch 'MDL-75834-m311' of https://github.com/sammarshallou/moodle into MOODLE_311_STABLE 2022-10-20 14:38:03 +08:00
Jun Pataleta 5d0b1f0ed3 Merge branch 'MDL-59458-311' of https://github.com/laurentdavid/moodle into MOODLE_311_STABLE 2022-10-20 13:08:44 +08:00
Jun Pataleta 180bf41216 Merge branch 'MDL-75985-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-19 21:28:07 +08:00
Andrew Nicols 509578453a MDL-75985 behat: Return newline character for \n
Somehow part of this commit was lost during the push and/or squash.
2022-10-19 20:27:45 +08:00
Sara Arjona 8be7ac509a Merge branch 'MDL-76010_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-10-19 12:56:32 +02:00
Jun Pataleta fcfd012b6a Merge branch 'MDL-75645_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-10-19 15:37:05 +08:00
Jun Pataleta a778af133e Merge branch 'MDL-75985-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-19 10:55:41 +08:00
Eloy Lafuente (stronk7) 1ff07992ec MDL-75645 mnet: Stop caching OpenSSLAsymmetricKey keys
The mnet_environment->keypair array contains the following
elements (and more, just focussing on these):
- keypair_PEM : textual representation of the private key.
- certificate : textual representation of the public key.
- privatekey  : OpenSSLAsymmetricKey representation of the private key,
                generated from keypair_PEM. See get_private_key().
- publickey   : OpenSSLAsymmetricKey representation if the public key,
                generated from certificate. See get_public_key().

The last 2 elements in the array are only used as "caching", to avoid
having to call to openssl_pkey_get_private() and
openssl_pkey_get_public() to convert from the textual representation
to the OpenSSLAsymmetricKey representation that is the one required
by a number of openssl functions.

Problems arrive when, as part of the MNet protocol, the mnet_environment
is serialised, because, since PHP 8.0 those OpenSSLAsymmetricKey objects
aren't serialisable any more.

So, as far as they are only used for internal caching it's perfectly ok
to remove the caching bits and use the openssl_pkey_get_xxx() methods
to calculate them under demand.

The alternative to this would be to implement into the mnet_environment
some custom serialisation, skipping those OpenSSLAsymmetricKey
instances, using __sleep(), the Serializabla interface or __serialize(),
but that seems unnecessary because, as explained above, the uses are
really limited and easily replaceable.

That's what this patch does.
2022-10-18 14:31:03 +02:00
Eloy Lafuente (stronk7) 8cbcbc094c MDL-76010 behat: New scenario to verify that manual attempts work
This is basically the manual background that was removed in the
previous commit, with 4 attempts here. Note it includes the 2
waits that are REQUIRED to make it pass in too-quick environments.

If they are removed, they begin to fail because it seems that
the attempts need a minimum of separation between them.
2022-10-18 14:28:07 +02:00
Eloy Lafuente (stronk7) a35c9aab6d MDL-76010 behat: Move feature to use attempts generator
This moves away from manual attempts and uses the activity
attempts generator instead. Quicker and not exposed to the
problems with clicks, refreshes and missing attempts.

Note that there is a small change in the attempt generator
so, now, when a new attempt is created, if the activity has
tracking enabled, the final result / grades are recalculated.

That's the real behaviour when the activity settings are
changes in the edition form and it's natural to get them
recalculated without having to visit the form. Specifically,
this allows the 1st scenario to pass, because in that scenario
no changes to the form are being performed.

Also, little detail, amend a dupe scenario name.
2022-10-18 14:28:07 +02:00
Sara Arjona bef4181788 weekly release 3.11.10+ 2022-10-18 13:09:58 +02:00
Laurent David abcbc42139 MDL-75599 mod_data: Fix warning message
* Fix warning message when accessing advanced search page with a date field.
2022-10-18 07:56:14 +02:00
Jun Pataleta f65577ef3a Merge branch 'MDL-75783-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-18 10:06:51 +08:00
Andrew Nicols fdc7349577 MDL-75783 javascript: Add optional jsconfig configuration
This commit adds a new Grunt task which generates a jsconfig.json file.

This file is described at
https://code.visualstudio.com/docs/languages/jsconfig and can be used
to configure vscode and other similar editors to understand our module
loading.

This task is an optional task for Grunt and can be run with:

    npx grunt jsconfig

The file is git-ignored and will not affect normal usage.
2022-10-18 09:33:04 +08:00
Víctor Déniz 0ee24af3cd Merge branch 'MDL-75983_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-10-18 01:09:04 +01:00
Sara Arjona 815419ad12 Merge branch 'MDL-72836-311' of https://github.com/mickhawkins/moodle into MOODLE_311_STABLE 2022-10-17 16:40:00 +02:00
Sara Arjona b92f5e00aa Merge branch 'MDL-74814-311-1' of https://github.com/HuongNV13/moodle into MOODLE_311_STABLE 2022-10-17 15:30:59 +02:00
Huong Nguyen 54263aa1f6 MDL-74814 forms: Fix accessibility issue in edit profile page
- Fixed legend tag issue
 - Modified the passwordunmask Javascript hide/unhide the password field by CSS class
2022-10-17 15:52:20 +07:00
Andrew Nicols 100fad08fe MDL-75969 behat: Allow the editor field to request a save
Some editors do not immediately store their content to the textarea they
represent and only do so when the form is submitted or they are
requested to.

This change adds to the existing API to allow an (optional)
`store_current_value` function to be defined for the editor type so that
it can use the JavaScript API to persist any current content to the
editor.
2022-10-14 23:46:25 +08:00
Andrew Nicols 14f87ce4b5 MDL-75985 behat: Standardise HTML output when comparing editor content
This commit adds a standardise_html function and updates the matches
function to compare normalised content.

This allows for a wider variety of valid editor output to be handled
using the standard value matching steps in Behat, thus supporting
editors other than Atto better.
2022-10-14 23:44:11 +08:00
Eloy Lafuente (stronk7) b4b650f9cd MDL-75983 gha: Update used actions to be node16 compatible
Node12 is being deprecated in github for actions:

https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/

So we need to ensure we are using node16 actions.
2022-10-14 13:28:25 +02:00
Sara Arjona efc6d19ac2 weekly release 3.11.10+ 2022-10-14 12:49:22 +02:00
Sara Arjona a887e577a4 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2022-10-14 12:49:20 +02:00
AMOS bot 5b9f243378 Automatically generated installer lang files 2022-10-14 00:07:33 +00:00
Jun Pataleta 1900cadd4f Merge branch 'MDL-74887-MOODLE_311_STABLE' of https://github.com/sh-csg/moodle into MOODLE_311_STABLE 2022-10-14 00:30:55 +08:00
Sara Arjona f55fd1b49c Merge branch 'MDL-75959-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-13 16:03:41 +02:00
Ilya Tregubov 575358c0f0 Merge branch 'MDL-75970-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-10-13 14:09:06 +03:00
Stefan Hanauska 83a1703746 MDL-74887 mod_label: Update visibility 2022-10-13 12:47:31 +02:00
Paul Holden 5c74434dfa MDL-75970 tool_customlang: clarify CLI export target/filename. 2022-10-12 10:32:30 +01:00
Jun Pataleta 72e2a0dfb5 Merge branch 'MDL-75887-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-12 09:23:13 +08:00
Simey Lameze 8c30413ba8 MDL-75887 behat: Add ability to set value regardless of the editor
Prior to this commit, the behat_form_editor integration was hard-coded
to use Atto.

This change allows other editors to be used to set editor values, and
breaks that hard bond. Following this change, any editor is able to
define a behat_editor_[name].php file defining a function which meets
the following signature:

  set_editor_value(string $editorid, string $value): void

Each editor is responsible for checking whether its own API is available
and calling any relevant functions to force the editor to set the
content.

Please note: Behat is unable to determine the current editor in use on
the page automatically.
2022-10-12 06:44:30 +08:00
Andrew Nicols ce2a901414 MDL-75959 customfield: Correct inappropriate class import
I suspect this was an incorrect tab completion import by an IDE which
was missed.
2022-10-12 06:40:18 +08:00
Jun Pataleta 811fc31904 weekly release 3.11.10+ 2022-10-11 23:16:41 +08:00
Jun Pataleta 25efc9e7aa Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2022-10-11 23:16:39 +08:00
AMOS bot c29ba27942 Automatically generated installer lang files 2022-10-11 00:07:30 +00:00
sam marshall 125065e488 MDL-75834 lib: Focus lock JS bug when focus area removed 2022-10-10 16:41:49 +01:00
Sara Arjona 613ba34b07 Merge branch 'MDL-75656-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-10-10 16:16:32 +02:00
Jun Pataleta 975ef5c540 Merge branch 'MDL-75909-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-10 18:08:04 +08:00
Jun Pataleta 1db7e78c8b Merge branch 'MDL-75922-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-10 14:55:17 +08:00
Jun Pataleta 37fa9f51e9 Merge branch 'MDL-75910-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-10 11:06:55 +08:00
Simey Lameze 4eed9bd261 MDL-75922 behat: Apply @editor_atto tag to tests requiring Atto
These steps are currently using Atto-specific UI features and must
therefore make use of the @editor_atto tag to ensure that they continue
to run using Atto.

A new issue will be raised to migrate each of these to be
editor-agnostic.
2022-10-09 20:27:05 +08:00
Andrew Nicols ec6c3cd9a0 Merge branch 'MDL-61395-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-10-09 13:13:39 +08:00
Stefan Hanauska 133b7b700d MDL-74887 course: Hide stealth mode without view page 2022-10-08 08:09:34 +02:00
AMOS bot c269c67830 Automatically generated installer lang files 2022-10-08 00:07:29 +00:00
Michael Hawkins 8d09620c14 MDL-72836 core: Updated security.txt expiry and policy URL 2022-10-07 14:12:14 +08:00
Mikhail Golenkov 94327ba15f MDL-75907 core: Add index on temp table to optimise stats cron 2022-10-07 16:16:44 +11:00
Andrew Nicols 8e1353f39d weekly release 3.11.10+ 2022-10-07 13:04:02 +08:00
Andrew Nicols 342c6367d0 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2022-10-07 13:04:00 +08:00
AMOS bot fe6c455b51 Automatically generated installer lang files 2022-10-07 00:07:35 +00:00
Simey Lameze 777025b298 MDL-75910 core_form: Allow editor field to set a hidden label
When an editor is used in a form as part of a group, it is missing its
label element.

This happens because there is no inline template for the editor, and
therefore it reverts to using the old `toHtml` function. The legacy
function does not cater to the editor being in a group, and therefore
does not add the hidden label.

In addition, the hiddenLabel attribute was missing from the editor
element. This is a semi-standard element but must be added to each
supporting element.

Both the missing inline template for the editor, and the hidden label
attribute must be present:
- If the hidden label attribute is not present, then the standard inline
  template will add a visible label within the group.
- If the inline editor template is missing, then the label is not shown
  at all.
2022-10-06 22:54:12 +08:00
Andrew Nicols 1545abb21d MDL-75909 mod_data: Make template editor use html editor
When the template editor is configured to use the HTML Editor, it should
indicate this to Behat by setting the `data-fieldtype` to "editor".

This indicates to the behat field manager that the editor is in use,
which ensures that the correct value setting can take place.

This is important in the context of MDL-75887.
2022-10-06 21:49:01 +08:00
Andrew Nicols d70b73345c MDL-71686 core_form: Rebuild amd util module 2022-10-06 16:13:17 +08:00
Andrew Nicols fbc97ebdcd MDL-71686 core_form: Include missing build 2022-10-06 14:44:35 +08:00
Andrew Nicols 95b4682d3c MDL-71686 core_form: Move form serializer to shared function 2022-10-06 10:22:46 +08:00
Andrew Nicols 27f7c54d58 Merge branch 'MDL-71686-311' of https://github.com/marinaglancy/moodle into MOODLE_311_STABLE 2022-10-06 10:21:34 +08:00
Shamim Rezaie 459da610c6 Merge branch 'MDL-75886-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-10-06 12:24:45 +11:00
Thorsten Siegmund Bartel 930a0d2944 MDL-74606 mod_assign: Support multilanguage strings in group names. 2022-10-05 12:56:16 +02:00
Andrew Nicols e881dee5b4 MDL-75886 atto: Always use Atto for @atto tests
This change, which should be easy to mimic for other editors.

This will ensure that the correct editor is used for tests relating to
that editor, or its subplugins.
2022-10-05 09:57:19 +08:00
Jun Pataleta f525194ea2 Merge branch 'MDL-66955-m311' of https://github.com/NeillM/moodle into MOODLE_311_STABLE 2022-10-04 16:36:25 +08:00
AMOS bot d18f60bd3f Automatically generated installer lang files 2022-10-04 00:07:33 +00:00
Frederik Milling Pytlick 01643574c5 MDL-75876 core_calendar: Add raise_memory_limit call to export_execute
Added a call to raise_memory_limit in /calendar/export_execute.php as it can be very memory intensive.
2022-10-03 12:47:57 +02:00
Paul Holden 0268bbd07b MDL-73030 backup: case-insensitive detection of Moodle backups. 2022-10-03 09:32:05 +01:00
Andrew Nicols 4f5d221749 Merge branch 'MDL-75836_311' of https://github.com/jrchamp/moodle into MOODLE_311_STABLE 2022-10-02 21:44:40 +08:00
Andrew Nicols 8ca4a0087d MDL-75614 dml: Unit tests must test something 2022-09-30 16:38:27 +08:00
Andrew Nicols 357ab40ff4 Merge branch 'MDL-75614-debugsqltrace-MOODLE_311_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_311_STABLE 2022-09-30 16:38:24 +08:00
Neill Magill a0518068fb MDL-66955 messages: Improve speed of message search
The OR conditions in the WHERE clause prevented the query from
effectively filtering the messages related to the user quickly, this
change helps gets around this by allowing the database to limit
the rows in the messages table it needs to scan significantly.
2022-09-30 08:31:11 +01:00
Mihail Geshoski 5ef68db33a MDL-68437 forum: Support to show only active course users in grader
The following change adds support to show only active course users
in the forum grader and generally replicates the behaviour from the
assignment grader which relies on certain config settings, user
permissions and capabilities.
2022-09-30 12:18:46 +08:00
Mihail Geshoski 2914d47171 MDL-68437 course: ws support to optionally fetch only active users
Modifies the 'core_course_get_enrolled_users_by_cmid' webservice and
the generic js methods that call this webservice and enables defining
whether the ws should only return the active users or all enrolled
users in the course.
2022-09-30 12:12:28 +08:00
Jake Dallimore e79b14e2a9 weekly release 3.11.10+ 2022-09-30 10:17:39 +08:00
Andrew Nicols b97ed6d75a Merge branch 'MDL-74922_MOODLE_311_STABLE_fix_storage_wrapper_validate_cache' of https://github.com/gthomas2/moodle into MOODLE_311_STABLE 2022-09-29 12:06:45 +08:00
Jun Pataleta f4d830d7e4 Merge branch 'MDL-75782-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-09-29 11:53:57 +08:00
Jun Pataleta 2974880afe Merge branch 'MDL-75559-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-09-29 10:53:59 +08:00
Jun Pataleta 4ed21af7df Merge branch 'MDL-66902_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-28 23:15:26 +08:00
Jun Pataleta e1d80935a3 Merge branch 'MDL-75827-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-09-28 20:35:58 +08:00
Jake Dallimore f40424cd25 Merge branch '31_mdl75668' of https://github.com/danmarsden/moodle into MOODLE_311_STABLE 2022-09-28 16:36:36 +08:00
Jun Pataleta 47f85d5da1 Merge branch 'MDL-72490-m311' of https://github.com/sammarshallou/moodle into MOODLE_311_STABLE 2022-09-28 11:55:08 +08:00
Jun Pataleta ac0444bff4 Merge branch 'MDL-66273-MOODLE-311-v2' of https://github.com/golenkovm/moodle into MOODLE_311_STABLE 2022-09-28 09:45:35 +08:00
Jun Pataleta bb7955546c Merge branch 'MDL-75726_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-28 08:12:14 +08:00
Jun Pataleta 0fd522dd1f Merge branch 'MDL-75776_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-28 08:06:39 +08:00
Jonathan Champ a09f258f70 MDL-75836 activities: preserve moodleform validation errors 2022-09-27 14:24:36 -04:00
Andrew Nicols b193122b29 Merge branch 'MDL-75168-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-09-27 23:42:42 +08:00
Paul Holden 10d39a1feb MDL-75168 tag: cleanup module tag instances upon course deletion. 2022-09-27 14:11:32 +01:00
Jun Pataleta d51a14792b Merge branch 'MDL-75800-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-09-27 20:19:54 +08:00
Andrew Nicols 074307ebba Merge branch 'MDL-27570_311' of https://github.com/timhunt/moodle into MOODLE_311_STABLE 2022-09-27 17:02:24 +08:00
Jun Pataleta aeacebf383 Merge branch 'MDL-71531-311' of https://github.com/andrewnicols/moodle into MOODLE_311_STABLE 2022-09-27 16:29:01 +08:00
Andrew Nicols 51c22d1e3f MDL-75744 qtype_gapselect: Remove unnecessary javascript tag 2022-09-27 12:45:25 +08:00
Andrew Nicols e5bf98ab9d Merge branch 'MDL-75744-311' of https://github.com/NashTechOpenUniversity/moodle into MOODLE_311_STABLE 2022-09-27 12:38:23 +08:00
Paul Holden 1b1758caa2 MDL-75827 theme_boost: append table elements to popover whitelist.
This allows for their use within popover tooltips, such as those
used for showing help icon dialogues.
2022-09-26 16:06:42 +01:00
Eloy Lafuente (stronk7) a71341c693 MDL-66902 tests: Fix all incorrect namespaces
This issue just goes over all the currently incorrect
namespaces in test cases and:

1. Change the namespace to the correct one.
2. Move/rename it to correct location if needed (level 2 and down).
3. Remove not needed MOODLE_INTERNAL check when possible.
4. Remove file phpdoc when the file only has one class.
5. Make small adjustments in case the change of namespace requires it.
2022-09-26 14:34:30 +02:00
Hien Dinh b21541294a MDL-72490 availability: Show error if conflict in date restriction 2022-09-26 11:19:39 +01:00
Paul Holden 806a667b3a MDL-61395 forms: style frozen tag element values. 2022-09-26 11:16:13 +01:00
Paul Holden 7311810970 MDL-75656 tag: decode entities in tags element values. 2022-09-26 10:56:37 +01:00
Eloy Lafuente (stronk7) c8773b698a MDL-75726 ci: Bump GHA to Ubuntu 22.04
Have tried to also bump Travis to 22.04 (jammy) but it
was not working ok, with problems trying to find both
PHP and PostgreSQL versions.

Surely that's because 22.04 support is really new (Sep 9, 2022):

https://blog.travis-ci.com/22-9-9-ubuntujammy

So we'll have to wait a little more before being able to, also,
bump Travis to use 22.04
2022-09-22 17:45:16 +02:00
Eloy Lafuente (stronk7) e446e2b6a9 MDL-75776 composer: minor updates
In stables, just minors updates to components.

Generated using the instructions @ https://docs.moodle.org/dev/Composer
and using PHP 7.3 (always the min version supported) to generate the
lock file.
2022-09-22 17:44:45 +02:00
Eloy Lafuente (stronk7) 6a6344e268 weekly release 3.11.10+ 2022-09-22 17:05:51 +02:00
Tim Hunt bcdee74ae9 MDL-27570 quiz timing: add unit test and simplify top of process_attempt 2022-09-22 11:12:45 +01:00
Philipp Imhof dacd86c23c MDL-27570 quiz: check if time is really up 2022-09-21 11:39:14 +01:00
Paul Holden bb6c03a252 MDL-75800 enrol: correct instance deleted event name. 2022-09-20 14:09:40 +01:00
Jun Pataleta b37a074180 Merge branch 'MDL-75777_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-20 15:11:59 +08:00
Eloy Lafuente (stronk7) 64e570d0ab MDL-75777 phpunit: Move tests to use correct names and ns (take#6)
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.
2022-09-19 11:03:36 +02:00
Jun Pataleta 0a4af5f771 Merge branch 'MDL-75757_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-19 13:01:50 +08:00
Andrew Nicols d288aea421 MDL-75782 mod_quiz: Make TinyMCE autosave less fragile
This commit amends the quiz autosave feature to not assume the
components of the Tiny API as much, and add support for newer versions
of TinyMCE.
2022-09-19 12:56:55 +08:00
Eloy Lafuente (stronk7) a9edf3962a MDL-75757 phpunit: Add some tolerance to a few failing assertions
Recently, PHPUnit (all versions) did some changes about how the
comparators worked and this has caused some float comparisons
to stop working.

We need to move them to assertEqualsWithDelta(), allowing a small
tolerance to workaround the floats comparison problem.

0.00001 has been decided. And applied to all the similar assertions
within the unittest function, so if more cases are added to them
better be copied with the agreed tolerance.
2022-09-18 15:57:36 +02:00
Sara Arjona 6087c2a835 Merge branch 'MDL-75108-m311' of https://github.com/sammarshallou/moodle into MOODLE_311_STABLE 2022-09-16 11:23:29 +02:00
Sara Arjona 6fd68977ac weekly release 3.11.10+ 2022-09-15 16:11:55 +02:00
Sara Arjona 94f6eefb86 Merge branch 'install_311_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_311_STABLE 2022-09-15 16:11:53 +02:00
hieuvu d03da85cef MDL-75744 gapselect: remove empty choices option. 2022-09-15 15:46:16 +07:00
Andrew Nicols 3e789e5d6d MDL-71531 cachestore_file: Stop locking cache files to read
The cache file is only ever written to in the `write_file` function,
where it does so by writing to a temp file and performing an atomic
rename of that file. When writing, the target file is never locked.

The cache file is only ever read in the `get` function, and there is no
need for an exclusive lock in that situation.

There is therefore no need to obtain any lock, shared or exclusive, to
read the cache file. Doing so only affects performance of the file sytem
as file locks must be needlessly obtained and written to disk for a read
operation which does not benefit from them.
2022-09-15 10:14:51 +08:00
Jun Pataleta b16eb4c432 Merge branch 'MDL-75716_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-15 09:55:38 +08:00
Marina Glancy f533978709 MDL-71686 forms: allow arrays in dynamic forms args 2022-09-14 18:00:05 +02:00
Sara Arjona 53846820df Merge branch 'MDL-74010-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-09-14 11:41:53 +02:00
Eloy Lafuente (stronk7) 65c8839157 MDL-75716 phpunit: Move tests to use correct names and ns (take#5)
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- In lib/tests/blocklib_test.php 2 helper classes have been
  moved to tests/fixtures, because they needed to be namespace-free.
2022-09-12 23:34:59 +02:00
Sara Arjona 0561f8c5b5 Merge branch 'MDL-75051_311' of https://github.com/mkassaei/moodle into MOODLE_311_STABLE 2022-09-12 12:30:38 +02:00
Mikhail Golenkov 8684cd6a76 MDL-66273 qtype_random: Fix question deletion during course restore 2022-09-12 16:43:37 +10:00
Andrew Nicols fa10357f57 MDL-75559 behat: Sort behat_hooks to top of context list 2022-09-12 12:33:40 +08:00
AMOS bot d463e0d8f6 Automatically generated installer lang files 2022-09-11 00:07:54 +00:00
Eloy Lafuente (stronk7) 54b614ca7e Moodle release 3.11.10 2022-09-10 12:16:05 +02:00
Mahmoud Kassaei 9f7d92de62 MDL-75051 Questions: Selecting idnumber in the question bank,
the copy/pasting, includes extraneous text in Chrome
2022-09-09 10:39:22 +01:00
Jun Pataleta 4125c3c470 weekly release 3.11.9+ 2022-09-09 08:36:51 +08:00
Jun Pataleta 258cdfaa6a Merge branch 'MDL-74866-311-behat' of https://github.com/HuongNV13/moodle into MOODLE_311_STABLE 2022-09-08 11:29:43 +08:00
Huong Nguyen 8c2792cb5d MDL-74866 core_calendar: Fix Behat failures 2022-09-08 09:49:40 +07:00
Michael Hawkins 25d4bc7ffc MDL-68066 output: Apply disable lambda rendering to Mustache renderer 2022-09-07 23:56:51 +08:00
Lars Bonczek d98b39a597 MDL-68066 output: Mustache - Add option to disable lambda rendering
This commit is based on an outstanding pull request to the Mustache repo
2022-09-07 23:56:51 +08:00
Paul Holden 191badf5ad MDL-72012 mod_h5pactivity: respect user access when getting report. 2022-09-07 22:10:56 +08:00
Jun Pataleta c4ba598a0b MDL-75283 core: Fetch proper column mapping for sort
Calling \core_user\fields::get_sql() incerements a static uniqueid
variable. This should be called only once and not make a separate call
for the sort mapping data as it doing so will result to an incorrect
table alias for the sort mapping data.
2022-09-07 17:16:03 +04:00
Sara Arjona f77ea5bffa Merge branch 'MDL-74866-311' of https://github.com/HuongNV13/moodle into MOODLE_311_STABLE 2022-09-07 13:10:24 +02:00
stevando 3d11b25cce MDL-75283 admin: Update admin user fetching to use sort helper 2022-09-07 13:18:43 +08:00
Jun Pataleta 8a55673463 Merge branch 'MDL-75553-311' of https://github.com/junpataleta/moodle into MOODLE_311_STABLE 2022-09-07 12:58:54 +08:00
Jun Pataleta 230f7a2d1b MDL-75553 mod_data: Fix wording of data fields in Behat tests 2022-09-07 12:55:50 +08:00
Huong Nguyen 87344d03e1 MDL-74866 bennu: Fix parameter parsing
Some parameter values are wrapped by DQUOTE character.
We need to go through and get the actual value inside the quoted string.
2022-09-07 11:16:01 +07:00
Dan Marsden e237e83dfb MDL-75668 backup: Save context mapping of duplicate blocks. 2022-09-07 12:40:47 +12:00
David Mudrák aa392ce73a MDL-75553 lang: Fix Behat regressions in scenario files 2022-09-06 21:49:32 +02:00
Paul Holden 6220f712ab MDL-75405 block_html: safer unserialize during old block conversion. 2022-09-06 17:54:17 +02:00
Jun Pataleta 714b88a1b8 Merge branch 'MDL-75231-311' of https://github.com/lameze/moodle into MOODLE_311_STABLE 2022-09-06 23:49:08 +08:00
Sara Arjona bbadf7a02c Merge branch 'MDL-75548_311' of https://github.com/timhunt/moodle into MOODLE_311_STABLE 2022-09-05 13:09:57 +02:00
Ilya Tregubov 57b97b29b7 Merge branch 'MDL-60666-311' of https://github.com/ilyatregubov/moodle into MOODLE_311_STABLE 2022-09-05 14:38:41 +04:00
Peter Sistrom 6fe4eb2a86 MDL-60666 auth_ldap: One transaction per user 2022-09-05 14:35:26 +04:00
Sara Arjona 8a0274423d Merge branch 'MDL-75550-311' of https://github.com/mickhawkins/moodle into MOODLE_311_STABLE 2022-09-05 08:57:37 +02:00
Jun Pataleta ddd80a5d2c Merge branch 'MDL-75641_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-09-05 14:37:09 +08:00
Helen Foster 50bf83fede MDL-75553 lang: Import fixed English strings (en_fix) 2022-09-04 21:07:38 +02:00
Eloy Lafuente (stronk7) cafbfc6076 MDL-75641 core_lang: Add string for new Europe/Kyiv timezone
With IANA TZDB (timezone database) release 2022b, Europe/Kiev
has been renamed to Europe/Kyiv. So we need to add this string
to our list to keep tests passing.

Note that the old Europe/Kiev continues working (is an alias) and,
also, there are places in core where we are using it. Just we cannot
remove/replace those uses in core until we ensure that everybody is
using PHP 8.0.23 (TZDB 2022b) or more recent versions. Hence,
not changing those uses now.
2022-09-04 10:11:20 +02:00
Ilya Tregubov 2b22716dc2 weekly release 3.11.9+ 2022-09-02 08:49:20 +04:00
Brendan Heywood 3498aeaf1e MDL-75614 dml: Fixed debugsqltrace with anon classes bug 2022-09-02 11:42:22 +10:00
Jun Pataleta c59d4f9612 Merge branch 'MDL-75111_311' of https://github.com/stronk7/moodle into MOODLE_311_STABLE 2022-08-31 23:04:15 +08:00
Jun Pataleta e3ce532831 Merge branch 'MDL-75019-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2022-08-31 20:24:56 +08:00
Ilya Tregubov 87e0d39e19 Merge branch 'MDL-74861-311' of https://github.com/andelacruz/moodle into MOODLE_311_STABLE 2022-08-31 11:52:30 +04:00
Michael Hawkins 90aceb5e6c MDL-75550 lib: Update Mustache const to reflect correct version
Mustache version 2.14.1 is already included, but the VERSION const
incorrectly listed 2.14.0 in the tagged Mustache release. A later
upstream commit corrected this in the library, which this now matches.
2022-08-31 15:29:52 +08:00
Sara Arjona 7d1996fb3a Merge branch 'MDL-68717-311' of https://github.com/laurentdavid/moodle into MOODLE_311_STABLE 2022-08-30 16:05:11 +02:00
Víctor Déniz cb9583c21c Merge branch 'MDL-75360-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-08-30 11:43:33 +01:00
Jun Pataleta 633c6d7e80 MDL-70480 mod_assign: Apply proper upgrade savepoint version 2022-08-30 17:18:38 +08:00
Jun Pataleta 76ed3885a9 MDL-70480 mod_assign: Bump version.php properly 2022-08-30 17:04:17 +08:00
Víctor Déniz f4456f6afe Merge branch 'MDL-70480-311' of https://github.com/chanqihui/moodle into MOODLE_311_STABLE 2022-08-30 09:17:00 +01:00
Ilya Tregubov 21384101e1 Merge branch 'MDL-71662-311' of https://github.com/paulholden/moodle into MOODLE_311_STABLE 2022-08-30 08:00:37 +04:00
Eloy Lafuente (stronk7) 61cedbd56e MDL-75111 phpunit: Move tests to use correct names and ns (take#4)
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- The following task tests have been moved within the level2 directory:
  - \core\adhoc_task_test => \core\task\adhoc_task_test
  - \core\scheduled_task_test => \core\task\scheduled_task_test
  - \core\calendar_cron_task_test => \core\task\calendar_cron_task_test
  - \core\h5p_get_content_types_task_test => \core\task\h5p_get_content_types_task_test
  - \core\task_database_logger_test => \core\task\database_logger_test
  - \core\task_logging_test => \core\task\logging_test

- The following event tests have been moved within level2 directory:
  - \core\event_context_locked_test => \core\event\context_locked_test
  - \core\event_deprecated_test => \core\event\deprecated_test
  - \core\event_grade_deleted_test => \core\event\grade_deleted_test
  - \core\event_profile_field_test => \core\event\profile_field_test
  - \core\event_unknown_logged_test => \core\event\unknown_logged_test
  - \core\event_user_graded_test => \core\event\user_graded_test
  - \core\event_user_password_updated_test => \core\event\user_password_updated_test

- The following output tests have been moved within level2 directory:
  - \core\mustache_template_finder_test => \core\output\mustache_template_finder_test
  - \core\mustache_template_source_loader_test => \core\output\mustache_template_source_loader_test
  - \core\output_mustache_helper_collection_test => \core\output\mustache_helper_collection_test

- The following tests have been moved to their correct tests directories:
  - lib/tests/time_splittings_test.php => analytics/tests/time_splittings_test.php

- All the classes and tests under lib/filebrowser and lib/filestorage
  belong to core, not to core_files. Some day we should move
  them to their correct subsystem.
- All the classes and tests under lib/grade belong to core, not
  to core_grades. Some day we should move them to their correct
  subsystem.
- The core_grades_external class and its \core\grades_external_test
  unit test should belong to the grades subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The core_grading_external class and its \core\grading_external_test
  unit test should belong to the grading subsystem or, alternatively,
  to \core\external, they both should be moved together.
- The \core\message\message and \core\message\inbound (may be others)
  classes, and their associated tests should go to the core_message
  subsystem.
- The core_user class, and its associated tests should go to the
  core_user subsystem.
- The \core\update namespace is plain wrong (update is not valid API)
  and needs action 1) create it or 2) move elsewhere.
2022-08-26 16:34:28 +02:00
Shamim Rezaie 376e57d267 weekly release 3.11.9+ 2022-08-26 21:07:42 +10:00
Tim Hunt 9de11ea641 MDL-75548 misc: final Required parameter follows optional notices 2022-08-22 15:19:55 +01:00
Simey Lameze d793ac8e5e MDL-75231 files: make bucket calculations more precise
This commit changes changes the unit test calculations to
keep track of the time the bucket starts/finishes bursting
and use milliseconds instead of seconds to have a precise
time to sleep.
2022-08-22 14:11:39 +08:00
Mikhail Golenkov e5e8bc4b22 MDL-75448 assignfeedback_editpdf: Fix conversion for rotated images 2022-08-19 15:35:34 +10:00
Mikhail Golenkov 911fafd9a9 MDL-75448 stored_file: Cover rotate_image() method with unit tests 2022-08-19 15:35:34 +10:00
Laurent David 739b551fa8 MDL-59458 mod_data: Fix sorting data query
* When activating sorting on a different field than the original field
the list of records is empty
2022-08-15 17:14:33 +02:00
Laurent David a9ce394b63 MDL-68717 core_calendar: Hide completed event
* "expectcompletionon" type of event should be hidden if the related
activity is completed
2022-08-08 07:18:26 +02:00
Angelia Dela Cruz a8c9e82653 MDL-74861 behat: H5P behat generators use UI
Replace steps that manually add H5Pactivity instances via the UI
and use Behat generators. This improves the speed of the Behat test
runs.

Co-authored-by: Simey Lameze <simey@moodle.com>
2022-08-08 12:18:28 +08:00
Paul Holden f8351de05e MDL-74010 core: check defined MDL_PERF* values in conditionals. 2022-08-05 11:03:09 +01:00
Angelia Dela Cruz 34f352ded2 MDL-75019 behat: Folder behat generators use UI
Replace steps that manually add Folder instances via the UI and
use Behat generators. This improves the speed of the Behat test
runs.
2022-08-05 15:41:57 +08:00
Qihui Chan a287546036 MDL-70480 mod_assign: fix user and group submission and update database 2022-08-04 18:03:42 +10:00
Paul Holden 2eb859a839 MDL-71662 mod_h5pactivity: add group filter to attempts report. 2022-08-03 15:30:36 +01:00
Paul Holden 0448a7b267 MDL-75360 user: relax initial parameter types of external method.
Defer cleaning of supplied text to inside the method, so we don't
throw confusing exceptions if a user enters "unsafe" characters in
the form input.
2022-08-02 21:04:40 +01:00
sam marshall 2571dcf012 MDL-75108 block_html: Search tries to index directory entries
Search attach_files function should only attach indexable files,
not directory entries which are 0 bytes and cannot be indexed.
2022-07-01 14:08:51 +01:00
gthomas2 23f0472514 MDL-74922 javascript: storragewrapper validateCache fix 2022-06-08 09:33:46 +01:00
553 changed files with 8608 additions and 6503 deletions
+7 -7
View File
@@ -13,14 +13,14 @@ env:
jobs:
Grunt:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checking out code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Configuring node & npm
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
@@ -54,11 +54,11 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04
php: 7.3
extensions:
db: mysqli
- os: ubuntu-20.04
- os: ubuntu-22.04
php: 8.0
db: pgsql
extensions: xmlrpc-beta
@@ -85,7 +85,7 @@ jobs:
postgresql password: test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v3.x
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
@@ -96,7 +96,7 @@ jobs:
coverage: none
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setting up PHPUnit
env:
+1
View File
@@ -52,3 +52,4 @@ moodle-plugin-ci.phar
.stylelintignore
/jsdoc
.phpcs.xml
jsconfig.json
+1
View File
@@ -233,6 +233,7 @@ const getOwningComponentDirectory = checkPath => {
};
module.exports = {
fetchComponentData,
getAmdSrcGlobList,
getComponentFromPath,
getComponentPaths,
+3
View File
@@ -47,6 +47,9 @@ module.exports = grunt => {
// Load ESLint.
require('./eslint')(grunt);
// Load jsconfig.
require('./jsconfig')(grunt);
// Load JSDoc.
require('./jsdoc')(grunt);
+53
View File
@@ -0,0 +1,53 @@
// 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);
};
-5
View File
@@ -3781,11 +3781,6 @@
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
+2 -3
View File
@@ -59,9 +59,8 @@ class mnet_simple_host_form extends moodleform {
$wwwroot = 'http://'.$wwwroot;
}
if ($host = $DB->get_record('mnet_host', array('wwwroot' => $wwwroot))) {
global $CFG;
return array('wwwroot' => get_string('hostexists', 'mnet',
new moodle_url('/admin/mnet/peers.php', array('hostid' => $host->id))));
$str = get_string('hostexists', 'mnet', (new moodle_url('/admin/mnet/peers.php', ['hostid' => $host->id]))->out());
return array('wwwroot' => $str);
}
return array();
}
@@ -323,7 +323,7 @@ class accessibility {
/**
* This function runs one specified check on the html item
*
* @param string $html The html string to be analysed; might be NULL.
* @param string|null $html The html string to be analysed; might be NULL.
* @param int $contentid The content area ID
* @param int $errid The error ID
* @param string $check The check name to run
@@ -333,7 +333,7 @@ class accessibility {
* @throws \dml_exception
*/
public static function run_one_check(
string $html = null,
?string $html,
int $contentid,
int $errid,
string $check,
+6 -5
View File
@@ -36,7 +36,7 @@ Useful for uploading custom langstrings to AMOS or importing or syncing them to
Options:
-l, --lang Comma seperated language ids to export, default: all
-c, --components Comma seperated components to export, default: all
-t, --target Target to copy the zip files to, default: $CFG->tempdir/customlang
-t, --target Target directory to copy the zip files to, default: $CFG->tempdir/customlang
-o, --overwrite Overwrite existing files in the target folder.
Note: If the target is not set, the files are always overwritten!
-h, --help Print out this help
@@ -73,9 +73,10 @@ if ($options['help']) {
echo $usage;
die;
}
if (!file_exists($options['target'])) {
mkdir($options['target'], 0777, true);
}
// Ensure target directory exists.
$options['target'] = rtrim($options['target'], '/') . '/';
check_dir_exists($options['target']);
cli_writeln(get_string('cliexportheading', 'tool_customlang'));
$langs = [];
@@ -90,7 +91,7 @@ foreach ($langs as $lang) {
$filename = $options['target'] . get_string('exportzipfilename', 'tool_customlang', ['lang' => $lang]);
// If the file exists and we are not using the temp folder it requires an ovewrite.
if ($options['target'] != $dafaulttarget && file_exists($filename) && !$options['overwrite']) {
cli_problem(get_string('cliexportfileexists', 'tool_customlang', $lang));
cli_problem(get_string('cliexportfileexists', 'tool_customlang', ['lang' => $lang]));
continue;
}
cli_heading(get_string('cliexportstartexport', 'tool_customlang', $lang));
+10
View File
@@ -160,6 +160,16 @@ foreach ($langfiles as $lng => $files) {
cli_heading(get_string('clifiles', 'tool_customlang', $lng));
// If we intend to check in any changes, we must first check them out.
if ($checkin) {
cli_writeln(get_string('checkout', 'tool_customlang'));
$progressbar = new progress_bar();
$progressbar->create();
tool_customlang_utils::checkout($lng, $progressbar);
}
foreach ($files as $file) {
// Generate a valid stored_file from this file.
$record = (object)[
@@ -50,6 +50,7 @@ $string['customlang:export'] = 'Export local translation';
$string['customlang:view'] = 'View local translation';
$string['export'] = 'Export custom strings';
$string['exportfilter'] = 'Select component(s) to export';
$string['exportzipfilename'] = 'customlang-export-{$a->lang}.zip';
$string['filter'] = 'Filter strings';
$string['filtercomponent'] = 'Show strings of these components';
$string['filtercustomized'] = 'Customised only';
+3 -1
View File
@@ -89,7 +89,9 @@ class tool_customlang_utils {
* @param progress_bar $progressbar optionally, the given progress bar can be updated
*/
public static function checkout($lang, progress_bar $progressbar = null) {
global $DB;
global $DB, $CFG;
require_once("{$CFG->libdir}/adminlib.php");
// For behat executions we are going to load only a few components in the
// language customisation structures. Using the whole "en" langpack is
@@ -22,8 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_httpsreplace\tests;
namespace tool_httpsreplace;
defined('MOODLE_INTERNAL') || die();
@@ -124,6 +124,12 @@ class controller {
}
if ($rm1 or $rm2) {
// Set the default site language to en if the deleted language pack is the default site language.
if ($CFG->lang === $lang) {
set_config('lang', 'en');
// Fix the user's current language to the default site language.
fix_current_language($CFG->lang);
}
$this->info[] = get_string('langpackremoved', 'tool_langimport', $lang);
event\langpack_removed::event_with_langcode($lang)->trigger();
return true;
@@ -77,9 +77,10 @@
ucw.registerEvents('[data-region="user-competency-status"]');
ucw.on('status-changed', infoReloader.reload.bind(infoReloader));
ucw.on('error-occured', infoReloader.reload.bind(infoReloader));
var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}', '', '{{#str}}chooserating, tool_lp{{/str}}');
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
{{#cangrade}}
var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '{{plan.id}}', '', '{{#str}}chooserating, tool_lp{{/str}}');
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
{{/cangrade}}
});
{{/js}}
{{/usercompetency}}
@@ -95,13 +95,14 @@
{{#js}}
require(['jquery', 'tool_lp/grade_user_competency_inline', 'tool_lp/user_competency_info'], function($, mod, info) {
var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', '{{#str}}chooserating, tool_lp{{/str}}');
var competencyElement = $('[data-region-id="{{uniqid}}"]');
var displayuser = ('{{displayuser}}' == 'true') ? true : false;
var infoReloader = new info(competencyElement, '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', displayuser);
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
{{#cangrade}}
var inlineGrader = new mod('#rate_{{uniqid}}', '{{competency.scaleid}}', '{{competency.competency.id}}', '{{user.id}}', '', '{{course.id}}', '{{#str}}chooserating, tool_lp{{/str}}');
inlineGrader.on('competencyupdated', infoReloader.reload.bind(infoReloader));
{{/cangrade}}
});
{{/js}}
@@ -14,24 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the import_handler_info class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_moodlenet\local\tests;
namespace tool_moodlenet\local;
use tool_moodlenet\local\import_handler_info;
use tool_moodlenet\local\import_strategy;
use tool_moodlenet\local\import_strategy_file;
defined('MOODLE_INTERNAL') || die();
/**
* Class tool_moodlenet_import_handler_info_testcase, providing test cases for the import_handler_info class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class import_handler_info_test extends \advanced_testcase {
@@ -14,15 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the import_handler_registry class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_moodlenet\local\tests;
namespace tool_moodlenet\local;
use tool_moodlenet\local\import_handler_registry;
use tool_moodlenet\local\import_handler_info;
@@ -31,10 +23,13 @@ use tool_moodlenet\local\import_strategy_link;
use tool_moodlenet\local\remote_resource;
use tool_moodlenet\local\url;
defined('MOODLE_INTERNAL') || die();
/**
* Class tool_moodlenet_import_handler_registry_testcase, providing test cases for the import_handler_registry class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class import_handler_registry_test extends \advanced_testcase {
@@ -14,24 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the import_info class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_moodlenet\local\tests;
namespace tool_moodlenet\local;
use tool_moodlenet\local\import_info;
use tool_moodlenet\local\remote_resource;
use tool_moodlenet\local\url;
defined('MOODLE_INTERNAL') || die();
/**
* Class tool_moodlenet_import_info_testcase, providing test cases for the import_info class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class import_info_test extends \advanced_testcase {
@@ -14,15 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the import_processor class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_moodlenet\local\tests;
namespace tool_moodlenet\local;
use tool_moodlenet\local\import_handler_registry;
use tool_moodlenet\local\import_processor;
@@ -31,10 +23,13 @@ use tool_moodlenet\local\import_strategy_link;
use tool_moodlenet\local\remote_resource;
use tool_moodlenet\local\url;
defined('MOODLE_INTERNAL') || die();
/**
* Class tool_moodlenet_import_processor_testcase, providing test cases for the import_processor class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class import_processor_test extends \advanced_testcase {
@@ -14,24 +14,19 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace tool_moodlenet\local;
use tool_moodlenet\local\remote_resource;
use tool_moodlenet\local\url;
/**
* Unit tests for the remote_resource class.
* Class tool_moodlenet_remote_resource_testcase, providing test cases for the remote_resource class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_moodlenet\local\tests;
use tool_moodlenet\local\remote_resource;
use tool_moodlenet\local\url;
defined('MOODLE_INTERNAL') || die();
/**
* Class tool_moodlenet_remote_resource_testcase, providing test cases for the remote_resource class.
*/
class remote_resource_test extends \advanced_testcase {
/**
@@ -14,23 +14,18 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace tool_moodlenet\local;
use tool_moodlenet\local\url;
/**
* Unit tests for the url class.
* Class tool_moodlenet_url_testcase, providing test cases for the url class.
*
* @package tool_moodlenet
* @category test
* @copyright 2020 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_moodlenet\local\tests;
use tool_moodlenet\local\url;
defined('MOODLE_INTERNAL') || die();
/**
* Class tool_moodlenet_url_testcase, providing test cases for the url class.
*/
class url_test extends \advanced_testcase {
/**
@@ -134,7 +134,6 @@ Feature: Basic OAuth2 functionality
And I set the following fields to these values:
| Name | Testing service modified |
And I press "Save changes"
And I should see "Could not discover service endpoints"
And I should see "Testing service modified"
And I click on "Delete" "link" in the "Testing service modified" "table_row"
And I should see "Are you sure you want to delete the identity issuer \"Testing service modified\"?"
@@ -239,13 +238,12 @@ Feature: Basic OAuth2 functionality
And I press "Save changes"
And "Do not allow login" "icon" should exist in the "Valid custom" "table_row"
And "Allow services" "icon" should exist in the "Valid custom" "table_row"
And "Service discovery successful" "icon" should exist in the "Valid custom" "table_row"
And I should see "-" in the "Valid custom" "table_row"
And I click on "Edit" "link" in the "Valid custom service" "table_row"
And I set the following fields to these values:
| Name | Invalid custom service |
| Service base URL | https://dc.imsglobal.org/ |
And I press "Save changes"
Then I should see "Could not discover end points for identity issuer: Invalid custom service"
And I should see "-" in the "Invalid custom service" "table_row"
And I click on "Delete" "link" in the "Invalid custom service" "table_row"
And I should see "Are you sure you want to delete the identity issuer \"Invalid custom service\"?"
@@ -281,13 +279,12 @@ Feature: Basic OAuth2 functionality
And I press "Save changes"
And "Do not allow login" "icon" should exist in the "Valid custom" "table_row"
And "Allow services" "icon" should exist in the "Valid custom" "table_row"
And "Service discovery successful" "icon" should exist in the "Valid custom" "table_row"
And I should see "-" in the "Valid custom" "table_row"
And I click on "Edit" "link" in the "Valid custom service" "table_row"
And I set the following fields to these values:
| Name | Invalid custom service |
| Service base URL | https://dc.imsglobal.org/ |
And I press "Save changes"
Then I should see "Could not discover end points for identity issuer: Invalid custom service"
And I should see "-" in the "Invalid custom service" "table_row"
And I click on "Edit" "link" in the "Invalid custom service" "table_row"
And I set the following fields to these values:
@@ -351,9 +348,12 @@ Feature: Basic OAuth2 functionality
And I should see "Custom display name" in the "Empty custom service" "table_row"
And "Not configured" "icon" should exist in the "Empty custom service" "table_row"
And "Do not allow services" "icon" should exist in the "Empty custom service" "table_row"
And I click on "Edit" "link" in the "Empty custom service" "table_row"
And I click on "Configure endpoints" "link" in the "Empty custom service" "table_row"
And I press "Create new endpoint for issuer \"Empty custom service\""
And I set the following fields to these values:
| Service base URL | https://accounts.google.com |
| Name | userinfo_endpoint |
| URL | https://example.com/userinfo |
And I press "Save changes"
And I navigate to "Server > OAuth 2 services" in site administration
And "Allow login" "icon" should exist in the "Empty custom service" "table_row"
And "Do not allow services" "icon" should exist in the "Empty custom service" "table_row"
+5 -14
View File
@@ -14,17 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the analysis class.
*
* @package core_analytics
* @copyright 2019 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/fixtures/test_timesplitting_upcoming_seconds.php');
namespace core_analytics;
/**
* Unit tests for the analysis class.
@@ -33,18 +23,19 @@ require_once(__DIR__ . '/fixtures/test_timesplitting_upcoming_seconds.php');
* @copyright 2019 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class analytics_analysis_testcase extends advanced_testcase {
class analysis_test extends \advanced_testcase {
/**
* Test fill_firstanalyses_cache.
* @return null
*/
public function test_fill_firstanalyses_cache() {
require_once(__DIR__ . '/fixtures/test_timesplitting_upcoming_seconds.php');
$this->resetAfterTest();
$modelid = 1;
$params = ['startdate' => (new DateTimeImmutable('-5 seconds'))->getTimestamp()];
$params = ['startdate' => (new \DateTimeImmutable('-5 seconds'))->getTimestamp()];
$course1 = $this->getDataGenerator()->create_course($params);
$course2 = $this->getDataGenerator()->create_course($params);
$analysable1 = new \core_analytics\course($course1);
@@ -72,7 +63,7 @@ class analytics_analysis_testcase extends advanced_testcase {
$this->assertEquals($earliest, $firstanalyses[$modelid . '_' . $course1->id]);
// Upcoming periodic time-splitting methods can read and process the cached data.
$seconds = new test_timesplitting_upcoming_seconds();
$seconds = new \test_timesplitting_upcoming_seconds();
$seconds->set_modelid($modelid);
$seconds->set_analysable($analysable1);
+6 -15
View File
@@ -14,18 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the calculation info cache.
*
* @package core_analytics
* @copyright 2019 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/fixtures/test_indicator_max.php');
require_once(__DIR__ . '/fixtures/test_indicator_min.php');
namespace core_analytics;
/**
* Unit tests for the calculation info cache.
@@ -34,7 +23,7 @@ require_once(__DIR__ . '/fixtures/test_indicator_min.php');
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class analytics_calculation_info_testcase extends advanced_testcase {
class calculation_info_test extends \advanced_testcase {
/**
* test_calculation_info description
@@ -47,12 +36,14 @@ class analytics_calculation_info_testcase extends advanced_testcase {
* @return null
*/
public function test_calculation_info_add_pull($info1, $info2, $info3, $info4) {
require_once(__DIR__ . '/fixtures/test_indicator_max.php');
require_once(__DIR__ . '/fixtures/test_indicator_min.php');
$this->resetAfterTest();
$atimesplitting = new \core\analytics\time_splitting\quarters();
$indicator1 = new test_indicator_min();
$indicator2 = new test_indicator_max();
$indicator1 = new \test_indicator_min();
$indicator2 = new \test_indicator_max();
$calculationinfo = new \core_analytics\calculation_info();
$calculationinfo->add_shared(111, [111 => $info1]);
+2 -10
View File
@@ -14,15 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the dataset manager.
*
* @package core_analytics
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
namespace core_analytics;
/**
* Unit tests for the dataset manager.
@@ -31,7 +23,7 @@ defined('MOODLE_INTERNAL') || die();
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class dataset_manager_testcase extends advanced_testcase {
class dataset_manager_test extends \advanced_testcase {
/**
* setUp
+3 -9
View File
@@ -14,13 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for the indicator API.
*
* @package core_analytics
* @copyright 2019 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
defined('MOODLE_INTERNAL') || die();
@@ -35,7 +29,7 @@ require_once(__DIR__ . '/fixtures/test_indicator_min.php');
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class analytics_indicator_testcase extends advanced_testcase {
class indicator_test extends \advanced_testcase {
/**
* test_validate_calculated_value
@@ -79,7 +73,7 @@ class analytics_indicator_testcase extends advanced_testcase {
->onlyMethods(['calculate_sample'])
->getMock();
$indicatormock->method('calculate_sample')->willReturn($willreturn);
$this->expectException(coding_exception::class);
$this->expectException(\coding_exception::class);
list($values, $unused) = $indicatormock->calculate([1], 'notrelevanthere');
}
+10 -8
View File
@@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/fixtures/test_indicator_max.php');
@@ -39,7 +41,7 @@ require_once(__DIR__ . '/fixtures/test_analysis.php');
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class analytics_model_testcase extends advanced_testcase {
class model_test extends \advanced_testcase {
public function setUp(): void {
@@ -183,7 +185,7 @@ class analytics_model_testcase extends advanced_testcase {
global $DB;
$this->resetAfterTest();
$statictarget = new test_static_target_shortname();
$statictarget = new \test_static_target_shortname();
$indicators['test_indicator_max'] = \core_analytics\manager::get_indicator('test_indicator_max');
$model = \core_analytics\model::create($statictarget, $indicators, '\core\analytics\time_splitting\quarters');
$modelobj = $model->get_model_obj();
@@ -301,11 +303,11 @@ class analytics_model_testcase extends advanced_testcase {
$courses[$analysable->get_id()] = $course;
}
$target = new test_target_course_level_shortname();
$target = new \test_target_course_level_shortname();
$analyser = new \core\analytics\analyser\courses(1, $target, [], [], []);
$result = new \core_analytics\local\analysis\result_array(1, false, []);
$analysis = new test_analysis($analyser, false, $result);
$analysis = new \test_analysis($analyser, false, $result);
// Each analysable element takes 0.5 secs minimum (test_analysis), so the max (and likely) number of analysable
// elements that will be processed is 2.
@@ -342,7 +344,7 @@ class analytics_model_testcase extends advanced_testcase {
// Training and prediction data do not get mixed.
$result = new \core_analytics\local\analysis\result_array(1, false, []);
$analysis = new test_analysis($analyser, false, $result);
$analysis = new \test_analysis($analyser, false, $result);
$analysis->run();
$params = array('modelid' => 1, 'action' => 'training');
$this->assertLessThanOrEqual(2, $DB->count_records('analytics_used_analysables', $params));
@@ -402,7 +404,7 @@ class analytics_model_testcase extends advanced_testcase {
$this->model->update(true, [], false);
$this->assertFalse($this->model->can_export_configuration());
$statictarget = new test_static_target_shortname();
$statictarget = new \test_static_target_shortname();
$indicators['test_indicator_max'] = \core_analytics\manager::get_indicator('test_indicator_max');
$model = \core_analytics\model::create($statictarget, $indicators, '\\core\\analytics\\time_splitting\\quarters');
$this->assertFalse($model->can_export_configuration());
@@ -418,7 +420,7 @@ class analytics_model_testcase extends advanced_testcase {
$modelconfig = new \core_analytics\model_config($this->model);
$method = new ReflectionMethod('\\core_analytics\\model_config', 'export_model_data');
$method = new \ReflectionMethod('\\core_analytics\\model_config', 'export_model_data');
$method->setAccessible(true);
$modeldata = $method->invoke($modelconfig);
@@ -566,7 +568,7 @@ class analytics_model_testcase extends advanced_testcase {
private function add_fake_log() {
global $DB, $USER;
$log = new stdClass();
$log = new \stdClass();
$log->modelid = $this->modelobj->id;
$log->version = $this->modelobj->version;
$log->target = $this->modelobj->target;
+2 -8
View File
@@ -14,13 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for prediction actions.
*
* @package core_analytics
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
defined('MOODLE_INTERNAL') || die();
@@ -34,7 +28,7 @@ require_once(__DIR__ . '/fixtures/test_target_shortname.php');
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class analytics_prediction_actions_testcase extends advanced_testcase {
class prediction_actions_test extends \advanced_testcase {
/**
* Common startup tasks
+12 -18
View File
@@ -14,21 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for evaluation, training and prediction.
*
* NOTE: in order to execute this test using a separate server for the
* python ML backend you need to define these variables in your config.php file:
*
* define('TEST_MLBACKEND_PYTHON_HOST', '127.0.0.1');
* define('TEST_MLBACKEND_PYTHON_PORT', 5000);
* define('TEST_MLBACKEND_PYTHON_USERNAME', 'default');
* define('TEST_MLBACKEND_PYTHON_PASSWORD', 'sshhhh');
*
* @package core_analytics
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
defined('MOODLE_INTERNAL') || die();
@@ -48,11 +34,19 @@ require_once(__DIR__ . '/../../course/lib.php');
/**
* Unit tests for evaluation, training and prediction.
*
* NOTE: in order to execute this test using a separate server for the
* python ML backend you need to define these variables in your config.php file:
*
* define('TEST_MLBACKEND_PYTHON_HOST', '127.0.0.1');
* define('TEST_MLBACKEND_PYTHON_PORT', 5000);
* define('TEST_MLBACKEND_PYTHON_USERNAME', 'default');
* define('TEST_MLBACKEND_PYTHON_PASSWORD', 'sshhhh');
*
* @package core_analytics
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_analytics_prediction_testcase extends advanced_testcase {
class prediction_test extends \advanced_testcase {
/**
* Purge all the mlbackend outputs.
@@ -746,7 +740,7 @@ class core_analytics_prediction_testcase extends advanced_testcase {
$samples,
$ranges
);
$dataset = phpunit_util::call_internal_method($analysis, 'calculate_indicators', $params,
$dataset = \phpunit_util::call_internal_method($analysis, 'calculate_indicators', $params,
'\core_analytics\analysis');
$this->assertArrayHasKey('123-0', $dataset);
$this->assertArrayHasKey('123-1', $dataset);
@@ -770,7 +764,7 @@ class core_analytics_prediction_testcase extends advanced_testcase {
$samples,
$ranges
);
$dataset = phpunit_util::call_internal_method($analysis, 'calculate_indicators', $params,
$dataset = \phpunit_util::call_internal_method($analysis, 'calculate_indicators', $params,
'\core_analytics\analysis');
$this->assertArrayNotHasKey('123-0', $dataset);
$this->assertArrayNotHasKey('123-1', $dataset);
+4 -9
View File
@@ -14,14 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Provides the {@link analytics_stats_testcase} class.
*
* @package core_analytics
* @category test
* @copyright 2019 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
defined('MOODLE_INTERNAL') || die();
@@ -31,10 +24,12 @@ require_once(__DIR__ . '/fixtures/test_target_shortname.php');
/**
* Unit tests for the analytics stats.
*
* @package core_analytics
* @category test
* @copyright 2019 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class analytics_stats_testcase extends advanced_testcase {
class stats_test extends \advanced_testcase {
/**
* Set up the test environment.
@@ -14,30 +14,26 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core time splitting methods.
*
* @package core
* @category analytics
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_analytics;
use test_timesplitting_seconds;
use test_timesplitting_upcoming_seconds;
defined('MOODLE_INTERNAL') || die();
require_once(__DIR__ . '/../../analytics/tests/fixtures/test_timesplitting_seconds.php');
require_once(__DIR__ . '/../../analytics/tests/fixtures/test_timesplitting_upcoming_seconds.php');
require_once(__DIR__ . '/fixtures/test_timesplitting_seconds.php');
require_once(__DIR__ . '/fixtures/test_timesplitting_upcoming_seconds.php');
require_once(__DIR__ . '/../../lib/enrollib.php');
/**
* Unit tests for core time splitting methods.
*
* @package core
* @category analytics
* @category test
* @copyright 2017 David Monllaó {@link http://www.davidmonllao.com}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_analytics_time_splittings_testcase extends advanced_testcase {
class time_splittings_test extends \advanced_testcase {
/**
* setUp
@@ -214,7 +210,7 @@ class core_analytics_time_splittings_testcase extends advanced_testcase {
// We now use an ongoing course not yet ready to generate predictions.
$threedaysago = new DateTime('-3 days');
$threedaysago = new \DateTime('-3 days');
$params = array(
'startdate' => $threedaysago->getTimestamp(),
);
@@ -229,7 +225,7 @@ class core_analytics_time_splittings_testcase extends advanced_testcase {
// We now use a ready-to-predict ongoing course.
$onemonthago = new DateTime('-30 days');
$onemonthago = new \DateTime('-30 days');
$params = array(
'startdate' => $onemonthago->getTimestamp(),
);
@@ -284,10 +280,10 @@ class core_analytics_time_splittings_testcase extends advanced_testcase {
// We now check how new ranges get added as time passes.
$fewsecsago = new DateTime('-5 seconds');
$fewsecsago = new \DateTime('-5 seconds');
$params = array(
'startdate' => $fewsecsago->getTimestamp(),
'enddate' => (new DateTimeImmutable('+1 year'))->getTimestamp(),
'enddate' => (new \DateTimeImmutable('+1 year'))->getTimestamp(),
);
$course = $this->getDataGenerator()->create_course($params);
$analysable = new \core_analytics\course($course);
+4 -9
View File
@@ -866,11 +866,8 @@ class auth_plugin_ldap extends auth_plugin_base {
if (!empty($users)) {
print_string('userentriestoupdate', 'auth_ldap', count($users));
$transaction = $DB->start_delegated_transaction();
$xcount = 0;
$maxxcount = 100;
foreach ($users as $user) {
$transaction = $DB->start_delegated_transaction();
echo "\t"; print_string('auth_dbupdatinguser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id));
$userinfo = $this->get_userinfo($user->username);
if (!$this->update_user_record($user->username, $updatekeys, true,
@@ -878,12 +875,11 @@ class auth_plugin_ldap extends auth_plugin_base {
echo ' - '.get_string('skipped');
}
echo "\n";
$xcount++;
// Update system roles, if needed.
$this->sync_roles($user);
$transaction->allow_commit();
}
$transaction->allow_commit();
unset($users); // free mem
}
} else { // end do updates
@@ -903,8 +899,8 @@ class auth_plugin_ldap extends auth_plugin_base {
if (!empty($add_users)) {
print_string('userentriestoadd', 'auth_ldap', count($add_users));
$transaction = $DB->start_delegated_transaction();
foreach ($add_users as $user) {
$transaction = $DB->start_delegated_transaction();
$user = $this->get_userinfo_asobj($user->username);
// Prep a few params
@@ -939,9 +935,8 @@ class auth_plugin_ldap extends auth_plugin_base {
// Add roles if needed.
$this->sync_roles($euser);
$transaction->allow_commit();
}
$transaction->allow_commit();
unset($add_users); // free mem
} else {
print_string('nouserstobeadded', 'auth_ldap');
+2 -2
View File
@@ -482,13 +482,13 @@ class tree extends tree_node {
*
* @param bool $not True if there is a NOT in effect
* @param info $info Information about location of condition tree
* @param result $result Result object if this is a student display, else null
* @param result|null $result Result object if this is a student display, else null
* @param bool $root True if this is the root item
* @param bool $hidden Staff display; true if this tree has show=false (from parent)
* @return string|renderable Information to render
*/
protected function get_full_information_recursive(
$not, info $info, result $result = null, $root, $hidden = false) {
$not, info $info, ?result $result, $root, $hidden = false) {
// Get list of children - either full list, or those which are shown.
$children = $this->children;
$staff = true;
@@ -49,7 +49,7 @@ class frontend extends \core_availability\frontend {
protected function get_javascript_strings() {
return array('ajaxerror', 'direction_before', 'direction_from', 'direction_until',
'direction_label');
'direction_label', 'error_dateconflict');
}
/**
@@ -28,6 +28,7 @@ $string['direction_from'] = 'from';
$string['direction_label'] = 'Direction';
$string['direction_until'] = 'until';
$string['description'] = 'Prevent access until (or from) a specified date and time.';
$string['error_dateconflict'] = 'Conflicts with other date restrictions';
$string['full_from'] = 'It is after <strong>{$a}</strong>';
$string['full_from_date'] = 'It is on or after <strong>{$a}</strong>';
$string['full_until'] = 'It is before <strong>{$a}</strong>';
@@ -142,5 +142,84 @@ M.availability_date.form.fillValue = function(value, node) {
value.t = parseInt(node.getData('time'), 10);
};
/**
* List out Date node value in an array node.
*
* This will go through all array node and list from earlier date node to current date node.
*
* @method convertTreeDateValue
* @param {array} tree Tree node to convert
* @param {array} arrayDateNode
* @param {array} currentNode current node.
*
* @return {array} arrayDateNode
*/
M.availability_date.form.convertTreeDateValue = function(tree, arrayDateNode, currentNode) {
var shouldSkip = false;
tree.forEach(function(node) {
if (shouldSkip) {
return;
}
if (node.type === 'date') {
// We go through all tree node, if we meet the current node then return.
if (node.t === parseInt(currentNode.getData('time'), 10)
&& currentNode.one('select[name=direction]').get('value') == node.d) {
shouldSkip = true;
return;
}
arrayDateNode.push(node);
} else if (node.type === undefined) {
M.availability_date.form.convertTreeDateValue(node.c, arrayDateNode, currentNode);
}
});
return arrayDateNode;
};
/**
* Check current node.
*
* This will check current date node with all date node in tree node.
*
* @method checkConditionDate
* @param {array} currentNode The curent node.
*
* @return {boolean} error Return true if the date is conflict.
*/
M.availability_date.form.checkConditionDate = function(currentNode) {
var error = false;
if (M.core_availability.form.rootList.getValue().op === '&') {
var jsValue = M.core_availability.form.rootList.getValue().c;
var arrayDateNode = M.availability_date.form.convertTreeDateValue(jsValue, [], currentNode);
var currentNodeDirection = currentNode.one('select[name=direction]').get('value');
var currentNodeTime = parseInt(currentNode.getData('time'), 10);
arrayDateNode.forEach(function(checkNode) {
// Validate if the date is conflict.
if (checkNode.d === '<') {
if (currentNodeDirection === '>=' && currentNodeTime >= checkNode.t) {
error = true;
}
} else {
if (currentNodeDirection === '<' && currentNodeTime <= checkNode.t) {
error = true;
}
}
return error;
});
return error;
} else {
if (currentNode.one('div > .badge-warning')) {
currentNode.one('div > .badge-warning').remove();
}
return error;
}
};
M.availability_date.form.fillErrors = function(errors, node) {
var error = M.availability_date.form.checkConditionDate(node);
if (error) {
errors.push('availability_date:error_dateconflict');
}
};
}, '@VERSION@', {"requires": ["base", "node", "event", "io", "moodle-core_availability-form"]});
@@ -1 +1 @@
YUI.add("moodle-availability_date-form",function(o,e){M.availability_date=M.availability_date||{},M.availability_date.form=o.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,a){this.html=e,this.defaultTime=a},M.availability_date.form.getNode=function(e){var t,i,a='<span class="col-form-label pr-3">'+M.util.get_string("direction_before","availability_date")+'</span> <span class="availability-group"><label><span class="accesshide">'+M.util.get_string("direction_label","availability_date")+' </span><select name="direction" class="custom-select"><option value="&gt;=">'+M.util.get_string("direction_from","availability_date")+'</option><option value="&lt;">'+M.util.get_string("direction_until","availability_date")+"</option></select></label></span> "+this.html,n=o.Node.create("<span>"+a+"</span>");return e.t!==undefined?(n.setData("time",e.t),n.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)}),a=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime&time="+e.t,o.io(a,{on:{success:function(e,a){var t,i,l=o.JSON.parse(a.responseText);for(t in l)(i=n.one("select[name=x\\["+t+"\\]]")).set("value",""+l[t]),i.set("disabled",!1)},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})):n.setData("time",this.defaultTime),e.d!==undefined&&n.one("select[name=direction]").set("value",e.d),M.availability_date.form.addedEvents||(M.availability_date.form.addedEvents=!0,(a=o.one(".availability-field")).delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),a.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")),n.one("a[href=#]")&&(M.form.dateselector.init_single_date_selector(n),t=n.one("select[name=x\\[year\\]]"),i=t.set,t.set=function(e,a){i.call(t,e,a),"selectedIndex"===e&&setTimeout(function(){M.availability_date.form.updateTime(n)},0)}),n},M.availability_date.form.updateTime=function(t){var e=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");o.io(e,{on:{success:function(e,a){t.setData("time",a.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,a){e.d=a.one("select[name=direction]").get("value"),e.t=parseInt(a.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
YUI.add("moodle-availability_date-form",function(o,e){M.availability_date=M.availability_date||{},M.availability_date.form=o.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,a){this.html=e,this.defaultTime=a},M.availability_date.form.getNode=function(e){var t,i,a='<span class="col-form-label pr-3">'+M.util.get_string("direction_before","availability_date")+'</span> <span class="availability-group"><label><span class="accesshide">'+M.util.get_string("direction_label","availability_date")+' </span><select name="direction" class="custom-select"><option value="&gt;=">'+M.util.get_string("direction_from","availability_date")+'</option><option value="&lt;">'+M.util.get_string("direction_until","availability_date")+"</option></select></label></span> "+this.html,n=o.Node.create("<span>"+a+"</span>");return e.t!==undefined?(n.setData("time",e.t),n.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)}),a=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime&time="+e.t,o.io(a,{on:{success:function(e,a){var t,i,l=o.JSON.parse(a.responseText);for(t in l)(i=n.one("select[name=x\\["+t+"\\]]")).set("value",""+l[t]),i.set("disabled",!1)},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})):n.setData("time",this.defaultTime),e.d!==undefined&&n.one("select[name=direction]").set("value",e.d),M.availability_date.form.addedEvents||(M.availability_date.form.addedEvents=!0,(a=o.one(".availability-field")).delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),a.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")),n.one("a[href=#]")&&(M.form.dateselector.init_single_date_selector(n),t=n.one("select[name=x\\[year\\]]"),i=t.set,t.set=function(e,a){i.call(t,e,a),"selectedIndex"===e&&setTimeout(function(){M.availability_date.form.updateTime(n)},0)}),n},M.availability_date.form.updateTime=function(t){var e=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");o.io(e,{on:{success:function(e,a){t.setData("time",a.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,a){e.d=a.one("select[name=direction]").get("value"),e.t=parseInt(a.getData("time"),10)},M.availability_date.form.convertTreeDateValue=function(e,a,t){var i=!1;return e.forEach(function(e){i||("date"===e.type?e.t!==parseInt(t.getData("time"),10)||t.one("select[name=direction]").get("value")!=e.d?a.push(e):i=!0:e.type===undefined&&M.availability_date.form.convertTreeDateValue(e.c,a,t))}),a},M.availability_date.form.checkConditionDate=function(e){var a,t,i,l=!1;return"&"===M.core_availability.form.rootList.getValue().op?(a=M.core_availability.form.rootList.getValue().c,a=M.availability_date.form.convertTreeDateValue(a,[],e),t=e.one("select[name=direction]").get("value"),i=parseInt(e.getData("time"),10),a.forEach(function(e){return"<"===e.d?">="===t&&i>=e.t&&(l=!0):"<"===t&&i<=e.t&&(l=!0),l})):e.one("div > .badge-warning")&&e.one("div > .badge-warning").remove(),l},M.availability_date.form.fillErrors=function(e,a){M.availability_date.form.checkConditionDate(a)&&e.push("availability_date:error_dateconflict")}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
@@ -142,5 +142,84 @@ M.availability_date.form.fillValue = function(value, node) {
value.t = parseInt(node.getData('time'), 10);
};
/**
* List out Date node value in an array node.
*
* This will go through all array node and list from earlier date node to current date node.
*
* @method convertTreeDateValue
* @param {array} tree Tree node to convert
* @param {array} arrayDateNode
* @param {array} currentNode current node.
*
* @return {array} arrayDateNode
*/
M.availability_date.form.convertTreeDateValue = function(tree, arrayDateNode, currentNode) {
var shouldSkip = false;
tree.forEach(function(node) {
if (shouldSkip) {
return;
}
if (node.type === 'date') {
// We go through all tree node, if we meet the current node then return.
if (node.t === parseInt(currentNode.getData('time'), 10)
&& currentNode.one('select[name=direction]').get('value') == node.d) {
shouldSkip = true;
return;
}
arrayDateNode.push(node);
} else if (node.type === undefined) {
M.availability_date.form.convertTreeDateValue(node.c, arrayDateNode, currentNode);
}
});
return arrayDateNode;
};
/**
* Check current node.
*
* This will check current date node with all date node in tree node.
*
* @method checkConditionDate
* @param {array} currentNode The curent node.
*
* @return {boolean} error Return true if the date is conflict.
*/
M.availability_date.form.checkConditionDate = function(currentNode) {
var error = false;
if (M.core_availability.form.rootList.getValue().op === '&') {
var jsValue = M.core_availability.form.rootList.getValue().c;
var arrayDateNode = M.availability_date.form.convertTreeDateValue(jsValue, [], currentNode);
var currentNodeDirection = currentNode.one('select[name=direction]').get('value');
var currentNodeTime = parseInt(currentNode.getData('time'), 10);
arrayDateNode.forEach(function(checkNode) {
// Validate if the date is conflict.
if (checkNode.d === '<') {
if (currentNodeDirection === '>=' && currentNodeTime >= checkNode.t) {
error = true;
}
} else {
if (currentNodeDirection === '<' && currentNodeTime <= checkNode.t) {
error = true;
}
}
return error;
});
return error;
} else {
if (currentNode.one('div > .badge-warning')) {
currentNode.one('div > .badge-warning').remove();
}
return error;
}
};
M.availability_date.form.fillErrors = function(errors, node) {
var error = M.availability_date.form.checkConditionDate(node);
if (error) {
errors.push('availability_date:error_dateconflict');
}
};
}, '@VERSION@', {"requires": ["base", "node", "event", "io", "moodle-core_availability-form"]});
+79
View File
@@ -139,3 +139,82 @@ M.availability_date.form.fillValue = function(value, node) {
value.d = node.one('select[name=direction]').get('value');
value.t = parseInt(node.getData('time'), 10);
};
/**
* List out Date node value in an array node.
*
* This will go through all array node and list from earlier date node to current date node.
*
* @method convertTreeDateValue
* @param {array} tree Tree node to convert
* @param {array} arrayDateNode
* @param {array} currentNode current node.
*
* @return {array} arrayDateNode
*/
M.availability_date.form.convertTreeDateValue = function(tree, arrayDateNode, currentNode) {
var shouldSkip = false;
tree.forEach(function(node) {
if (shouldSkip) {
return;
}
if (node.type === 'date') {
// We go through all tree node, if we meet the current node then return.
if (node.t === parseInt(currentNode.getData('time'), 10)
&& currentNode.one('select[name=direction]').get('value') == node.d) {
shouldSkip = true;
return;
}
arrayDateNode.push(node);
} else if (node.type === undefined) {
M.availability_date.form.convertTreeDateValue(node.c, arrayDateNode, currentNode);
}
});
return arrayDateNode;
};
/**
* Check current node.
*
* This will check current date node with all date node in tree node.
*
* @method checkConditionDate
* @param {array} currentNode The curent node.
*
* @return {boolean} error Return true if the date is conflict.
*/
M.availability_date.form.checkConditionDate = function(currentNode) {
var error = false;
if (M.core_availability.form.rootList.getValue().op === '&') {
var jsValue = M.core_availability.form.rootList.getValue().c;
var arrayDateNode = M.availability_date.form.convertTreeDateValue(jsValue, [], currentNode);
var currentNodeDirection = currentNode.one('select[name=direction]').get('value');
var currentNodeTime = parseInt(currentNode.getData('time'), 10);
arrayDateNode.forEach(function(checkNode) {
// Validate if the date is conflict.
if (checkNode.d === '<') {
if (currentNodeDirection === '>=' && currentNodeTime >= checkNode.t) {
error = true;
}
} else {
if (currentNodeDirection === '<' && currentNodeTime <= checkNode.t) {
error = true;
}
}
return error;
});
return error;
} else {
if (currentNode.one('div > .badge-warning')) {
currentNode.one('div > .badge-warning').remove();
}
return error;
}
};
M.availability_date.form.fillErrors = function(errors, node) {
var error = M.availability_date.form.checkConditionDate(node);
if (error) {
errors.push('availability_date:error_dateconflict');
}
};
@@ -971,7 +971,21 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
// If any errors were added, add the marker to this item.
var errorLabel = this.node.one('> .badge-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
errorLabel.appendChild(document.createTextNode(M.util.get_string('invalid', 'availability')));
var errorString = '';
// Fetch the last error code from the array of errors and split using the ':' delimiter.
var langString = errors[errors.length - 1].split(':');
var component = langString[0];
var identifier = langString[1];
// If get_string can't find the string, it will return the string in this format.
var undefinedString = '[[' + identifier + ',' + component + ']]';
// Get the lang string.
errorString = M.util.get_string(identifier, component);
if (errorString === undefinedString) {
// Use a generic invalid input message when the error lang string cannot be loaded.
errorString = M.util.get_string('invalid', 'availability');
}
// Show the error string.
errorLabel.appendChild(document.createTextNode(errorString));
} else if (errors.length === before && errorLabel.get('firstChild')) {
errorLabel.get('firstChild').remove();
}
File diff suppressed because one or more lines are too long
@@ -971,7 +971,21 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
// If any errors were added, add the marker to this item.
var errorLabel = this.node.one('> .badge-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
errorLabel.appendChild(document.createTextNode(M.util.get_string('invalid', 'availability')));
var errorString = '';
// Fetch the last error code from the array of errors and split using the ':' delimiter.
var langString = errors[errors.length - 1].split(':');
var component = langString[0];
var identifier = langString[1];
// If get_string can't find the string, it will return the string in this format.
var undefinedString = '[[' + identifier + ',' + component + ']]';
// Get the lang string.
errorString = M.util.get_string(identifier, component);
if (errorString === undefinedString) {
// Use a generic invalid input message when the error lang string cannot be loaded.
errorString = M.util.get_string('invalid', 'availability');
}
// Show the error string.
errorLabel.appendChild(document.createTextNode(errorString));
} else if (errors.length === before && errorLabel.get('firstChild')) {
errorLabel.get('firstChild').remove();
}
+15 -1
View File
@@ -969,7 +969,21 @@ M.core_availability.Item.prototype.fillErrors = function(errors) {
// If any errors were added, add the marker to this item.
var errorLabel = this.node.one('> .badge-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
errorLabel.appendChild(document.createTextNode(M.util.get_string('invalid', 'availability')));
var errorString = '';
// Fetch the last error code from the array of errors and split using the ':' delimiter.
var langString = errors[errors.length - 1].split(':');
var component = langString[0];
var identifier = langString[1];
// If get_string can't find the string, it will return the string in this format.
var undefinedString = '[[' + identifier + ',' + component + ']]';
// Get the lang string.
errorString = M.util.get_string(identifier, component);
if (errorString === undefinedString) {
// Use a generic invalid input message when the error lang string cannot be loaded.
errorString = M.util.get_string('invalid', 'availability');
}
// Show the error string.
errorLabel.appendChild(document.createTextNode(errorString));
} else if (errors.length === before && errorLabel.get('firstChild')) {
errorLabel.get('firstChild').remove();
}
+14 -5
View File
@@ -4239,7 +4239,8 @@ class restore_block_instance_structure_step extends restore_structure_step {
// Look for the parent contextid
if (!$data->parentcontextid = $this->get_mappingid('context', $data->parentcontextid)) {
throw new restore_step_exception('restore_block_missing_parent_ctx', $data->parentcontextid);
// Parent contextid does not exist, ignore this block.
return false;
}
// TODO: it would be nice to use standard plugin supports instead of this instance_allow_multiple()
@@ -4285,14 +4286,17 @@ class restore_block_instance_structure_step extends restore_structure_step {
$params['subpagepattern'] = $data->subpagepattern;
}
$exists = $DB->record_exists_sql("SELECT bi.id
$existingblock = $DB->get_records_sql("SELECT bi.id
FROM {block_instances} bi
JOIN {block} b ON b.name = bi.blockname
WHERE bi.blockname = :blockname
AND $contextsql
AND bi.pagetypepattern $pagetypepatternsql
AND $subpagepatternsql", $params);
if ($exists) {
if (!empty($existingblock)) {
// Save the context mapping in case something else is linking to this block's context.
$newcontext = context_block::instance(reset($existingblock)->id);
$this->set_mapping('context', $oldcontextid, $newcontext->id);
// There is at least one very similar block visible on the page where we
// are trying to restore the block. In these circumstances the block API
// would not allow the user to add another instance of the block, so we
@@ -4311,6 +4315,9 @@ class restore_block_instance_structure_step extends restore_structure_step {
if ($birecs = $DB->get_records('block_instances', $params)) {
foreach($birecs as $birec) {
if ($birec->configdata == $data->configdata) {
// Save the context mapping in case something else is linking to this block's context.
$newcontext = context_block::instance($birec->id);
$this->set_mapping('context', $oldcontextid, $newcontext->id);
return false;
}
}
@@ -5296,7 +5303,8 @@ class restore_process_file_aliases_queue extends restore_execution_step {
continue;
}
if ($info->oldfile->repositorytype === 'local' or $info->oldfile->repositorytype === 'coursefiles') {
if ($info->oldfile->repositorytype === 'local' || $info->oldfile->repositorytype === 'coursefiles'
|| $info->oldfile->repositorytype === 'contentbank') {
// Aliases to Server files and Legacy course files may refer to a file
// contained in the backup file or to some existing file (if we are on the
// same site).
@@ -5459,7 +5467,8 @@ class restore_process_file_aliases_queue extends restore_execution_step {
// Both Server files and Legacy course files repositories have a single
// instance at the system context to use. Let us try to find it.
if ($info->oldfile->repositorytype === 'local' or $info->oldfile->repositorytype === 'coursefiles') {
if ($info->oldfile->repositorytype === 'local' || $info->oldfile->repositorytype === 'coursefiles'
|| $info->oldfile->repositorytype === 'contentbank') {
$sql = "SELECT ri.id
FROM {repository} r
JOIN {repository_instances} ri ON ri.typeid = r.id
+5 -3
View File
@@ -145,9 +145,11 @@ abstract class convert_helper {
$firstchars = fread($handle, 200);
$status = fclose($handle);
if (strpos($firstchars,'<?xml version="1.0" encoding="UTF-8"?>') !== false and
strpos($firstchars,'<moodle_backup>') !== false and
strpos($firstchars,'<information>') !== false) {
// Look for expected XML elements (case-insensitive to account for encoding attribute).
if (stripos($firstchars, '<?xml version="1.0" encoding="UTF-8"?>') !== false &&
strpos($firstchars, '<moodle_backup>') !== false &&
strpos($firstchars, '<information>') !== false) {
return true;
}
+1 -1
View File
@@ -643,7 +643,7 @@ class backup_ui_stage_complete extends backup_ui_stage_final {
}
$output .= $renderer->get_samesite_notification();
$output .= $renderer->notification(get_string('executionsuccess', 'backup'), 'notifysuccess');
$output .= $renderer->continue_button($restorerul);
$output .= $renderer->continue_button($restorerul, 'get');
$output .= $renderer->box_end();
return $output;
+2 -2
View File
@@ -553,7 +553,8 @@ class core_backup_renderer extends plugin_renderer_base {
}
/**
* Displays a continue button
* Displays a continue button, overriding core renderer method of the same in order
* to override submission method of the button form
*
* @param string|moodle_url $url
* @param string $method
@@ -566,7 +567,6 @@ class core_backup_renderer extends plugin_renderer_base {
if ($method != 'post') {
$method = 'get';
}
$url->param('sesskey', sesskey());
$button = new single_button($url, get_string('continue'), $method, true);
$button->class = 'continuebutton';
return $this->render($button);
+4 -2
View File
@@ -1161,8 +1161,10 @@ class restore_ui_stage_complete extends restore_ui_stage_process {
$html .= $renderer->notification(get_string('restorefileweremissing', 'backup'), 'notifyproblem');
}
$html .= $renderer->notification(get_string('restoreexecutionsuccess', 'backup'), 'notifysuccess');
$html .= $renderer->continue_button(new moodle_url('/course/view.php', array(
'id' => $this->get_ui()->get_controller()->get_courseid())), 'get');
$courseurl = course_get_url($this->get_ui()->get_controller()->get_courseid());
$html .= $renderer->continue_button($courseurl, 'get');
$html .= $renderer->box_end();
return $html;
@@ -21,7 +21,7 @@ Feature: Restore Moodle 2 course backups with different user data settings
| data | Test database name | n | C1 | data1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I add a "Text input" field to "Test database name" database and I fill the form with:
And I add a "Short text" field to "Test database name" database and I fill the form with:
| Field name | Test field name |
| Field description | Test field description |
And I follow "Templates"
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace block_accessreview\tests;
namespace block_accessreview;
use ReflectionClass;
use advanced_testcase;
+2 -2
View File
@@ -36,7 +36,7 @@ class moodle1_block_html_handler extends moodle1_block_handler {
$contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
$decodeddata = base64_decode($olddata['configdata']);
list($updated, $configdata) = upgrade_fix_serialized_objects($decodeddata);
$configdata = unserialize($configdata);
$configdata = unserialize_object($configdata);
// get a fresh new file manager for this instance
$this->fileman = $this->converter->get_file_manager($contextid, 'block_html');
@@ -44,7 +44,7 @@ class moodle1_block_html_handler extends moodle1_block_handler {
// convert course files embedded in the block content
$this->fileman->filearea = 'content';
$this->fileman->itemid = 0;
$configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
$configdata->text = moodle1_converter::migrate_referenced_files($configdata->text ?? '', $this->fileman);
$configdata->format = FORMAT_HTML;
return base64_encode(serialize($configdata));
+2 -1
View File
@@ -83,7 +83,8 @@ class content extends \core_search\base_block {
$context = \context::instance_by_id($document->get('contextid'));
$files = $fs->get_area_files($context->id, 'block_html', 'content');
$files = $fs->get_area_files($context->id, 'block_html', 'content',
false, 'itemid, filepath, filename', false);
foreach ($files as $file) {
$document->add_stored_file($file);
}
+2 -4
View File
@@ -137,11 +137,9 @@ class search_content_test extends \advanced_testcase {
$this->assertCount(0, $doc->get_files());
$area->attach_files($doc);
$files = $doc->get_files();
$this->assertCount(2, $files);
// The directory entry should NOT be provided for indexing.
$this->assertCount(1, $files);
foreach ($files as $file) {
if ($file->is_directory()) {
continue;
}
$this->assertEquals('file.txt', $file->get_filename());
$this->assertEquals('File content', $file->get_content());
}
+7 -5
View File
@@ -358,17 +358,19 @@ class cachestore_file extends cache_store implements cache_is_key_aware, cache_i
if (!$handle = fopen($file, 'rb')) {
return false;
}
// Lock it up!
// We don't care if this succeeds or not, on some systems it will, on some it won't, meah either way.
flock($handle, LOCK_SH);
// Note: There is no need to perform any file locking here.
// The cache file is only ever written to in the `write_file` function, where it does so by writing to a temp
// file and performing an atomic rename of that file. The target file is never locked, so there is no benefit to
// obtaining a lock (shared or exclusive) here.
$data = '';
// Read the data in 1Mb chunks. Small caches will not loop more than once. We don't use filesize as it may
// be cached with a different value than what we need to read from the file.
do {
$data .= fread($handle, 1048576);
} while (!feof($handle));
// Unlock it.
flock($handle, LOCK_UN);
// Return it unserialised.
return $this->prep_data_after_read($data);
}
+7 -2
View File
@@ -180,8 +180,13 @@ class container {
$course = new \stdClass();
$course->id = $dbrow->courseid;
$completion = new \completion_info($course);
return (bool) !$completion->is_enabled($cm);
if ($completion->is_enabled($cm)) {
// Check if the event is completed, then in this case we do not need to complete it.
// Make sure we're using a cm_info object.
$completiondata = $completion->get_data($cm);
return intval($completiondata->completionstate) === COMPLETION_COMPLETE;
}
return true;
}
return false;
+13 -13
View File
@@ -118,16 +118,16 @@ class event implements event_interface {
* @param int $id The event's ID in the database.
* @param string $name The event's name.
* @param description_interface $description The event's description.
* @param proxy_interface $category The category associated with the event.
* @param proxy_interface $course The course associated with the event.
* @param proxy_interface $group The group associated with the event.
* @param proxy_interface $user The user associated with the event.
* @param event_collection_interface $repeats Collection of repeat events.
* @param proxy_interface $coursemodule The course module that created the event.
* @param proxy_interface|null $category The category associated with the event.
* @param proxy_interface|null $course The course associated with the event.
* @param proxy_interface|null $group The group associated with the event.
* @param proxy_interface|null $user The user associated with the event.
* @param event_collection_interface|null $repeats Collection of repeat events.
* @param proxy_interface|null $coursemodule The course module that created the event.
* @param string $type The event's type.
* @param times_interface $times The times associated with the event.
* @param bool $visible The event's visibility. True for visible, false for invisible.
* @param proxy_interface $subscription The event's subscription.
* @param proxy_interface|null $subscription The event's subscription.
* @param string $location The event's location.
* @param string $component The event's component.
*/
@@ -135,12 +135,12 @@ class event implements event_interface {
$id,
$name,
description_interface $description,
proxy_interface $category = null,
proxy_interface $course = null,
proxy_interface $group = null,
proxy_interface $user = null,
event_collection_interface $repeats = null,
proxy_interface $coursemodule = null,
?proxy_interface $category,
?proxy_interface $course,
?proxy_interface $group,
?proxy_interface $user,
?event_collection_interface $repeats,
?proxy_interface $coursemodule,
$type,
times_interface $times,
$visible,
+2
View File
@@ -5,6 +5,8 @@ require_once('../config.php');
require_once($CFG->dirroot.'/calendar/lib.php');
require_once($CFG->libdir.'/bennu/bennu.inc.php');
raise_memory_limit(MEMORY_HUGE);
$userid = optional_param('userid', 0, PARAM_INT);
$username = optional_param('username', '', PARAM_TEXT);
$authtoken = required_param('authtoken', PARAM_ALPHANUM);
+4 -4
View File
@@ -63,13 +63,13 @@
<div class="commands float-sm-right">
{{#canedit}}
{{#candelete}}
<a href="{{deleteurl}}" data-action="delete">
{{#pix}}t/delete, core, {{#str}}delete{{/str}}{{/pix}}
<a href="{{deleteurl}}" data-action="delete" aria-label="{{#str}}delete{{/str}}" title="{{#str}}delete{{/str}}">
{{#pix}}t/delete, core{{/pix}}
</a>
{{/candelete}}
{{^isactionevent}}
<a href="{{editurl}}" data-action="edit">
{{#pix}}t/edit, core, {{#str}}edit{{/str}}{{/pix}}
<a href="{{editurl}}" data-action="edit" aria-label="{{#str}}edit{{/str}}" title="{{#str}}edit{{/str}}">
{{#pix}}t/edit, core{{/pix}}
</a>
{{/isactionevent}}
{{/canedit}}
+26 -3
View File
@@ -136,16 +136,39 @@ class behat_calendar extends behat_base {
}
/**
* Navigate to a specific date in the calendar.
* Navigate to a specific month in the calendar.
*
* @Given /^I view the calendar for "(?P<month>\d+)" "(?P<year>\d+)"$/
* @param int $month the month selected as a number
* @param int $year the four digit year
*/
public function i_view_the_calendar_for($month, $year) {
$time = make_timestamp($year, $month, 1);
$this->execute('behat_general::i_visit', ['/calendar/view.php?view=month&course=1&time='.$time]);
$this->view_the_calendar('month', 1, $month, $year);
}
/**
* Navigate to a specific date in the calendar.
*
* @Given /^I view the calendar for "(?P<day>\d+)" "(?P<month>\d+)" "(?P<year>\d+)"$/
* @param int $day the day selected as a number
* @param int $month the month selected as a number
* @param int $year the four digit year
*/
public function i_view_the_calendar_day_view(int $day, int $month, int $year) {
$this->view_the_calendar('day', $day, $month, $year);
}
/**
* View the correct calendar view with specific day
*
* @param string $type type of calendar view: month or day
* @param int $day the day selected as a number
* @param int $month the month selected as a number
* @param int $year the four digit year
*/
private function view_the_calendar(string $type, int $day, int $month, int $year) {
$time = make_timestamp($year, $month, $day);
$this->execute('behat_general::i_visit', ['/calendar/view.php?view=' . $type . '&course=1&time=' . $time]);
}
/**
@@ -74,3 +74,19 @@ Feature: Import and edit calendar events
And I upload "calendar/tests/fixtures/import.ics" file to "Calendar file (.ics)" filemanager
And I press "Add"
And I should see "Site events"
Scenario: Import iCalendar file with parameter.
Given I log in as "admin"
And I view the calendar for "7" "2022"
And I press "Manage subscriptions"
And I set the following fields to these values:
| Calendar name | Test Import |
| Import from | Calendar file (.ics) |
| Type of event | User |
And I upload "calendar/tests/fixtures/import_with_parameters.ics" file to "Calendar file (.ics)" filemanager
And I press "Add"
When I view the calendar for "1" "7" "2022"
Then I should see "First event"
And I should see "Description of the first event"
And I should see "Second event"
And I should see "Description of the second event"
+36
View File
@@ -23,6 +23,7 @@ use core_calendar\local\event\factories\event_factory;
use core_calendar\local\event\factories\event_factory_interface;
use core_calendar\local\event\mappers\event_mapper;
use core_calendar\local\event\mappers\event_mapper_interface;
use core_completion\api;
defined('MOODLE_INTERNAL') || die();
@@ -366,6 +367,41 @@ class container_test extends \advanced_testcase {
$this->assertNull($factory->create_instance($event));
}
/**
* Checks that completed activities events do not show.
* @covers \core_calendar\local\event::init
*/
public function test_event_factory_with_completed_module_related_event() {
global $CFG, $DB;
$this->setAdminUser();
// Create a course.
$course = $this->getDataGenerator()->create_course(['enablecompletion' => 1]);
$user = $this->getDataGenerator()->create_and_enrol($course);
// Create an assign activity with a time set.
$time = time();
$assign = $this->getDataGenerator()->create_module(
'assign', ['course' => $course->id, 'completion' => COMPLETION_TRACKING_MANUAL]);
// Create the event but set it to tomorrow.
$CFG->enablecompletion = true;
api::update_completion_date_event($assign->cmid, 'assign', $assign,
$time + DAYSECS);
$this->setUser($user);
// Check that we get should be completed event.
$this->assertCount(1, \core_calendar\local\event\container::get_event_vault()->get_events());
// Then Complete the activity.
$completion = new \completion_info($course);
$cmassign = get_coursemodule_from_id('assign', $assign->cmid);
// This should trigger another call to the update_completion_date_event.
$completion->update_state($cmassign, COMPLETION_COMPLETE, $user->id);
// Check that we do not see the event anymore.
$this->assertCount(0, \core_calendar\local\event\container::get_event_vault()->get_events());
}
/**
* Test that the event factory only returns an event if the logged in user
* is enrolled in the course.
+27
View File
@@ -0,0 +1,27 @@
BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//Huong Nguyen/NONSGML Moodle//EN
VERSION:2.0
BEGIN:VEVENT
UID:special_import_moodle_1
SUMMARY:First event
DESCRIPTION:Description of the first event\n
CLASS:PUBLIC
LAST-MODIFIED:20220728T034015Z
LOCATION:Vietnam
DTSTAMP:20220728T034031Z
DTSTART:20220701T070000Z
DTEND:20220701T070000Z
END:VEVENT
BEGIN:VEVENT
UID:special_import_moodle_2
SUMMARY:Second event
DESCRIPTION;ALTREP="http://moodle.com/":Description of the second event\n
CLASS:PUBLIC
LAST-MODIFIED:20220728T034021Z
LOCATION:Vietnam
DTSTAMP:20220728T034031Z
DTSTART:20220701T080000Z
DTEND:20220701T080000Z
END:VEVENT
END:VCALENDAR
+5 -5
View File
@@ -12,13 +12,13 @@
],
"require-dev": {
"phpunit/phpunit": "9.5.*",
"mikey179/vfsstream": "^1.6",
"behat/mink": "~1.8",
"mikey179/vfsstream": "1.6.*",
"behat/mink": "^1.10.0",
"friends-of-behat/mink-extension": "dev-master",
"behat/mink-goutte-driver": "~1.2",
"behat/mink-goutte-driver": "^1.3",
"symfony/process": "^4.0 || ^5.0",
"behat/behat": "3.10.*",
"oleg-andreyev/mink-phpwebdriver": "^1.0"
"behat/behat": "3.11.*",
"oleg-andreyev/mink-phpwebdriver": "^1.0.1"
},
"autoload-dev": {
"psr-0": {
Generated
+413 -657
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -409,6 +409,9 @@ $CFG->admin = 'admin';
// Print to footer (works with the default theme)
// define('MDL_PERFTOFOOT', true);
//
// Print additional data to log of included files
// define('MDL_PERFINC', true);
//
// Enable earlier profiling that causes more code to be covered
// on every request (db connections, config load, other inits...).
// Requires extra configuration to be defined in config.php like:
+2 -2
View File
@@ -58,9 +58,9 @@ class bankcontent implements renderable, templatable {
*
* @param \core_contentbank\content[] $contents Array of content bank contents.
* @param array $toolbar List of content bank toolbar options.
* @param \context $context Optional context to check (default null)
* @param \context|null $context Optional context to check (default null)
*/
public function __construct(array $contents, array $toolbar, \context $context = null) {
public function __construct(array $contents, array $toolbar, ?\context $context) {
$this->contents = $contents;
$this->toolbar = $toolbar;
$this->context = $context;
+1 -1
View File
@@ -5,6 +5,6 @@ define("core_course/repository",["exports","core/ajax"],(function(_exports,_ajax
* @module core_course/repository
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_ajax=(obj=_ajax)&&obj.__esModule?obj:{default:obj};var _default={getEnrolledCoursesByTimelineClassification:function(classification,limit,offset,sort){var args={classification:classification};void 0!==limit&&(args.limit=limit),void 0!==offset&&(args.offset=offset),void 0!==sort&&(args.sort=sort);var request={methodname:"core_course_get_enrolled_courses_by_timeline_classification",args:args};return _ajax.default.call([request])[0]},getLastAccessedCourses:function(userid,limit,offset,sort){var args={};void 0!==userid&&(args.userid=userid),void 0!==limit&&(args.limit=limit),void 0!==offset&&(args.offset=offset),void 0!==sort&&(args.sort=sort);var request={methodname:"core_course_get_recent_courses",args:args};return _ajax.default.call([request])[0]},getUsersFromCourseModuleID:function(cmid,groupID){var request={methodname:"core_course_get_enrolled_users_by_cmid",args:{cmid:cmid,groupid:groupID}};return _ajax.default.call([request])[0]},toggleManualCompletion:function(cmid,completed){var request={methodname:"core_completion_update_activity_completion_status_manually",args:{cmid:cmid,completed:completed}};return _ajax.default.call([request])[0]}};return _exports.default=_default,_exports.default}));
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_ajax=(obj=_ajax)&&obj.__esModule?obj:{default:obj};var _default={getEnrolledCoursesByTimelineClassification:function(classification,limit,offset,sort){var args={classification:classification};void 0!==limit&&(args.limit=limit),void 0!==offset&&(args.offset=offset),void 0!==sort&&(args.sort=sort);var request={methodname:"core_course_get_enrolled_courses_by_timeline_classification",args:args};return _ajax.default.call([request])[0]},getLastAccessedCourses:function(userid,limit,offset,sort){var args={};void 0!==userid&&(args.userid=userid),void 0!==limit&&(args.limit=limit),void 0!==offset&&(args.offset=offset),void 0!==sort&&(args.sort=sort);var request={methodname:"core_course_get_recent_courses",args:args};return _ajax.default.call([request])[0]},getUsersFromCourseModuleID:function(cmid,groupID){var onlyActive=arguments.length>2&&void 0!==arguments[2]&&arguments[2],request={methodname:"core_course_get_enrolled_users_by_cmid",args:{cmid:cmid,groupid:groupID,onlyactive:onlyActive}};return _ajax.default.call([request])[0]},toggleManualCompletion:function(cmid,completed){var request={methodname:"core_completion_update_activity_completion_status_manually",args:{cmid:cmid,completed:completed}};return _ajax.default.call([request])[0]}};return _exports.default=_default,_exports.default}));
//# sourceMappingURL=repository.min.js.map
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -100,14 +100,16 @@ const getLastAccessedCourses = (userid, limit, offset, sort) => {
*
* @param {Number} cmid Course Module from which the users will be obtained
* @param {Number} groupID Group ID from which the users will be obtained
* @param {Boolean} onlyActive Whether to fetch only the active enrolled users or all enrolled users in the course.
* @returns {Promise} Promise containing a list of users
*/
const getEnrolledUsersFromCourseModuleID = (cmid, groupID) => {
const getEnrolledUsersFromCourseModuleID = (cmid, groupID, onlyActive = false) => {
var request = {
methodname: 'core_course_get_enrolled_users_by_cmid',
args: {
cmid: cmid,
groupid: groupID,
onlyactive: onlyActive,
},
};
+7 -6
View File
@@ -4103,6 +4103,8 @@ class core_course_external extends external_api {
return new external_function_parameters([
'cmid' => new external_value(PARAM_INT, 'id of the course module', VALUE_REQUIRED),
'groupid' => new external_value(PARAM_INT, 'id of the group', VALUE_DEFAULT, 0),
'onlyactive' => new external_value(PARAM_BOOL, 'whether to return only active users or all.',
VALUE_DEFAULT, false),
]);
}
@@ -4111,26 +4113,25 @@ class core_course_external extends external_api {
*
* @param int $cmid Course Module id from which the users will be obtained
* @param int $groupid Group id from which the users will be obtained
* @param bool $onlyactive Whether to return only the active enrolled users or all enrolled users in the course.
* @return array List of users
* @throws invalid_parameter_exception
*/
public static function get_enrolled_users_by_cmid(int $cmid, int $groupid = 0) {
public static function get_enrolled_users_by_cmid(int $cmid, int $groupid = 0, bool $onlyactive = false) {
global $PAGE;
$warnings = [];
[
'cmid' => $cmid,
'groupid' => $groupid,
] = self::validate_parameters(self::get_enrolled_users_by_cmid_parameters(), [
self::validate_parameters(self::get_enrolled_users_by_cmid_parameters(), [
'cmid' => $cmid,
'groupid' => $groupid,
'onlyactive' => $onlyactive,
]);
list($course, $cm) = get_course_and_cm_from_cmid($cmid);
$coursecontext = context_course::instance($course->id);
self::validate_context($coursecontext);
$enrolledusers = get_enrolled_users($coursecontext, '', $groupid);
$enrolledusers = get_enrolled_users($coursecontext, '', $groupid, 'u.*', null, 0, 0, $onlyactive);
$users = array_map(function ($user) use ($PAGE) {
$user->fullname = fullname($user);
+6 -3
View File
@@ -212,6 +212,7 @@ abstract class moodleform_mod extends moodleform {
$this->_features->showdescription = plugin_supports('mod', $this->_modname, FEATURE_SHOW_DESCRIPTION, false);
$this->_features->gradecat = ($this->_features->outcomes or $this->_features->hasgrades);
$this->_features->advancedgrading = plugin_supports('mod', $this->_modname, FEATURE_ADVANCED_GRADING, false);
$this->_features->hasnoview = plugin_supports('mod', $this->_modname, FEATURE_NO_VIEW_LINK, false);
$this->_features->canrescale = (component_callback_exists('mod_' . $this->_modname, 'rescale_activity_grades') !== false);
}
@@ -386,11 +387,10 @@ abstract class moodleform_mod extends moodleform {
// form verification
function validation($data, $files) {
global $COURSE, $DB, $CFG;
$errors = parent::validation($data, $files);
$mform =& $this->_form;
$errors = array();
$errors = parent::validation($data, $files);
if ($mform->elementExists('name')) {
$name = trim($data['name']);
@@ -574,7 +574,10 @@ abstract class moodleform_mod extends moodleform {
$mform->addElement('header', 'modstandardelshdr', get_string('modstandardels', 'form'));
$section = get_fast_modinfo($COURSE)->get_section_info($this->_section);
$allowstealth = !empty($CFG->allowstealth) && $this->courseformat->allow_stealth_module_visibility($this->_cm, $section);
$allowstealth =
!empty($CFG->allowstealth) &&
$this->courseformat->allow_stealth_module_visibility($this->_cm, $section) &&
!$this->_features->hasnoview;
if ($allowstealth && $section->visible) {
$modvisiblelabel = 'modvisiblewithstealth';
} else if ($section->visible) {
@@ -14,13 +14,10 @@ Feature: View subfolders in a course in-line
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Folder" to section "3" and I fill the form with:
| Name | Test folder |
| Display folder contents | On a separate page |
| Show subfolders expanded | |
And I am on the "Test folder" "folder activity" page
And the following "activities" exist:
| activity | course | name | display | showexpanded |
| folder | C1 | Test folder | 0 | 0 |
And I am on the "Test folder" "folder activity" page logged in as "teacher1"
And I press "Edit"
And I press "Create folder"
And I set the field "New folder name" to "Test subfolder 1"
+38
View File
@@ -3500,6 +3500,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$user1 = self::getDataGenerator()->create_user();
$user2 = self::getDataGenerator()->create_user();
$user3 = self::getDataGenerator()->create_user();
$user1picture = new user_picture($user1);
$user1picture->size = 1;
@@ -3509,6 +3510,10 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$user2picture->size = 1;
$user2->profileimage = $user2picture->get_url($PAGE)->out(false);
$user3picture = new user_picture($user3);
$user3picture->size = 1;
$user3->profileimage = $user3picture->get_url($PAGE)->out(false);
// Set the first created user to the test user.
self::setUser($user1);
@@ -3523,6 +3528,8 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
// Following lines enrol and assign default role id to the users.
$this->getDataGenerator()->enrol_user($user1->id, $course1->id);
$this->getDataGenerator()->enrol_user($user2->id, $course1->id);
// Enrol a suspended user in the course.
$this->getDataGenerator()->enrol_user($user3->id, $course1->id, null, 'manual', 0, 0, ENROL_USER_SUSPENDED);
// Create what we expect to be returned when querying the course module.
$expectedusers = array(
@@ -3544,11 +3551,42 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
'lastname' => $user2->lastname,
'profileimage' => $user2->profileimage,
];
$expectedusers['users'][2] = [
'id' => $user3->id,
'fullname' => fullname($user3),
'firstname' => $user3->firstname,
'lastname' => $user3->lastname,
'profileimage' => $user3->profileimage,
];
// Test getting the users in a given context.
$users = core_course_external::get_enrolled_users_by_cmid($forum1->cmid);
$users = external_api::clean_returnvalue(core_course_external::get_enrolled_users_by_cmid_returns(), $users);
$this->assertEquals(3, count($users['users']));
$this->assertEquals($expectedusers, $users);
// Test getting only the active users in a given context.
$users = core_course_external::get_enrolled_users_by_cmid($forum1->cmid, 0, true);
$users = external_api::clean_returnvalue(core_course_external::get_enrolled_users_by_cmid_returns(), $users);
$expectedusers['users'] = [
[
'id' => $user1->id,
'fullname' => fullname($user1),
'firstname' => $user1->firstname,
'lastname' => $user1->lastname,
'profileimage' => $user1->profileimage,
],
[
'id' => $user2->id,
'fullname' => fullname($user2),
'firstname' => $user2->firstname,
'lastname' => $user2->lastname,
'profileimage' => $user2->profileimage,
]
];
$this->assertEquals(2, count($users['users']));
$this->assertEquals($expectedusers, $users);
}
+1 -2
View File
@@ -33,7 +33,6 @@ use core_privacy\local\request\approved_contextlist;
use core_privacy\local\request\contextlist;
use core_privacy\local\request\writer;
use core_privacy\manager;
use Horde\Socket\Client\Exception;
/**
* Class provider
@@ -196,7 +195,7 @@ class provider implements
$field = array_key_exists($record->fieldid, $fields) ? $fields[$record->fieldid] : null;
$data = data_controller::create(0, $record, $field);
self::export_customfield_data($data, array_merge($subcontext, [$record->id]));
} catch (Exception $e) {
} catch (\Exception $e) {
// We store some data that we can not initialise controller for. We still need to export it.
self::export_customfield_data_unknown($record, $field, array_merge($subcontext, [$record->id]));
}
@@ -1,4 +1,5 @@
@customfield @customfield_textarea @javascript @_file_upload
# This feature has Atto-specific steps. See MDL-75913 for further details.
@customfield @customfield_textarea @javascript @_file_upload @editor_atto
Feature: Default value for the textarea custom field can contain images
In order to see images on custom fields
As a manager
@@ -1,4 +1,5 @@
@core @core_course @core_customfield @javascript
# This feature has Atto-specific steps. See MDL-75913 for further details.
@core @core_course @core_customfield @javascript @editor_atto
Feature: Teachers can edit course custom fields
In order to have additional data on the course
As a teacher
+4 -1
View File
@@ -344,6 +344,9 @@ class tool_provider extends ToolProvider {
if ($userlog->serviceurl != $serviceurl) {
$userlog->serviceurl = $serviceurl;
}
if (empty($userlog->consumersecret)) {
$userlog->consumersecret = $this->consumer->secret;
}
$userlog->lastaccess = time();
$DB->update_record('enrol_lti_users', $userlog);
} else {
@@ -354,7 +357,7 @@ class tool_provider extends ToolProvider {
$userlog->serviceurl = $serviceurl;
$userlog->sourceid = $sourceid;
$userlog->consumerkey = $this->consumer->getKey();
$userlog->consumersecret = $tool->secret;
$userlog->consumersecret = $this->consumer->secret;
$userlog->lastgrade = 0;
$userlog->lastaccess = time();
$userlog->timecreated = time();
+42
View File
@@ -69,5 +69,47 @@ function xmldb_enrol_lti_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2021051701, 'enrol', 'lti');
}
if ($oldversion < 2021051702) {
// Update lti user information for LTI 2.0 users having the wrong consumer secret recorded.
// This applies to any LTI 2.0 user who has launched the tool (i.e. has lastaccess) and fixes a non-functional grade sync
// for LTI 2.0 consumers.
$sql = "SELECT lu.id, lc.secret
FROM {enrol_lti_users} lu
JOIN {enrol_lti_lti2_consumer} lc
ON (lu.consumerkey = lc.consumerkey256)
WHERE lc.ltiversion = :ltiversion
AND lu.consumersecret != lc.secret
AND lu.lastaccess IS NOT NULL";
$affectedltiusersrs = $DB->get_recordset_sql($sql, ['ltiversion' => 'LTI-2p0']);
foreach ($affectedltiusersrs as $ltiuser) {
$DB->set_field('enrol_lti_users', 'consumersecret', $ltiuser->secret, ['id' => $ltiuser->id]);
}
$affectedltiusersrs->close();
// Lti savepoint reached.
upgrade_plugin_savepoint(true, 2021051702, 'enrol', 'lti');
}
if ($oldversion < 2021051703) {
// Update lti user information for any users missing a consumer secret.
// This applies to any user who has launched the tool (i.e. has lastaccess) but who doesn't have a secret recorded.
// This fixes a bug where enrol_lti_users records are created first during a member sync, and are missing the secret,
// even despite having launched the tool subsequently.
$sql = "SELECT lu.id, lc.secret
FROM {enrol_lti_users} lu
JOIN {enrol_lti_lti2_consumer} lc
ON (lu.consumerkey = lc.consumerkey256)
WHERE lu.consumersecret IS NULL
AND lu.lastaccess IS NOT NULL";
$affectedltiusersrs = $DB->get_recordset_sql($sql);
foreach ($affectedltiusersrs as $ltiuser) {
$DB->set_field('enrol_lti_users', 'consumersecret', $ltiuser->secret, ['id' => $ltiuser->id]);
}
$affectedltiusersrs->close();
// Lti savepoint reached.
upgrade_plugin_savepoint(true, 2021051703, 'enrol', 'lti');
}
return true;
}
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2021051701; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2021051703; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2021051100; // Requires this Moodle version.
$plugin->component = 'enrol_lti'; // Full name of the plugin (used for diagnostics).
@@ -26,6 +26,7 @@ namespace core_files\local\archive_writer;
use ZipStream\Option\Archive;
use ZipStream\ZipStream;
use ZipStream\Option\File as FileOptions;
use core_files\archive_writer;
use core_files\local\archive_writer\file_writer_interface as file_writer_interface;
use core_files\local\archive_writer\stream_writer_interface as stream_writer_interface;
@@ -110,8 +111,12 @@ class zip_writer extends archive_writer implements file_writer_interface, stream
}
public function add_file_from_stored_file(string $name, \stored_file $file): void {
$datetime = new \DateTime();
$datetime->setTimestamp($file->get_timemodified());
$fileoptions = new FileOptions();
$fileoptions->setTime($datetime);
$filehandle = $file->get_content_file_handle();
$this->archive->addFileFromStream($this->sanitise_filepath($name), $filehandle);
$this->archive->addFileFromStream($this->sanitise_filepath($name), $filehandle, $fileoptions);
fclose($filehandle);
}
+5 -10
View File
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_files\local\archive_writer/zip_archive.
*
* @package core_files
* @category test
* @copyright 2020 Mark Nelson <mdjnelson@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
namespace core_files;
use advanced_testcase;
@@ -31,7 +22,11 @@ use core_files\local\archive_writer\zip_writer;
/**
* Unit tests for \core_files\archive_writer.
*
* @coversDefaultClass \core_files\archive_writer
* @package core_files
* @category test
* @copyright 2020 Mark Nelson <mdjnelson@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @covers \core_files\archive_writer
*/
class archive_writer_test extends advanced_testcase {
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for \core_files\local\archive_writer\zip_writer.
*
* @package core_files
* @category test
* @copyright 2020 Mark Nelson <mdjnelson@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
namespace core_files\local\archive_writer;
use advanced_testcase;
@@ -33,7 +24,11 @@ use ZipArchive;
/**
* Unit tests for \core_files\local\archive_writer\zip_writer.
*
* @coversDefaultClass \core_files\local\archive_writer\zip_writer
* @package core_files
* @category test
* @copyright 2020 Mark Nelson <mdjnelson@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @covers \core_files\local\archive_writer\zip_writer
*/
class zip_writer_test extends advanced_testcase {
@@ -49,7 +49,8 @@ Feature: Render H5P content using filters
And I wait until the page is ready
Then ".h5p-iframe" "css_element" should not exist
@javascript
# This scenario has Atto-specific steps. See MDL-75913 for further details.
@javascript @editor_atto
Scenario: Render a local H5P file as admin
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
@@ -83,7 +84,8 @@ Feature: Render H5P content using filters
And I should not see "you don't have access"
And I should see "Lorum ipsum"
@javascript
# This scenario has Atto-specific steps. See MDL-75913 for further details.
@javascript @editor_atto
Scenario: Render a local H5P file as teacher
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
@@ -107,7 +109,8 @@ Feature: Render H5P content using filters
Then I should see "Note that the libraries may exist in the file you uploaded, but you're not allowed to upload new libraries."
And I should see "missing-required-library"
@javascript
# This scenario has Atto-specific steps. See MDL-75913 for further details.
@javascript @editor_atto
Scenario: Render a local H5P file with existing libraries
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
@@ -165,7 +168,8 @@ Feature: Render H5P content using filters
Then I should not see "missing-required-library"
And I should see "Lorum ipsum"
@javascript
# This scenario has Atto-specific steps. See MDL-75913 for further details.
@javascript @editor_atto
Scenario: Render local H5P file with a disabled main library
Given I log in as "admin"
# Upload H5P file to private files.
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package gradingform_guide
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace gradingform_guide\grades\grader\gradingpanel\external;
@@ -42,7 +33,7 @@ use moodle_exception;
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_guide_external_fetch_test extends advanced_testcase {
class fetch_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package gradingform_guide
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace gradingform_guide\grades\grader\gradingpanel\external;
@@ -42,7 +33,7 @@ use moodle_exception;
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_guide_external_store_test extends advanced_testcase {
class store_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package gradingform_rubric
* @category test
* @copyright 2019 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace gradingform_rubric\grades\grader\gradingpanel\external;
@@ -43,7 +34,7 @@ use moodle_exception;
* @copyright 2019 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_rubric_external_fetch_test extends advanced_testcase {
class fetch_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package gradingform_rubric
* @category test
* @copyright 2019 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace gradingform_rubric\grades\grader\gradingpanel\external;
@@ -42,7 +33,7 @@ use moodle_exception;
* @copyright 2019 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_rubric_external_store_test extends advanced_testcase {
class store_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
+1 -1
View File
@@ -25,7 +25,7 @@
declare(strict_types = 1);
namespace tests\core_grades {
namespace core_grades {
use advanced_testcase;
use core_grades\component_gradeitems;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package core_grades
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace core_grades\grades\grader\gradingpanel\point\external;
@@ -42,7 +33,7 @@ use moodle_exception;
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_point_external_fetch_test extends advanced_testcase {
class fetch_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package core_grades
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace core_grades\grades\grader\gradingpanel\point\external;
@@ -44,7 +35,7 @@ use grade_item;
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_point_external_store_test extends advanced_testcase {
class store_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package core_grades
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace core_grades\grades\grader\gradingpanel\scale\external;
@@ -42,7 +33,7 @@ use moodle_exception;
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_scale_external_fetch_test extends advanced_testcase {
class fetch_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,15 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit tests for core_grades\component_gradeitems;
*
* @package core_grades
* @category test
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
declare(strict_types = 1);
namespace core_grades\grades\grader\gradingpanel\scale\external;
@@ -44,7 +35,7 @@ use grade_item;
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grades_grader_gradingpanel_scale_external_store_test extends advanced_testcase {
class store_test extends advanced_testcase {
public static function setupBeforeClass(): void {
global $CFG;
@@ -14,16 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Testing the H5P H5PFileStorage interface implementation.
*
* @package core_h5p
* @category test
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_h5p\local\tests;
namespace core_h5p;
use core_h5p\file_storage;
use core_h5p\local\library\autoloader;
@@ -38,11 +29,12 @@ use zip_archive;
* Test class covering the H5PFileStorage interface implementation.
*
* @package core_h5p
* @category test
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @runTestsInSeparateProcesses
*/
class h5p_file_storage_test extends \advanced_testcase {
class file_storage_test extends \advanced_testcase {
/** @var \core_h5p\file_storage H5P file storage instance */
protected $h5p_file_storage;
+1 -1
View File
@@ -30,4 +30,4 @@
defined('MOODLE_INTERNAL') || die();
$string['thisdirection'] = 'ltr';
$string['thislanguage'] = 'Breizh';
$string['thislanguage'] = 'Brezhoneg';
+33
View File
@@ -0,0 +1,33 @@
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/**
* Automatically generated strings for Moodle installer
*
* Do not edit this file manually! It contains just a subset of strings
* needed during the very first steps of installation. This file was
* generated automatically by export-installer.php (which is part of AMOS
* {@link http://docs.moodle.org/dev/Languages/AMOS}) using the
* list of strings defined in /install/stringnames.txt.
*
* @package installer
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['parentlanguage'] = 'es';
$string['thislanguage'] = 'Español - Argentina';

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