141 Commits

Author SHA1 Message Date
Sara Arjona
b91ec287dc
Merge branch 'MDL-80190-main' of https://github.com/ferranrecio/moodle 2024-02-13 15:28:05 +01:00
Sara Arjona
d3cac65bf9
Merge branch 'mdl-80576_master' of https://github.com/james-cnz/moodle 2024-02-08 15:32:27 +08:00
Ferran Recio
97a7958aee MDL-80190 core_courseformat: do not render delegated sections in course 2024-02-07 12:06:03 +01:00
Ilya Tregubov
32fe5a74ed Merge branch 'MDL-80098' of https://github.com/paulholden/moodle 2024-01-25 10:20:05 +08:00
James C
66789055b6 MDL-80576 course: Fix section_info::getIterator()
- section_info::getIterator() failed to fetch course format custom options
  as the section number provided was not recognized
2024-01-23 23:01:48 +13:00
Ferran Recio
557099a81e MDL-80187 core_courseformat: create and delete section methods 2024-01-17 10:39:13 +01:00
Paul Holden
e187e13947
MDL-80098 core: correct arguments for invalidmoduleid exceptions.
The "invalid module ID" should be passed as the `$a` constructor
argument.
2024-01-17 08:58:49 +00:00
Ferran Recio
837dc7e852 MDL-80186 course: adding new fields to delegate sections logic 2023-12-20 12:02:51 +01:00
Ferran Recio
93cb5b090a MDL-79999 course: save session cache by id
The course modinfo cache now stores sections no matter the section
number. This will be needed when delegated sections will be implemented.
2023-11-29 15:16:36 +01:00
Amaia Anabitarte
8b12110dfd MDL-79999 course: Improve section meaning in modinfolib classes
section variables and properties in modinfolib classes
sometimes contain sectionid and some others contain sectionnum.
We need to make the variables and properties more consistent and clear.
2023-11-24 11:03:23 +01:00
Mark Johnson
f3fc03e90c MDL-79615 course: Improve efficency of cache rebuilds
When bulk-updating course module visibility, set_coursemodule_visibily
was triggering a partial cache purge and rebuild for each course module.
This potentially led to 2 cache sets each requiring a lock to be
acquired and released per course module, plus any other cache updates
for other changes to the course in the same request.

This adds a new $rebuildcache paramter to the
set_coursemodule_visibilty, which is true by default to retain the
existing behaviour. If set false, it will skip doing the partial purge
and rebuild for that course module, and it is up to the calling code to
ensure the cache is updated as requried.

To assist with this, there is a new
course_modinfo::purge_course_module_cache_multiple() method, which
allows multiple course modules to be purged from the cache in a single
cache set.
2023-10-27 10:50:40 +01:00
sam marshall
0f8577784d MDL-78467 core_cache: Improve cache locking API
* Makes it possible to safely call acquire_lock so that it throws an
  exception instead of returning false if it can't get a lock (which
  most existing uses assumed it already does).
* Fix some omissions from the requirelockingbeforewrite option (it
  now checks on delete).
* Modinfo uses a versioned cache, so it is not necessary to delete
  items, only increase the version. (Provided we keep track of
  cacherev carefully...)
2023-09-14 09:28:10 +01:00
Meirza
97ff68fd6b MDL-78159 lib: Added missing properties for core libraries
In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
2023-06-21 15:39:53 +07:00
Sara Arjona
6db715f5c3 MDL-78207 course: Add new module badges feature
The new activity card design proposed for Moodle 4.3 differentiates badge
information from other HTML content (displayed using the afterlink feature).
This commit adds a new activitybadge class that can be extended by any
module to display any content in a badge near the activity name. These
are the main features:
- The badge content is always plain text (no HTML).
- The badge style can be set (by default is initialized with badge-none,
but it can be set by any module).
- An optional URL to redirect the user when the badge is clicked.
- An optional ID to add the element in case the module wants to add some
JS to the badge events.
- Optionally, any other extra HTML attributes to the badge element (for
example, data attributes).
2023-06-13 12:09:58 +02:00
sam marshall
a2af6bd669 MDL-78092 Cache: Modinfo locking with Redis store does not work
The feature added in 4.1 to lock the modinfo cache does not work when
using Redis, because:

