947 Commits

Author SHA1 Message Date
Marina Glancy
ef1759da74 MDL-80820 various: fix incorrect phpdocs 2024-04-08 10:13:10 +01:00
Safat
fc7127e867 MDL-78551 core_access: Add support for hooks api 2024-03-26 13:53:39 +11:00
Andrew Nicols
99c1543aa8
MDL-79581 communication: Context is a mandatory field
The API was incorrectly assuming that all uses of the API were for a
course, and that the instanceid of the communication instance was a
course id. These assumptions are both entirely wrong.

The API is intended to support a range of uses including use at the
site, user, and activity levels.

Furthermore, if a group were to be used, then the instanceid should be
of that group's id, and therefore the contextid would need to be fetched
or that group's course instead.

The only solution here is to add a new contextid field to the table, and
implement it all parts of the API.
2023-10-04 20:37:57 +08:00
Sara Arjona
cc9430929d
MDL-77708 docs: Update references from docs.moodle.org/dev 2023-09-26 10:30:19 +02:00
Andrew Nicols
d72ebf1bf2
MDL-78129 communication_matrix: Update room membership on unennrol 2023-09-22 10:44:03 +08:00
Safat
3e47253787
MDL-78129 core_communication: Add update membership api 2023-09-21 13:28:20 +08:00
Andrew Nicols
a677a02d71
Merge branch 'MDL-78297-master' of https://github.com/MartinGauk/moodle 2023-06-12 10:17:13 +08:00
Sara Arjona
06bead8e8c Merge branch 'MDL-77946' of https://github.com/paulholden/moodle 2023-06-08 06:56:46 +02:00
Martin Gauk
695c74ac60 MDL-78297 core: Less cache lookups in deprecated capabilities feature
Avoid use of $cache->has.
2023-06-07 12:36:00 +02:00
Paul Holden
ebcc7e58ce
MDL-77946 access: fix category sort order of capability contexts. 2023-05-11 08:33:22 +01:00
Rajneel Totaram
f74f702c88 MDL-77930 accesslib: php81 deprecation warnings on missing plugins 2023-05-09 17:44:15 +12:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Petr Skoda
176191dab5 MDL-74936 core: tidy up context API 2023-03-31 23:09:39 +02:00
Petr Skoda
728c3c4bd1 MDL-74936 core: namespace all context class 2023-03-31 23:09:39 +02:00
Laurent David
8f3d9e291e MDL-76940 core_courseformat: Index refreshing when role switch
* Hidden sections and content should not visible to students when switching role
2023-03-08 11:47:21 +01:00
Thong Bui
5db011a600 MDL-76797 core_role: Add create role event class 2023-02-20 12:37:35 +07:00
Tim Hunt
a344e7a3b4 MDL-77018 qbank_statistics: only load stats for contexts that exist
Also, pre-load the contexts for efficiency.
2023-01-27 20:51:05 +00:00
Andrew Nicols
eceb3c49fd MDL-76362 core: Test coursealias before using 2023-01-23 09:15:55 +08:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
sam marshall
0b2c2a1f95 MDL-76129 upgrade: Allow caching in specific functions
During install/upgrade, caching is disabled. This change provides a
way to temporarily enable caching (using in-memory cache storage only)
within a specific function; caches are deleted afterwards.

Adding this to two locations improves install performance quite a lot.

Caching is not enabled during the parts of plugin installation that
can vary for individual plugins (install.php/upgrade.php) as these
might be relying on its absence, for example by making direct database
changes.
2022-12-22 11:05:45 +00:00
sam marshall
7724e543ff MDL-76129 accesslib: Speed up adding new cloned capabilities
Adding new capabilities can be slow if they have permissions cloned
from an existing capability, and if there are many places in the
database where the existing capability was overridden.

This change optimises the clone-capability performance, approximately
halving the number of queries required.
2022-12-22 11:05:39 +00:00
sam marshall
fe6a51265a MDL-76129 accesslib: Improve performance of adding new capabilities
Adding multiple capabilities was very slow because it clears and
rebuilds the capability cache after each one. This change makes it
clear the cache once after adding all capabilities, before adding
permissions to the archetype roles.
2022-12-22 11:05:14 +00:00
Shamim Rezaie
9708ad500b Merge branch 'MDL-55580_master' of https://github.com/marxjohnson/moodle 2022-10-17 19:19:36 +11:00
Laurent David
bcc18e2439 MDL-55580 core: Process for deprecating a capability
* Add a $deprecatedcapabilities variable to deal with deprecated
capabilities

