Created a flag, 'deletioninprogress' on the course_modules table to be
used when deleting course modules and course sections. Modified
modinfolib caches such that, when rebuilt, these caches hide the
relevant modules based on the value of the flag.
Final deprecation of the following methods:
- course_modinfo::build_section_cache()
- cm_info::get_deprecated_group_members_only()
- cm_info::is_user_access_restricted_by_group()
Plus throw coding exception for direct calls of the following:
- cm_info::get_url()
- cm_info::get_content()
- cm_info::get_extra_classes()
- cm_info::get_on_click()
- cm_info::get_custom_data()
- cm_info::get_after_link()
- cm_info::get_after_edit_icons()
- cm_info::obtain_dynamic_data()
Currently cm_info::create allows the 'null' parameter, and
returns null (as a null $cm should still be null when treated
as a cm_info object).
Some unit tests relied on the value 'false' being treated
the same as null in this regard. This seems like a generally
safe assumption (given this is a function about changing
weakly typed data into a stronger type) so I modified the
function to accept anything PHP false, returning null.
* Upgrades existing data so that the groupmembersonly option is
replaced with equivalent data for the new availability API.
* Removes the database field and admin setting used for
groupmembersonly.
* Changes core modinfo library to remove/deprecate groupmembersonly
data and functions.
* Changes other core library files to remove groupmembersonly
references.
Includes deprecation of several functions, listed in lib/upgrade.txt.
Creates two new functions that make it easier to get cm_info
objects (both in modinfolib.php):
get_course_and_cm($cmid) - intended for use e.g. in modules;
efficiently loads $course and $cm (normally saves 1 query).
cm_info::from_mixed($cm) - for use in back-end API where we
are not sure whether a $cm is a real cm_info or a stdClass.
Changes core code to use new API instead of the old one when
checking user access to activities and sections.
Includes changes to other libraries that are necessary after
adding the availability system and removing old conditional tables
etc.
convert moodle_url (all other fields are numbers or strings) to string before caching and then back to moodle_url when restoring.
Otherwise serialized modinfo can contain \0 byte which cause problems in Postgres DB
Prior to the fix, if you did not have a capability like mod/page:view,
then you woulds still see the link to the Page activity in the course
section, but when you clicked on it, you would run into a
require_capability error.
It is a principle that we never show users a link to a page they are not
allowed to access, therefore, when users do not have mod/...:view, they
should not see the link on the course page.
This patch implements this in the cm_info class, in a similar way to how
access restrictions by groups works.
It does not assume that the mod/...:view capability exists. If the
capability does not exist, then users are not prevented from seeing the
link.
- Core upgrade MUST NOT call rebuild_course_cache() at all - update DB directly instead
- Plugins MUST call rebuild_course_cache(.., TRUE) for clearing the course cache and can not update DB directly
- Plugins MUST NOT call rebuild_course_cache() unless for clearing the cache
- Created function upgrade_ensure_not_running() to be included in other functions that can not be used during upgrade