* The API to acquire a cache lock is confusing, and the code did not
  check that it successfully acquired a lock before going on to build
  the cache anyway.

* Unlike the other types of cache lock, the Redis store did not retry
  the lock for a timeout period before giving up and failing.

This change fixes both points.
2023-05-22 10:43:14 +01:00
Jun Pataleta
064971648c MDL-77105 core: Cast custom data to an array when evaluating filtericon
Since other modules may treat custom data as an object, we need to make
cast it to an array before evaluating for the `filtericon` custom data.
2023-03-28 18:48:31 +08:00
Jun Pataleta
a898d8ac54 MDL-77105 core: Add a filtericon parameter to course mod icon URLs
* If a plugin defines a `filtericon` custom data or uses its monologo
version of the icon, a `filtericon` parameter is being added to the
icon's URL. This information can help plugins determine whether to
render the activity icon as is or with CSS filtering.
2023-03-27 13:32:09 +08:00
Mark Johnson
2f1e7982df MDL-67020 Cache: Refactor build_course_cache 2022-10-20 11:31:33 +01:00
Mark Johnson
ea01fb2427 MDL-67020 Cache: Make local caching work for coursemodinfo 2022-10-20 11:31:33 +01:00
Mark Johnson
dcc7d7b8df MDL-67020 Cache: Increment cacherev when purging course cache 2022-10-19 09:04:33 +01:00
Víctor Déniz
ab764c0062 Merge branch 'MDL-75736-master' of https://github.com/sammarshallou/moodle 2022-10-14 16:09:01 +01:00
sam marshall
18dc2a50ab MDL-75736 lib: Course cache can be rebuilt unnecessarily
This change puts back the behaviour that get_fast_modinfo will accept
a cached version of modinfo that is newer than expected (according to
the course cacherev).

Not accepting newer versions can lead to poor performance in cases
where multiple requests take place at once, or using a clustered
database.
2022-10-11 16:56:21 +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
Mikhail Golenkov
db04ed91ae MDL-74993 course: Output cm id when throwing Invalid course module id 2022-09-12 14:17:25 +10:00
Tim Hunt
8babdbd396 MDL-74608 activities: a new option to force the activity language
For a long time, Moodle has had the feature to force the language
for a whole course. This change adds the same feature at activity
level.

The course-level feature was controlled by a capability
moodle/course:setforcedlanguage, and I decided to use the same
capability to control this feature. I think a new capability would be
overkill.
2022-08-15 22:15:52 +01:00
Simey Lameze
c85b88c1b6 MDL-74967 core: deprecate groupmember hack from USER object 2022-06-29 04:55:42 +08:00
Tim Hunt
5fff990e25 MDL-74255 quiz: clean up lots of stuff mainly in the tests
This fixes lots of stuff like outdated or incomplete PHPdoc comments
or test heler functions where the arguments don't have their types
declared.

A few more significant fixes, like places were a silly method
was used to get a context which was readily available.
2022-04-08 12:19:52 +01:00
Andrew Nicols
e4aa381679 MDL-74235 mod: Update mod icon to use monologo 2022-04-07 13:27:18 +06:00
Huong Nguyen
bfe14e2312 MDL-72991 Course: Partial course cache rebuild with cache versioning 2022-03-17 15:34:26 +07:00
Huong Nguyen
4bc2b24a51 MDL-72991 Course: Modify the courseminfo cacheid to force a rebuild
Co-authored-by: Andrew Lyons <andrew@nicols.co.uk>
2022-03-17 15:34:26 +07:00
Dongsheng Cai
f97b86e841 MDL-72991 Course: Partial course cache rebuild
When updating/deleting a section/module, the system now only
invalidate of the element (section/module), not the whole course cache
Also, the system now only recalculate the cache for element (section/module)
if necessary, not the whole course cache

