settings: cleanup#713
Merged
smbader merged 4 commits intoncstate-delta:mainfrom Apr 23, 2026
Merged
Conversation
Cleanups: - `$moodlehashideif` is always `true` because this plugin already requires Moodle 3.7+. - Remove "false" branches and tidy. - Remove `environmentlib.php` because we no longer use `normalize_version()`. - Use notification constants instead of static strings. Requires Moodle 3.1. - Use `new lang_string()` when not immediately using the string. Requires Moodle 2.3. - Use admin_setting_configcheckbox_with_lock for locked fields. Requires Moodle 2.0. - Avoid creating unnecessary local variables.
cbounphengsy
approved these changes
Apr 23, 2026
Contributor
cbounphengsy
left a comment
There was a problem hiding this comment.
Awesome! By removing unnecessary code use and optimizing the settings, we can increase its efficiency and security.
smbader
approved these changes
Apr 23, 2026
Contributor
smbader
left a comment
There was a problem hiding this comment.
A massive Spring cleaning effort!
I learned a couple things as well:
new lang_stringadmin_setting_configcheckbox_with_lock
Thanks Champ!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleanups:
$moodlehashideifis alwaystruebecause this plugin already requires Moodle 3.7+.environmentlib.phpbecause we no longer usenormalize_version().new lang_string()when not immediately using the string. Requires Moodle 2.3.Notes:
use fakenamespace\fakeclass;and the code will work just fine (because it ignores references until they are needed).$hassiteconfigoffers a small amount of defense-in-depth. It's checked before the file is included, but just in case!modsettingzoompage name, becauseplugininfo_mod(andadmin/settings/plugins.phpbefore that) provide us with an appropriately instantiatedadmin_settingpage, we should not create our own and should use the name attribute that the class provides and uses as the official section name. One less thing to cause a problem if Moodle were to decide to move all plugins into a single folder.classes/external.php, because that will be resolved when fix: Use new external class names (requires Moodle 4.2) #673 is merged.