Compare commits

...

562 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) 23360fd95b Moodle release 3.2.4 2017-07-08 20:43:34 +02:00
AMOS bot 0ed1c5d259 Automatically generated installer lang files 2017-07-08 00:16:24 +08:00
Jake Dallimore 28f52bc329 weekly release 3.2.3+ 2017-07-07 12:10:16 +08:00
Jake Dallimore 8c18772edc Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-07-07 12:10:14 +08:00
AMOS bot dd819dbb88 Automatically generated installer lang files 2017-07-07 00:06:39 +08:00
Simey Lameze 4c48d88c46 MDL-59456 auth_cas: patch phpCAS auth bypass vulnerability 2017-07-06 09:33:27 +01:00
Jun Pataleta af16b393ea MDL-58651 logstore_database: Set dbhandlesoptions in test page 2017-07-05 23:04:51 +08:00
Dan Poltawski 2dc0dc6293 MDL-57021 passwords: only use unmask field with shared secrets
When a user is entering a password which isn't returned back to them
then its not correct to use the unmask element - this element was
designed for places where we are storing shared secrets.
2017-07-05 12:25:41 +02:00
Eloy Lafuente (stronk7) a3aa1600de Merge branch 'MDL-59398-32-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-07-05 11:52:42 +02:00
Eloy Lafuente (stronk7) fb629ce56a Merge branch 'MDL-59294-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-07-05 09:44:54 +02:00
Eloy Lafuente (stronk7) 33f31a12d4 Merge branch 'MDL-58286-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-07-05 09:40:55 +02:00
Helen Foster 92033f7e9d MDL-59398 lang: Merge English strings from the en_fix language pack 2017-07-05 09:34:14 +02:00
John Okely 8e28bc402b MDL-58286 enrol_ldap: Pass connection to ldap_paged_results_supported
Thanks to Bianco Veigel for the original patch.
2017-07-05 09:50:10 +08:00
Eloy Lafuente (stronk7) 1cee1602be Merge branch 'MDL-58651_32' of git://github.com/aolley/moodle into MOODLE_32_STABLE 2017-07-05 01:23:39 +02:00
Jake Dallimore bea116e2ff Merge branch 'MDL-59380-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-07-04 16:29:36 +08:00
Marina Glancy 106eb4921a MDL-59409 admin: set admin user in unittest 2017-07-04 11:05:24 +08:00
Ankit Agarwal bc1d916868 MDL-56565 forum: Add sitename as heading when there is nothing to display 2017-07-04 10:11:39 +08:00
Ankit Agarwal a053131595 MDL-56565 forum: Make sure userfullname is not disclosed 2017-07-04 10:11:39 +08:00
Jake Dallimore f3b9685ad0 MDL-56565 navigation: fix for cap checks in nav and context header
Fix to:
- Make sure we properly check both user and course contexts in
the load_for_user function in navigation lib and user the
user_can_view_profile function for same-course access checks.
- Use user_can_view_profile in the renderer's context_header to
properly decide whether a user can view another user's picture
and messaging options in the page header.
2017-07-04 10:11:39 +08:00
Jake Dallimore 93e09909ab MDL-56565 navigation: fix user details disclosure in nav tree
Fixes a bug in which a user's full name might be disclosed via the
nav tree. Nav generation now checks the current user's access to the
user before adding the node, else adds a dummy node.
2017-07-04 10:11:39 +08:00
Jake Dallimore f373c08314 MDL-56565 core: fix user details disclosure in page context header
Fixes a bug with context_header function in which user details were
displayed regardless of the current user's capabilities.
2017-07-04 10:11:39 +08:00
Marina Glancy dacac4d10b MDL-59409 admin: check access to every setting in category 2017-07-04 10:03:42 +08:00
Jake Dallimore 35d1b3da7a weekly release 3.2.3+ 2017-06-29 16:23:47 +08:00
Jake Dallimore a52742dea7 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-06-29 16:23:46 +08:00
Jun Pataleta ffd642a654 MDL-59294 block_login: Make display of ID provider buttons consistent 2017-06-29 09:36:56 +08:00
Mark Nelson dbbbf02dc0 MDL-56046 mod_quiz: do not close the sheet twice 2017-06-28 14:15:36 +08:00
Jun Pataleta e29ea1b2c9 MDL-59294 theme_bootstrapbase: Fix display of ID provider buttons 2017-06-28 13:39:02 +08:00
Jake Dallimore 74accbdd85 Merge branch 'wip-MDL-59308-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-06-28 13:10:16 +08:00
Adam Olley eea5900c13 MDL-58651 logstore_database: Add ability to not send database options
In the core dml:
PostgreSQL connections now use advanced options to reduce connection overhead.
These options are not compatible with some connection poolers. The
dbhandlesoptions parameter has been added to allow the database to configure
the required defaults.