Move module/section purging to course_modinfo:
  + course_modinfo::purge_course_section_cache_by_id was created to purge section by id
  + course_modinfo::purge_course_section_cache_by_number was created to purge section by number
  + course_modinfo::purge_course_module_cache was created to purge module
2022-03-17 15:34:01 +07:00
Sara Arjona
9b5da4de17 Merge branch 'MDL-73993-master' of https://github.com/golenkovm/moodle 2022-03-09 13:24:29 +01:00
Mikhail Golenkov
8c914c8756 MDL-73993 phpdoc: get_module_types_names returns lang_string objects 2022-03-03 10:39:09 +11:00
Andrew Nicols
6544843894 Merge branch 'MDL-73762-master' of https://github.com/ferranrecio/moodle 2022-03-01 09:35:59 +08:00
Ferran Recio
23856b1086 MDL-73762 core_courseformat: refactor cm and section outputs 2022-02-25 13:35:23 +01:00
sam marshall
02bb326314 MDL-72837 core_cache: Use versioned cache for modinfo
Uses the new versioned cache feature for modinfo, which should make it
safe as a localisable cache.
2022-02-24 13:51:07 +00:00
Simey Lameze
89e59a60ef MDL-69561 mod: handle content download on course modules 2021-11-11 18:38:53 +08:00
Ilya Tregubov
ac93013cd1 MDL-72995 core_course: Revert "MDL-55231: Partial course cache rebuild"
This reverts commits c1468388bcecec43e671335db8edfc839494e710,
c1468388bcecec43e671335db8edfc839494e710 and
9a900492bc14176c4f56b8e600ef459069a3ec7a.
2021-11-04 11:57:58 +02:00
Dongsheng Cai
9a900492bc MDL-55231 core_course: Partial course cache rebuild 2021-10-26 19:08:15 +11:00
Peter
90acd8d381 MDL-52206 core: Add completion criteria to course_modules 2021-10-04 19:44:02 +08:00
Ferran Recio
21d93554d4 MDL-71863 courseformat: create courseformat subsystem 2021-06-28 13:50:18 +02:00
Sara Arjona
6347b916bc MDL-71165 course: core_course_update_course external method 2021-06-14 14:36:20 +08:00
Huong Nguyen
3e2570611f MDL-71486 course: Notice when in site home/course page 2021-04-29 14:42:49 +07:00
Shamim Rezaie
4ddc9fe0f4 MDL-71410 core: Prevent recursively calling getters 2021-04-27 14:32:26 +10:00
Shamim Rezaie
14e37590bb MDL-71410 core: Introduce override_customdata()
The get_custom_data() method now calls obtain_dynamic_data() because
$this->customdata can be dynamic now.
2021-04-26 05:28:36 +10:00
Víctor Déniz
4d0292b3b5 Merge branch 'MDL-70537-master' of https://github.com/sammarshallou/moodle 2021-03-26 20:14:19 +00:00
sam marshall
c89ea6733c MDL-70537 Availability: Avoid recursive calls to $cm->name
These recursive calls didn't work in PHP 7.3 and below, but in PHP
7.4 they also cause a fatal error which means if you have invalid
availability data, the whole page might die.
2021-03-18 15:54:17 +00:00
Ferran Recio
1c839f9072 MDL-65974 course: move format_base to core_course\course_format 2021-03-11 17:36:34 +01:00
Mark Johnson
d91aa1e760 MDL-65327 performance: Lazy-load module name strings 2019-09-20 08:59:34 +01:00
Shamim Rezaie
ea191cf1b4 MDL-41507 core_group: Consistent default value for FEATURE_GROUPS 2018-12-12 14:03:45 +11:00