-
Improvement
-
Resolution: Won't Do
-
Major
-
None
-
2.3.1, 2.7.1
-
MOODLE_23_STABLE, MOODLE_27_STABLE
The way that Moodle currently sets default values for config settings is through literal values in the code, such as in the following example. This is quite poor.
/admin/settings/frontpage.php, lines 50-52 |
$temp->add(new admin_setting_configtext('commentsperpage', new lang_string('commentsperpage', 'admin'), '', 15, PARAM_INT));
|
|
$temp->add(new admin_setting_configtext('coursesperpage', new lang_string('coursesperpage', 'admin'), new lang_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
|
A number of bugs have come about because, through various circumstances, config values are not being set and this has an impact on the system when such settings are used.
One solution to this problem is to pre-populate the global config object $CFG with all default values, before over-writing these defaults with values from the DB. It might also be useful to start with a default object ($DEFAULT) that is copied as the config object ($CFG) so that default values can always be checked later. This would ensure that:
- all global config settings are guaranteed to have a value (would that lead to sloppy checking?), and
- the defaults for config values would be defined in a common place, and can be referred to when needed, instead of relying on literal values.
- has been marked as being related by
-
MDL-38770 Consolidate JS settings
-
- Closed
-
-
MDL-28584 Emtpy Value in moodlecourse | maxsections defaults to 0 when editing a course
-
- Closed
-
-
MDL-46487 Option to disable all advanced features and plugins when installing
-
- Closed
-
-
MDL-36795 In the default course settings, numsections is not limited to maxsections
-
- Closed
-
-
MDL-40101 Encourage the use of get_config/set_config instead of $CFG where ever possible
-
- Closed
-
-
MDL-42961 Children themes should fully inherit from their parents
-
- Closed
-
- will help resolve
-
MDL-27824 Add/ Editing Categories / Courses / Sub courses and it crashes with a coding error detected. "paging_bar requires a perpage value"
-
- Closed
-
-
MDL-36065 $CFG->themedir not defaulting to $CFG->dirroot . '/theme'
-
- Closed
-