Change-Id: I14f44d331e8a1c4bd9abe9566c78d911c0205583
Co-authored-by: Mark Johnson <mark.johnson@catalyst-eu.net>
2022-10-11 08:48:17 +01:00
Marina Glancy
41b93bd7e5 MDL-73424 general: Internal methods must have same type as parent
Otherwise the error is thrown in PHP8.1
2022-10-10 16:46:13 +02:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Andrew Nicols
00efa6aecf MDL-74271 context: Improve performance of block context creation 2022-04-06 23:40:15 +08:00
Peter Spicer
edde68e078
MDL-67428 navigation: Apply navigation text filters at system context
On some larger sites, processing the navigation with format_string will
habitually load all the contexts for navigation which can take 400+ DB
queries. Explicitly tying all those format_string calls to the system
context reduces this overhead to a single DB query that probably has
already been run on the page previously.

Co-authored-by: Peter Burnett <peterburnett@catalyst-au.net>
2022-03-04 14:36:25 +10:00
cescobedo
3c6ad8ac09 MDL-72616 blocks: Remove block_quiz_results 2021-10-27 06:23:04 +02:00
Amaia Anabitarte
1d4edcb57b MDL-72099 core_contenbank: Add context navigation 2021-10-14 13:04:13 +02:00
Brendan Heywood
7b938088b5 MDL-71014 core: Cache immutable bootstrap config locally 2021-09-02 13:22:28 +10:00
Luca Bösch
0fb0743025 MDL-71284 assign: prevent double escaping assignment name. 2021-05-27 20:31:42 +02:00
Luca Bösch
7dd58aac64 MDL-60331 questions: prevent double escaping question categories. 2021-04-28 17:30:46 +02:00
sam marshall
5e72715e4f MDL-71099 Lib: Move new user_fields class from core to core_user
This class would belong more appropriately within the 'user' API
(core_user) instead of within the 'core' API, since it is
directly related to user data.

Since the class has only just been added to Moodle, now is a good
time to move it.
2021-03-25 13:47:23 +00:00
sam marshall
558cc1b85e MDL-45242 Lib: Replace calls to deprecated functions
In all cases changes have been kept to a minimum while not making
the code completely horrible. For example, there are many instances
where it would probably be better to rewrite a query entirely, but
I have not done that (in order to reduce the risk of changes).
2021-03-10 10:57:10 +00:00
Paul Holden
43adc7a333 MDL-70614 user: consistent roles spacing in course profile. 2021-02-01 07:55:04 +00:00
Paul Holden
20905a1481 MDL-70159 tool_capability: order capabilities by their name. 2021-01-14 07:32:56 +00:00
Andrew Nicols
81bb3a65b1 MDL-68974 admin: Prevent login as outside of the desired context 2020-09-08 08:54:26 +02:00
Paul Holden
a9165e69b4 MDL-63387 access: add parameter to define how role names are returned. 2020-09-01 12:05:15 +01:00
Mike Churchward
9e8e75a05a MDL-68866 accesslib: Fixing parameter documentation. 2020-05-28 22:01:22 -04:00
Matt Porritt
01436f7539 MDL-64843 Backup: Course copy user interface
This patch adds better core support for copying courses.
There is now a simplified and dedicated UI for copying
courses. This can be accessed from the course context
menu or course management screens.

All backups are done asynchronously and there can be multiple
copies of a course in flight at once.
2020-05-15 06:02:02 +00:00
Tim Hunt
1ed243c2fe MDL-68402 accesslib: fix coding style of loops 2020-05-06 09:18:02 +01:00
Tim Hunt
1736c59925 MDL-68402 accesslib: Modernise coding style in the functions changed 2020-05-06 09:18:02 +01:00
Tim Hunt
0d3bdb94bc MDL-68402 accesslib: fix get_with_capability_join logic
In fact, rather than fix the old logic, I noticed that the correct
logic was already implemented in get_users_by_capability. So, I
refactored to extract the working version into a function, which it
turns out can have exactly the same API as get_with_capability_join,
which was convenient.
2020-05-06 09:18:02 +01:00
Tim Hunt
45c4d4aa8c MDL-46123 accesslib: improve get_component_string 2019-12-03 23:11:11 +01:00
sam marshall
7ba2a20166 MDL-66326 Global search: Delete from index when courses are deleted
Adds new API support within search engines for optional methods to
delete data for courses and contexts, and implements this for the
two core search plugins (simpledb and solr).

The new API is automatically called when courses or contexts are
deleted. When a whole course is deleted, it only sends the course
delete rather than sending 1,000 separate context deletions as
each activity/block is deleted.
2019-08-23 11:51:50 +01:00
Neill Magill
e3ec42093a MDL-65443 core: Log when a context is locked or unlocked 2019-08-20 08:52:35 +01:00
Simey Lameze
a98bafa163 MDL-66034 core_role: implement capability unassigned event 2019-08-05 13:09:18 +08:00
Simey Lameze
7b0afca816 MDL-66034 core_role: implement capability assigned event 2019-08-05 13:09:18 +08:00
Andrew Nicols
29c442c558 MDL-65646 core: Move component storage to json 2019-06-13 12:26:00 +08:00