Extend the admin flag options, that currently allow the 'advanced' and 'locked' states
of a form setting to be controlled by a plugins admin settings, to also include
the 'required' state. These options appear as a list of checkboxes next to the admin
setting.
We are already cleaning all sort of caches, statics, singletons
there and it's better to ensure they are always reset to avoid
myterious failures @ distance.
Committer's note: This change was originally part of a bigger patchset
submitted by the author. This is a stripped-down version that does not
use phpunit tests for the new behaviour.
This is the initial deprecation of:
* plagiarism_save_form_elements
* plagiarism_get_form_elements_module
* plagiarism_plugin::get_form_elements_module
* plagiarism_plugin::save_form_elements
This just deletes all the upgrade steps previous to 3.5.0. Some
small adjustments, like tweaking globals can also be applied
when needed.
Also includes an upgrade step to prevent upgrading from any
version < 2018051700 (v3.5.0) as anti-cheating measure.
Previous commits have removed/deprecated all the upgradelib functions
not used anymore in codebase. Deletion has been documented in corresponding
upgrade.txt files:
- upgrade_fix_block_instance_configuration()
- upgrade_theme_is_from_family(), upgrade_find_theme_location()
and linkcoursesectionsupgradescriptwasrun setting
- upgrade_block_positions
- upgrade_fix_config_auth_plugin_names()
and upgrade_fix_config_auth_plugin_defaults()
- format_xxx_upgrade_remove_numsections(), format_xxx_upgrade_hide_extra_sections()
and format_xxx_upgrade_add_empty_sections()
- filter_mathjaxloader_upgrade_cdn_cloudflare()
and filter_mathjaxloader_upgrade_mathjaxconfig_equal()
- get_assignments_with_rescaled_null_grades()
These have been kept because continue being used by restore:
- \core\task\refresh_mod_calendar_events_task
These functions were used only by deleted upgrade steps
so it's safe to proceed with straight deletion, considering
them internal. Deletion has been documented in corresponding
upgrade.txt files:
- format_topics_upgrade_remove_numsections()
- format_topics_upgrade_hide_extra_sections()
- format_topics_upgrade_add_empty_sections()
- format_weeks_upgrade_remove_numsections()
- format_weeks_upgrade_hide_extra_sections()
- format_weeks_upgrade_add_empty_sections()
In PHP the following are true:
assert('' == '');
assert(0 == '');
assert(null == '');
The options in the course completion settings are now:
'' => none selected
[int] => itemnumber of activity course completion item.
In the case where the itemnumber was 0 this was being incorrectly
evaluated as an empty string due to the implicit cast to int of the
empty string:
(int) '' === 0
As a result, the non-strict comparison means that the following are
identical:
assert(0 == '');
assert(0 == (int) '');
assert(0 == '0');
Changing the comparison to a strict comparison is correct because it
ensures the type consitency between the empty string value, and the int
of itemnumber 0. It is safe because the value always comes from the
form, where an int is always returned, and not the DB, where a string is
returned.
The default value is an empty string (""), which in PHP evaluates to 0 when
cast to a string in our DML layer.
The fix is to forcibly make it null which is not cast to string in DML
for optional strings.
This reverts commit ed080a580ffd0eea70ad3eaa9214234cf2463034.
This issue reverts the behaviour modified in MDL-66181, as that change
negatively impacted course-creation workflows. As this appears to be
the intended functionality, the Security team has agreed to revert
this change.
I sneaked in an unrelated change to enrol-partly-active-ends-afterwards
test case as the endtime and enrolment timestart values were swapped.
The case when the enrolment start is after the analysis end is already
tested in enrol-after-end test case.