This item adds a setting to the logstore_database plugin to let you set the
same flag for your destination database - without it you won't be able to ship
logs to a postgresql database with a pgbouncer frontend.
2017-06-28 13:20:36 +09:30
Marina Glancy 01005ff69a MDL-59308 calendar: pass module context when known
this will protect us from exceptions when context for removed instance can not be retrieved
2017-06-28 11:18:03 +08:00
Eloy Lafuente (stronk7) ee3ba0c3f8 Merge branch 'MDL-57809-32-progressbar' of https://github.com/roperto/moodle into MOODLE_32_STABLE 2017-06-27 20:17:55 +02:00
Eloy Lafuente (stronk7) 5bbc58a7fb Merge branch 'wip-MDL-59136-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-06-27 18:09:50 +02:00
David Monllao c6a447f1b7 Merge branch 'MDL-32151-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-06-27 17:47:47 +02:00
Eloy Lafuente (stronk7) 2584ce25c7 Merge branch 'MDL-59362_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-06-27 17:22:11 +02:00
Danny Jung 2dd87cb37a MDL-59073 Workshop: Prevent submission without content or file 2017-06-27 17:06:02 +02:00
David Monllao 53456587f6 Merge branch 'MDL-59158-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-06-27 16:40:07 +02:00
David Monllao b9874d0c13 Merge branch 'MDL-57927-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-27 15:55:40 +02:00
Eloy Lafuente (stronk7) bf58adf836 Merge branch 'MDL-58844-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-06-27 11:42:22 +02:00
Eloy Lafuente (stronk7) afeb42ed9e Merge branch 'MDL-59296-32' of git://github.com/crazyserver/moodle into MOODLE_32_STABLE 2017-06-27 11:40:10 +02:00
Jake Dallimore 52cabc8f66 Merge branch 'MDL-59312-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-06-27 15:10:41 +08:00
Damyon Wiese 4197baf775 MDL-59380 fragments: Include js from templates
Mustache templates containing {{#js}} blocks are not returned via the
fragments API. This is because the requirements manager is assigned when the renderer is created
and not updated by the call to start collecting page requirements.
2017-06-27 13:35:40 +08:00
Jake Dallimore ba9f218e17 Merge branch 'MDL-56046_32-fix' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-06-27 13:18:50 +08:00
Mark Nelson 32dc9a45d6 MDL-56046 dataformat: minor changes to PHPDocs and upgrade.txt 2017-06-27 11:26:35 +08:00
Andrew Nicols 8c696ccafc MDL-58844 testing: Move to GCE build infrastructure
Switch back to GCE build infrastructure for Travis Builds and move
databases to RAM Disk.

This also adds a software entropy generator (haveged) which is
recommended when using a RAMdisk for the database.
2017-06-27 09:39:20 +08:00
Eloy Lafuente (stronk7) 0bfbdaef20 Merge branch 'MDL-56046_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-06-27 02:43:00 +02:00
Eloy Lafuente (stronk7) 55fc1104d5 Merge branch 'MDL-40818-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-06-27 01:50:48 +02:00
Eloy Lafuente (stronk7) 7032ff37b7 Merge branch 'MDL-59295-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-27 00:54:25 +02:00
Eloy Lafuente (stronk7) 1d0867ae48 Merge branch 'mdl58813-moodle32' of https://github.com/tlock/moodle into MOODLE_32_STABLE 2017-06-26 19:38:51 +02:00
Mark Nelson 4e50a38018 MDL-56046 core: enable multiple sheets for flexible table 2017-06-26 13:55:21 +08:00
Mark Nelson a54703d88f MDL-56046 dataformat: added related information to upgrade.txt 2017-06-26 13:55:21 +08:00
Mark Nelson 4ba0709401 MDL-56046 dataformat_*: convert core plugins 2017-06-26 13:28:02 +08:00
Mark Nelson f72bc10fe3 MDL-56046 core: convert download_as_dataformat to use new API 2017-06-26 13:28:02 +08:00
Mark Nelson b15859b879 MDL-56046 core_dataformat: added functions to support multiple sheets
Also removed write_header() and write_footer(). The reason for this
is because in core we want to know if the format being used supports
multiple sheets. To do this, and ensure we do not break third-party
dataformat plugins, we are using method_exist(). If write_header()
and write_footer() remain in the base class then this will always
be true.
2017-06-26 13:19:09 +08:00
Mark Nelson ed248331a4 MDL-59362 core: ensure we use 'new' when throwing exceptions 2017-06-26 13:10:43 +08:00
Marina Glancy 5b8ca7ac93 MDL-59136 roles: avoid double escaping in role names 2017-06-26 11:57:49 +08:00
Jake Dallimore 0efb93bbe9 Merge branch 'MDL-49484-moodle32' of github.com:jebarviabb/moodle into MOODLE_32_STABLE 2017-06-26 10:52:49 +08:00
Josh Ebarvia f3008f556c MDL-49484 mod_lesson: Fix lesson page headers when editing 2017-06-24 05:23:16 +09:30
AMOS bot aac5a4f103 Merge branch 'MOODLE_32_STABLE' into install_32_STABLE 2017-06-24 00:09:03 +08:00
Pau Ferrer Ocaña e5881ad801 MDL-59296 data: Fix latlong field search 2017-06-23 09:15:31 +02:00
Andrew Nicols c244743775 MDL-59312 js: Improve display of exception stacktrace 2017-06-23 10:50:11 +08:00
John Okely deb442a293 MDL-59312 notification: Normalise backtrace/stacktrace 2017-06-23 10:50:11 +08:00
Andrew Nicols 93a935049e MDL-59312 js: Add exception on AJAX error 2017-06-23 10:50:11 +08:00
Jun Pataleta f2fb8f5a7f MDL-32151 group: Use appropriate error langstring error key 2017-06-23 10:28:13 +08:00
Jun Pataleta 3a5ae742f1 MDL-32151 grade: Use appropriate error langstring error key 2017-06-23 10:28:13 +08:00
Jun Pataleta 017d8f1aec MDL-59158 theme_boost: Remove auto width and height for user picture 2017-06-23 10:13:00 +08:00
Jun Pataleta 95e1ac08fe MDL-40818 calendar: Require login to calendar pages
* Make sure that the course ID being passed points to an existing course
* Require user to login before granting access to calendar pages.
2017-06-23 09:21:05 +08:00
Daniel Thee Roperto ef43566698 MDL-57809 weblib: Added missing NO_OUTPUT_BUFFERING directive. 2017-06-23 09:42:37 +10:00
Daniel Thee Roperto d33f7642dd MDL-57809 weblib: Added opening disclaimer and file-level phpdocs. 2017-06-23 09:42:37 +10:00
Daniel Thee Roperto a9a72025b6 MDL-57809 weblib: Progress bar and output buffer - added debugging
This fix makes Moodle show a debbuging message if using progressbar without defining NO_OUTPUT_BUFFERING.
2017-06-23 09:42:37 +10:00
AMOS bot 222189cc75 Automatically generated installer lang files 2017-06-23 00:08:05 +08:00
Dan Poltawski 62c58d22be weekly release 3.2.3+ 2017-06-22 15:40:47 +01:00
Simey Lameze b962ac2439 MDL-59295 tool_lp: remove useless ng-label attribute 2017-06-22 15:49:46 +08:00
Tim Lock c2f08942d9 MDL-58813 webservice: create_courses() initialise all section records 2017-06-22 11:13:38 +09:30
Eloy Lafuente (stronk7) 9072b59c0e Merge branch 'MDL-59217-32' of git://github.com/ryanwyllie/moodle into MOODLE_32_STABLE 2017-06-20 20:40:45 +02:00
Eloy Lafuente (stronk7) f86bb360b5 Merge branch 'MDL-59269-32-languninstall' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-06-20 17:57:15 +02:00
Mathieu Petit-Clair 90e86c7568 MDL-58952 admin: use valid default for language selection dropdown. 2017-06-20 11:31:55 +01:00
Dan Poltawski f730eb2a81 Merge branch 'MDL-59005-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-20 09:52:46 +01:00
Dan Poltawski 485decb3a2 Merge branch 'MDL-58472-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-06-20 09:36:53 +01:00
Jun Pataleta b95a012124 Merge branch 'MDL-57770-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-20 16:28:31 +08:00
Jake Dallimore f7e3be1bbb Merge branch 'wip-MDL-58729-32' of git://github.com/abgreeve/moodle into MOODLE_32_STABLE 2017-06-20 15:19:13 +08:00
Simey Lameze 5a5efa8bd9 MDL-57927 tool_lp: make both buttons consistent 2017-06-20 08:50:32 +08:00
Dan Poltawski 079c73c98d Merge branch 'MDL-59048_32' of https://github.com/timhunt/moodle into MOODLE_32_STABLE 2017-06-19 15:43:19 +01:00
Dan Poltawski 3fb4b3a9ed Merge branch 'MDL-59173-32' of git://github.com/tobiasreischmann/moodle into MOODLE_32_STABLE 2017-06-19 12:27:45 +01:00
Dan Poltawski c7d6a0e356 Merge branch 'wip-MDL-51917-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-06-19 12:21:50 +01:00
Dan Poltawski 8b57dd0768 Merge branch 'MDL-46418-32-hiddenrepos' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-06-19 10:33:34 +01:00
Jun Pataleta 97d966df08 Merge branch 'MDL-44961-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-06-19 16:25:18 +08:00
Jun Pataleta fe67ec46da Merge branch 'MDL-58310-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-06-19 13:26:46 +08:00
John Okely 285e7e5eb3 MDL-58310 ajax: suppress errors upon page unload 2017-06-19 11:45:45 +08:00
John Okely 53e3825619 MDL-58310 message: No longer need to supress errors from messaging 2017-06-19 11:45:45 +08:00
Vladimir Zhirov 90156e427c MDL-59005 resource: fixed zip extraction for filenames in CP-1251/CP-866 2017-06-19 08:51:19 +08:00
David Mudrák 5074849703 MDL-59269 lang: Fix ability to uninstall certain language packs
In the issue MDL-39319 (6ddf92c77), the ability to uninstall multiple
language packs at once was added. By a mistake, the PARAM_ALPHAEXT was
used as paramater type for the dash-separated list of language packs to
be uninstalled. Language packs with a number in the name (such as
en_us_k12) do not pass the ALPHAEXT cleaning.

This patch changes the parameter cleaning to PARAM_SAFEPATH which is
more appropriate for the given scenario as language code themselves must
be SAFEDIRs.
2017-06-16 14:15:31 +02:00
Tobias Reischmann c5a8568799 MDL-59173 tablelib.php: changed default of $params in set_sql to array()
Default of $params = null leads to a problem in query_db().
There this value is used in array_merge, which can not handle null
values. If null is passed for one of the params the outcome will be null
independent of the value of the second param!
2017-06-16 10:27:21 +02:00
Jake Dallimore ab7056032d weekly release 3.2.3+ 2017-06-16 13:29:36 +08:00
David Mudrák 0d063c69ac MDL-46418 repositories: Fix how enabled repositories are populated
Repository instances are stored in the 'repository' table. Repositories
in the table are either 'Enabled and visible' or 'Enabled but hidden'.
Hidden repositories still serve their files, but are not visible in the
filepicker UI. Disabling a repository instance removes its record from
the table.

In the original implementation of the plugin manager (see b9934a17), the
method plugintype_repository::get_enabled_repositories() correctly
returned all records from the repository table. Then as a part of the
bigger refactoring in MDL-41437, the commit bde002b8 replaced the
original method with the new get_enabled_plugins() one which started to
return visible repositories only.

As a consequence, the admin tree stopped populating setting page nodes
for hidden repository instances. So attempting to visit their setting
page threw a section error. Credit goes to Ike Quigley for debugging and
tracing this down.

This patch fixes the way how the list of enabled repositories is
populated by the plugin manager so that both visible and hidden
repositories are returned again. This does not affect the filepicker
itself as it is using its own methods for obtaining the list.
2017-06-15 21:22:48 +02:00
Simey Lameze ac6ab5b8d2 MDL-57770 tool_lp: style fixes for the competency rule dialog 2017-06-15 15:39:17 +08:00
Ankit Agarwal 74fbdebd0d MDL-59217 restore: Check for userride only for activity events 2017-06-15 06:02:38 +00:00
Mark Nelson e523626603 MDL-59140 core: apply limit only on courses to be shown in specific nav
There can be a different number of courses displayed in the
'Navigation' block and in the 'Flat' navigation. This patch
decides what courses we want to display on each, then
applies the 'navcourselimit' setting individually.
2017-06-15 13:36:35 +08:00
Ankit Agarwal c33e03ae95 MDL-44961 logs: Keep log dates constant during restore 2017-06-14 15:21:36 +05:30
Jake Dallimore b3f3c3c395 Merge branch 'MDL-59142-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-14 11:40:13 +08:00
Dan Poltawski 072c0b4196 Merge branch 'MDL-59171-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-06-13 14:40:47 +01:00
Dan Poltawski 638aa54cbb Merge branch 'MDL-59140_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-06-13 13:23:39 +01:00
Mark Nelson 8d9e621f2c MDL-59140 core: upgrade 'navcourselimit' if set to old default value 2017-06-13 18:27:04 +08:00
Mark Nelson bb3956eb5c MDL-59140 core: limit the number of courses shown in the navigation
If the user is enrolled in more courses than the limit then a 'More...'
link is displayed which takes the user to the course/index.php page.
2017-06-13 18:27:04 +08:00
Mark Nelson a8fc3a33ab MDL-59140 core: changes to the 'navcourselimit' setting
Changed the default and description.
2017-06-13 18:23:52 +08:00
Eloy Lafuente (stronk7) 2c6f3befeb Merge branch 'wip-MDL-58523-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-06-13 11:21:48 +02:00
Jun Pataleta d11850101e Merge branch 'MDL-58991-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-14 16:56:36 +08:00
Dan Poltawski 531c1ec0be Merge branch 'MDL-41426_32-block-completionstatus-spaces' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-06-13 09:53:56 +01:00
Eloy Lafuente (stronk7) 8ae8ed4aca MDL-46322 database: alias sort fields to avoid ambiguous naming 2017-06-13 09:17:08 +01:00
Jake Dallimore 1faba07075 Merge branch 'MDL-58136-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-06-13 15:55:45 +08:00
Damyon Wiese 587b99609d MDL-58136 course: Remove lines from unit test
Remove unused vars and logic from the unit test for classifying a course.
2017-06-13 15:08:18 +08:00
Marina Glancy c9192ffccb MDL-51917 course completion: order activities in reports
Thanks to Nick Phillips for initial patch
2017-06-13 14:49:24 +08:00
Marina Glancy 4290182491 MDL-58523 mod_feedback: deleting response should reset completion 2017-06-13 14:36:35 +08:00
Jake Dallimore cb1c0ae4dc Merge branch 'MDL-51691-moodle32' of https://github.com/jebarviabb/moodle into MOODLE_32_STABLE 2017-06-13 10:35:37 +08:00
Damyon Wiese ffc7fda945 MDL-58136 navigation: Ensure we have all course fields
To properly classify courses we need the start/end dates etc.
2017-06-13 10:10:22 +08:00
Marcus Green a9ba142326 MDL-58248 theme_boost: label/span for sidepanel expand button
Add string "Side panel" to make the purpose of
trigram/hamburger icon at top left clearer, particularly
when using screen readers e.g. Jaws/NVDA.
Currently it reads out only "expand"
2017-06-13 09:51:07 +08:00
Simey Lameze 59527f3e7a MDL-59142 core_theme: cache post-processed css
Thanks Cameron Ball for the base patch
2017-06-13 09:39:56 +08:00
Damyon Wiese 8122557661 MDL-58472 videojs: Force manual initialise
If we let videojs auto-init the video/audio tags present in the page - we cannot guarantee that the
youtube library will be loaded by the time video.js is processing the tag.

Video.js uses the presence of a data-setup attibute to signal that it should auto-init this tag, so
we have to rename our config attribute to something else.
2017-06-13 09:13:07 +08:00
Eloy Lafuente (stronk7) ae84db35c7 Merge branch 'MDL-40015-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-06-13 01:23:52 +02:00
Eloy Lafuente (stronk7) ab8b6fae1a Merge branch 'mdl58161-moodle32' of https://github.com/tlock/moodle into MOODLE_32_STABLE 2017-06-13 01:22:09 +02:00
Josh Ebarvia b3ca553f3a MDL-51691 assignsubmission_feedback: Fix delete comments 2017-06-13 08:39:08 +09:30
Tim Lock 7e31bb6dc2 MDL-58161 user: tests: user_can_view_profile fails under certain cases 2017-06-13 08:09:14 +09:30
Eloy Lafuente (stronk7) 5e39900691 Merge branch 'MDL-59112-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-06-12 14:39:22 +02:00
Dan Poltawski a4f5cdddcf Merge branch 'mdl46322-moodle32' of https://github.com/AndresMelo/moodle into MOODLE_32_STABLE 2017-06-12 10:29:53 +01:00
Damyon Wiese 4d26fcd737 MDL-58136 cache: Add a course completion cache
The last change added 1 db read per course per page which is not OK. Add a cache to compensate.
2017-06-12 16:11:52 +08:00
Damyon Wiese 11127354db MDL-58136 boost: Limit courses in flatnav
Only show "in-progress" courses in the boost flat navigation (as per the myoverview block).
2017-06-12 16:09:56 +08:00
Adrian Greeve f751b97393 MDL-58729 database: Improve performance of CLI tool.
Imporve the speed with which mysql_collation converts to
a different collation.
2017-06-12 14:15:34 +08:00
Jake Dallimore 9265a5db56 Merge branch 'MDL-57103-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-06-12 13:59:57 +08:00
Jun Pataleta f5942f3e6f Merge branch 'MDL-59154-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-06-12 13:45:33 +08:00
John Okely 3ad8f33235 MDL-57103 lib: Force ajax renderer for all ajax fatal errors 2017-06-12 10:37:37 +08:00
Jun Pataleta abeb033dfb MDL-59171 mod_lti: Set mod_lti_view_lti's type to 'read' 2017-06-12 08:34:52 +08:00
Luca Bösch 98b955d665 MDL-41426 block: Whitespace lacking in completion status block 2017-06-08 19:10:21 +02:00
Dan Poltawski 7624f86fb2 weekly release 3.2.3+ 2017-06-08 12:16:21 +01:00
Dan Poltawski 7f4835a7da Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-06-08 12:16:20 +01:00
Juan Leyva ba76815aaf MDL-40015 core_course: Fix description of duplicate_course WS
It said that the duplication didn’t include user data, but that’s not
true since there is a parameter to include it.
2017-06-08 10:20:46 +01:00
Juan Leyva 70dcc1e39a MDL-59112 theme_clean: Always return expected moodle_url
The function was returned some times a moodle_url object and another
times just a string with a relative URL.
2017-06-08 09:40:47 +01:00
Andrew Nicols 25ffa9a67f MDL-59154 theme: Lock for all caching builds
The previous behaviour was to only lock when in theme designer mode.
As a result, when generating the theme for after a reset, each new
client was starting the generation afresh and no locking was taking
place at all.
2017-06-08 12:05:39 +08:00
Dan Poltawski 99864cdf74 Merge branch 'MDL-59101-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-06-07 16:26:21 +01:00
Jun Pataleta d356128f05 MDL-59101 calendar: Properly calculate expected until date 2017-06-07 23:12:52 +08:00
Dan Poltawski c33c78a33c Merge branch 'MDL-58658_32' of https://github.com/sk-unikent/moodle into MOODLE_32_STABLE 2017-06-06 10:01:44 +01:00
Dan Poltawski 3ec562a322 Merge branch 'MDL-59086_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-06-06 08:44:52 +01:00
Simey Lameze 07e6a3c6c1 MDL-58991 report_stats: use same date handling on chart rendering
This commmit fixes applies the same date handling used on stats
table render to the charts render.
2017-06-06 13:56:04 +08:00
Jun Pataleta 5ec875b281 Merge branch 'MDL-58646-32' of git://github.com/danpoltawski/moodle into MOODLE_32_STABLE 2017-06-06 12:24:46 +08:00
Jake Dallimore a202546fd3 Merge branch 'MDL-58900-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-06-06 11:40:12 +08:00
Eloy Lafuente (stronk7) 589b4c0360 Merge branch 'MDL-58826_32_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_32_STABLE 2017-06-06 01:45:17 +02:00
Dan Poltawski 5f6cf92f97 Merge branch 'MDL-59080_M32' of git://github.com/lazydaisy/moodle into MOODLE_32_STABLE 2017-06-05 12:49:48 +01:00
Mark Johnson 43391de3e2 MDL-58826 theme_boost: Prevent fatal errors in action menu behat steps 2017-06-05 09:04:06 +01:00
AMOS bot fbf621bd29 Automatically generated installer lang files 2017-06-04 00:07:23 +08:00
AMOS bot 5a10b55442 Automatically generated installer lang files 2017-06-04 00:07:23 +08:00
AMOS bot 554167b43a Automatically generated installer lang files 2017-06-03 00:07:58 +08:00
Dan Poltawski c90e9381d2 MDL-58646 lib: import latest sabberworm/PHP-CSS-Parser
This version includes a fix[1] contributed by Frédéric Massart investigating
our compilation time issues, which significantly improves the speed of
processing font awesome.

Thanks, Fred!

[1] https://github.com/sabberworm/PHP-CSS-Parser/pull/120
2017-06-02 11:03:51 +01:00
Mary Evans 8ac3e5ea59 MDL-59080 theme_boost: make drawer.scss variables default
--author="Urs Hunkler <urs.hunkler@unodo.de>"
2017-06-02 07:58:43 +01:00
Dan Poltawski 74554368a0 weekly release 3.2.3+ 2017-06-01 09:28:23 +01:00
Dan Poltawski 6f4d9a89d5 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-06-01 09:28:22 +01:00
Jake Dallimore 7fd70c34a0 Merge branch 'MDL-59094-32' of git://github.com/danpoltawski/moodle into MOODLE_32_STABLE 2017-06-01 15:29:15 +08:00
AMOS bot a31c6bc4b9 Automatically generated installer lang files 2017-06-01 00:12:41 +08:00
Dan Poltawski 6160631e28 Merge branch 'MDL-59093-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-05-31 11:09:27 +01:00
Dan Poltawski c82ad7c6e0 MDL-59094 npm: Update shrinkwrap file to npm 5 generated
Starting with npm version 5, npm install will generate a lockfile
(now named package-lock.json) or update the existing npm-shrinkwrap.json

To prevent changes being generated in the codebase when this happens, we
need to commit the version 5 generated shrinkwrap.

This is related to a general overhaul [1] of how npm manages things. But
for our purposes, we the lockfile should be BC to previous versions [2].

Going forward, we need to ensure we generate the lockfile on npm >=5 to
prevent differences from the previously un-versioned lockfile.

[1] http://blog.npmjs.org/post/161081169345/v500
[2] https://github.com/npm/npm/issues/16728#issuecomment-305104149
2017-05-31 10:13:45 +01:00
Jun Pataleta 087ab1e345 MDL-59093 calendar: Use a fixed start day for forever BYMONTH test 2017-05-31 15:02:15 +08:00
Simey Lameze f7c9dd2158 MDL-58900 mod_assign: fix incorrect overrides ordering 2017-05-31 10:51:01 +08:00
Jake Dallimore 984bcd770c Merge branch 'MDL-54887-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-05-31 08:40:43 +08:00
Eloy Lafuente (stronk7) e84d284e65 Merge branch 'MDL-49988_fix_wiki_preview_32_STABLE' of https://github.com/DMaterka/moodle into MOODLE_32_STABLE 2017-05-31 00:30:45 +02:00
Dan Poltawski 352b9b00d6 Merge branch 'MDL-58997_32-group-names-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-30 16:56:23 +01:00
Luca Bösch 2a7bb7a0f8 MDL-58997 calendar: Group names passing multilang filters. 2017-05-30 16:52:07 +02:00
Dan Poltawski 269e1f027e Merge branch 'MDL-49040-moodle32' of https://github.com/jebarviabb/moodle into MOODLE_32_STABLE 2017-05-30 11:42:35 +01:00
Jun Pataleta 48903d67ea Merge branch 'MDL-57313-32-clibootswatch' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-05-30 16:58:15 +08:00
Jun Pataleta 3bfdb64f43 MDL-54887 calendar: PR fixes
* Use the calendar_event::description property and format it using
format_text() on it in order to apply the appropriate filters.
* Then use html_to_text() on it to strip the tags and convert the
description to plain text while converting <br> and <p> tags to
line breaks.
2017-05-30 16:53:57 +08:00
Soon-Systems a42233487e MDL-54887 calendar: Format summary + description of an event for export 2017-05-30 16:53:57 +08:00
Mark Nelson 07da0155a7 MDL-59086 gradereport_grader: style 'Save changes' button 2017-05-30 13:44:15 +08:00
AMOS bot 1a7cf17ed8 Automatically generated installer lang files 2017-05-28 14:07:41 +08:00
David Mudrák 818bc4c9a7 MDL-57313 boost: Fix the CLI utility import-bootswatch.php 2017-05-26 09:48:28 +02:00
Dan Poltawski 8708ea0968 weekly release 3.2.3+ 2017-05-24 19:14:43 +01:00
Dan Poltawski cdffe52b28 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-05-24 19:14:41 +01:00
Tim Hunt 67970b8675 MDL-59048 user tours: avoid white-on-white text in Clean 2017-05-24 17:25:23 +01:00
AMOS bot d979b4614d Automatically generated installer lang files 2017-05-25 00:04:44 +08:00
Andrew Nicols 85eacc3a31 MDL-58577 stats: Correct groupby when getting report options 2017-05-23 19:46:55 +08:00
Andrew Nicols bfc16e66a5 Merge branch 'MDL-58577_32-statistics-report-header-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-23 19:45:56 +08:00
Luca Bösch 3a8f07f241 MDL-58577 stats: Use multilang with role in header 2017-05-23 11:14:09 +02:00
Jun Pataleta e621a47c48 Merge branch 'MDL-58895-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-05-23 16:54:35 +08:00
Jake Dallimore 4bb9787760 Merge branch 'MDL-58921_32-calculated-question-name-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-23 16:27:06 +08:00
Jun Pataleta 2469a838f1 Merge branch 'MDL-58165-32' of https://github.com/abias/moodle into MOODLE_32_STABLE 2017-05-23 14:47:38 +08:00
Ankit Agarwal c28e5eaee2 MDL-58895 groups: Add bootstrap classes to buttons 2017-05-23 12:05:42 +05:30
Alexander Bias f85f0c80da MDL-58165 navigation: Add node key to private files navigation node 2017-05-23 07:24:11 +02:00
Josh Ebarvia 4643358a5c MDL-49040 gradereport_grader: Fix feedback truncation after & char 2017-05-23 13:04:23 +09:30
AMOS bot 2774649389 Automatically generated installer lang files 2017-05-23 00:05:47 +08:00
Dan Poltawski 18d41005e3 Merge branch 'MDL-58922_32-calculatedmulti-question-name-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-22 10:44:52 +01:00
Luca Bösch a281621189 MDL-58921 questions: Calculated question name passing multilang.
In edit calculated question the question name does pass format_string to process multilang tags.
2017-05-22 11:37:22 +02:00
Luca Bösch ab8fa2ff7a MDL-58922 questions: Calculatedmulti question name passing multilang.
In edit calculatedmulti question the question name does pass format_string to process multilang tags.
2017-05-22 11:32:52 +02:00
David Monllao fb0e1b10fe Merge branch 'MOODLE_32_STABLE-MDL-56973' of https://github.com/fwsl/moodle into MOODLE_32_STABLE 2017-05-22 15:14:19 +08:00
Jake Dallimore 78f7595fd9 Merge branch 'MDL-56617_32-course-cbm-grade-to-pass' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-22 14:33:32 +08:00
David Monllao 338097adce Merge branch 'MDL-58986_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-05-22 12:22:37 +08:00
David Monllao f98e259ddb Merge branch 'MDL-57957_32' of https://github.com/bostelm/moodle into MOODLE_32_STABLE 2017-05-22 10:44:32 +08:00
Luca Bösch 0e106b8332 MDL-56617 mod_quiz: No grade to pass check if CBM used
When certainty-based marking is used, grades can 'exceed' the maximum grade
(because they are multiplied by factors). Therefore, in such cases, don't show
no warning.
2017-05-19 12:43:07 +02:00
Grzegorz Ziółek 25e3a8a14c MDL-56973 wiki: New page title readonly after changing course language 2017-05-19 11:10:41 +02:00
David Monllao 46280f7478 weekly release 3.2.3+ 2017-05-19 13:08:36 +08:00
David Monllao 80bf9ac40a Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-05-19 13:08:34 +08:00
Andres e2b4084bfd MDL-46322 mod_assign: Only list enrolled graders as potential markers 2017-05-18 22:22:45 -05:00
Mark Nelson 2a667a0820 MDL-58986 mod_quiz: add CSS classes to buttons on comment page 2017-05-18 16:50:06 +08:00
Andres Melo a4ad655bf1 MDL-46322 mod_assign: Only list enrolled graders as potential markers 2017-05-17 15:54:40 -05:00
AMOS bot 653e23bcc1 Automatically generated installer lang files 2017-05-18 00:07:20 +08:00
Mark Nelson 80d970cd0e MDL-58776 core_tag: removed whitespace from id attribute
This was preventing the JS from finding the element.
2017-05-17 12:13:40 +01:00
Simey Lameze f8962b4270 MDL-58884 core_competency: add exporter required course fields 2017-05-17 15:01:49 +08:00
Jake Dallimore e2f921ea2a Merge branch 'MDL-58947-m32' of https://github.com/sammarshallou/moodle into MOODLE_32_STABLE 2017-05-17 09:16:55 +08:00
Andrew Nicols 3586517ff8 Merge branch 'MDL-58795-moodle32' of https://github.com/jebarviabb/moodle into MOODLE_32_STABLE 2017-05-17 07:05:31 +08:00
Daniel Materka 4e8f93abba MDL-49988 wiki: fix broken page layout if html contains line breaks 2017-05-16 19:00:02 +01:00
Dan Poltawski 164d1e290e Merge branch 'MDL-58776-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-05-16 17:49:07 +01:00
AMOS bot 373bd248b9 Automatically generated installer lang files 2017-05-17 00:09:11 +08:00
Henning Bostelmann c6bbd48e23 MDL-57957 mod_assign: show feedback file in absence of grade item 2017-05-16 12:00:46 +01:00
Iñaki Arenaza 4db85a5943 MDL-57558 ldap: fix ldap_get_entries_moodle()
While ldap_get_entries_moodle() PHPdocs state that it returns "array
ldap-entries with lower-cased attributes as indexes.", this is not true. It
uses ldap_get_attributes() internally, which returns both numerically indexed
attribute names, and dictionary-like entries indexed by attribute names.

Current code lowercases the dictionary-like entries, but then uses the
numerically indexed entries for the attribute names used as keys in the
returned array. The numerically indexed names might or might not be lowercased,
depending on the LDAP server and PHP version) version. E.g., OpenLDAP 2.x,
Novell eDirectory 8.x and MS Active Directory return mixed-cased attribute
names, and PHP 5.x and PHP 7.x don't lowercase them inside ldap_get_entries().

This is probably why all calls to ldap_get_entries_moodle() are followed by
calls to array_change_key_case(), even if that shouldn't be necessary.

So make sure we always return lower-cased attributs as indexes and add some
unit tests to avoid regressions in the future.
2017-05-16 10:47:22 +01:00
Jun Pataleta 726fce53e7 Merge branch 'MDL-58811-32-extra-slash' of https://github.com/dmitriim/moodle into MOODLE_32_STABLE 2017-05-16 17:43:14 +08:00
Josh Ebarvia 5607f04f15 MDL-58795 gradereport_grader: Prevent duplicates in grader report
Currently, the sorting being used for the grader report table
(asc/desc arrows) is just the grade_grades.finalgrade.
This adds grade_grades.userid in the sort to prevent duplicate
in records returned when using pages.
2017-05-16 16:56:44 +09:30
Jake Dallimore 5d37f70d68 Merge branch 'MDL-58723-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-05-16 15:17:57 +08:00
Jun Pataleta 163e56dfbb MDL-58723 calendar: Better testing of forever recurring events
* Change the start date of the parent event to the current date
  for tests that with events that recur forever.
* Limit query results to 100 for events that recur forever that can
  generate more than 100 event records.
2017-05-16 14:40:29 +08:00
Andrew Nicols 07f1e2b49c Merge branch 'MDL-58756_32-statslib-roles-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-16 13:53:23 +08:00
Luca Bösch 328159027c MDL-58756 stats: Use multilang with role. 2017-05-16 07:28:43 +02:00
Dmitrii Metelkin c6e47712f5 MDL-58811 backup: fix an extra slash on restore for the legacy files 2017-05-16 14:31:05 +10:00
David Monllao 4a1d28e6c6 Merge branch 'MDL-58884-32' of git://github.com/StudiUM/moodle into MOODLE_32_STABLE 2017-05-16 10:41:53 +08:00
Jake Dallimore cbbfaad531 Merge branch 'MDL-58770-32' of https://github.com/IMSGlobal/moodle into MOODLE_32_STABLE 2017-05-16 09:58:42 +08:00
sam marshall bb78b2fd22 MDL-58947 Search: Label URLs not correctly calculated 2017-05-15 17:56:41 +01:00
AMOS bot 021b544c7a Automatically generated installer lang files 2017-05-16 00:07:22 +08:00
Dan Poltawski 71e94edfd8 Merge branch 'MDL-58916-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-05-15 11:01:43 +01:00
Dan Poltawski 37b143aeaf Merge branch 'MDL-58841-32' of git://github.com/cameron1729/moodle into MOODLE_32_STABLE 2017-05-15 10:46:11 +01:00
Dan Poltawski d1e6ca40a0 Merge branch 'MDL-58852_32-choice-chart-options-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-15 10:23:05 +01:00
Andrew Nicols d926390fba Merge branch 'MDL-58893-32-missing-div' of https://github.com/dmitriim/moodle into MOODLE_32_STABLE 2017-05-15 15:15:34 +08:00
Andrew Nicols 1dcc39e9a1 Merge branch 'MDL-58920_32-calculated-question-edit-name-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-15 14:54:20 +08:00
Dmitrii Metelkin e48bab0b24 MDL-58893 portfolio: add missing closing div 2017-05-15 15:52:52 +10:00
David Monllao bc71da7f50 Merge branch 'MDL-58656-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-05-15 11:39:39 +08:00
AMOS bot 3739127caf Automatically generated installer lang files 2017-05-14 00:04:48 +08:00
Luca Bösch 4321953314 MDL-58920 questions: Calculated question name passing multilang.
In "Shared wild cards" table calculated question name do pass format_string to process multilang tags.
Thus, not breaking the layout any more.
2017-05-12 18:07:55 +02:00
AMOS bot d69fcc7bc1 Automatically generated installer lang files 2017-05-13 00:04:43 +08:00
Dan Poltawski 723ed522a5 weekly release 3.2.3+ 2017-05-12 10:02:00 +01:00
Dan Poltawski 0d011d9ad3 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-05-12 10:01:59 +01:00
John Okely 15e5a39266 MDL-58916 user_profile: Pass site context when determining menu options 2017-05-12 15:59:48 +08:00
AMOS bot 1a63aaddeb Automatically generated installer lang files 2017-05-12 00:04:33 +08:00
Issam Taboubi ec66fbbeec MDL-58884 competency: Inaccurate stats proficient competencies in course 2017-05-11 11:51:53 -04:00
Skylar Kelty 11580ef62a MDL-58658 caching: Add static acceleration unit test for empty arrays 2017-05-11 11:04:25 +01:00
Skylar Kelty 8afd92382e MDL-58658 caching: Fix static acceleration for empty arrays 2017-05-11 11:04:15 +01:00
AMOS bot cf4753e354 Automatically generated installer lang files 2017-05-11 00:04:44 +08:00
David Monllao ed8c3327fb Merge branch 'MDL-58833-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-05-10 14:07:59 +08:00
David Monllao 3bd5edccf8 Merge branch 'MDL-58843-32-exchandler' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-05-10 14:06:06 +08:00
Dan Poltawski 01932fa6fa Merge branch 'MDL-58836-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-05-10 06:57:12 +01:00
Andrew Nicols db8ff4bc78 Merge branch 'MDL-58780-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-05-10 11:49:07 +08:00
Eloy Lafuente (stronk7) 2dced48edf Merge branch 'wip-MDL-58854-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-05-10 02:09:34 +02:00
AMOS bot 835bc90d7c Automatically generated installer lang files 2017-05-10 00:05:27 +08:00
Dan Poltawski 4d160525d3 weekly release 3.2.3+ 2017-05-09 12:41:47 +01:00
Dan Poltawski b3d4341009 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-05-09 12:41:44 +01:00
Cameron Ball bfa2ed7f6c MDL-58841 mod_assign: Style "view all" link on grading summary 2017-05-09 15:05:58 +08:00
David Mudrák 00fe8e5e3f MDL-58843 core: Do not expect a particular class of the thrown exception
Since PHP 7, the custom exception handlers are also called to handle
thrown Errors which are not Exceptions.
2017-05-09 08:42:53 +02:00
Andrew Nicols 5aeb8b003c Merge branch 'MDL-58822-32' of git://github.com/ryanwyllie/moodle into MOODLE_32_STABLE 2017-05-09 14:16:57 +08:00
Ryan Wyllie d90b7b734c MDL-58822 backup: backup and restore user override events 2017-05-09 05:49:25 +00:00
Jun Pataleta 26aaa71667 MDL-58780 mod_assign: Remove AS keyword in table alias
* The AS keyword is not recognised by Oracle for table aliases.
This is okay with other databases, but optional, so better to
remove it.
2017-05-09 12:00:45 +08:00
Marina Glancy 2265e74a31 MDL-58854 theme_boost: override templates for columns 2017-05-09 10:36:38 +08:00
Damyon Wiese 04f82f5669 MDL-58836 auth: Improve backwards compatibility
Auth plugins with custom signup forms may not be using renderables / renderers - or
even if they are they may return a renderable that can only be rendered with the renderer from the auth
plugin.

This change checks if the signup form is a renderable - if so try the plugin renderer or fall back on the general renderer.
Otherwise call display() from the mform which is the previous way of rendering an mform.
2017-05-09 10:27:39 +08:00
Luca Bösch e4d2487dd2 MDL-58852 choice: Use multilang for choice options in charts 2017-05-08 23:29:40 +02:00
AMOS bot b603370a23 Automatically generated installer lang files 2017-05-09 00:06:57 +08:00
Andrew Nicols 6ed25aee09 MDL-58833 tool_templatelibrary: Skip if directory empty 2017-05-08 15:02:20 +08:00
Jun Pataleta 9fff50ae00 MDL-58810 calendar: Fix rrule_manager issues
* Set the correct repeat ID for the recurring event
* Unset UUID for 'child' events of recurring events
2017-05-08 09:48:46 +08:00
Jun Pataleta 787d1a8f53 MDL-58810 calendar: Add coverage for UUID in recurring events 2017-05-08 09:40:19 +08:00
Eloy Lafuente (stronk7) 896ce9b4e6 Moodle release 3.2.3 2017-05-07 21:32:59 +02:00
AMOS bot c41605e282 Automatically generated installer lang files 2017-05-08 00:06:07 +08:00
AMOS bot 70ae23829f Automatically generated installer lang files 2017-05-07 00:05:59 +08:00
Eloy Lafuente (stronk7) f29a819640 weekly release 3.2.2+ 2017-05-05 17:26:59 +02:00
Andrew Nicols c89d29f8e0 Merge branch 'wip-MDL-50670-32-fix' of https://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-05-05 15:08:55 +08:00
Marina Glancy dc5cbf1532 MDL-50670 course: apply defaults when format was switched 2017-05-05 14:51:15 +08:00
Jun Pataleta 08c1b6eff4 Merge branch 'MDL-58807_32-activities-result-title-multilang' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-05-05 12:09:44 +08:00
Andrew Nicols 02660c64ff MDL-58259 mod_forum: Check if attachments allowed
If the current user is not allowed to submit attachments with a post,
and attachments are incldued, they are now dropped.
2017-05-05 10:29:11 +08:00
Andrew Nicols 787573a007 Merge branch 'MDL-55371-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-05-05 10:07:52 +08:00
Eloy Lafuente (stronk7) 6585f80f29 MDL-58772 behat: change step to 3.2 and up alternative 2017-05-05 08:26:56 +08:00
Dan Poltawski 7bcc28ac2f Merge branch 'MDL-58709-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-05-04 15:15:05 +01:00
Luca Bösch cc22e91f8f MDL-58807 block_activity_results: Use multilang in block title
The title passes format_string now.
2017-05-04 11:29:00 +02:00
Juan Leyva 3b2ea17ec4 MDL-55371 mod_assign: Do not return empty users in get_participant WS
The WS was returning null users making the WS to fail.
2017-05-04 10:10:23 +02:00
Jun Pataleta ce37064429 Merge branch 'MDL-58749-32-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-05-04 14:50:18 +08:00
Andrew Nicols 6aa0203deb MDL-56675 cachestore_memcached: Check all connected servers for support 2017-05-04 13:36:35 +08:00
Andrew Nicols d6d9c4a9c3 Merge branch 'MDL-58707-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-05-04 11:45:03 +08:00
Andrew Nicols 993a1ac38f Merge branch 'MDL-58431-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-05-04 11:02:59 +08:00
David Monllao e76a83ebf9 Merge branch 'MDL-56675-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-05-04 10:56:46 +08:00
Andrew Nicols e6d2eb3792 Merge branch 'MDL-58514-32' of git://github.com/cameron1729/moodle into MOODLE_32_STABLE 2017-05-04 08:54:43 +08:00
Helen Foster 0f11ec17ca MDL-58749 lang: Merge English strings from the en_fix language pack
Significant string changes:

* errorinvalidbyhour,core_calendar - correcting number from 59 to 23
* cron_help,core_admin - updated recommendation to run cron
  every minute
2017-05-03 22:07:22 +02:00
Eloy Lafuente (stronk7) c09577b5f3 Merge branch 'MDL-58754-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-05-03 20:53:44 +02:00
Eloy Lafuente (stronk7) 68124fe0af Merge branch 'MDL-58788-32' of git://github.com/danpoltawski/moodle into MOODLE_32_STABLE 2017-05-03 18:45:57 +02:00
Dan Poltawski 5611053587 MDL-58788 behat: backport of course navigation with editing step 2017-05-03 17:31:23 +01:00
Dan Poltawski c493c6ba2a Merge branch 'MDL-58772_32' of git://github.com/aolley/moodle into MOODLE_32_STABLE 2017-05-03 16:50:32 +01:00
Dan Poltawski ce589fb4fe Merge branch 'MDL-35913-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-05-03 14:13:21 +01:00
Dan Poltawski d8564f56f0 Merge branch 'MDL-58434-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-05-03 14:03:10 +01:00
Dan Poltawski e17ee1e9c5 Merge branch 'MDL-50670_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-05-03 13:30:47 +01:00
Dan Poltawski 9ddd0bd72a MDL-58788 behat: backport of course navigation step
These got introduced in master on
3353cfd8c1 / MDL-58265

It will be useful for third party devs sharing feature files between
multiple branches.
2017-05-03 10:36:41 +01:00
Cameron Ball fba8a2e290 MDL-58514 mod_assign: Apply consistent logic for overrides
Previously the assign submission page was using "lenient" logic
for overrides when more than one group override applied to a user
(i.e., use the earliest "open" date and the latest "due" date)
when really it should be using the sortorder as per the assign
grading table.
2017-05-03 17:10:47 +08:00
Jake Dallimore 6f4f3946f6 Merge branch 'MDL-58650_32' of git://github.com/markn86/moodle into MOODLE_32_STABLE 2017-05-03 15:58:34 +08:00
Marina Glancy b6098b92b0 MDL-58740 block_course_overview: check session key
Thanks to Kukas Schmidt for initial patch
2017-05-03 10:48:18 +08:00
Marina Glancy a42ebf3385 MDL-58670 blog: respect capability to search entries 2017-05-03 10:48:18 +08:00
Marina Glancy 6acdd1f3ab MDL-58635 blogs: check edited blog belongs to current user 2017-05-03 10:48:18 +08:00
Andrew Hancox 602b3815a0 MDL-58172 mod_choice: Make export choice respect id fields 2017-05-03 10:48:18 +08:00
David Monllao b06b50cf1a weekly release 3.2.2+ 2017-05-03 10:27:47 +08:00
David Monllao 9c2f96a13d Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-05-03 10:27:46 +08:00
Andrew Nicols 9214bc50a2 MDL-56675 cachestore_memcached: Disable store if not purgeable
If the store is shared and the getAllKeys function is broken due to an
incompatability between libmemcached and memcached >= 1.4.23, then it is
not possible to purge the cache, and we cannot support the plugin.

This patch adjusts the isready check to additionally check if the
combination of libmemcached and memcached is affected by this issue.
2017-05-03 09:24:51 +08:00
Andrew Nicols 45e0bc6372 MDL-58746 core: Simplify environment check 2017-05-03 08:32:52 +08:00
Juan Leyva b1e73801d1 MDL-58434 mod_lesson: Display invalid responses in detailed report
In the detailed statistics view for one user attempt, the user response
for numerical question types was not being displayed.
This was only happening for incorrect responses.
2017-05-02 19:57:18 +02:00
AMOS bot 445308fc3b Automatically generated installer lang files 2017-05-03 00:05:56 +08:00
Marina Glancy 3179ca58b7 MDL-50670 course: correctly apply defaults for format options 2017-05-02 17:36:53 +08:00
Mark Nelson 86cbb2c450 MDL-58650 core_message: always use 'popup' processor for messages 2017-05-02 16:07:20 +08:00
Ankit Agarwal b84949f618 MDL-58776 tags: Add bootstrap classes to buttons 2017-05-02 12:26:20 +05:30
Andrew Nicols 0c4220fba5 MDL-58754 competency: Change query for DISTINCT COUNT 2017-05-02 14:49:11 +08:00
Adam Olley 743ad4f126 MDL-58772 mod_feedback: Dont overwrite anonymous entries
The feedback module lets you alternate between responses being anonymised and
not anonymised. When the module is in anonymous mode, its possible for a single
user to make multiple responses.

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

This change lets them leave a new non-anonymised feedback entry and retains all
previous anonymous responses instead of incorrectly reusing one of their anon
ones at random.
2017-05-02 12:49:53 +09:30
Andrew Nicols 4a5e209d8c Merge branch 'MDL-57704-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-05-02 10:39:26 +08:00
John Okely 6b50178e4e MDL-57704 ltiprovider: Don't force SSLv3 2017-05-02 09:34:01 +08:00
Stephen Vickers 22227b7701 MDL-58770 mod_lti: Strip HTML from parameters
Remove HTML tags from parameters which should be plain text.
2017-05-01 21:10:40 +01:00
Marina Glancy db4031fa52 MDL-55468 mod_feedback: revive export analysis to excel 2017-05-01 14:33:49 +01:00
Jun Pataleta 9a68e396e8 Merge branch 'MDL-58632-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-05-01 14:28:13 +08:00
Andrew Nicols b5cc09d20b MDL-58746 core: Add environment check for finfo 2017-05-01 13:06:34 +08:00
Dan Poltawski 75528e9305 weekly release 3.2.2+ 2017-04-28 12:35:55 +01:00
Dan Poltawski 1082da020e Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-04-28 12:35:54 +01:00
Damyon Wiese 7d085745be MDL-54849 lesson: Fix backport
The backport branch was using undefined behat steps and functions.
2017-04-28 10:29:56 +08:00
Dan Poltawski d46c89d4e7 Merge branch 'wip-MDL-58689-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-27 18:35:29 +01:00
Juan Leyva 8817bcf7ba MDL-58709 registration: Fix incorrect setType 2017-04-27 16:58:20 +02:00
Dan Poltawski 00b7c8a2fd Merge branch 'MDL-58722-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-27 14:36:26 +01:00
David Monllao c1d089b1be Merge branch 'MDL-58628-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-04-27 17:09:41 +08:00
Damyon Wiese 3bbd2e7892 MDL-58722 mathjax: Update to 2.7.1 and remove a11y
2.7.1 bundles the accessibility and mchem extensions so we no longer need to bundle them and apply custom config.
2017-04-27 16:55:58 +08:00
Juan Leyva c35f42e679 MDL-58628 mod_quiz: Return missing fields in get_quizzes_by_courses
These fields must be returned always (even if the quiz is closed).
Those fields are required to display data to users that, for example,
finished a timed quiz.
2017-04-27 08:52:19 +02:00
Jake Dallimore 070262c8f9 Merge branch 'MDL-58701-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-04-27 13:33:45 +08:00
Ankit Agarwal ac3022fb0e MDL-58701 phpunit: Add tests for external_settings 2017-04-27 09:40:31 +05:30
Ankit Agarwal eed84bfd4b MDL-58701 libraries: Use pluginfile.php as rewrite url for web req. 2017-04-27 09:40:30 +05:30
David Monllao 133c06b2e1 Merge branch 'MDL-58698-32-strlang' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-04-27 11:34:58 +08:00
David Monllao 6c18a3c802 Merge branch 'wip-MDL-57807-32' of git://github.com/abgreeve/moodle into MOODLE_32_STABLE 2017-04-27 11:33:43 +08:00
David Monllao e7c4f87a5d Merge branch 'MDL-58372-32' of git://github.com/Dagefoerde/moodle into MOODLE_32_STABLE 2017-04-27 11:32:00 +08:00
Andrew Nicols 2e95bfa5f2 Merge branch 'MDL-58691-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-04-27 11:26:52 +08:00
David Monllao f8ca828c02 Merge branch 'MDL-54849-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-27 11:20:27 +08:00
Marina Glancy 22e22a39af MDL-58689 dml: prevent logging during setup 2017-04-27 10:05:25 +08:00
Adrian Greeve 6823ac39cc MDL-57807 mod_data: Advanced search with menu item.
It is now possible to search other criteria without first
setting the menu items.

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

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

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

What was missed in MDL-52486 was that when replacing a value (and not a
regular expression), only the first instance of the value is replaced.
So the value "en_us-k12" was sent as the lang parameter which is invalid
PARAM_LANG value and the exception was thrown.
2017-04-26 10:21:10 +02:00
Jake Dallimore cfe4df185c weekly release 3.2.2+ 2017-04-26 14:49:13 +08:00
Jake Dallimore 41c817ef38 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-04-26 14:49:12 +08:00
Jun Pataleta 32549792c2 Merge branch 'MDL-58668-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-04-26 11:05:48 +08:00
John Okely b6c6b99470 MDL-58632 assignsubmission_file: Don't allow any extension 2017-04-26 09:35:44 +08:00
Juan Leyva 72f7cc6a07 MDL-58707 mod_assign: Fix param type for returned field
The ‘description’ field is populated via a get_string call, this means
that it may content html.
The component used for translation is also fixed in this commit.
2017-04-25 14:42:27 +02:00
Juan Leyva a6757673a2 MDL-58668 mod_lesson: Fix how multi answers are processed
The module was choosing as incorrect the first possible incorrect
answer instead the first student incorrect answer.
In the patch I also refactored the foreach loop to avoid code
duplication.
2017-04-24 13:33:18 +02:00
Dan Poltawski e47c42f4a8 Merge branch 'MDL-58556-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-24 11:05:17 +01:00
Ankit Agarwal c51e98722b MDL-58691 exporter: Filters should always apply for web pages
The variables AJAX_SCIRPT, CLI_SCRIPT, WS_SERVER are always defined (and set to false)
when webpages are rendered, hence the check of 'defined' is invalid
2017-04-24 13:45:17 +05:30
Jake Dallimore d513f79a24 Merge branch 'MDL-57793-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-04-24 15:17:27 +08:00
Damyon Wiese e7048861a6 MDL-58556 auth: better expired password
If the auth plugin is using a custom url to change password - don't rely on forcepasswordchange
user preference being reset.
2017-04-24 15:09:05 +08:00
Damyon Wiese a188724a19 MDL-54849 lesson: Move on to next question
Move on to next question button takes you to the same question again.
2017-04-24 14:50:10 +08:00
Jun Pataleta d165d2cf24 Merge branch 'MDL-58586-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-24 09:34:49 +08:00
AMOS bot 6db0ef42d4 Automatically generated installer lang files 2017-04-23 00:04:28 +08:00
Dan Poltawski 0e526f9ea6 weekly release 3.2.2+ 2017-04-21 15:47:44 +01:00
Dan Poltawski f2520ef454 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-04-21 15:47:40 +01:00
Ryan Wyllie 9fd041ad16 MDL-58349 mod_assign: text wrap for comment search while grading 2017-04-21 13:36:29 +08:00
Damyon Wiese 608923c445 MDL-58586 css: add margin to userpictures
Boost has a right margin on the userpicture but this is missing in bootstrapbase (it is
added only on random pages).

Add a margin to bootstrapbase so it matches boost.
2017-04-21 11:39:57 +08:00
Jun Pataleta ec3ade054f Merge branch 'MDL-58636-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-04-21 11:39:34 +08:00
Andrew Nicols 0edc92e6bf MDL-58636 course: Ensure that the drag constraint has height 2017-04-21 10:48:32 +08:00
Jake Dallimore ebdcc591a2 Merge branch 'MDL-58613-32-workshopfullname' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-04-21 10:27:13 +08:00
David Monllao 029a29a3cf Merge branch 'MDL-58590_32' of https://github.com/sk-unikent/moodle into MOODLE_32_STABLE 2017-04-21 10:05:25 +08:00
Jun Pataleta 856dbae2cb Merge branch 'MDL-58482-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-04-21 09:05:53 +08:00
Simey Lameze 729c7f143b MDL-58482 theme_boost: css fixes for view badge page 2017-04-21 08:57:25 +08:00
AMOS bot 5f42866391 Automatically generated installer lang files 2017-04-21 00:10:40 +08:00
Skylar Kelty e0b69258fb MDL-58590 mobile: Cache mobile-supporting plugins 2017-04-20 09:34:40 +01:00
David Monllao e684411988 Merge branch 'MDL-58349-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-20 15:20:46 +08:00
Jake Dallimore 1e15527fa5 Merge branch 'wip-MDL-58452-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-20 15:10:42 +08:00
David Monllao 0373f42728 Merge branch 'MDL-58278-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-20 14:08:35 +08:00
Damyon Wiese 8a33f2a530 MDL-58656 competencies: Fix buggy scale caching
This affects the competency breakdown report in a course.
2017-04-20 13:24:56 +08:00
Damyon Wiese 864cf11c2f MDL-58278 mod_assign: Ignore send notify with mw
When marking workflow is on and the grade is not released we never send notifications anyway.
Instead of preventing the grading form from submitting (validation error) we silently ignore it.
2017-04-20 11:47:39 +08:00
AMOS bot ba6e9f22b4 Automatically generated installer lang files 2017-04-20 00:07:04 +08:00
Juan Leyva 554afbe2cd MDL-58431 mod_lesson: Fix error in random jumps on first visit
Random jumps to content pages were not working when they were set in
the first page.
This was caused because the page where the jump was, was not being
marked as visited before calculating the jump.
2017-04-19 17:48:05 +02:00
David Mudrák a0f9277b51 MDL-58613 workshop: Provide all data to display user name
Additional fields such as middlename, alternatename and others were not
passed to the fullname(), causing a debugging message.
2017-04-19 14:19:49 +02:00
David Monllao ebda22d612 Merge branch 'MDL-54901_32' of git://github.com/stronk7/moodle into MOODLE_32_STABLE 2017-04-19 11:31:57 +08:00
David Monllao 0ad03ab13c Merge branch 'MDL-58096-32' of git://github.com/StudiUM/moodle into MOODLE_32_STABLE 2017-04-19 05:18:22 +08:00
Gilles-Philippe Leblanc 4dcdab69f6 MDL-58096 reports: Add SQL required by preload_from_record() 2017-04-18 15:42:01 -04:00
Dan Poltawski a8321fc3ac Merge branch 'MDL-58463-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-04-18 18:54:01 +01:00
David Monllao 167a73cffc Merge branch 'MDL-58116-32' of https://github.com/barrasroger/moodle-1 into MOODLE_32_STABLE 2017-04-19 00:49:56 +08:00
AMOS bot b19bf809dc Automatically generated installer lang files 2017-04-19 00:04:41 +08:00
Dan Poltawski d2f333357d Merge branch 'MDL-58374-32-ltierrorlog' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-04-18 16:49:03 +01:00
Gilles-Philippe Leblanc a1d78eac23 MDL-58096 reports: Optimize database request 2017-04-18 11:00:08 -04:00
Dan Poltawski 937831c736 weekly release 3.2.2+ 2017-04-18 12:34:09 +01:00
Dan Poltawski de7951b817 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-04-18 12:34:08 +01:00
barrasroger 0e1c96a44c MDL-58116 core_enrol: fix handling of users on different methods 2017-04-18 13:06:54 +02:00
Jun Pataleta cdabef710d MDL-57793 calendar: Additional edge-case tests
* Added leap year and 31th day of the month tests.
2017-04-18 13:57:39 +08:00
Jun Pataleta 2a7b253e82 MDL-57793 calendar: Add recursion to satisfy COUNT rule
* Add recursion to the creation of recurring calendar events to satisfy
  the COUNT rule, if necessary.
2017-04-18 13:57:39 +08:00
Jun Pataleta b87f4d1ea5 MDL-58463 mod_assign: Improve coverage of test_assign_refresh_events() 2017-04-18 13:22:33 +08:00
Jun Pataleta c3606bf9ba MDL-58463 mod_assign: Use correct course ID for fetching assignment's CM 2017-04-18 11:57:45 +08:00
Andrew Nicols 6806700b01 Merge branch 'MDL-58559-32' of git://github.com/lameze/moodle into MOODLE_32_STABLE 2017-04-18 09:47:41 +08:00
Andrew Nicols 071633c194 Merge branch 'MDL-58582-32' of https://github.com/Dagefoerde/moodle into MOODLE_32_STABLE 2017-04-18 09:32:32 +08:00
Andrew Nicols ef01fb49a6 Merge branch 'MDL-58539_32' of https://github.com/dmonllao/moodle into MOODLE_32_STABLE 2017-04-18 09:04:48 +08:00
Simey Lameze b9fb0ede39 MDL-58559 block_community: check if the course has subject 2017-04-18 08:57:15 +08:00
Eloy Lafuente (stronk7) 3567a37302 MDL-54901 environment: pg93, openssl, https & utf8mb4 2017-04-18 02:53:47 +02:00
Eloy Lafuente (stronk7) 34770e55b2 MDL-54901 environment: 3.3 base information
This is a direct copy of the 3.2 branch to
have changes under control easier in next commits.
2017-04-18 02:53:46 +02:00
Ruslan Kabalin f7e9dbcbe2 MDL-58539 assignfeedback_editpdf: Fix group assignment fatal error.
This makes sure that $grade->attemptnumber is not NULL before using its
value.
2017-04-17 16:58:44 +02:00
Jan Dageförde e353a80475 MDL-58582 theme: Improve PHPDoc comment on SVG image resolution 2017-04-17 15:24:32 +02:00
Dan Poltawski 8226afc20e MDL-58486 userprefs: clarifying comment 2017-04-17 12:17:57 +01:00
Dan Poltawski 535abb009d Merge branch 'MDL-58486_32' of git://github.com/timhunt/moodle into MOODLE_32_STABLE 2017-04-17 12:17:54 +01:00
Dan Poltawski 3125397713 Merge branch 'MDL-58479-32-weblib-notice-phpdoc' of git://github.com/roperto/moodle into MOODLE_32_STABLE 2017-04-17 10:46:10 +01:00
Dan Poltawski 9ce8250f77 Merge branch 'MDL-58465-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-04-17 10:41:18 +01:00
Dan Poltawski 1eefc40296 Merge branch 'MDL-58393-32_filter-order' of https://github.com/roperto/moodle into MOODLE_32_STABLE 2017-04-17 10:30:41 +01:00
Dan Poltawski a3d444a3af Merge branch 'MDL-58593-32' of git://github.com/merrill-oakland/moodle into MOODLE_32_STABLE 2017-04-17 10:03:23 +01:00
Dan Poltawski 3509e3771a MDL-39913 behat: fix filetype search
Like the previous commit, the string had been badly backported from 33
on 32 th gdocs extension is not in spreadhseet files.
2017-04-17 08:36:20 +01:00
Dan Poltawski d7dd9aa732 MDL-39913 behat: fix steps which don't exist
'And I am on "Course 1" course homepage' is a step introduced into 33.
2017-04-17 08:31:39 +01:00
Eric Merrill 2335a0018d MDL-58593 database: More efficiently track issued key names 2017-04-13 12:24:27 -04:00
Dan Poltawski 6cb68d8d3a Merge branch 'MDL-32596_32' of https://github.com/rezaies/moodle into MOODLE_32_STABLE 2017-04-13 15:57:23 +01:00
David Monllao a3b99f1c03 Merge branch 'MDL-58244-32' of https://github.com/MartinGauk/moodle into MOODLE_32_STABLE 2017-04-13 13:00:40 +02:00
David Monllao 139c549e3c Merge branch 'MDL-58171_32-report-role-format_text' of https://github.com/lucaboesch/moodle into MOODLE_32_STABLE 2017-04-13 12:40:08 +02:00
Martin Gauk 8336d2be91 MDL-58244 shibboleth: handle users who are logged out
If the user is (already) logged out, do not access $USER->auth and redirect him to the return URL.
2017-04-13 10:07:04 +00:00
Andrew Nicols 46629407c2 Merge branch 'MDL-39913-32-new-validation' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-04-13 09:18:15 +08:00
AMOS bot f1996f596b Automatically generated installer lang files 2017-04-13 00:04:26 +08:00
David Monllao db2718a65d Merge branch 'MDL57475-MOODLE_32_STABLE' of https://github.com/mmafrar/moodle into MOODLE_32_STABLE 2017-04-12 16:19:08 +02:00
Luca Bösch 2e26127821 MDL-58171 report: role name passing format_text
Have the role name in h2 of the participation report passing filters
like multilang2 by having it call format_text.

Signed-off-by: Luca Bösch <luca.boesch@bfh.ch>
2017-04-12 15:32:45 +02:00
David Monllao ccbc8fadf8 Merge branch 'MDL-58555_32' of https://github.com/timhunt/moodle into MOODLE_32_STABLE 2017-04-12 14:09:33 +02:00
David Monllao 0905763270 weekly release 3.2.2+ 2017-04-12 09:32:38 +02:00
David Monllao 558d773213 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-04-12 09:32:36 +02:00
Tim Hunt 4288a75a48 MDL-58555 ajax: make ajax web service log entries more useful
It is not used for anything, but we put the method name(s) being called in the URL.
2017-04-11 09:41:02 +01:00
Andrew Nicols cdcb157b7e Merge branch 'wip-MDL-57616-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-11 12:01:28 +08:00
Andrew Nicols 12d454cb4c Merge branch 'MDL-58461-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-04-11 11:34:43 +08:00
AMOS bot c1d1c098f4 Automatically generated installer lang files 2017-04-11 00:04:44 +08:00
David Monllao 402ce4d5f5 Merge branch 'patch-25' of https://github.com/sk-unikent/moodle into MOODLE_32_STABLE 2017-04-10 16:59:34 +02:00
David Monllao f8db8073a2 Merge branch 'mdl-58489-m32' of https://github.com/Dagefoerde/moodle into MOODLE_32_STABLE 2017-04-10 16:56:23 +02:00
David Monllao 2eb6dd8cdc Merge branch 'mdl-58485-m32' of https://github.com/Dagefoerde/moodle into MOODLE_32_STABLE 2017-04-10 16:34:28 +02:00
David Monllao 32cf700c31 Merge branch 'wip-MDL-55950-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-10 16:10:04 +02:00
David Monllao c2542c35f6 Merge branch 'MDL-57858-32' of git://github.com/pavelsokolov/moodle into MOODLE_32_STABLE 2017-04-10 14:15:12 +02:00
David Monllao a563739951 MDL-56370 mod_feedback: Note about undeprecation 2017-04-10 13:17:14 +02:00
David Monllao 04d312fbcc Merge branch 'wip-MDL-56370-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-10 13:15:24 +02:00
David Monllao e82c98f26d Merge branch 'wip-MDL-55939-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-10 12:57:50 +02:00
David Monllao f40585c94d Merge branch 'MDL-58104-32' of git://github.com/pavelsokolov/moodle into MOODLE_32_STABLE 2017-04-10 09:58:44 +02:00
Andrew Nicols b91250e430 Merge branch 'wip-MDL-58180-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-10 13:40:29 +08:00
John Okely ea3f8fa0cb MDL-39913 assignsubmission_file: Add validation 2017-04-10 12:12:07 +08:00
AMOS bot e1f11ce7b1 Automatically generated installer lang files 2017-04-08 00:05:54 +08:00
David Mudrák 7c920b5706 MDL-58374 lti: Log the error message of a failed message verification
Previously the exception message (which holds the actual explanation of
what went wrong) was thrown away so the user had no way to debug.
2017-04-07 11:27:19 +02:00
Jan Dageförde 3abc7d1c4e MDL-58485 admin: Show all SVG plugin icons 2017-04-07 10:10:42 +02:00
Jan Dageförde d2decc7fb0 MDL-58489 core: Fix unreachable HTTP error handling 2017-04-07 10:07:54 +02:00
Marina Glancy 784e8588ee MDL-58452 ajax: do not show popup when can't retrieve the message count 2017-04-07 16:06:07 +08:00
John Okely d00a536a0c MDL-39913 assign: Add help on filetype submissions 2017-04-07 16:04:56 +08:00
Jonathon Fowler 9a9a841497 MDL-39913 assignsubmission_file: add file types restriction
Testing for uploading a non-permitted file won't work as things stand
currently because the filemanager throws an exception that Behat
catches, which causes a fail.
2017-04-07 16:04:53 +08:00
Jonathon Fowler e319e5a2d0 MDL-39913 filetypes: mimetypes remediation
Going by http://www.iana.org/assignments/media-types/media-types.xhtml.
Disambiguated the Office 2007 types, Apple iWorks and other types
changes by tonyjbutler.
2017-04-07 16:04:13 +08:00
Jun Pataleta 90574fd1c8 weekly release 3.2.2+ 2017-04-07 12:45:57 +08:00
Jun Pataleta 67e8ddc65f Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-04-07 12:45:56 +08:00
Marina Glancy a41f004fb7 MDL-56370 mod_feedback: behat for repeat completion 2017-04-07 08:22:58 +08:00
AMOS bot 22c756c644 Automatically generated installer lang files 2017-04-07 00:04:53 +08:00
Skylar Kelty b42298d3fa MDL-58456 chat: Add missing new in throw 2017-04-06 09:47:41 +01:00
Shamim Rezaie e13c169ded MDL-32596 tool_xmldb: Updated confirmcheckforeignkeys
Updated $string['confirmcheckforeignkeys']
2017-04-06 18:29:24 +10:00
Marina Glancy 766a5891b6 MDL-55950 mod_feedback: correct link to response in the email 2017-04-06 15:44:14 +08:00
Marina Glancy 5108b3e7c1 MDL-55939 course: no permission is needed to view frontpage 2017-04-06 14:52:54 +08:00
Damyon Wiese 87f417f510 MDL-58461 filter_mathjaxloader: Update defaults
Also included a version bump for Moodle in order to trigger a filter upgrade.
2017-04-06 13:58:28 +08:00
Damyon Wiese 7a75832faa MDL-58461 mathjax: Ship accessibility extensions
There are not mirrored on the new CDN so we need to ship them with moodle.
2017-04-06 13:58:24 +08:00
AMOS bot 8b2d2a5fc6 Automatically generated installer lang files 2017-04-06 00:07:27 +08:00
AMOS bot 5b9dead542 Automatically generated installer lang files 2017-04-06 00:07:27 +08:00
Marina Glancy 50b024746e MDL-56370 mod_feedback: allow to restore values from last attempt 2017-04-05 15:45:16 +08:00
Andrew Nicols c0ab266dd0 MDL-58055 theme_bootstrap: Change padding around unread link 2017-04-05 00:34:29 +02:00
Eloy Lafuente (stronk7) a90270455e Merge branch 'MDL-55326-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-04-04 19:26:36 +02:00
Eloy Lafuente (stronk7) f0be825426 Merge branch 'MDL-55499-32' of git://github.com/andrewnicols/moodle into MOODLE_32_STABLE 2017-04-04 18:24:04 +02:00
AMOS bot dce24b2a5a Automatically generated installer lang files 2017-04-05 00:04:46 +08:00
Tim Hunt 985b62f3a9 MDL-58486 user_prefs: always update $USER cache when applicable
set_user_preference and unset_user_preference let you pass the user to
set preferences for as an id. Previously, if you passed $USER->id there,
those methods did not update the Cache in $USER, which was surprising,
and not easy to debug.

Now, we always update the preference cache in $USER if the preference is
being changed for the current user.
2017-04-04 16:22:52 +01:00
Daniel Thee Roperto d92499f4c4 MDL-58479 documentation: fixed phpdoc for notice(). 2017-04-04 16:20:01 +10:00
Marina Glancy 6c61222fbb MDL-57616 label: allow to drag and drop video/audio files 2017-04-04 12:31:32 +08:00
Andrew Nicols 6e19e0c175 Merge branch 'wip-MDL-41809-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-04-04 10:54:44 +08:00
Mohamed Afrar 92ae0fda60 MDL-57475 Forum: Fixing issue with the 'preferences' link in emails 2017-04-04 03:08:22 +05:30
AMOS bot 9702e72bd7 Automatically generated installer lang files 2017-04-04 00:05:38 +08:00
Daniel Thee Roperto 1401dd8f47 MDL-58394 filters: Fixed order not being respected. 2017-04-03 14:47:26 +10:00
Ankit Agarwal aae0a865bb MDL-58465 unittests: Fix invalid use of exception 2017-04-03 09:25:46 +05:30
Damyon Wiese fed7bdfa96 MDL-58461 filter_mathjaxloader: Change CDN url
The MathJax CDN url is going away - we need to switch to another mirror.
2017-04-03 11:18:20 +08:00
Dan Poltawski 57a38cf813 weekly release 3.2.2+ 2017-03-31 11:15:47 +01:00
David Monllao ed6478fb7e MDL-58450 mod_forum: Force groups to be returned as they are created
Long history resumed: The test relies on the first group
being the first that is created, the first group is
actually the first one ordering by name. If  is
group-999 and  is group-1000  is returned
as the first group.
2017-03-31 11:14:16 +01:00
Pavel Sokolov 26ce8a1f15 MDL-57858 mod_assign: fix submissions count for assign with scales 2017-03-31 12:01:03 +03:00
Dan Poltawski f2ceab9582 weekly release 3.2.2+ 2017-03-31 09:16:40 +01:00
Dan Poltawski 02151fbe85 Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-03-31 09:16:39 +01:00
Pavel Sokolov 6db9bc560d MDL-58104 mod_assign: Show attempt settings for the latest attempt 2017-03-30 11:10:52 +03:00
Andrew Nicols 440b00b7d3 MDL-55499 mod_forum: Use context when formatting e-mail text 2017-03-30 11:38:37 +08:00
Dan Poltawski ba0bd5b9ab Merge branch 'MDL-58264_32' of https://github.com/darrencocco/moodle into MOODLE_32_STABLE 2017-03-28 18:02:42 +01:00
AMOS bot cf2cda4b31 Automatically generated installer lang files 2017-03-29 00:05:39 +08:00
David Monllao 3cc6435b18 MDL-58079 enrol: Move new test to existing test case 2017-03-28 17:35:48 +02:00
David Monllao e0b383aae0 Merge branch 'MDL-58079_32' of https://github.com/kiklop74/moodle into MOODLE_32_STABLE 2017-03-28 17:35:05 +02:00
Juan Leyva 2121f50755 MDL-35913 site home: Set the page layout before setting blocks
When the default home page is set by user preference the site home
blocks are gone.
This is caused because the page layout is not correctly set before
manipulating the navigation block (the base layout it is used instead).
2017-03-28 17:11:07 +02:00
Dan Poltawski 121c9d3099 MDL-58227 mod_feedback: remove uncessary if 2017-03-28 16:00:08 +01:00
Dan Poltawski 32e709a9dc Merge branch 'MDL-58227-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-03-28 15:59:23 +01:00
Dan Poltawski 397a8936cb Merge branch 'MOODLE_32_STABLE' of https://github.com/fwsl/moodle into MOODLE_32_STABLE 2017-03-28 12:07:29 +01:00
Dan Poltawski 4e3551004e Merge branch 'MDL-58160_32' of git://github.com/aolley/moodle into MOODLE_32_STABLE 2017-03-28 11:34:59 +01:00
Dan Poltawski e48dd18997 Merge branch 'wip-MDL-58092-32' of git://github.com/marinaglancy/moodle into MOODLE_32_STABLE 2017-03-28 10:56:00 +01:00
Dan Poltawski 6d36432f2f Merge branch 'MDL-58257_M32' of https://github.com/ak4t0sh/moodle into MOODLE_32_STABLE 2017-03-28 10:50:59 +01:00
AMOS bot aaf67d012b Automatically generated installer lang files 2017-03-28 00:06:38 +08:00
Dan Poltawski 316706511d Merge branch 'MDL-57510-32' of git://github.com/ankitagarwal/moodle into MOODLE_32_STABLE 2017-03-27 09:41:35 +01:00
Andrew Nicols b407285890 MDL-55326 core_text: Correct typo3 file permissions 2017-03-27 15:07:59 +08:00
Luca Bösch 042b90d078 MDL-58180 lib: Role name pass format_text.
In function stats_get_report_options, the role names are returned after
having been processed through format_text which lets the filters work on them.

Signed-off-by: Luca Bösch <luca.boesch@bfh.ch>
2017-03-27 10:41:38 +08:00
Darren Cocco c2465fa0e3 MDL-58264 quiz: removed additional = symbol
Removed superflous = symbol from SQL snippet
2017-03-27 11:11:47 +11:00
AMOS bot 4b4f760bfa Automatically generated installer lang files 2017-03-27 00:04:24 +08:00
Ankit Agarwal 9ec4ffe9be MDL-57510 questionbank: Add horizontal navigation 2017-03-24 19:08:13 +05:30
Grzegorz Ziółek 08e1b1e49e MDL-58325 config_log: Record changes in editor management to config_log. 2017-03-24 09:41:20 +01:00
Marina Glancy 8bf0e602c6 MDL-58092 gradingform_guide: behat to demonstrate double quote fix 2017-03-24 13:28:40 +08:00
gthomas2 4583242dd6 MDL-58092 grading methods: Fix double escape for freq used questions 2017-03-24 13:28:40 +08:00
Eloy Lafuente (stronk7) af97a17395 weekly release 3.2.2+ 2017-03-23 20:31:01 +01:00
Eloy Lafuente (stronk7) 89574179da Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-03-23 20:30:59 +01:00
Marina Glancy 6ee2dd680e MDL-41809 course: do not rely on page context
page context may not be set, use the correct course context when calling format_string
2017-03-23 14:41:47 +08:00
Andrew Nicols 72fce6fc46 Merge branch 'MDL-57429-32-fix' of https://github.com/snake/moodle into MOODLE_32_STABLE 2017-03-23 11:52:39 +08:00
Jake Dallimore 3c57ce6e72 MDL-57429 badges: handle curl problems nicely during connection creation
- Properly validate the displayer API response before sending the
verification email.
- Properly validate the displayer API response before creating the
saved connection.
2017-03-23 11:36:11 +08:00
Jun Pataleta 79d55f5dee MDL-58255 mod_assign: Fix one more incorrect assign context usage 2017-03-23 09:31:33 +08:00
AMOS bot d9864df62c Automatically generated installer lang files 2017-03-23 00:08:55 +08:00
Dan Poltawski a04b4d89b2 Merge branch 'MDL-58274-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-03-22 09:30:40 +00:00
Damyon Wiese 21735b6075 MDL-58349 assign: editpdf search comments style
The line height and margins are messed up on the comment search dialog.
2017-03-22 13:33:02 +08:00
Jun Pataleta 156371af9c MDL-57994 course: Fix newsitems setting for course formats without news 2017-03-22 09:33:05 +08:00
Dan Poltawski a3a8a4a970 Merge branch 'MDL-56324-32' of https://github.com/lucisgit/moodle into MOODLE_32_STABLE 2017-03-21 11:27:41 +00:00
Juan Leyva 3848d57eef MDL-58227 mod_feedback: Delete duplicated completions records
This commit also fixes the way the previous completion record was
fetched to avoid the creation of new duplicates.
2017-03-21 09:55:37 +01:00
Dan Poltawski 4afdece091 Merge branch 'MDL-58317-32' of git://github.com/damyon/moodle into MOODLE_32_STABLE 2017-03-21 07:57:59 +00:00
John Okely 649bad89a2 MDL-37168 mod_lti: Fix rename behat 2017-03-21 10:30:52 +08:00
Eloy Lafuente (stronk7) 886ce4cfcb Merge branch 'MDL-57840-32-get_users_by_field' of https://github.com/roperto/moodle into MOODLE_32_STABLE 2017-03-21 01:05:55 +01:00
AMOS bot 8da74658b5 Automatically generated installer lang files 2017-03-21 00:04:24 +08:00
Dan Poltawski 59f2ef03ae Merge branch 'MDL-58262-32' of git://github.com/merrill-oakland/moodle into MOODLE_32_STABLE 2017-03-20 15:20:18 +00:00
Dan Poltawski d1b41e0a34 Merge branch 'wip-mdl-58261-m32' of https://github.com/rajeshtaneja/moodle into MOODLE_32_STABLE 2017-03-20 13:51:30 +00:00
Dan Poltawski c2e2d38d99 Merge branch 'MDL-58050-32-msgtrans' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-03-20 13:19:26 +00:00
Dan Poltawski 7bde88208c Merge branch 'MDL-58121-32' of https://github.com/snake/moodle into MOODLE_32_STABLE 2017-03-20 13:15:15 +00:00
Dan Poltawski 2e2686acf2 Merge branch 'MDL-58255-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-03-20 13:08:52 +00:00
Dan Poltawski ed532e8f3b Merge branch 'MDL-58273-32-ldapenrol' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-03-20 11:08:46 +00:00
David Monllao 94535cbc8a Merge branch 'MDL-37168-32' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-03-20 10:16:18 +01:00
Dan Poltawski 12d3875811 Merge branch 'MDL-58285-m32' of https://github.com/NeillM/moodle into MOODLE_32_STABLE 2017-03-20 08:54:02 +00:00
John Okely be52d0dace MDL-37168 grade: Debugging if gradebook callbacks are not both present 2017-03-20 16:31:31 +08:00
John Okely e078aa1351 MDL-37168 mod_lti: Add behat test to cover lti quick edit 2017-03-20 16:00:15 +08:00
Sam Chaffee 1b13df8f65 MDL-37168 mod_lti: Fix LTI activity quick edit title 2017-03-20 16:00:14 +08:00
Darko Miletic 3111a4f120 MDL-58079 core_enrol: Fixed invalid category tag 2017-03-20 04:11:48 -03:00
David Monllao aacfdda594 Merge branch 'MDL-57419-32-2' of https://github.com/xow/moodle into MOODLE_32_STABLE 2017-03-20 07:33:38 +01:00
David Monllao 349027033c Merge branch 'MDL-57254-32' of git://github.com/jleyva/moodle into MOODLE_32_STABLE 2017-03-20 06:49:29 +01:00
Damyon Wiese 4ca5db7c0b MDL-58317 templates: Fix async template render
There is an edge case where we do not wait for all promises before
rendering a template. This can generate "failed to pre-fetch the template" JS errors.
2017-03-20 13:36:51 +08:00
David Monllao 4c72716d43 Merge branch 'MDL-57994_M32' of https://github.com/ak4t0sh/moodle into MOODLE_32_STABLE 2017-03-20 06:32:44 +01:00
David Monllao 733e84fc26 Merge branch 'MDL-58166-32' of git://github.com/pavelsokolov/moodle into MOODLE_32_STABLE 2017-03-20 05:12:03 +01:00
David Monllao 594253c322 Merge branch 'MDL-58182-32' of https://github.com/snake/moodle into MOODLE_32_STABLE 2017-03-20 05:04:40 +01:00
Andrew Nicols 1cf3129e86 Merge branch 'MDL-57429-32' of https://github.com/snake/moodle into MOODLE_32_STABLE 2017-03-20 10:19:52 +08:00
AMOS bot 6178a8c820 Automatically generated installer lang files 2017-03-20 00:07:29 +08:00
AMOS bot 4c22adddef Automatically generated installer lang files 2017-03-19 00:05:46 +08:00
AMOS bot 91b779aa02 Automatically generated installer lang files 2017-03-18 00:09:29 +08:00
Pavel Sokolov 27946d0c65 MDL-58166 mod_assign: markingworkflow breaks assign for non-graders 2017-03-17 17:52:11 +03:00
Tony Butler 9ac0280f80 MDL-56324 assignfeedback_editpdf: Revert erroneous commits
This reverts commits 88d309d and 3cd718e.
2017-03-17 11:04:04 +00:00
Arnaud Trouve b2931bc620 MDL-58257 course: fix search containing a hyphen
In case a hyphen (-) was preceded and followed by spaces,
the pattern for the "not regex" was empty causing an empty response from the database
2017-03-17 08:28:25 +01:00
Damyon Wiese 7acd833a3c MDL-58274 boost: div is not the same as span
display: block and display: inline are very different - you can't just
change tags and expect everything to look fine.
2017-03-17 10:03:10 +08:00
Jun Pataleta 8f48fbf6f6 MDL-58255 mod_assign: Fix usage of assign object for overrides
* Fix the parameters being passed for the assign constructor.
* Use assign::get_instance() instead of assign::get_context() to fetch
the assignment instance's properties.
2017-03-17 09:34:03 +08:00
Jake Dallimore 81636e4694 MDL-58121 email: ensure support user is defined in email_to_user 2017-03-17 09:13:17 +08:00
Jake Dallimore 91df0eb289 MDL-58182 javascript: Fix for buttons regression in core dialog.
Fixes a regression caused by MDL-56364, wherein the buttons were made
readOnly, meaning addButtons wouldn't work. This removes that change,
while maintaining the original dependency between the buttons and the
closeButton config options.
2017-03-17 09:06:30 +08:00
Arnaud Trouve 27e0254e8f MDL-57994 course: fix newsitems value 2017-03-16 18:37:12 +01:00
Darko Miletic 1929107b8c MDL-58079 core_enrol: Implementing fix and unit test 2017-03-16 14:27:22 -03:00
Neill Magill e587b9be09 MDL-58285 tool_mobile: Web service generates incorrect fileurl on IIS
The tool_mobile_get_plugins_supporting_mobile generated an incorrect
fileurl on IIS. The /mobile/filename.zip part was generated as
\mobile\filename.zip, this failed the PARAM_URL check.

This change stops the use of OS specific directory separators and uses
the linux/web separator. PHP file functions recognise this properly.
2017-03-16 12:10:59 +00:00
Dan Poltawski 80ff09db28 weekly release 3.2.2+ 2017-03-16 11:52:59 +00:00
Dan Poltawski 61495ffbcb Merge branch 'install_32_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_32_STABLE 2017-03-16 11:52:57 +00:00
John Okely 3bc489a0ec MDL-57419 messaging: Don't use enter to send 2017-03-16 10:50:06 +08:00
Rajesh Taneja 6d3a686c2c MDL-58261 behat: Fixed missing @_file_upload tags 2017-03-16 09:36:02 +08:00
Jake Dallimore e9fe4cc37c MDL-57429 badges: add email verification for openbackpack connections
With the Persona provider now out of commission, no new connections to
the Mozilla openbackpack can be created. This patch adds an email
verification step to core to restore the openbackpack functionality.
2017-03-16 09:33:30 +08:00
David Mudrák 4457c6605b MDL-58273 enrol_ldap: Fix the name of the capability
This capability controls who can hide/show the enrolment instance.
2017-03-15 18:33:04 +01:00
Andrew Nicols d82b0d8ed9 Merge branch 'MDL-57658-32-integration-fix-2' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-03-15 15:14:33 +08:00
Jun Pataleta f16b97eb8c MDL-57658 calendar: Remove BYDAY filtering dependence on NumberFormatter 2017-03-15 14:24:12 +08:00
Andrew Nicols dda3512514 Merge branch 'MDL-57658-32-integration-fix' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-03-15 11:42:06 +08:00
Jun Pataleta f4fe47705e MDL-57658 calendar: Set sort order for fetched DB records 2017-03-15 11:26:31 +08:00
Eloy Lafuente (stronk7) 3ec84d746a Merge branch 'MDL-57066-32' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-03-15 00:58:45 +01:00
Eric Merrill 330f45b6e2 MDL-58262 assign: Use unique sql parameter 2017-03-14 15:10:00 -04:00
Dan Poltawski cddbbc1752 Merge branch 'MDL-58023_behat_find_node_in_navigation_improvement_MOODLE_32_STABLE' of https://github.com/gthomas2/moodle into MOODLE_32_STABLE 2017-03-14 16:47:52 +00:00
Dan Poltawski 9407afa0ba Merge branch 'MDL-57658-32-3' of git://github.com/junpataleta/moodle into MOODLE_32_STABLE 2017-03-14 16:06:20 +00:00
AMOS bot a62863c658 Automatically generated installer lang files 2017-03-15 00:04:51 +08:00
Juan Leyva 1164882eff MDL-57254 mod_choice: Add not open case in choice_can_view_results
If the choice is not available (not open yet), the function must return
false even is CHOICE_SHOWRESULTS_ALWAYS is set to true.
This was failing only in Web Services, in Web that function is not
reached (execution stops when the time open check is done).
2017-03-14 13:35:38 +01:00
David Monllao 7b0a42b20c Merge branch 'MDL-58114-32-excparams' of git://github.com/mudrd8mz/moodle into MOODLE_32_STABLE 2017-03-14 11:02:50 +01:00
Rajesh Taneja ff14679150 MDL-58169 phpunit: Clear opcode cache before checking file
In unit test, we write cache file often and
opcache might fail to detect changes. It will
be nice to invalidate opcode cache to ensure
we have the correct file_exists status
2017-03-14 09:07:28 +00:00
Andrew Nicols e79a53e370 Merge branch 'MDL-57583-32' of https://github.com/snake/moodle into MOODLE_32_STABLE 2017-03-14 12:47:59 +08:00
Rajesh Taneja e78f6b391a MDL-58250 behat: Status should be new exit code
Oring should not be done with old status,
as it will always return failure.
2017-03-14 07:30:44 +08:00
AMOS bot 5a04868aec Automatically generated installer lang files 2017-03-14 00:04:43 +08:00
gthomas2 b3a6face59 MDL-58023 behat: Improve find_node_in_navigation function 2017-03-13 11:39:23 +00:00
Krishnan e7714135a4 MDL-57066 theme_boost: Fix course section move icon alignment 2017-03-13 14:43:29 +08:00
Jake Dallimore e2b2fad613 MDL-57583 completion: fix bug with advcheckbox in course completion form
Added the appropriate checks to handle the advcheckbox post data.
2017-03-13 09:21:54 +08:00
AMOS bot b85bdc91d4 Automatically generated installer lang files 2017-03-13 00:04:18 +08:00
Jun Pataleta 39f02182de MDL-57658 calendar: Fix rrulemanager and unit tests
Issues fixed:
* Additional rule validations.
* Rewrote recurrence logic.
* Additional unit tests, especially from the examples in the RFC.
* The date format "YmdThis" results into an incorrect date for the
  "UNTIL" parameter. The literal "T" should be escaped, and a literal
  "Z" is also needed at the end of the format string to indicate UTC.
* Implemented handling of negative modifier values for BYxxx rules.
* Implemented handling of BYWEEKNO, BYYEARDAY, BYSETPOS, BYHOUR,
  BYMINUTE, BYSECOND rules.
2017-03-09 16:11:29 +08:00
Adam Olley fc73f127eb MDL-58160 coursecat: Use set_many to populate category cache
When the course category cache needs to be repopulated, two entries are added
to the cache for each category. In core this is currently done in a for-loop,
resulting in N set calls to the cache (where N is twice the number of
categories in Moodle).

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

For a site with say, 1000 categories, this results in only 1 set call to the
cachestore instead of 2000.
2017-03-06 12:06:13 +10:30
David Mudrák e35a24916f MDL-58114 plugin manager: Fix exception parameters 2017-03-01 15:01:38 +01:00
David Mudrák 36916193d2 MDL-58050 message: Commit the transaction before the early return
If there was no conversation found and the method returned early, the
active transaction was not marked as committable and the error was
reported by the request shutdown handler.

Attaching a unit test for the case just because it did not seem to be
covered. I was trying to reproduce the thrown error in the unit test but
it can't be used in this case. The shutdown handler puts the warning
directly into the error_log and it is not guaranteed where such messages
go (depending on the PHP configuration). And we do not even raise it
during the unit test execution (presumably due to noise it would
produce) anyway.
2017-02-22 14:02:34 +01:00
David Mudrák c85f8d3f93 MDL-58050 message: Fix the DB transaction handling
Consumer code is not supposed to call commit_delegated_transaction()
method directly, this was incorrect usage of the delegated transactions.
2017-02-22 14:02:34 +01:00
Daniel Thee Roperto 4bdc05f059 MDL-57840 libraries: Fixed missing fields in get_users_by_field(). 2017-02-22 16:06:38 +11:00
415 changed files with 11126 additions and 3239 deletions
+29 -1
View File
@@ -2,7 +2,7 @@
# process (which uses our internal CI system) this file is here for the benefit
# of community developers git clones - see MDL-51458.
sudo: false
sudo: required
# We currently disable Travis notifications entirely until https://github.com/travis-ci/travis-ci/issues/4976
# is fixed.
@@ -16,6 +16,12 @@ php:
- 7.1
- 5.6
addons:
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
services:
- redis-server
@@ -70,6 +76,28 @@ cache:
- $HOME/.npm
install:
- sudo apt-get -y install haveged
- sudo service haveged start
- >
if [ "$DB" = 'mysqli' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo stop mysql
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
sudo start mysql
fi
- >
if [ "$DB" = 'pgsql' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo service postgresql stop
sudo mv /var/lib/postgresql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/postgresql /var/lib/postgresql
sudo service postgresql start 9.1
fi
- >
if [ "$TASK" = 'PHPUNIT' ];
then
+1 -1
View File
@@ -89,7 +89,7 @@ if ($PAGE->user_allowed_editing()) {
$savebutton = false;
$outputhtml = '';
foreach ($settingspage->children as $childpage) {
if ($childpage->is_hidden()) {
if ($childpage->is_hidden() || !$childpage->check_access()) {
continue;
}
if ($childpage instanceof admin_externalpage) {
+40 -4
View File
@@ -53,7 +53,7 @@ Options:
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
";
if (!empty($options['collation'])) {
@@ -145,9 +145,22 @@ if (!empty($options['collation'])) {
$skipped++;
} else {
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
echo "CONVERTED\n";
$converted++;
try {
$DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation");
echo "CONVERTED\n";
$converted++;
} catch (ddl_exception $e) {
$result = mysql_set_row_format($table->name, $charset, $collation, $engine);
if ($result) {
echo "CONVERTED\n";
$converted++;
} else {
// We don't know what the problem is. Stop the conversion.
cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this
table and try again.");
die();
}
}
}
$sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL";
@@ -290,3 +303,26 @@ function mysql_get_column_collations($tablename) {
$rs->close();
return $collations;
}
function mysql_set_row_format($tablename, $charset, $collation, $engine) {
global $DB;
$sql = "SELECT row_format
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND table_name = ?";
$rs = $DB->get_record_sql($sql, array($tablename));
if ($rs) {
if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') {
$rowformat = $DB->get_row_format_sql($engine, $collation);
// Try to convert to compressed format and then try updating the collation again.
$DB->change_database_structure("ALTER TABLE $tablename $rowformat");
$DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation");
} else {
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
return false;
}
} else {
return false;
}
return true;
}
+4
View File
@@ -47,6 +47,7 @@ switch ($action) {
// remove from enabled list
$key = array_search($editor, $active_editors);
unset($active_editors[$key]);
add_to_config_log('editor_visibility', '1', '0', $editor);
break;
case 'enable':
@@ -54,6 +55,7 @@ switch ($action) {
if (!in_array($editor, $active_editors)) {
$active_editors[] = $editor;
$active_editors = array_unique($active_editors);
add_to_config_log('editor_visibility', '0', '1', $editor);
}
break;
@@ -66,6 +68,7 @@ switch ($action) {
$fsave = $active_editors[$key];
$active_editors[$key] = $active_editors[$key + 1];
$active_editors[$key + 1] = $fsave;
add_to_config_log('editor_position', $key, $key + 1, $editor);
}
}
break;
@@ -79,6 +82,7 @@ switch ($action) {
$fsave = $active_editors[$key];
$active_editors[$key] = $active_editors[$key - 1];
$active_editors[$key - 1] = $fsave;
add_to_config_log('editor_position', $key, $key - 1, $editor);
}
}
break;
+176
View File
@@ -1905,4 +1905,180 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.3" requires="2.7">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="5.5.31" />
<VENDOR name="mysql" version="5.5.31" />
<VENDOR name="postgres" version="9.3" />
<VENDOR name="mssql" version="10.0" />
<VENDOR name="oracle" version="10.2" />
</DATABASE>
<PHP version="5.6.5" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="required">
<FEEDBACK>
<ON_ERROR message="opensslrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="optional">
<FEEDBACK>
<ON_CHECK message="intlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
<PHP_EXTENSION name="fileinfo" level="required"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
<FEEDBACK>
<ON_CHECK message="ishttpswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
<FEEDBACK>
<ON_CHECK message="incompleteunicodesupport" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+3 -3
View File
@@ -232,7 +232,7 @@ class site_registration_form extends moodleform {
}
$language = get_config('hub', 'site_language_' . $cleanhuburl);
if ($language === false) {
$language = current_language();
$language = explode('_', current_language())[0];
}
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
@@ -422,12 +422,12 @@ class site_registration_form extends moodleform {
$mform->addElement('checkbox', 'badges', '',
" " . get_string('badgesnumber', 'hub', $badges));
$mform->setDefault('badges', $badgesnumber != -1);
$mform->setType('resources', PARAM_INT);
$mform->setType('badges', PARAM_INT);
$mform->addElement('checkbox', 'issuedbadges', '',
" " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
$mform->setDefault('issuedbadges', $issuedbadgesnumber != -1);
$mform->setType('resources', PARAM_INT);
$mform->setType('issuedbadges', PARAM_INT);
$mform->addElement('checkbox', 'participantnumberaverage', '',
" " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
+1 -1
View File
@@ -1612,7 +1612,7 @@ class core_admin_renderer extends plugin_renderer_base {
$row = new html_table_row();
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name, null)) {
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'icon pluginicon'));
} else {
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
+2 -1
View File
@@ -179,7 +179,8 @@ preferences,moodle|/user/preferences.php|preferences',
'idnumber' => new lang_string('sort_idnumber', 'admin'),
);
$temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
$temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 0));
+1
View File
@@ -325,6 +325,7 @@ if ($verbose || $status) {
}
// Update status after auto-rerun finished.
$status = 0;
foreach ($exitcodes as $name => $exitcode) {
if ($exitcode) {
if (!empty($parallelrun)) {
@@ -0,0 +1,42 @@
@tool @tool_behat
Feature: Backported behat step definitions
In order to provide feature file compatibility between multiple Moodle versions
As a developer
I need to be able to use backported steps from newer Moodle versiosn
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C101 | topics |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C101 | student |
| teacher1 | C101 | editingteacher |
Scenario: I am on the course homepage
When I log in as "student1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
@javascript
Scenario: I am on the course homepage with JS
When I log in as "teacher1"
And I am on "Course 1" course homepage
Then I should see "Topic 1"
Scenario: I am on the course homepage with editing
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Then I should see "Topic 1"
And I should see "Add an activity or resource"
@javascript
Scenario: I am on the course homepage with editing and JS
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Then I should see "Topic 1"
And I should see "Add an activity or resource"
@@ -31,7 +31,7 @@ $string['delete_confirmation'] = 'Are you absolutely sure you want to remove <st
$string['deletea'] = 'Delete {$a}';
$string['deletefiletypes'] = 'Delete a file type';
$string['description'] = 'Custom description';
$string['description_help'] = 'Simple file type description, e.g. &lsquo;Kindle ebook&rsquo;. If your site supports multiple languages and uses the multi-language filter, you can enter multi-language tags in this field to supply a description in different languages.';
$string['description_help'] = 'Simple file type description, e.g. \'Kindle ebook\'. If your site supports multiple languages and uses the multi-language filter, you can enter multi-language tags in this field to supply a description in different languages.';
$string['descriptiontype'] = 'Description type';
$string['descriptiontype_help'] = 'There are three possible ways to specify a description.
@@ -49,15 +49,15 @@ $string['error_defaulticon'] = 'Another file extension with the same MIME type i
$string['error_extension'] = 'The file type extension <strong>{$a}</strong> already exists or is invalid. File extensions must be unique and must not contain special characters.';
$string['error_notfound'] = 'The file type with extension {$a} cannot be found.';
$string['extension'] = 'Extension';
$string['extension_help'] = 'File name extension without the dot, e.g. &lsquo;mobi&rsquo;';
$string['extension_help'] = 'File name extension without the dot, e.g. \'mobi\'';
$string['groups'] = 'Type groups';
$string['groups_help'] = 'Optional list of file type groups that this type belongs to. These are generic categories such as &lsquo;document&rsquo; and &lsquo;image&rsquo;.';
$string['groups_help'] = 'Optional list of file type groups that this type belongs to. These are generic categories such as \'document\' and \'image\'.';
$string['icon'] = 'File icon';
$string['icon_help'] = 'Icon filename.
The list of icons is taken from the /pix/f directory inside your Moodle installation. You can add custom icons to this folder if required.';
$string['mimetype'] = 'MIME type';
$string['mimetype_help'] = 'MIME type associated with this file type, e.g. &lsquo;application/x-mobipocket-ebook&rsquo;';
$string['mimetype_help'] = 'MIME type associated with this file type, e.g. \'application/x-mobipocket-ebook\'';
$string['pluginname'] = 'File types';
$string['revert'] = 'Restore {$a} to Moodle defaults';
$string['revert_confirmation'] = 'Are you sure you want to restore <strong>.{$a}</strong> to Moodle defaults, discarding your changes?';
+6 -4
View File
@@ -40,7 +40,7 @@ if (empty($CFG->langotherroot)) {
$mode = optional_param('mode', 0, PARAM_INT); // action
$pack = optional_param_array('pack', array(), PARAM_SAFEDIR); // pack to install
$uninstalllang = optional_param_array('uninstalllang', array(), PARAM_LANG);// installed pack to uninstall
$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_ALPHAEXT); // uninstallation confirmation
$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_SAFEPATH); // uninstallation confirmation
$purgecaches = optional_param('purgecaches', false, PARAM_BOOL); // explicit caches reset
if ($purgecaches) {
@@ -74,7 +74,7 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co
// Actually deleting languages, languages to delete are passed as GET parameter as string
// ...need to populate them to array.
if (empty($uninstalllang)) {
$uninstalllang = explode('-', $confirmtounistall);
$uninstalllang = explode('/', $confirmtounistall);
}
if (in_array('en', $uninstalllang)) {
@@ -84,8 +84,10 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co
} else if (empty($confirmtounistall) and confirm_sesskey()) { // User chose langs to be deleted, show confirmation.
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('uninstallconfirm', 'tool_langimport', implode(', ', $uninstalllang)),
'index.php?mode='.DELETION_OF_SELECTED_LANG.'&confirmtouninstall='.implode('-', $uninstalllang),
'index.php');
new moodle_url($PAGE->url, array(
'mode' => DELETION_OF_SELECTED_LANG,
'confirmtouninstall' => implode('/', $uninstalllang),
)), $PAGE->url);
echo $OUTPUT->footer();
die;
@@ -84,8 +84,7 @@ abstract class restore_tool_log_logstore_subplugin extends restore_subplugin {
}
}
// Roll dates.
$data->timecreated = $this->apply_date_offset($data->timecreated);
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
// Revert other to its original php way.
$data->other = unserialize(base64_decode($data->other));
@@ -88,6 +88,7 @@ class store implements \tool_log\log\writer, \core\log\sql_reader {
$dboptions['dbport'] = $this->get_config('dbport', '');
$dboptions['dbschema'] = $this->get_config('dbschema', '');
$dboptions['dbcollation'] = $this->get_config('dbcollation', '');
$dboptions['dbhandlesoptions'] = $this->get_config('dbhandlesoptions', false);
try {
$db->connect($this->get_config('dbhost'), $this->get_config('dbuser'), $this->get_config('dbpass'),
$this->get_config('dbname'), false, $dboptions);
@@ -31,6 +31,8 @@ $string['databasesettings_help'] = 'Connection details for the external log data
$string['databasepersist'] = 'Persistent database connections';
$string['databaseschema'] = 'Database schema';
$string['databasecollation'] = 'Database collation';
$string['databasehandlesoptions'] = 'Database handles options';
$string['databasehandlesoptions_help'] = 'Does the remote database handle its own options.';
$string['databasetable'] = 'Database table';
$string['databasetable_help'] = 'Name of the table where logs will be stored. This table should have a structure identical to the one used by logstore_standard (mdl_logstore_standard_log).';
$string['includeactions'] = 'Include actions of these types';
@@ -54,6 +54,8 @@ if ($hassiteconfig) {
'logstore_database'), '', ''));
$settings->add(new admin_setting_configtext('logstore_database/dbcollation', get_string('databasecollation',
'logstore_database'), '', ''));
$settings->add(new admin_setting_configcheckbox('logstore_database/dbhandlesoptions', get_string('databasehandlesoptions',
'logstore_database'), get_string('databasehandlesoptions_help', 'logstore_database'), '0'));
$settings->add(new admin_setting_configtext('logstore_database/buffersize', get_string('buffersize',
'logstore_database'), get_string('buffersize_help', 'logstore_database'), 50));
@@ -64,6 +64,7 @@ $dboptions['dbsocket'] = get_config('logstore_database', 'dbsocket');
$dboptions['dbport'] = get_config('logstore_database', 'dbport');
$dboptions['dbschema'] = get_config('logstore_database', 'dbschema');
$dboptions['dbcollation'] = get_config('logstore_database', 'dbcollation');
$dboptions['dbhandlesoptions'] = get_config('logstore_database', 'dbhandlesoptions');
try {
$db->connect(get_config('logstore_database', 'dbhost'), get_config('logstore_database', 'dbuser'),
@@ -83,6 +83,11 @@ class logstore_database_store_testcase extends advanced_testcase {
} else {
set_config('dbcollation', '', 'logstore_database');
}
if (!empty($CFG->dboptions['dbhandlesoptions'])) {
set_config('dbhandlesoptions', $CFG->dboptions['dbhandlesoptions'], 'logstore_database');
} else {
set_config('dbhandlesoptions', false, 'logstore_database');
}
// Enable logging plugin.
set_config('enabled_stores', 'logstore_database', 'tool_log');
+11
View File
@@ -0,0 +1,11 @@
This files describes API changes in the logstore_database code.
=== 3.2.4 ===
* PostgreSQL connections now use advanced options to reduce connection overhead. These options are not compatible
with some connection poolers. The dbhandlesoptions parameter has been added to allow the database to configure the
required defaults. The parameters that are required in the database are;
ALTER DATABASE moodle SET client_encoding = UTF8;
ALTER DATABASE moodle SET standard_conforming_strings = on;
ALTER DATABASE moodle SET search_path = 'moodle,public'; -- Optional, if you wish to use a custom schema.
You can set these options against the database or the moodle user who connects.
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016120500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2016120501; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2016112900; // Requires this Moodle version.
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
@@ -51,7 +51,7 @@
</div>
</div>
<div data-region="footer" class="pull-xs-right">
<input type="button" data-action="rate" value="{{#str}}rate, tool_lp{{/str}}" class="btn btn-primary">
<button data-action="rate" class="btn btn-primary">{{#str}}rate, tool_lp{{/str}}</button>
<button data-action="cancel" class="btn btn-secondary">{{#str}}cancel{{/str}}</button>
</div>
<div class="clearfix"></div>
@@ -60,7 +60,7 @@
<div data-region="rule-base" class="form">
<div data-region="rule-outcome" class="form-group">
<label>{{#str}}outcome, tool_lp{{/str}}</label>
<select name="outcome" class="custom-select" ng-label="{{#str}}outcome, tool_lp{{/str}}">
<select name="outcome" class="custom-select">
{{#outcomes}}
<option value="{{code}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/outcomes}}
@@ -68,7 +68,7 @@
</div>
<div data-region="rule-type" class="form-group">
<label>{{#str}}when, tool_lp{{/str}}</label>
<select name="rule" class="custom-select" ng-label="{{#str}}when, tool_lp{{/str}}">
<select name="rule" class="custom-select">
<option value="-1">{{#str}}choosedots{{/str}}</option>
{{#rules}}
<option value="{{type}}" {{#selected}}selected{{/selected}}>{{name}}</option>
@@ -81,10 +81,11 @@
{{/config}}
</div>
<div data-region="footer" class="pull-xs-right">
<div data-region="footer" class="pull-xs-right m-t-1">
{{#config}}
<input type="button" class="btn btn-primary" data-action="save" value="{{#str}}savechanges{{/str}}"/>
{{/config}}
<input type="button" class="btn btn-secondary" data-action="cancel" value="{{#str}}cancel{{/str}}"/>
</div>
<div class="clearfix"></div>
</div>
@@ -1012,7 +1012,7 @@ class manager {
$messageparams = new \stdClass();
$messageparams->html = $message->html;
$messageparams->plain = $message->plain;
$messagepreferencesurl = new \moodle_url("/message/edit.php", array('id' => $USER->id));
$messagepreferencesurl = new \moodle_url("/message/notificationpreferences.php", array('id' => $USER->id));
$messageparams->messagepreferencesurl = $messagepreferencesurl->out();
$htmlmessage = get_string('messageprocessingsuccesshtml', 'tool_messageinbound', $messageparams);
$plainmessage = get_string('messageprocessingsuccess', 'tool_messageinbound', $messageparams);
+12 -2
View File
@@ -57,6 +57,13 @@ class api {
global $CFG;
require_once($CFG->libdir . '/adminlib.php');
// Check if we can return this from cache.
$cache = \cache::make('tool_mobile', 'plugininfo');
$pluginsinfo = $cache->get('mobileplugins');
if ($pluginsinfo !== false) {
return (array)$pluginsinfo;
}
$pluginsinfo = [];
$plugintypes = core_component::get_plugin_types();
@@ -68,7 +75,7 @@ class api {
$component = $plugintype . '_' . $plugin;
$version = get_component_version($component);
require_once("$path/db/mobile.php");
require("$path/db/mobile.php");
foreach ($addons as $addonname => $addoninfo) {
$plugininfo = array(
'component' => $component,
@@ -81,7 +88,7 @@ class api {
);
// All the mobile packages must be under the plugin mobile directory.
$package = $path . DIRECTORY_SEPARATOR . 'mobile' . DIRECTORY_SEPARATOR . $addonname . '.zip';
$package = $path . '/mobile/' . $addonname . '.zip';
if (file_exists($package)) {
$plugininfo['fileurl'] = $CFG->wwwroot . '' . str_replace($CFG->dirroot, '', $package);
$plugininfo['filehash'] = sha1_file($package);
@@ -91,6 +98,9 @@ class api {
}
}
}
$cache->set('mobileplugins', $pluginsinfo);
return $pluginsinfo;
}
+34
View File
@@ -0,0 +1,34 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Mobile cache definitions.
*
* @package tool_mobile
* @copyright 2017 Skylar Kelty <S.Kelty@kent.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$definitions = array(
'plugininfo' => array(
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'staticacceleration' => true,
'staticaccelerationsize' => 1
)
);
@@ -24,6 +24,7 @@
$string['autologinkeygenerationlockout'] = 'Auto-login key generation is blocked because of too many requests within an hour.';
$string['autologinnotallowedtoadmins'] = 'Auto-login is not allowed for site admins.';
$string['cachedef_plugininfo'] = 'This stores the list of plugins with mobile addons';
$string['clickheretolaunchtheapp'] = 'Click here if the app does not open automatically.';
$string['configmobilecssurl'] = 'A CSS file to customise your mobile app interface.';
$string['enablesmartappbanners'] = 'Enable Smart App Banners';
@@ -70,6 +70,9 @@ class api {
// Look at all the templates dirs for subsystems.
$subsystems = core_component::get_core_subsystems();
foreach ($subsystems as $subsystem => $dir) {
if (empty($dir)) {
continue;
}
$dir .= '/templates';
if (is_dir($dir)) {
$dirs = mustache_template_finder::get_template_directories_for_component('core_' . $subsystem, $themename);
+1 -1
View File
@@ -49,7 +49,7 @@ It\'s highly recommended to be running the latest (+ version) available of your
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmcheckforeignkeys'] = 'This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.)
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes.
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search for potential violations of the foreign keys.
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmcheckindexes'] = 'This functionality will search for potential missing indexes in your Moodle server, generating (but not executing!) automatically the needed SQL statements to keep everything updated.
+12 -12
View File
@@ -3187,6 +3187,18 @@ class CAS_Client
false/*$no_response*/, true/*$bad_response*/, $text_response
);
$result = false;
} else if ( $tree_response->getElementsByTagName("authenticationFailure")->length != 0) {
// authentication failed, extract the error code and message and throw exception
$auth_fail_list = $tree_response
->getElementsByTagName("authenticationFailure");
throw new CAS_AuthenticationException(
$this, 'Ticket not validated', $validate_url,
false/*$no_response*/, false/*$bad_response*/,
$text_response,
$auth_fail_list->item(0)->getAttribute('code')/*$err_code*/,
trim($auth_fail_list->item(0)->nodeValue)/*$err_msg*/
);
$result = false;
} else if ($tree_response->getElementsByTagName("authenticationSuccess")->length != 0) {
// authentication succeded, extract the user name
$success_elements = $tree_response
@@ -3227,18 +3239,6 @@ class CAS_Client
$result = true;
}
}
} else if ( $tree_response->getElementsByTagName("authenticationFailure")->length != 0) {
// authentication succeded, extract the error code and message
$auth_fail_list = $tree_response
->getElementsByTagName("authenticationFailure");
throw new CAS_AuthenticationException(
$this, 'Ticket not validated', $validate_url,
false/*$no_response*/, false/*$bad_response*/,
$text_response,
$auth_fail_list->item(0)->getAttribute('code')/*$err_code*/,
trim($auth_fail_list->item(0)->nodeValue)/*$err_msg*/
);
$result = false;
} else {
throw new CAS_AuthenticationException(
$this, 'Ticket not validated', $validate_url,
+1
View File
@@ -2,3 +2,4 @@ Description of phpCAS 1.3.4 library import
* downloaded from http://downloads.jasig.org/cas-clients/php/current/
* MDL-59456 phpCAS library has been patched because of an authentication bypass security vulnerability.
+1 -1
View File
@@ -143,7 +143,7 @@ class login implements renderable, templatable {
$data->error = $this->error;
$data->forgotpasswordurl = $this->forgotpasswordurl->out(false);
$data->hasidentityproviders = !empty($this->identityproviders);
$data->hasinstructions = !empty($this->instructions);
$data->hasinstructions = !empty($this->instructions) || $this->cansignup;
$data->identityproviders = $identityproviders;
list($data->instructions, $data->instructionsformat) = external_format_text($this->instructions, FORMAT_MOODLE,
context_system::instance()->id);
+9 -9
View File
@@ -276,7 +276,7 @@ class auth_plugin_ldap extends auth_plugin_base {
}
$ldapval = NULL;
foreach ($values as $value) {
$entry = array_change_key_case($user_entry[0], CASE_LOWER);
$entry = $user_entry[0];
if (($value == 'dn') || ($value == 'distinguishedname')) {
$result[$key] = $user_dn;
continue;
@@ -634,7 +634,7 @@ class auth_plugin_ldap extends auth_plugin_base {
if ($sr) {
$info = ldap_get_entries_moodle($ldapconnection, $sr);
if (!empty ($info)) {
$info = array_change_key_case($info[0], CASE_LOWER);
$info = $info[0];
if (isset($info[$this->config->expireattr][0])) {
$expiretime = $this->ldap_expirationtime2unix($info[$this->config->expireattr][0], $ldapconnection, $user_dn);
if ($expiretime != 0) {
@@ -1201,7 +1201,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return false;
}
$user_entry = array_change_key_case($user_entry[0], CASE_LOWER);
$user_entry = $user_entry[0];
foreach ($attrmap as $key => $ldapkeys) {
$profilefield = '';
@@ -1369,7 +1369,7 @@ class auth_plugin_ldap extends auth_plugin_base {
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
if ($sr) {
$entry = ldap_get_entries_moodle($ldapconnection, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$newattrs = array();
if (!empty($info[$this->config->expireattr][0])) {
// Set expiration time only if passwordExpirationInterval is defined
@@ -2024,7 +2024,7 @@ class auth_plugin_ldap extends auth_plugin_base {
}
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$useraccountcontrol = $info['useraccountcontrol'][0];
if ($useraccountcontrol & UF_DONT_EXPIRE_PASSWD) {
// Password doesn't expire.
@@ -2069,17 +2069,17 @@ class auth_plugin_ldap extends auth_plugin_base {
}
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$domaindn = $info['defaultnamingcontext'][0];
$sr = ldap_read ($ldapconn, $domaindn, '(objectClass=*)',
array('maxPwdAge'));
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$maxpwdage = $info['maxpwdage'][0];
if ($sr = ldap_read($ldapconn, $user_dn, '(objectClass=*)', array('msDS-ResultantPSO'))) {
if ($entry = ldap_get_entries_moodle($ldapconn, $sr)) {
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$userpso = $info['msds-resultantpso'][0];
// If a PSO exists, FGPP is being utilized.
@@ -2087,7 +2087,7 @@ class auth_plugin_ldap extends auth_plugin_base {
if (!empty($userpso)) {
$sr = ldap_read($ldapconn, $userpso, '(objectClass=*)', array('msDS-MaximumPasswordAge'));
if ($entry = ldap_get_entries_moodle($ldapconn, $sr)) {
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
// Default value of msds-maximumpasswordage is 42 and is always set.
$maxpwdage = $info['msds-maximumpasswordage'][0];
}
+5 -4
View File
@@ -26,13 +26,14 @@ if (!is_enabled_auth('shibboleth')) {
$inputstream = file_get_contents("php://input");
if ($action == 'logout' && !empty($redirect)) {
if ($USER->auth == 'shibboleth') {
// Logout out user from application.
if (isloggedin($USER) && $USER->auth == 'shibboleth') {
// Logout user from application.
require_logout();
// Finally, send user to the return URL.
redirect($redirect);
}
// Finally, send user to the return URL.
redirect($redirect);
} else if (!empty($inputstream)) {
// Back channel logout.
+11
View File
@@ -15,6 +15,17 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script is used to configure and execute the backup proccess.
*
* @package core
* @subpackage backup
* @copyright Moodle
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php');
+26
View File
@@ -1,5 +1,31 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script is used to configure and execute the import proccess.
*
* @package core
* @subpackage backup
* @copyright Moodle
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
// Require both the backup and restore libs
require_once('../config.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
+8
View File
@@ -869,6 +869,14 @@ class backup_calendarevents_structure_step extends backup_structure_step {
AND (eventtype = 'course' OR eventtype = 'group')";
$calendar_items_params = array('courseid'=>backup::VAR_COURSEID);
$event->set_source_sql($calendar_items_sql, $calendar_items_params);
} else if ($this->name == 'activity_calendar') {
$params = array('instance' => backup::VAR_ACTIVITYID, 'modulename' => backup::VAR_MODNAME);
// If we don't want to include the userinfo in the backup then setting the courseid
// will filter out all of the user override events (which have a course id of zero).
if (!$this->get_setting_value('userinfo')) {
$params['courseid'] = backup::VAR_COURSEID;
}
$event->set_source_table('event', $params);
} else {
$event->set_source_table('event', array('courseid' => backup::VAR_COURSEID, 'instance' => backup::VAR_ACTIVITYID, 'modulename' => backup::VAR_MODNAME));
}
+20 -4
View File
@@ -2632,6 +2632,17 @@ class restore_calendarevents_structure_step extends restore_structure_step {
$data = (object)$data;
$oldid = $data->id;
$restorefiles = true; // We'll restore the files
// User overrides for activities are identified by having a courseid of zero with
// both a modulename and instance value set.
$isuseroverride = !$data->courseid && $data->modulename && $data->instance;
// If we don't want to include user data and this record is a user override event
// for an activity then we should not create it. (Only activity events can be user override events - which must have this
// setting).
if ($isuseroverride && $this->task->setting_exists('userinfo') && !$this->task->get_setting_value('userinfo')) {
return;
}
// Find the userid and the groupid associated with the event.
$data->userid = $this->get_mappingid('user', $data->userid);
if ($data->userid === false) {
@@ -2667,7 +2678,9 @@ class restore_calendarevents_structure_step extends restore_structure_step {
'name' => $data->name,
'description' => $data->description,
'format' => $data->format,
'courseid' => $this->get_courseid(),
// User overrides in activities use a course id of zero. All other event types
// must use the mapped course id.
'courseid' => $data->courseid ? $this->get_courseid() : 0,
'groupid' => $data->groupid,
'userid' => $data->userid,
'repeatid' => $this->get_mappingid('event', $data->repeatid),
@@ -2689,10 +2702,11 @@ class restore_calendarevents_structure_step extends restore_structure_step {
WHERE " . $DB->sql_compare_text('name', 255) . " = " . $DB->sql_compare_text('?', 255) . "
AND courseid = ?
AND modulename = ?
AND instance = ?
AND timestart = ?
AND timeduration = ?
AND " . $DB->sql_compare_text('description', 255) . " = " . $DB->sql_compare_text('?', 255);
$arg = array ($params['name'], $params['courseid'], $params['modulename'], $params['timestart'], $params['timeduration'], $params['description']);
$arg = array ($params['name'], $params['courseid'], $params['modulename'], $params['instance'], $params['timestart'], $params['timeduration'], $params['description']);
$result = $DB->record_exists_sql($sql, $arg);
if (empty($result)) {
$newitemid = $DB->insert_record('event', $params);
@@ -3045,7 +3059,8 @@ class restore_course_logs_structure_step extends restore_structure_step {
$data = (object)($data);
$data->time = $this->apply_date_offset($data->time);
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
$data->userid = $this->get_mappingid('user', $data->userid);
$data->course = $this->get_courseid();
$data->cmid = 0;
@@ -3092,7 +3107,8 @@ class restore_activity_logs_structure_step extends restore_course_logs_structure
$data = (object)($data);
$data->time = $this->apply_date_offset($data->time);
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
$data->userid = $this->get_mappingid('user', $data->userid);
$data->course = $this->get_courseid();
$data->cmid = $this->task->get_moduleid();
@@ -0,0 +1,99 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests for backup_xml_transformer class.
*
* @package core_backup
* @subpackage moodle2
* @category backup
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php');
/**
* Tests for backup_xml_transformer.
*
* @package core_backup
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_xml_transformer_testcase extends advanced_testcase {
/**
* Initial set up.
*/
public function setUp() {
parent::setUp();
$this->resetAfterTest(true);
}
/**
* Data provider for ::test_filephp_links_replace.
*
* @return array
*/
public function filephp_links_replace_data_provider() {
return array(
array('http://test.test/', 'http://test.test/'),
array('http://test.test/file.php/1', 'http://test.test/file.php/1'),
array('http://test.test/file.php/2/1.jpg', 'http://test.test/file.php/2/1.jpg'),
array('http://test.test/file.php/2', 'http://test.test/file.php/2'),
array('http://test.test/file.php/1/1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php/1//1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=/1', '$@FILEPHP@$'),
array('http://test.test/file.php?file=/2/1.jpg', 'http://test.test/file.php?file=/2/1.jpg'),
array('http://test.test/file.php?file=/2', 'http://test.test/file.php?file=/2'),
array('http://test.test/file.php?file=/1/1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=/1//1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2f1', '$@FILEPHP@$'),
array('http://test.test/file.php?file=%2f2%2f1.jpg', 'http://test.test/file.php?file=%2f2%2f1.jpg'),
array('http://test.test/file.php?file=%2f2', 'http://test.test/file.php?file=%2f2'),
array('http://test.test/file.php?file=%2f1%2f1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2f1%2f%2f1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2F1', '$@FILEPHP@$'),
array('http://test.test/file.php?file=%2F2%2F1.jpg', 'http://test.test/file.php?file=%2F2%2F1.jpg'),
array('http://test.test/file.php?file=%2F2', 'http://test.test/file.php?file=%2F2'),
array('http://test.test/file.php?file=%2F1%2F1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2F1%2F%2F1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
);
}
/**
* Test that backup_xml_transformer replaces file php links to $@FILEPHP@$.
*
* @dataProvider filephp_links_replace_data_provider
* @param string $content Testing content.
* @param string $expected Expected result.
*/
public function test_filephp_links_replace($content, $expected) {
global $CFG;
$CFG->wwwroot = 'http://test.test';
$transformer = new backup_xml_transformer(1);
$this->assertEquals($expected, $transformer->process($content));
}
}
+25 -1
View File
@@ -1,5 +1,29 @@
<?php
//This script is used to configure and execute the restore proccess.
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script is used to configure and execute the restore proccess.
*
* @package core
* @subpackage backup
* @copyright Moodle
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
@@ -60,17 +60,26 @@ class restore_structure_parser_processor extends grouped_parser_processor {
} else if (strpos($cdata, '$@FILEPHP@$') === false) { // No $@FILEPHP@$, nothing to convert
return $cdata;
}
if ($CFG->slasharguments) {
$slash = '/';
$forcedownload = '?forcedownload=1';
} else {
$slash = '%2F';
$forcedownload = '&amp;forcedownload=1';
}
// We have to remove trailing slashes, otherwise file URLs will be restored with an extra slash.
$basefileurl = rtrim(moodle_url::make_legacyfile_url($this->courseid, null)->out(true), $slash);
// Decode file.php calls
$search = array ("$@FILEPHP@$");
$replace = array(moodle_url::make_legacyfile_url($this->courseid, null));
$replace = array($basefileurl);
$result = str_replace($search, $replace, $cdata);
// Now $@SLASH@$ and $@FORCEDOWNLOAD@$ MDL-18799
$search = array('$@SLASH@$', '$@FORCEDOWNLOAD@$');
if ($CFG->slasharguments) {
$replace = array('/', '?forcedownload=1');
} else {
$replace = array('%2F', '&amp;forcedownload=1');
}
$replace = array($slash, $forcedownload);
return str_replace($search, $replace, $result);
}
@@ -0,0 +1,132 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Tests for restore_structure_parser_processor class.
*
* @package core_backup
* @category test
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/util/helper/restore_structure_parser_processor.class.php');
/**
* Tests for restore_structure_parser_processor class.
*
* @package core_backup
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_structure_parser_processor_test extends advanced_testcase {
/**
* Initial set up.
*/
public function setUp() {
parent::setUp();
$this->resetAfterTest(true);
}
/**
* Data provider for ::test_process_cdata.
*
* @return array
*/
public function process_cdata_data_provider() {
return array(
array(null, null, true),
array("$@NULL@$", null, true),
array("$@NULL@$ ", "$@NULL@$ ", true),
array(1, 1, true),
array(" ", " ", true),
array("1", "1", true),
array("$@FILEPHP@$1.jpg", "$@FILEPHP@$1.jpg", true),
array(
"http://test.test/$@SLASH@$",
"http://test.test/$@SLASH@$",
true
),
array(
"<a href='$@FILEPHP@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php/11.jpg'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php/1/1.jpg'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php/1//1.jpg'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php?file=%2F11.jpg'>Image</a>",
false
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php?file=%2F1%2F1.jpg'>Image</a>",
false
),
array(
"<a href='$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php?file=%2F1%2F%2F1.jpg'>Image</a>",
false
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg$@FORCEDOWNLOAD@$'>Image</a>",
"<a href='http://test.test/file.php/1/1.jpg?forcedownload=1'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg$@FORCEDOWNLOAD@$'>Image</a>",
"<a href='http://test.test/file.php?file=%2F1%2F1.jpg&amp;forcedownload=1'>Image</a>",
false
),
);
}
/**
* Test that restore_structure_parser_processor replaces $@FILEPHP@$ to correct file php links.
*
* @dataProvider process_cdata_data_provider
* @param string $content Testing content.
* @param string $expected Expected result.
* @param bool $slasharguments A value for $CFG->slasharguments setting.
*/
public function test_process_cdata($content, $expected, $slasharguments) {
global $CFG;
$CFG->slasharguments = $slasharguments;
$CFG->wwwroot = 'http://test.test';
$processor = new restore_structure_parser_processor(1, 1);
$this->assertEquals($expected, $processor->process_cdata($content));
}
}
+42 -25
View File
@@ -46,23 +46,6 @@ class edit_backpack_form extends moodleform {
$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
$mform->addElement('static', 'url', get_string('url'), BADGE_BACKPACKURL);
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
array('class' => 'notconnected', 'id' => 'connection-status'));
$mform->addElement('static', 'status', get_string('status'), $status);
$nojs = html_writer::tag('noscript', get_string('error:personaneedsjs', 'badges'),
array('class' => 'notconnected'));
$personadiv = $OUTPUT->container($nojs, null, 'persona-container');
$mform->addElement('static', 'persona', '', $personadiv);
$mform->addHelpButton('persona', 'personaconnection', 'badges');
$PAGE->requires->js(new moodle_url('https://login.persona.org/include.js'));
$PAGE->requires->js('/badges/backpack.js');
$PAGE->requires->js_init_call('badges_init_persona_login_button', null, false);
$PAGE->requires->strings_for_js(array('error:backpackloginfailed', 'signinwithyouremail',
'error:noassertion', 'error:connectionunknownreason', 'error:badjson', 'connecting',
'notconnected'), 'badges');
$mform->addElement('hidden', 'userid', $USER->id);
$mform->setType('userid', PARAM_INT);
@@ -70,23 +53,57 @@ class edit_backpack_form extends moodleform {
$mform->addElement('hidden', 'backpackurl', BADGE_BACKPACKURL);
$mform->setType('backpackurl', PARAM_URL);
if (isset($this->_customdata['email'])) {
// Email will be passed in when we're in the process of verifying the user's email address,
// so set the connection status, lock the email field, and provide options to resend the verification
// email or cancel the verification process entirely and start over.
$status = html_writer::tag('span', get_string('backpackemailverificationpending', 'badges'),
array('class' => 'notconnected', 'id' => 'connection-status'));
$mform->addElement('static', 'status', get_string('status'), $status);
$mform->addElement('hidden', 'email', $this->_customdata['email']);
$mform->setType('email', PARAM_RAW_TRIMMED);
$mform->hardFreeze(['email']);
$status = html_writer::tag('span', $this->_customdata['email'], []);
$mform->addElement('static', 'emailverify', get_string('email'), $status);
$buttonarray = [];
$buttonarray[] = &$mform->createElement('submit', 'submitbutton',
get_string('backpackconnectionresendemail', 'badges'));
$buttonarray[] = &$mform->createElement('submit', 'revertbutton',
get_string('backpackconnectioncancelattempt', 'badges'));
$mform->addGroup($buttonarray, 'buttonar', '', [''], false);
$mform->closeHeaderBefore('buttonar');
} else {
// Email isn't present, so provide an input element to get it and a button to start the verification process.
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
array('class' => 'notconnected', 'id' => 'connection-status'));
$mform->addElement('static', 'status', get_string('status'), $status);
$mform->addElement('text', 'email', get_string('email'), 'maxlength="100" size="30"');
$mform->addHelpButton('email', 'backpackemail', 'badges');
$mform->addRule('email', get_string('required'), 'required', null, 'client');
$mform->setType('email', PARAM_RAW_TRIMMED);
$this->add_action_buttons(false, get_string('backpackconnectionconnect', 'badges'));
}
}
/**
* Validates form data
*/
public function validation($data, $files) {
global $DB;
$errors = parent::validation($data, $files);
$check = new stdClass();
$check->backpackurl = $data['backpackurl'];
$check->email = $data['email'];
// We don't need to verify the email address if we're clearing a pending email verification attempt.
if (!isset($data['revertbutton'])) {
$check = new stdClass();
$check->backpackurl = $data['backpackurl'];
$check->email = $data['email'];
$bp = new OpenBadgesBackpackHandler($check);
$request = $bp->curl_request('user');
if (isset($request->status) && $request->status == 'missing') {
$errors['email'] = get_string('error:nosuchuser', 'badges');
$bp = new OpenBadgesBackpackHandler($check);
$request = $bp->curl_request('user');
if (isset($request->status) && $request->status == 'missing') {
$errors['email'] = get_string('error:nosuchuser', 'badges');
} else if (!isset($request->status) || $request->status !== 'okay') {
$errors['email'] = get_string('backpackconnectionunexpectedresult', 'badges');
}
}
return $errors;
}
+78
View File
@@ -0,0 +1,78 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Endpoint for the verification email link.
*
* @package core
* @subpackage badges
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(__DIR__ . '/../config.php');
require_once($CFG->libdir . '/badgeslib.php');
require_once(__DIR__ . '/lib/backpacklib.php');
$data = optional_param('data', '', PARAM_RAW);
require_login();
$PAGE->set_url('/badges/openbackpackemailverify.php');
$PAGE->set_context(context_user::instance($USER->id));
$redirect = '/badges/mybackpack.php';
// Confirm the secret and create the backpack connection.
$storedsecret = get_user_preferences('badges_email_verify_secret');
if (!is_null($storedsecret)) {
if ($data === $storedsecret) {
$storedemail = get_user_preferences('badges_email_verify_address');
$data = new stdClass();
$data->backpackurl = BADGE_BACKPACKURL;
$data->email = $storedemail;
$bp = new OpenBadgesBackpackHandler($data);
// Make sure we have all the required information before trying to save the connection.
$backpackuser = $bp->curl_request('user');
if (isset($backpackuser->status) && $backpackuser->status === 'okay' && isset($backpackuser->userId)) {
$backpackuid = $backpackuser->userId;
} else {
redirect(new moodle_url($redirect), get_string('backpackconnectionunexpectedresult', 'badges'),
null, \core\output\notification::NOTIFY_ERROR);
}
$obj = new stdClass();
$obj->userid = $USER->id;
$obj->email = $data->email;
$obj->backpackurl = $data->backpackurl;
$obj->backpackuid = $backpackuid;
$obj->autosync = 0;
$obj->password = '';
$DB->insert_record('badge_backpack', $obj);
// Remove the verification vars and redirect to the mypackpack page.
unset_user_preference('badges_email_verify_secret');
unset_user_preference('badges_email_verify_address');
redirect(new moodle_url($redirect), get_string('backpackemailverifysuccess', 'badges'),
null, \core\output\notification::NOTIFY_SUCCESS);
} else {
// Stored secret doesn't match the supplied secret. Take user back to the mybackpack page and present a warning message.
redirect(new moodle_url($redirect), get_string('backpackemailverifytokenmismatch', 'badges'),
null, \core\output\notification::NOTIFY_ERROR);
}
} else {
// Stored secret is null. Either the email address has already been verified, or there is no record of a verification attempt
// for the current user. Either way, just redirect to the mybackpack page.
redirect(new moodle_url($redirect));
}
+42
View File
@@ -117,3 +117,45 @@ class OpenBadgesBackpackHandler {
return $this->backpack;
}
}
/**
* Create and send a verification email to the email address supplied.
*
* Since we're not sending this email to a user, email_to_user can't be used
* but this function borrows largely the code from that process.
*
* @param string $email the email address to send the verification email to.
* @return true if the email was sent successfully, false otherwise.
*/
function send_verification_email($email) {
global $DB, $USER;
// Store a user secret (badges_email_verify_secret) and the address (badges_email_verify_address) as users prefs.
// The address will be used by edit_backpack_form for display during verification and to facilitate the resending
// of verification emails to said address.
$secret = random_string(15);
set_user_preference('badges_email_verify_secret', $secret);
set_user_preference('badges_email_verify_address', $email);
// To, from.
$tempuser = $DB->get_record('user', array('id' => $USER->id), '*', MUST_EXIST);
$tempuser->email = $email;
$noreplyuser = core_user::get_noreply_user();
// Generate the verification email body.
$verificationurl = '/badges/backpackemailverify.php';
$verificationurl = new moodle_url($verificationurl);
$verificationpath = $verificationurl->out(false);
$site = get_site();
$args = new stdClass();
$args->link = $verificationpath . '?data='. $secret;
$args->sitename = $site->fullname;
$args->admin = generate_email_signoff();
$messagesubject = get_string('backpackemailverifyemailsubject', 'badges', $site->fullname);
$messagetext = get_string('backpackemailverifyemailbody', 'badges', $args);
$messagehtml = text_to_html($messagetext, false, false, true);
return email_to_user($tempuser, $noreplyuser, $messagesubject, $messagetext, $messagehtml);
}
+29 -13
View File
@@ -110,23 +110,39 @@ if ($backpack) {
}
} else {
// If backpack is not connected, need to connect first.
$form = new edit_backpack_form();
// To create a new connection to the backpack, first we need to verify the user's email address:
// 1. User enters email and clicks 'Connect to backpack'.
// 2. After cross-checking the email address against the backpack provider, an email is sent to the specified address,
// and the email and secret are stored in user preferences. These will be cleared upon successful verification.
// 3. User clicks verification link in the email to confirm the backpack connection.
// 4. User redirected to the mybackpack page.
// While the verification process is pending, the edit_backpack_form form will present the user with options to resend the
// verification email, and to cancel the current verification attempt and start over.
// To pass through the current state of the verification attempt to the form.
$params['email'] = get_user_preferences('badges_email_verify_address');
$form = new edit_backpack_form(new moodle_url('/badges/mybackpack.php'), $params);
if ($form->is_cancelled()) {
redirect(new moodle_url('/badges/mybadges.php'));
} else if ($data = $form->get_data()) {
$bp = new OpenBadgesBackpackHandler($data);
$obj = new stdClass();
$obj->userid = $data->userid;
$obj->email = $data->email;
$obj->backpackurl = $data->backpackurl;
$obj->backpackuid = $bp->curl_request('user')->userId;
$obj->autosync = 0;
$obj->password = '';
$DB->insert_record('badge_backpack', $obj);
redirect(new moodle_url('/badges/mybackpack.php'));
// The form may have been submitted under one of the following circumstances:
// 1. After clicking 'Connect to backpack'. We'll have $data->email.
// 2. After clicking 'Resend verification email'. We'll have $data->email.
// 3. After clicking 'Connect using a different email' to cancel the verification process. We'll have $data->revertbutton.
if (isset($data->revertbutton)) {
unset_user_preference('badges_email_verify_secret');
unset_user_preference('badges_email_verify_address');
redirect(new moodle_url('/badges/mybackpack.php'));
} else if (isset($data->email)) {
if (send_verification_email($data->email)) {
redirect(new moodle_url('/badges/mybackpack.php'),
get_string('backpackemailverifypending', 'badges', $data->email),
null, \core\output\notification::NOTIFY_INFO);
} else {
print_error ('backpackcannotsendverification', 'badges');
}
}
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
@core @core_badges @_file_upload
@core @core_badges
Feature: Add badges to the system
In order to give badges to users for their achievements
As an admin
@@ -27,7 +27,7 @@ Feature: Add badges to the system
Given I navigate to "Site badges" node in "Site pages"
Then I should see "There are no badges available."
@javascript
@javascript @_file_upload
Scenario: Add a badge
Given I navigate to "Add a new badge" node in "Site administration > Badges"
And I set the following fields to these values:
@@ -682,7 +682,7 @@ class block_activity_results extends block_base {
$o = html_writer::start_tag('h3');
$o .= html_writer::link(new moodle_url('/mod/'.$activity->itemmodule.'/view.php',
array('id' => $cm->id)), $activity->itemname);
array('id' => $cm->id)), format_string(($activity->itemname), true, ['context' => context_module::instance($cm->id)]));
$o .= html_writer::end_tag('h3');
return $o;
}
@@ -699,4 +699,4 @@ class block_activity_results extends block_base {
return $scale;
}
}
}
+2 -1
View File
@@ -153,7 +153,8 @@ class block_community_renderer extends plugin_renderer_base {
array('class' => 'hubcourseuserinfo'));
//create course content related information html
$course->subject = get_string($course->subject, 'edufields');
$course->subject = (get_string_manager()->string_exists($course->subject, 'edufields')) ?
get_string($course->subject, 'edufields') : get_string('none');
$course->audience = get_string('audience' . $course->audience, 'hub');
$course->educationallevel = get_string('edulevel' . $course->educationallevel, 'hub');
$coursecontentinfo = '';
+4 -4
View File
@@ -90,7 +90,7 @@ echo html_writer::start_tag('tbody');
if ($USER->id != $user->id) {
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('colspan' => '2'));
echo html_writer::tag('b', get_string('showinguser', 'completion'));
echo html_writer::tag('b', get_string('showinguser', 'completion') . ' ');
$url = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id));
echo html_writer::link($url, fullname($user));
echo html_writer::end_tag('td');
@@ -99,7 +99,7 @@ if ($USER->id != $user->id) {
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('colspan' => '2'));
echo html_writer::tag('b', get_string('status'));
echo html_writer::tag('b', get_string('status') . ' ');
// Is course complete?
$coursecomplete = $info->is_course_complete($user->id);
@@ -141,7 +141,7 @@ if (empty($completions)) {
} else {
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('colspan' => '2'));
echo html_writer::tag('b', get_string('required'));
echo html_writer::tag('b', get_string('required') . ' ');
// Get overall aggregation method.
$overall = $info->get_aggregation_method();
@@ -214,7 +214,7 @@ if (empty($completions)) {
echo core_text::strtolower(get_string('any', 'completion'));
}
echo html_writer::end_tag('i') .core_text::strtolower(get_string('required')).')';
echo ' ' . html_writer::end_tag('i') .core_text::strtolower(get_string('required')).')';
$agg_type = false;
}
}
@@ -64,7 +64,7 @@ class block_course_overview extends block_base {
$content = array();
$updatemynumber = optional_param('mynumber', -1, PARAM_INT);
if ($updatemynumber >= 0) {
if ($updatemynumber >= 0 && optional_param('sesskey', '', PARAM_RAW) && confirm_sesskey()) {
block_course_overview_update_mynumber($updatemynumber);
}
+1 -1
View File
@@ -213,7 +213,7 @@ class block_course_overview_renderer extends plugin_renderer_base {
for ($i = 1; $i <= $max; $i++) {
$options[$i] = $i;
}
$url = new moodle_url('/my/index.php');
$url = new moodle_url('/my/index.php', ['sesskey' => sesskey()]);
$select = new single_select($url, 'mynumber', $options, block_course_overview_get_max_user_courses(), array());
$select->set_label(get_string('numtodisplay', 'block_course_overview'));
$output .= $this->output->render($select);
+3 -1
View File
@@ -119,7 +119,9 @@ class block_login extends block_base {
$this->content->text .= '<h6>' . get_string('potentialidps', 'auth') . '</h6>';
$this->content->text .= '<div class="potentialidplist">';
foreach ($potentialidps as $idp) {
$this->content->text .= '<div class="potentialidp"><a href="' . $idp['url']->out() . '" title="' . s($idp['name']) . '">';
$this->content->text .= '<div class="potentialidp">';
$this->content->text .= '<a class="btn btn-default btn-block" ';
$this->content->text .= 'href="' . $idp['url']->out() . '" title="' . s($idp['name']) . '">';
$this->content->text .= $OUTPUT->render($idp['icon'], $idp['name']) . s($idp['name']) . '</a></div>';
}
$this->content->text .= '</div>';
+5 -5
View File
@@ -52,11 +52,11 @@ $action = (empty($id)) ? 'add' : 'edit';
$external = new stdClass();
// Check that this id exists.
if (!empty($id) && !$DB->record_exists('blog_external', array('id' => $id))) {
print_error('wrongexternalid', 'blog');
} else if (!empty($id)) {
$external = $DB->get_record('blog_external', array('id' => $id));
// Retrieve the external blog record.
if (!empty($id)) {
if (!$external = $DB->get_record('blog_external', array('id' => $id, 'userid' => $USER->id))) {
print_error('wrongexternalid', 'blog');
}
$external->autotags = core_tag_tag::get_item_tags_array('core', 'blog_external', $id);
}
+1 -1
View File
@@ -872,7 +872,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
}
// Append Search info.
if (!empty($search)) {
if (!empty($search) && has_capability('moodle/blog:search', $sitecontext)) {
$headers['filters']['search'] = $search;
$blogurl->param('search', $search);
$PAGE->navbar->add(get_string('searchterm', 'blog', $search), $blogurl->out());
+2 -2
View File
@@ -1018,7 +1018,7 @@ class cache implements cache_loader {
$result = $data;
}
}
if ($result) {
if ($result !== false) {
if ($this->perfdebug) {
cache_helper::record_cache_hit('** static acceleration **', $this->definition);
}
@@ -2197,4 +2197,4 @@ class cache_session extends cache {
*/
class cache_request extends cache {
// This comment appeases code pre-checker ;) !
}
}
+54 -2
View File
@@ -229,8 +229,60 @@ class cachestore_memcached extends cache_store implements cache_is_configurable
$version = phpversion('memcached');
$this->candeletemulti = ($version && version_compare($version, self::REQUIRED_VERSION, '>='));
// Test the connection to the main connection.
$this->isready = @$this->connection->set("ping", 'ping', 1);
$this->isready = $this->is_connection_ready();
}
/**
* Confirm whether the connection is ready and usable.
*
* @return boolean
*/
public function is_connection_ready() {
if (!@$this->connection->set("ping", 'ping', 1)) {
// Test the connection to the server.
return false;
}
if ($this->isshared) {
// There is a bug in libmemcached which means that it is not possible to purge the cache in a shared cache
// configuration.
// This issue currently affects:
// - memcached 1.4.23+ with php-memcached <= 2.2.0
// The following combinations are not affected:
// - memcached <= 1.4.22 with any version of php-memcached
// - any version of memcached with php-memcached >= 3.0.1
// This check is cheapest as it does not involve connecting to the server at all.
$safecombination = false;
$extension = new ReflectionExtension('memcached');
if ((version_compare($extension->getVersion(), '3.0.1') >= 0)) {
// This is php-memcached version >= 3.0.1 which is a safe combination.
$safecombination = true;
}
if (!$safecombination) {
$allsafe = true;
foreach ($this->connection->getVersion() as $version) {
$allsafe = $allsafe && (version_compare($version, '1.4.22') <= 0);
}
// All memcached servers connected are version <= 1.4.22 which is a safe combination.
$safecombination = $allsafe;
}
if (!$safecombination) {
// This is memcached 1.4.23+ and php-memcached < 3.0.1.
// The issue may have been resolved in a subsequent update to any of the three libraries.
// The only way to safely determine if the combination is safe is to call getAllKeys.
// A safe combination will return an array, whilst an affected combination will return false.
// This is the most expensive check.
if (!is_array($this->connection->getAllKeys())) {
return false;
}
}
}
return true;
}
/**
+4
View File
@@ -288,6 +288,10 @@ class cachestore_memcached_test extends cachestore_tests {
$definition = cache_definition::load_adhoc(cache_store::MODE_APPLICATION, 'cachestore_memcached', 'phpunit_test');
$cachestore = $this->create_test_cache_with_config($definition, array('isshared' => true));
if (!$cachestore->is_connection_ready()) {
$this->markTestSkipped('Could not test cachestore_memcached. Connection is not ready.');
}
$connection = new Memcached(crc32(__METHOD__));
$connection->addServers($this->get_servers(TEST_CACHESTORE_MEMCACHED_TESTSERVERS));
$connection->setOptions(array(
+33
View File
@@ -2173,6 +2173,39 @@ class core_cache_testcase extends advanced_testcase {
$startstats[$requestid]['stores']['cachestore_static']['sets']);
}
public function test_static_cache() {
global $CFG;
$this->resetAfterTest(true);
$CFG->perfdebug = 15;
// Create cache store with static acceleration.
$instance = cache_config_testing::instance();
$applicationid = 'phpunit/applicationperf';
$instance->phpunit_add_definition($applicationid, array(
'mode' => cache_store::MODE_APPLICATION,
'component' => 'phpunit',
'area' => 'applicationperf',
'simplekeys' => true,
'staticacceleration' => true,
'staticaccelerationsize' => 3
));
$application = cache::make('phpunit', 'applicationperf');
// Check that stores register sets.
$this->assertTrue($application->set('setMe1', 1));
$this->assertTrue($application->set('setMe2', 0));
$this->assertTrue($application->set('setMe3', array()));
$this->assertTrue($application->get('setMe1') !== false);
$this->assertTrue($application->get('setMe2') !== false);
$this->assertTrue($application->get('setMe3') !== false);
// Check that the static acceleration worked, even on empty arrays and the number 0.
$endstats = cache_helper::get_stats();
$this->assertEquals(0, $endstats[$applicationid]['stores']['** static acceleration **']['misses']);
$this->assertEquals(3, $endstats[$applicationid]['stores']['** static acceleration **']['hits']);
}
public function test_performance_debug_off() {
global $CFG;
$this->resetAfterTest(true);
+14
View File
@@ -288,6 +288,20 @@ class cache_config_testing extends cache_config_writer {
global $CFG;
return $CFG->wwwroot.'phpunit';
}
/**
* Checks if the configuration file exists.
*
* @return bool True if it exists
*/
public static function config_file_exists() {
// Allow for late static binding by using static.
$configfilepath = static::get_config_file_path();
// Invalidate opcode php cache, so we get correct status of file.
core_component::invalidate_opcode_php_cache($configfilepath);
return file_exists($configfilepath);
}
}
/**
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -72,7 +72,8 @@ class event_form extends moodleform {
if (!empty($eventtypes->groups) && is_array($eventtypes->groups)) {
$groupoptions = array();
foreach ($eventtypes->groups as $group) {
$groupoptions[$group->id] = $group->name;
$groupoptions[$group->id] = format_string($group->name, true,
array('context' => context_course::instance($group->courseid)));
}
$mform->addElement('select', 'groupid', get_string('typegroup', 'calendar'), $groupoptions);
$mform->disabledIf('groupid', 'eventtype', 'noteq', 'group');
+3 -2
View File
@@ -77,7 +77,8 @@ if (!empty($day) && !empty($mon) && !empty($year)) {
}
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid));
// Course ID must be valid and existing.
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$courses = array($course->id => $course);
$issite = false;
} else {
@@ -85,7 +86,7 @@ if ($courseid != SITEID && !empty($courseid)) {
$courses = calendar_get_default_courses();
$issite = true;
}
require_course_login($course);
require_login($course, false);
$url = new moodle_url('/calendar/export.php', array('time' => $time));
+13 -3
View File
@@ -193,10 +193,20 @@ foreach($events as $event) {
$hostaddress = str_replace('http://', '', $CFG->wwwroot);
$hostaddress = str_replace('https://', '', $hostaddress);
$ev = new iCalendar_event;
$me = new calendar_event($event); // To use moodle calendar event services.
$ev = new iCalendar_event; // To export in ical format.
$ev->add_property('uid', $event->id.'@'.$hostaddress);
$ev->add_property('summary', $event->name);
$ev->add_property('description', clean_param($event->description, PARAM_NOTAGS));
// Set iCal event summary from event name.
$ev->add_property('summary', format_string($event->name, true, ['context' => $me->context]));
// Format the description text.
$description = format_text($me->description, $me->format, ['context' => $me->context]);
// Then convert it to plain text, since it's the only format allowed for the event description property.
// We use html_to_text in order to convert <br> and <p> tags to new line characters for descriptions in HTML format.
$description = html_to_text($description, 0);
$ev->add_property('description', $description);
$ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL
$ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified));
$ev->add_property('dtstamp', Bennu::timestamp_to_datetime()); // now
+4 -2
View File
@@ -45,13 +45,15 @@ $PAGE->set_pagelayout('admin');
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'));
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid));
// Course ID must be valid and existing.
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$courses = array($course->id => $course);
} else {
$course = get_site();
$courses = calendar_get_default_courses();
}
require_course_login($course);
require_login($course, false);
if (!calendar_user_can_add_event($course)) {
print_error('errorcannotimport', 'calendar');
}
+51
View File
@@ -171,4 +171,55 @@ class core_calendar_lib_testcase extends advanced_testcase {
$event = reset($events);
$this->assertEquals('assign', $event->modulename);
}
/**
* Helper function to create calendar events using the old code.
*
* @param array $properties A list of calendar event properties to set
* @return calendar_event|bool
*/
protected function create_event($properties = []) {
$record = new \stdClass();
$record->name = 'event name';
$record->eventtype = 'global';
$record->timestart = time();
$record->timeduration = 0;
$record->timesort = 0;
$record->type = 1;
$record->courseid = 0;
foreach ($properties as $name => $value) {
$record->$name = $value;
}
$event = new calendar_event($record);
return $event->create($record, false);
}
/**
* Test that when course module is deleted all events are also deleted.
*/
public function test_delete_module_delete_events() {
global $DB;
$this->resetAfterTest(true);
$this->setAdminUser();
$user = $this->getDataGenerator()->create_user();
// Create the course we will be using.
$course = $this->getDataGenerator()->create_course();
$group = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
foreach (core_component::get_plugin_list('mod') as $modname => $unused) {
$module = $this->getDataGenerator()->create_module($modname, ['course' => $course->id]);
// Create bunch of events of different type (user override, group override, module event).
$this->create_event(['userid' => $user->id, 'modulename' => $modname, 'instance' => $module->id]);
$this->create_event(['groupid' => $group->id, 'modulename' => $modname, 'instance' => $module->id]);
$this->create_event(['modulename' => $modname, 'instance' => $module->id]);
$this->create_event(['modulename' => $modname, 'instance' => $module->id, 'courseid' => $course->id]);
// Delete module and make sure all events are deleted.
course_delete_module($module->cmid);
$this->assertEmpty($DB->get_record('event', ['modulename' => $modname, 'instance' => $module->id]));
}
}
}
File diff suppressed because it is too large Load Diff
-537
View File
@@ -1,537 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Defines test class to test manage rrule during ical imports.
*
* @package core_calendar
* @category test
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_calendar_rrule_manager_testcase extends advanced_testcase {
/** @var stdClass a dummy event */
protected $event;
/**
* Set up method.
*/
protected function setUp() {
global $DB, $CFG;
$this->resetAfterTest();
$this->setTimezone('Australia/Perth');
$user = $this->getDataGenerator()->create_user();
$sub = new stdClass();
$sub->url = '';
$sub->courseid = 0;
$sub->groupid = 0;
$sub->userid = $user->id;
$sub->pollinterval = 0;
$subid = $DB->insert_record('event_subscriptions', $sub, true);
$event = new stdClass();
$event->name = 'Event name';
$event->description = '';
$event->timestart = 1385913700; // A 2013-12-2 Monday event.
$event->timeduration = 3600;
$event->uuid = 'uuid';
$event->subscriptionid = $subid;
$event->userid = $user->id;
$event->groupid = 0;
$event->courseid = 0;
$event->eventtype = 'user';
$eventobj = calendar_event::create($event, false);
$DB->set_field('event', 'repeatid', $eventobj->id, array('id' => $eventobj->id));
$eventobj->repeatid = $eventobj->id;
$this->event = $eventobj;
}
/**
* Test parse_rrule() method.
*/
public function test_parse_rrule() {
$rrule = "FREQ=DAILY;COUNT=3;INTERVAL=4;BYSECOND=20,40;BYMINUTE=2,30;BYHOUR=3,4;BYDAY=MO,TH;BYMONTHDAY=20,
30;BYYEARDAY=300,-20;BYWEEKNO=22,33;BYMONTH=3,4";
$mang = new core_tests_calendar_rrule_manager($rrule);
$mang->parse_rrule();
$this->assertEquals(\core_calendar\rrule_manager::FREQ_DAILY, $mang->freq);
$this->assertEquals(3, $mang->count);
$this->assertEquals(4, $mang->interval);
$this->assertEquals(array(20, 40), $mang->bysecond);
$this->assertEquals(array(2, 30), $mang->byminute);
$this->assertEquals(array(3, 4), $mang->byhour);
$this->assertEquals(array('MO', 'TH'), $mang->byday);
$this->assertEquals(array(20, 30), $mang->bymonthday);
$this->assertEquals(array(300, -20), $mang->byyearday);
$this->assertEquals(array(22, 33), $mang->byweekno);
$this->assertEquals(array(3, 4), $mang->bymonth);
}
/**
* Test exception is thrown for invalid property.
*
* @expectedException moodle_exception
*/
public function test_parse_rrule_validation() {
$rrule = "RANDOM=PROPERTY;";
$mang = new core_tests_calendar_rrule_manager($rrule);
$mang->parse_rrule();
}
/**
* Test exception is thrown for invalid frequency.
*
* @expectedException moodle_exception
*/
public function test_freq_validation() {
$rrule = "FREQ=RANDOMLY;";
$mang = new core_tests_calendar_rrule_manager($rrule);
$mang->parse_rrule();
}
/**
* Test recurrence rules for daily frequency.
*/
public function test_daily_events() {
global $DB;
$rrule = 'FREQ=DAILY;COUNT=3'; // This should generate 2 child events + 1 parent.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(3, $count);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + DAYSECS)));
$this->assertTrue($result);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + 2 * DAYSECS)));
$this->assertTrue($result);
$until = $this->event->timestart + DAYSECS * 2;
$until = date('Y-m-d', $until);
$rrule = "FREQ=DAILY;UNTIL=$until"; // This should generate 1 child event + 1 parent,since by then until bound would be hit.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(2, $count);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + DAYSECS)));
$this->assertTrue($result);
$rrule = 'FREQ=DAILY;COUNT=3;INTERVAL=3'; // This should generate 2 child events + 1 parent, every 3rd day.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(3, $count);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + 3 * DAYSECS)));
$this->assertTrue($result);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + 6 * DAYSECS)));
$this->assertTrue($result);
// Forever event. This should generate events for time() + 10 year period, every 300th day.
$rrule = 'FREQ=DAILY;INTERVAL=300';
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $time = $this->event->timestart + 300 * DAYSECS * $i) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
}
/**
* Test recurrence rules for weekly frequency.
*/
public function test_weekly_events() {
global $DB;
$rrule = 'FREQ=WEEKLY;COUNT=1'; // This should generate 7 events in total, one for each day.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(7, $count);
for ($i = 0; $i < 7; $i++) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + $i * DAYSECS)));
$this->assertTrue($result);
}
// This should generate 4 child event + 1 parent, since by then until bound would be hit.
$until = $this->event->timestart + WEEKSECS * 4;
$until = date('YmdThis', $until);
$rrule = "FREQ=WEEKLY;BYDAY=MO;UNTIL=$until";
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(5, $count);
for ($i = 0; $i < 5; $i++) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + $i * WEEKSECS)));
$this->assertTrue($result);
}
// This should generate 4 events in total every monday and Wednesday of every 3rd week.
$rrule = 'FREQ=WEEKLY;INTERVAL=3;BYDAY=MO,WE;COUNT=2';
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(4, $count);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + 3 * WEEKSECS))); // Monday event.
$this->assertTrue($result);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + 2 * DAYSECS))); // Wednesday event.
$this->assertTrue($result);
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($this->event->timestart + 3 * WEEKSECS + 2 * DAYSECS))); // Wednesday event.
$this->assertTrue($result);
// Forever event. This should generate events over time() + 10 year period, every 50th monday.
$rrule = 'FREQ=WEEKLY;BYDAY=MO;INTERVAL=50';
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $time = $this->event->timestart + 50 * WEEKSECS * $i) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
}
/**
* Test recurrence rules for monthly frequency.
*/
public function test_monthly_events() {
global $DB;
$rrule = 'FREQ=MONTHLY;COUNT=3;BYMONTHDAY=2'; // This should generate 3 events in total.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(3, $count);
for ($i = 0; $i < 3; $i++) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => (strtotime("+$i month", $this->event->timestart))));
$this->assertTrue($result);
}
// This much seconds after the start of the day.
$offset = $this->event->timestart - mktime(0, 0, 0, date("n", $this->event->timestart), date("j", $this->event->timestart),
date("Y", $this->event->timestart));
$monthstart = mktime(0, 0, 0, date("n", $this->event->timestart), 1, date("Y", $this->event->timestart));
$rrule = 'FREQ=MONTHLY;COUNT=3;BYDAY=1MO'; // This should generate 3 events in total, first monday of the month.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(3, $count);
$time = strtotime('1 Monday', strtotime("+1 months", $monthstart)) + $offset;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
$this->assertTrue($result);
$time = strtotime('1 Monday', strtotime("+2 months", $monthstart)) + $offset;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
$this->assertTrue($result);
// This should generate 10 child event + 1 parent, since by then until bound would be hit.
$until = strtotime('+1 day +10 months', $this->event->timestart);
$until = date('YmdThis', $until);
$rrule = "FREQ=MONTHLY;BYMONTHDAY=2;UNTIL=$until";
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(11, $count);
for ($i = 0; $i < 11; $i++) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => (strtotime("+$i month", $this->event->timestart))));
$this->assertTrue($result);
}
// This should generate 10 child event + 1 parent, since by then until bound would be hit.
$until = strtotime('+1 day +10 months', $this->event->timestart);
$until = date('YmdThis', $until);
$rrule = "FREQ=MONTHLY;BYDAY=1MO;UNTIL=$until";
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(10, $count);
for ($i = 0; $i < 10; $i++) {
$time = strtotime('1 Monday', strtotime("+$i months", $monthstart)) + $offset;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
$this->assertTrue($result);
}
// This should generate 11 child event + 1 parent, since by then until bound would be hit.
$until = strtotime('+10 day +10 months', $this->event->timestart); // 12 oct 2014.
$until = date('YmdThis', $until);
$rrule = "FREQ=MONTHLY;INTERVAL=2;BYMONTHDAY=2,5;UNTIL=$until";
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(12, $count);
for ($i = 0; $i < 6; $i++) {
$moffset = $i * 2;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => (strtotime("+$moffset month", $this->event->timestart))));
$this->assertTrue($result);
// Event on the 5th of a month.
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => (strtotime("+3 days +$moffset month", $this->event->timestart))));
$this->assertTrue($result);
}
// This should generate 11 child event + 1 parent, since by then until bound would be hit.
$until = strtotime('+20 day +10 months', $this->event->timestart); // 22 oct 2014.
$until = date('YmdTHis', $until);
$rrule = "FREQ=MONTHLY;INTERVAL=2;BYDAY=1MO,3WE;UNTIL=$until";
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(12, $count);
for ($i = 0; $i < 6; $i++) {
$moffset = $i * 2;
$time = strtotime("+$moffset month", $monthstart);
$time2 = strtotime("+1 Monday", $time) + $offset;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time2));
$this->assertTrue($result);
$time2 = strtotime("+3 Wednesday", $time) + $offset;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => $time2)); // Event on the 5th of a month.
$this->assertTrue($result);
}
// Forever event. This should generate events over 10 year period, on 2nd of every 12th month.
$rrule = 'FREQ=MONTHLY;INTERVAL=12;BYMONTHDAY=2';
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $moffset = $i * 12,
$time = strtotime("+$moffset month", $this->event->timestart)) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
// Forever event. This should generate 10 child events + 1 parent over 10 year period, every 50th Monday.
$rrule = 'FREQ=MONTHLY;BYDAY=1MO;INTERVAL=12';
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(11, $count);
for ($i = 0, $moffset = 0, $time = $this->event->timestart; $time < $until; $i++, $moffset = $i * 12) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => ($time)));
$this->assertTrue($result);
$time = strtotime("+$moffset month", $monthstart);
$time = strtotime("+1 Monday", $time) + $offset;
}
}
/**
* Test recurrence rules for yearly frequency.
*/
public function test_yearly_events() {
global $DB;
$rrule = 'FREQ=YEARLY;COUNT=3;BYMONTH=12'; // This should generate 3 events in total.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(3, $count);
for ($i = 0, $time = $this->event->timestart; $i < 3; $i++, $time = strtotime("+$i years", $this->event->timestart)) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
$this->assertTrue($result);
}
// Create an event every december, until the time limit is hit.
$until = strtotime('+20 day +10 years', $this->event->timestart);
$until = date('YmdTHis', $until);
$rrule = "FREQ=YEARLY;BYMONTH=12;UNTIL=$until"; // Forever event.
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(11, $count);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2,
$time = strtotime("+$yoffset years", $this->event->timestart)) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
// This should generate 5 events in total, every second year in the month of december.
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2;COUNT=5';
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(5, $count);
for ($i = 0, $time = $this->event->timestart; $i < 5; $i++, $yoffset = $i * 2,
$time = strtotime("+$yoffset years", $this->event->timestart)) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2'; // Forever event.
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(6, $count);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2,
$time = strtotime("+$yoffset years", $this->event->timestart)) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
// This much seconds after the start of the day.
$offset = $this->event->timestart - mktime(0, 0, 0, date("n", $this->event->timestart), date("j", $this->event->timestart),
date("Y", $this->event->timestart));
$yearstart = mktime(0, 0, 0, 1, 1, date("Y", $this->event->timestart));
$rrule = 'FREQ=YEARLY;COUNT=3;BYMONTH=12;BYDAY=1MO'; // This should generate 3 events in total.
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(3, $count);
for ($i = 0; $i < 3; $i++) {
$time = strtotime("+11 months +$i years", $yearstart);
$time = strtotime("+1 Monday", $time) + $offset;
$result = $DB->record_exists('event', array('repeatid' => $this->event->id, 'timestart' => $time));
$this->assertTrue($result);
}
// Create an event every december, until the time limit is hit.
$until = strtotime('+20 day +10 years', $this->event->timestart);
$until = date('YmdTHis', $until);
$rrule = "FREQ=YEARLY;BYMONTH=12;UNTIL=$until;BYDAY=1MO";
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(11, $count);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
$time = strtotime("+11 months +$i years", $yearstart);
$time = strtotime("+1 Monday", $time) + $offset;
}
// This should generate 5 events in total, every second year in the month of december.
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2;COUNT=5;BYDAY=1MO';
$mang = new \core_calendar\rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(5, $count);
for ($i = $yoffset = 0, $time = $this->event->timestart; $i < 5; $i++, $yoffset = $i * 2) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
$time = strtotime("+11 months +$yoffset years", $yearstart);
$time = strtotime("+1 Monday", $time) + $offset;
}
$rrule = 'FREQ=YEARLY;BYMONTH=12;INTERVAL=2;BYDAY=1MO'; // Forever event.
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(6, $count);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
$time = strtotime("+11 months +$yoffset years", $yearstart);
$time = strtotime("+1 Monday", $time) + $offset;
}
$rrule = 'FREQ=YEARLY;INTERVAL=2'; // Forever event.
$mang = new \core_calendar\rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
$count = $DB->count_records('event', array('repeatid' => $this->event->id));
$this->assertEquals(6, $count);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
$time = strtotime("+11 months +$yoffset years", $yearstart);
$time = strtotime("+1 Monday", $time) + $offset;
}
}
}
/**
* Class core_calendar_test_rrule_manager
*
* Wrapper to access protected vars for testing.
*
* @package core_calendar
* @category test
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_tests_calendar_rrule_manager extends \core_calendar\rrule_manager{
/**
* Magic method to get properties.
*
* @param $prop string property
*
* @return mixed
* @throws coding_exception
*/
public function __get($prop) {
if (property_exists($this, $prop)) {
return $this->$prop;
}
throw new coding_exception('invalidproperty');
}
}
+3 -2
View File
@@ -85,7 +85,8 @@ $url->param('time', $time);
$PAGE->set_url($url);
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid));
// Course ID must be valid and existing.
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$courses = array($course->id => $course);
$issite = false;
navigation_node::override_active_url(new moodle_url('/course/view.php', array('id' => $course->id)));
@@ -95,7 +96,7 @@ if ($courseid != SITEID && !empty($courseid)) {
$issite = true;
}
require_course_login($course);
require_login($course, false);
$calendar = new calendar_information(0, 0, 0, $time);
$calendar->prepare_for_view($course, $courses);
+2 -1
View File
@@ -676,7 +676,8 @@ class competency extends persistent {
public static function share_same_framework(array $ids) {
global $DB;
list($insql, $params) = $DB->get_in_or_equal($ids);
return $DB->count_records_select(self::TABLE, "id $insql", $params, "COUNT(DISTINCT(competencyframeworkid))") == 1;
$sql = "SELECT COUNT('x') FROM (SELECT DISTINCT(competencyframeworkid) FROM {" . self::TABLE . "} WHERE id {$insql}) f";
return $DB->count_records_sql($sql, $params) == 1;
}
/**
+3 -1
View File
@@ -243,7 +243,9 @@ class course_competency extends persistent {
public static function list_courses($competencyid) {
global $DB;
$results = $DB->get_records_sql('SELECT course.id, course.visible, course.shortname, course.idnumber, course.fullname
$results = $DB->get_records_sql('SELECT course.id, course.visible, course.shortname, course.idnumber,
course.fullname, course.summary, course.summaryformat, course.startdate,
course.enddate
FROM {course} course
JOIN {' . self::TABLE . '} coursecomp
ON coursecomp.courseid = course.id
@@ -243,6 +243,8 @@ class user_competency_course extends persistent {
$sql = 'SELECT COUNT(comp.id)
FROM {' . self::TABLE . '} usercoursecomp
JOIN {' . course_competency::TABLE . '} cc
ON usercoursecomp.competencyid = cc.competencyid AND cc.courseid = usercoursecomp.courseid
JOIN {' . competency::TABLE . '} comp
ON usercoursecomp.competencyid = comp.id
WHERE usercoursecomp.courseid = ? AND usercoursecomp.userid = ? AND usercoursecomp.proficiency = ?';
+23 -3
View File
@@ -74,7 +74,16 @@ class completion_completion extends data_object {
* @return data_object instance of data_object or false if none found.
*/
public static function fetch($params) {
return self::fetch_helper('course_completions', __CLASS__, $params);
$cache = cache::make('core', 'coursecompletion');
$key = $params['userid'] . '_' . $params['course'];
if ($hit = $cache->get($key)) {
return $hit['value'];
}
$tocache = self::fetch_helper('course_completions', __CLASS__, $params);
$cache->set($key, ['value' => $tocache]);
return $tocache;
}
/**
@@ -179,9 +188,10 @@ class completion_completion extends data_object {
$this->timeenrolled = 0;
}
$result = false;
// Save record
if ($this->id) {
return $this->update();
$result = $this->update();
} else {
// Make sure reaggregate field is not null
if (!$this->reaggregate) {
@@ -193,7 +203,17 @@ class completion_completion extends data_object {
$this->timestarted = 0;
}
return $this->insert();
$result = $this->insert();
}
if ($result) {
// Update the cached record.
$cache = cache::make('core', 'coursecompletion');
$data = $this->get_record_data();
$key = $data->userid . '_' . $data->course;
$cache->set($key, ['value' => $data]);
}
return $result;
}
}
@@ -84,13 +84,17 @@ class completion_criteria_activity extends completion_criteria {
$this->course = $data->id;
foreach (array_keys($data->criteria_activity) as $activity) {
$module = $DB->get_record('course_modules', array('id' => $activity));
$this->module = self::get_mod_name($module->module);
$this->moduleinstance = $activity;
$this->id = NULL;
$this->insert();
// Data comes from advcheckbox, so contains keys for all activities.
// A value of 0 is 'not checked' whereas 1 is 'checked'.
foreach ($data->criteria_activity as $activity => $val) {
// Only update those which are checked.
if (!empty($val)) {
$module = $DB->get_record('course_modules', array('id' => $activity));
$this->module = self::get_mod_name($module->module);
$this->moduleinstance = $activity;
$this->id = null;
$this->insert();
}
}
}
}
+9 -13
View File
@@ -217,6 +217,12 @@ class course_edit_form extends moodleform {
$mform->addElement('select', 'calendartype', get_string('forcecalendartype', 'calendar'), $calendars);
}
$options = range(0, 10);
$mform->addElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
$courseconfig = get_config('moodlecourse');
$mform->setDefault('newsitems', $courseconfig->newsitems);
$mform->addHelpButton('newsitems', 'newsitemsnumber');
$mform->addElement('selectyesno', 'showgrades', get_string('showgrades'));
$mform->addHelpButton('showgrades', 'showgrades');
$mform->setDefault('showgrades', $courseconfig->showgrades);
@@ -368,19 +374,9 @@ class course_edit_form extends moodleform {
'addcourseformatoptionshere');
}
if ($courseformat->supports_news()) {
// Show the news items select field if the course format supports news.
$options = range(0, 10);
$newsitems = $mform->createElement('select', 'newsitems', get_string('newsitemsnumber'), $options);
$mform->insertElementBefore($newsitems, 'showgrades');
$courseconfig = get_config('moodlecourse');
$mform->setDefault('newsitems', $courseconfig->newsitems);
$mform->addHelpButton('newsitems', 'newsitemsnumber');
} else {
// Otherwise, create a hidden newsitems element and set its value to 0.
$newsitems = $mform->addElement('hidden', 'newsitems', 0);
$mform->setType('newsitems', PARAM_INT);
$newsitems->setValue(0);
// Remove newsitems element if format does not support news.
if (!$courseformat->supports_news()) {
$mform->removeElement('newsitems');
}
}
}
+8 -1
View File
@@ -433,7 +433,9 @@ class core_course_external extends external_api {
$exceptionparam->courseid = $course->id;
throw new moodle_exception('errorcoursecontextnotvalid', 'webservice', '', $exceptionparam);
}
require_capability('moodle/course:view', $context);
if ($course->id != SITEID) {
require_capability('moodle/course:view', $context);
}
$courseinfo = array();
$courseinfo['id'] = $course->id;
@@ -722,6 +724,11 @@ class core_course_external extends external_api {
//Note: create_course() core function check shortname, idnumber, category
$course['id'] = create_course((object) $course)->id;
// Create sections that aren't created by core create_course().
if (!empty($course['numsections']) && $course['numsections'] > 0) {
course_create_sections_if_missing((object)$course, range(0, $course['numsections']));
}
$resultcourses[] = array('id' => $course['id'], 'shortname' => $course['shortname']);
}
+3 -1
View File
@@ -678,7 +678,9 @@ abstract class format_base {
if (isset($option['type'])) {
$mform->setType($optionname, $option['type']);
}
if (is_null($mform->getElementValue($optionname)) && isset($option['default'])) {
if (isset($option['default']) && !array_key_exists($optionname, $mform->_defaultValues)) {
// Set defaults for the elements in the form.
// Since we call this method after set_data() make sure that we don't override what was already set.
$mform->setDefault($optionname, $option['default']);
}
}
+55 -1
View File
@@ -55,6 +55,10 @@ define('FIRSTUSEDEXCELROW', 3);
define('MOD_CLASS_ACTIVITY', 0);
define('MOD_CLASS_RESOURCE', 1);
define('COURSE_TIMELINE_PAST', 'past');
define('COURSE_TIMELINE_INPROGRESS', 'inprogress');
define('COURSE_TIMELINE_FUTURE', 'future');
function make_log_url($module, $url) {
switch ($module) {
case 'course':
@@ -1153,8 +1157,10 @@ function course_delete_module($cmid, $async = false) {
// Delete events from calendar.
if ($events = $DB->get_records('event', array('instance' => $cm->instance, 'modulename' => $modulename))) {
$coursecontext = context_course::instance($cm->course);
foreach($events as $event) {
$calendarevent = calendar_event::load($event->id);
$event->context = $coursecontext;
$calendarevent = calendar_event::load($event);
$calendarevent->delete();
}
}
@@ -2433,6 +2439,14 @@ function update_course($data, $editoroptions = NULL) {
}
}
// Set newsitems to 0 if format does not support announcements.
if (isset($data->format)) {
$newcourseformat = course_get_format((object)['format' => $data->format]);
if (!$newcourseformat->supports_news()) {
$data->newsitems = 0;
}
}
// Update with the new data
$DB->update_record('course', $data);
// make sure the modinfo cache is reset
@@ -3912,6 +3926,46 @@ function course_check_updates($course, $tocheck, $filter = array()) {
return array($instances, $warnings);
}
/**
* This function classifies a course as past, in progress or future.
*
* This function may incur a DB hit to calculate course completion.
* @param stdClass $course Course record
* @param stdClass $user User record (optional - defaults to $USER).
* @param completion_info $completioninfo Completion record for the user (optional - will be fetched if required).
* @return string (one of COURSE_TIMELINE_FUTURE, COURSE_TIMELINE_INPROGRESS or COURSE_TIMELINE_PAST)
*/
function course_classify_for_timeline($course, $user = null, $completioninfo = null) {
global $USER;
if ($user == null) {
$user = $USER;
}
$today = time();
// End date past.
if (!empty($course->enddate) && $course->enddate < $today) {
return COURSE_TIMELINE_PAST;
}
if ($completioninfo == null) {
$completioninfo = new completion_info($course);
}
// Course was completed.
if ($completioninfo->is_enabled() && $completioninfo->is_course_complete($user->id)) {
return COURSE_TIMELINE_PAST;
}
// Start date not reached.
if (!empty($course->startdate) && $course->startdate > $today) {
return COURSE_TIMELINE_FUTURE;
}
// Everything else is in progress.
return COURSE_TIMELINE_INPROGRESS;
}
/**
* Check module updates since a given time.
* This function checks for updates in the module config, file areas, completion, grades, comments and ratings.
+5 -3
View File
@@ -20,16 +20,18 @@
// //
///////////////////////////////////////////////////////////////////////////
/*
/**
* This page display the publication backup form
*
* @package course
* @subpackage publish
* @author Jerome Mouneyrac <jerome@mouneyrac.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* This page display the publication backup form
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../../config.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php');
+2 -1
View File
@@ -101,7 +101,8 @@ if ($switchrole > 0 && has_capability('moodle/role:switchroles', $context)) {
foreach ($roles as $key => $role) {
$url = new moodle_url('/course/switchrole.php', array('id' => $id, 'switchrole' => $key, 'returnurl' => $returnurl));
echo $OUTPUT->container($OUTPUT->single_button($url, $role), 'm-x-3 m-b-1');
// Button encodes special characters, apply htmlspecialchars_decode() to avoid double escaping.
echo $OUTPUT->container($OUTPUT->single_button($url, htmlspecialchars_decode($role)), 'm-x-3 m-b-1');
}
$url = new moodle_url($returnurl);
+48
View File
@@ -3689,4 +3689,52 @@ class core_course_courselib_testcase extends advanced_testcase {
}
$this->assertEquals(2, $count);
}
public function test_classify_course_for_timeline() {
global $DB, $CFG;
require_once($CFG->dirroot.'/completion/criteria/completion_criteria_self.php');
set_config('enablecompletion', COMPLETION_ENABLED);
$this->resetAfterTest(true);
$this->setAdminUser();
// Create courses for testing.
$generator = $this->getDataGenerator();
$future = time() + 3600;
$past = time() - 3600;
$futurecourse = $generator->create_course(['startdate' => $future]);
$pastcourse = $generator->create_course(['startdate' => $past - 60, 'enddate' => $past]);
$completedcourse = $generator->create_course(['enablecompletion' => COMPLETION_ENABLED]);
$inprogresscourse = $generator->create_course();
// Set completion rules.
$criteriadata = new stdClass();
$criteriadata->id = $completedcourse->id;
// Self completion.
$criteriadata->criteria_self = COMPLETION_CRITERIA_TYPE_SELF;
$class = 'completion_criteria_self';
$criterion = new $class();
$criterion->update_config($criteriadata);
$user = $this->getDataGenerator()->create_user();
$studentrole = $DB->get_record('role', array('shortname' => 'student'));
$this->getDataGenerator()->enrol_user($user->id, $futurecourse->id, $studentrole->id);
$this->getDataGenerator()->enrol_user($user->id, $pastcourse->id, $studentrole->id);
$this->getDataGenerator()->enrol_user($user->id, $completedcourse->id, $studentrole->id);
$this->getDataGenerator()->enrol_user($user->id, $inprogresscourse->id, $studentrole->id);
$this->setUser($user);
core_completion_external::mark_course_self_completed($completedcourse->id);
$ccompletion = new completion_completion(array('course' => $completedcourse->id, 'userid' => $user->id));
$ccompletion->mark_complete();
// Aggregate the completions.
$this->assertEquals(COURSE_TIMELINE_PAST, course_classify_for_timeline($pastcourse));
$this->assertEquals(COURSE_TIMELINE_FUTURE, course_classify_for_timeline($futurecourse));
$this->assertEquals(COURSE_TIMELINE_PAST, course_classify_for_timeline($completedcourse));
$this->assertEquals(COURSE_TIMELINE_INPROGRESS, course_classify_for_timeline($inprogresscourse));
}
}
+62 -2
View File
@@ -361,6 +361,40 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
core_course_external::update_categories($categories);
}
/**
* Test create_courses numsections
*/
public function test_create_course_numsections() {
global $DB;
$this->resetAfterTest(true);
// Set the required capabilities by the external function.
$contextid = context_system::instance()->id;
$roleid = $this->assignUserCapability('moodle/course:create', $contextid);
$this->assignUserCapability('moodle/course:visibility', $contextid, $roleid);
$numsections = 10;
$category = self::getDataGenerator()->create_category();
// Create base categories.
$course1['fullname'] = 'Test course 1';
$course1['shortname'] = 'Testcourse1';
$course1['categoryid'] = $category->id;
$course1['courseformatoptions'][] = array('name' => 'numsections', 'value' => $numsections);
$courses = array($course1);
$createdcourses = core_course_external::create_courses($courses);
foreach ($createdcourses as $createdcourse) {
$existingsections = $DB->get_records('course_sections', array('course' => $createdcourse['id']));
$modinfo = get_fast_modinfo($createdcourse['id']);
$sections = $modinfo->get_section_info_all();
$this->assertEquals(count($sections), $numsections + 1); // Includes generic section.
$this->assertEquals(count($existingsections), $numsections + 1); // Includes generic section.
}
}
/**
* Test create_courses
*/
@@ -483,7 +517,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$this->assertEquals($courseinfo->numsections, $course3options['numsections']);
$this->assertEquals($courseinfo->coursedisplay, $course3options['coursedisplay']);
} else {
throw moodle_exception('Unexpected shortname');
throw new moodle_exception('Unexpected shortname');
}
}
@@ -642,6 +676,32 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$this->assertEquals($DB->count_records('course'), count($courses));
}
/**
* Test get_courses without capability
*/
public function test_get_courses_without_capability() {
$this->resetAfterTest(true);
$course1 = $this->getDataGenerator()->create_course();
$this->setUser($this->getDataGenerator()->create_user());
// No permissions are required to get the site course.
$courses = core_course_external::get_courses(array('ids' => [SITEID]));
$courses = external_api::clean_returnvalue(core_course_external::get_courses_returns(), $courses);
$this->assertEquals(1, count($courses));
$this->assertEquals('PHPUnit test site', $courses[0]['fullname']);
$this->assertEquals('site', $courses[0]['format']);
// Requesting course without being enrolled or capability to view it will throw an exception.
try {
core_course_external::get_courses(array('ids' => [$course1->id]));
$this->fail('Exception expected');
} catch (moodle_exception $e) {
$this->assertEquals(1, preg_match('/Course or activity not accessible. \(Not enrolled\)/', $e->getMessage()));
}
}
/**
* Test search_courses
*/
@@ -1137,7 +1197,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$this->assertEquals(0, $courseinfo->newsitems);
$this->assertEquals(FORMAT_MOODLE, $courseinfo->summaryformat);
} else {
throw moodle_exception('Unexpected shortname');
throw new moodle_exception('Unexpected shortname');
}
}
@@ -661,6 +661,10 @@ DragDrop.prototype = {
return false;
}
while (contstraint.get('scrollHeight') === 0 && !contstraint.compareTo(window.document.body)) {
contstraint = contstraint.get('parentNode');
}
courseul.all('> li').each(function(li) {
this.initCourseListing(li, contstraint);
}, this);
File diff suppressed because one or more lines are too long
@@ -654,6 +654,10 @@ DragDrop.prototype = {
return false;
}
while (contstraint.get('scrollHeight') === 0 && !contstraint.compareTo(window.document.body)) {
contstraint = contstraint.get('parentNode');
}
courseul.all('> li').each(function(li) {
this.initCourseListing(li, contstraint);
}, this);
+4
View File
@@ -69,6 +69,10 @@ DragDrop.prototype = {
return false;
}
while (contstraint.get('scrollHeight') === 0 && !contstraint.compareTo(window.document.body)) {
contstraint = contstraint.get('parentNode');
}
courseul.all('> li').each(function(li) {
this.initCourseListing(li, contstraint);
}, this);
+21 -10
View File
@@ -42,11 +42,9 @@ class writer extends \core\dataformat\base {
public $extension = ".html";
/**
* Write the start of the format
*
* @param array $columns
* Write the start of the output
*/
public function write_header($columns) {
public function start_output() {
echo "<!DOCTYPE html><html>";
echo \html_writer::tag('title', $this->filename);
echo "<style>
@@ -75,9 +73,16 @@ table {
margin: auto;
}
</style>
<body>
<table border=1 cellspacing=0 cellpadding=3>
";
<body>";
}
/**
* Write the start of the sheet we will be adding data to.
*
* @param array $columns
*/
public function start_sheet($columns) {
echo "<table border=1 cellspacing=0 cellpadding=3>";
echo \html_writer::start_tag('tr');
foreach ($columns as $k => $v) {
echo \html_writer::tag('th', $v);
@@ -100,12 +105,18 @@ table {
}
/**
* Write the end of the format
* Write the end of the sheet containing the data.
*
* @param array $columns
*/
public function write_footer($columns) {
echo "</table></body></html>";
public function close_sheet($columns) {
echo "</table>";
}
/**
* Write the end of the sheet containing the data.
*/
public function close_output() {
echo "</body></html>";
}
}
+33 -5
View File
@@ -41,12 +41,31 @@ class writer extends \core\dataformat\base {
/** @var $extension */
public $extension = ".json";
/** @var $sheetstarted */
public $sheetstarted = false;
/** @var $sheetdatadded */
public $sheetdatadded = false;
/**
* Write the start of the format
* Write the start of the file.
*/
public function start_output() {
echo "[";
}
/**
* Write the start of the sheet we will be adding data to.
*
* @param array $columns
*/
public function write_header($columns) {
public function start_sheet($columns) {
if ($this->sheetstarted) {
echo ",";
} else {
$this->sheetstarted = true;
}
$this->sheetdatadded = false;
echo "[";
}
@@ -57,19 +76,28 @@ class writer extends \core\dataformat\base {
* @param int $rownum
*/
public function write_record($record, $rownum) {
if ($rownum) {
if ($this->sheetdatadded) {
echo ",";
}
echo json_encode($record);
$this->sheetdatadded = true;
}
/**
* Write the end of the format
* Write the end of the sheet containing the data.
*
* @param array $columns
*/
public function write_footer($columns) {
public function close_sheet($columns) {
echo "]";
}
/**
* Write the end of the file.
*/
public function close_output() {
echo "]";
}
}
+8
View File
@@ -1,6 +1,14 @@
This files describes API changes in /dataformat/ download system,
information provided here is intended especially for developers.
=== 3.2.4 ===
* In order to allow multiple sheets in an exported file the functions write_header() and write_footer() have
been removed from core dataformat plugins and have been replaced.
- write_header() has been replaced with the two functions start_output() and start_sheet().
- write_footer() has been replaced with the two functions close_output() and close_sheet().
For backwards compatibility write_header() and write_footer() will continue to work.
=== 3.1 ===
* Added new plugin system with low memory support for csv, ods, xls and json
+1 -1
View File
@@ -38,7 +38,7 @@ class enrol_guest_enrol_form extends moodleform {
$heading = $plugin->get_instance_name($instance);
$mform->addElement('header', 'guestheader', $heading);
$mform->addElement('passwordunmask', 'guestpassword', get_string('password', 'enrol_guest'));
$mform->addElement('password', 'guestpassword', get_string('password', 'enrol_guest'));
$this->add_action_buttons(false, get_string('submit'));
+2 -2
View File
@@ -62,8 +62,8 @@ $string['course_summary'] = 'Optional: LDAP attribute to get the summary from';
$string['course_summary_key'] = 'Summary';
$string['course_summary_updateonsync'] = 'Update summary during synchronisation script';
$string['course_summary_updateonsync_key'] = 'Update summary';
$string['createcourseextid'] = 'CREATE User enrolled to a nonexistant course \'{$a->courseextid}\'';
$string['createnotcourseextid'] = 'User enrolled to a nonexistant course \'{$a->courseextid}\'';
$string['createcourseextid'] = 'CREATE User enrolled to a non-existing course \'{$a->courseextid}\'';
$string['createnotcourseextid'] = 'User enrolled to a non-existing course \'{$a->courseextid}\'';
$string['creatingcourse'] = 'Creating course \'{$a}\'...';
$string['duplicateshortname'] = "Course creation failed. Duplicate short name. Skipping course with idnumber '{\$a->idnumber}'...";
$string['editlock'] = 'Lock value';
+3 -3
View File
@@ -132,7 +132,7 @@ class enrol_ldap_plugin extends enrol_plugin {
*/
public function can_hide_show_instance($instance) {
$context = context_course::instance($instance->courseid);
return has_capability('enrol/ldap:config', $context);
return has_capability('enrol/ldap:manage', $context);
}
/**
@@ -328,7 +328,7 @@ class enrol_ldap_plugin extends enrol_plugin {
return;
}
$ldap_pagedresults = ldap_paged_results_supported($this->get_config('ldap_version'));
$ldap_pagedresults = ldap_paged_results_supported($this->get_config('ldap_version'), $this->ldapconnection);
// we may need a lot of memory here
core_php_time_limit::raise();
@@ -761,7 +761,7 @@ class enrol_ldap_plugin extends enrol_plugin {
// Get all contexts and look for first matching user
$ldap_contexts = explode(';', $ldap_contexts);
$ldap_pagedresults = ldap_paged_results_supported($this->get_config('ldap_version'));
$ldap_pagedresults = ldap_paged_results_supported($this->get_config('ldap_version'), $this->ldapconnection);
foreach ($ldap_contexts as $context) {
$context = trim($context);
if (empty($context)) {
+1 -1
View File
@@ -78,7 +78,7 @@ class enrol_self_enrol_form extends moodleform {
if ($instance->password) {
// Change the id of self enrolment key input as there can be multiple self enrolment methods.
$mform->addElement('passwordunmask', 'enrolpassword', get_string('password', 'enrol_self'),
$mform->addElement('password', 'enrolpassword', get_string('password', 'enrol_self'),
array('id' => 'enrolpassword_'.$instance->id));
$context = context_course::instance($this->instance->courseid);
$keyholders = get_users_by_capability($context, 'enrol/self:holdkey', user_picture::fields('u'));
+110
View File
@@ -280,6 +280,62 @@ class core_enrollib_testcase extends advanced_testcase {
$this->assertEquals($sharedcourse->id, $course1->id);
}
public function test_enrol_get_shared_courses_different_methods() {
global $DB, $CFG;
require_once($CFG->dirroot . '/enrol/self/externallib.php');
$this->resetAfterTest();
$user1 = $this->getDataGenerator()->create_user();
$user2 = $this->getDataGenerator()->create_user();
$user3 = $this->getDataGenerator()->create_user();
$course1 = $this->getDataGenerator()->create_course();
// Enrol user1 and user2 in course1 with a different enrolment methode.
// Add self enrolment method for course1.
$selfplugin = enrol_get_plugin('self');
$this->assertNotEmpty($selfplugin);
$studentrole = $DB->get_record('role', array('shortname' => 'student'));
$this->assertNotEmpty($studentrole);
$instance1id = $selfplugin->add_instance($course1, array('status' => ENROL_INSTANCE_ENABLED,
'name' => 'Test instance 1',
'customint6' => 1,
'roleid' => $studentrole->id));
$instance1 = $DB->get_record('enrol', array('id' => $instance1id), '*', MUST_EXIST);
self::setUser($user2);
// Self enrol me (user2).
$result = enrol_self_external::enrol_user($course1->id);
// Enrol user1 manually.
$this->getDataGenerator()->enrol_user($user1->id, $course1->id, null, 'manual');
$course2 = $this->getDataGenerator()->create_course();
$this->getDataGenerator()->enrol_user($user1->id, $course2->id);
$course3 = $this->getDataGenerator()->create_course();
$this->getDataGenerator()->enrol_user($user2->id, $course3->id);
// Test that user1 and user2 have courses in common.
$this->assertTrue(enrol_get_shared_courses($user1, $user2, false, true));
// Test that user1 and user3 have no courses in common.
$this->assertFalse(enrol_get_shared_courses($user1, $user3, false, true));
// Test retrieving the courses in common.
$sharedcourses = enrol_get_shared_courses($user1, $user2, true);
// Only should be one shared course.
$this->assertCount(1, $sharedcourses);
$sharedcourse = array_shift($sharedcourses);
// It should be course 1.
$this->assertEquals($sharedcourse->id, $course1->id);
}
/**
* Test user enrolment created event.
*/
@@ -422,4 +478,58 @@ class core_enrollib_testcase extends advanced_testcase {
$this->assertEquals('self', $event->other['enrol']);
$this->assertEventContextNotUsed($event);
}
/**
* Confirms that timemodified field was updated after modification of user enrollment
*/
public function test_enrollment_update_timemodified() {
global $DB;
$this->resetAfterTest(true);
$datagen = $this->getDataGenerator();
/** @var enrol_manual_plugin $manualplugin */
$manualplugin = enrol_get_plugin('manual');
$this->assertNotNull($manualplugin);
$studentroleid = $DB->get_field('role', 'id', ['shortname' => 'student'], MUST_EXIST);
$course = $datagen->create_course();
$user = $datagen->create_user();
$instanceid = null;
$instances = enrol_get_instances($course->id, true);
foreach ($instances as $inst) {
if ($inst->enrol == 'manual') {
$instanceid = (int)$inst->id;
break;
}
}
if (empty($instanceid)) {
$instanceid = $manualplugin->add_default_instance($course);
if (empty($instanceid)) {
$instanceid = $manualplugin->add_instance($course);
}
}
$this->assertNotNull($instanceid);
$instance = $DB->get_record('enrol', ['id' => $instanceid], '*', MUST_EXIST);
$manualplugin->enrol_user($instance, $user->id, $studentroleid, 0, 0, ENROL_USER_ACTIVE);
$userenrolorig = (int)$DB->get_field(
'user_enrolments',
'timemodified',
['enrolid' => $instance->id, 'userid' => $user->id],
MUST_EXIST
);
$this->waitForSecond();
$this->waitForSecond();
$manualplugin->update_user_enrol($instance, $user->id, ENROL_USER_SUSPENDED);
$userenrolpost = (int)$DB->get_field(
'user_enrolments',
'timemodified',
['enrolid' => $instance->id, 'userid' => $user->id],
MUST_EXIST
);
$this->assertGreaterThan($userenrolorig, $userenrolpost);
}
}
+38
View File
@@ -33,6 +33,8 @@ function xmldb_filter_mathjaxloader_upgrade($oldversion) {
$dbman = $DB->get_manager();
require_once($CFG->dirroot . '/filter/mathjaxloader/db/upgradelib.php');
if ($oldversion < 2014081100) {
$sslcdnurl = get_config('filter_mathjaxloader', 'httpsurl');
@@ -157,6 +159,42 @@ MathJax.Hub.Config({
}
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2016120501) {
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
$newcdnurl = filter_mathjaxloader_upgrade_cdn_cloudflare($httpsurl, false);
set_config('httpsurl', $newcdnurl, 'filter_mathjaxloader');
$mathjaxconfig = get_config('filter_mathjaxloader', 'mathjaxconfig');
if (strpos($mathjaxconfig, 'MathJax.Ajax.config.path') === false) {
$newconfig = 'MathJax.Ajax.config.path["Contrib"] = "{wwwroot}/filter/mathjaxloader/contrib";' . "\n";
$newconfig .= $mathjaxconfig;
set_config('mathjaxconfig', $newconfig, 'filter_mathjaxloader');
}
upgrade_plugin_savepoint(true, 2016120501, 'filter', 'mathjaxloader');
}
if ($oldversion < 2016120502) {
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
if ($httpsurl === "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js") {
set_config('httpsurl', 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js', 'filter_mathjaxloader');
}
$mathjaxconfig = get_config('filter_mathjaxloader', 'mathjaxconfig');
if (strpos($mathjaxconfig, 'MathJax.Ajax.config.path') !== false) {
// Now we need to remove this config again because mathjax 2.7.1 supports the extensions on the CDN.
$configtoremove = 'MathJax.Ajax.config.path["Contrib"] = "{wwwroot}/filter/mathjaxloader/contrib";';
$mathjaxconfig = str_replace($configtoremove, '', $mathjaxconfig);
set_config('mathjaxconfig', $mathjaxconfig, 'filter_mathjaxloader');
}
upgrade_plugin_savepoint(true, 2016120502, 'filter', 'mathjaxloader');
}
return true;
}
+66
View File
@@ -0,0 +1,66 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Random functions for mathjax upgrades.
*
* @package filter_mathjaxloader
* @copyright 2017 Damyon Wiese (damyon@moodle.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* This function takes an existing mathjax url and, if it was using the standard mathjax cdn,
* upgrades it to use the cloudflare matchjax cdn (because the standard one is shutting down).
* @param string $mathjaxurl - The current url.
* @param boolean $httponly - Use http instead of https - really only for 3.1 upgrades.
* @return string The new url.
*/
function filter_mathjaxloader_upgrade_cdn_cloudflare($mathjaxurl, $httponly = false) {
$newcdnurl = $mathjaxurl;
$cdnroot = 'https://cdn.mathjax.org/mathjax/';
if ($httponly) {
$cdnroot = 'http://cdn.mathjax.org/mathjax/';
}
$usingcdn = strpos($mathjaxurl, $cdnroot) === 0;
if ($usingcdn) {
$majorversion = substr($mathjaxurl, strlen($cdnroot), 3);
$latestversion = '2.7.0';
if ($majorversion == '2.6') {
$latestversion = '2.6.1';
} else if ($majorversion == '2.5') {
$latestversion = '2.5.3';
}
$offset = strpos($mathjaxurl, '/', strlen($cdnroot));
if ($offset === false) {
return $newcdnurl;
}
$endofurl = substr($mathjaxurl, $offset + 1);
$newcdnbase = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/';
if ($httponly) {
$newcdnbase = 'http://cdnjs.cloudflare.com/ajax/libs/mathjax/';
}
$newcdnurl = $newcdnbase . $latestversion . '/' . $endofurl;
}
return $newcdnurl;
}
+3
View File
@@ -111,6 +111,9 @@ class filter_mathjaxloader extends moodle_text_filter {
$page->requires->js_module($moduleconfig);
$config = get_config('filter_mathjaxloader', 'mathjaxconfig');
$wwwroot = new moodle_url('/');
$config = str_replace('{wwwroot}', $wwwroot->out(true), $config);
$params = array('mathjaxconfig' => $config, 'lang' => $lang);
+1 -1
View File
@@ -33,7 +33,7 @@ if ($ADMIN->fulltree) {
$item = new admin_setting_configtext('filter_mathjaxloader/httpsurl',
new lang_string('httpsurl', 'filter_mathjaxloader'),
new lang_string('httpsurl_help', 'filter_mathjaxloader'),
'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js',
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js',
PARAM_RAW);
$settings->add($item);
@@ -0,0 +1,91 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unit test for the upgrade MathJax code.
*
* @package filter_mathjaxloader
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/filter/mathjaxloader/db/upgradelib.php');
/**
* Unit test for the upgrade MathJax code.
*
* Test the functions in upgradelib.php
*
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class filter_mathjax_upgradelib_testcase extends advanced_testcase {
public function test_upgradelib() {
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
$current = 'http://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
$expected = 'http://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current, true));
$current = 'http://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
$expected = 'http://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current, false));
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
$expected = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current, true));
$current = 'https://cdn.mathjax.org/mathjax/2.6-latest/MathJax.js?...';
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.6.1/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
$current = 'https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?...';
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.5.3/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
// Dont touch non https links.
$current = 'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?...';
$expected = 'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
// Dont touch non local links.
$current = 'https://mylocalmirror/mathjax/2.7-latest/MathJax.js?...';
$expected = 'https://mylocalmirror/mathjax/2.7-latest/MathJax.js?...';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
// Try some unexpected things.
$current = '';
$expected = '';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
// Try some unexpected things.
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest/MathJax.js';
$expected = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
// Try some unexpected things.
$current = 'https://cdn.mathjax.org/mathjax/2.7-latest';
$expected = 'https://cdn.mathjax.org/mathjax/2.7-latest';
$this->assertEquals($expected, filter_mathjaxloader_upgrade_cdn_cloudflare($current));
}
}
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0"?>
<libraries>
<!-- Accessibility extensions for mathjax were briefly included - and then removed again -->
</libraries>
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016120500;
$plugin->version = 2016120502;
$plugin->requires = 2016112900; // Requires this Moodle version.
$plugin->component= 'filter_mathjaxloader';

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