🐛 Declare main edflex table to fix course deletion - #6
Merged
Conversation
Moodle's remove_course_contents() runs SELECT ... FROM mdl_{modname} for
every installed module on course deletion. The missing main edflex table
raised a dmlreadexception that broke deletion of any course platform-wide.
- Add the edflex table to db/install.xml
- Create it on existing installs in db/upgrade.php (guarded by table_exists),
bump version to 2026062400
- Make edflex_delete_instance purge its row instead of returning false
DamienVauchel
force-pushed
the
bugfix/EDFLEX1-14964
branch
from
June 24, 2026 11:54
a530ee6 to
d4bb731
Compare
DamienVauchel
marked this pull request as ready for review
June 24, 2026 14:11
DamienVauchel
requested review from
johnny1991,
sserot and
traezh
as code owners
June 24, 2026 14:11
traezh
approved these changes
Jun 25, 2026
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.
🎯 Purpose of this Pull Request
The plugin never declared its mandatory main
edflextable. Moodle's coreremove_course_contents()runsSELECT … FROM mdl_{modname}for every installed module on course deletion, so the missing table raised admlreadexceptionthat broke deletion of any course platform-wide — even courses that never used Edflex.Related to #5
📝 Summary of Changes
edflextable indb/install.xml(id,course,name,intro,introformat,timemodified).db/upgrade.php, guarded bytable_exists(); bump$plugin->versionto2026062400.edflex_delete_instance()now purges its{edflex}row instead of returningfalse.✔️ Moodle Plugin Checklist
Code Quality & Standards
Functional Changes
db/upgrade.phpDatabase & Files
db/install.xmlanddb/upgrade.php🧪 Testing
Manual Tests
edflextable is created.dmlreadexception.edflextable is present after install.Automated Tests
moodle-plugin-ci(validate + savepoints) covers it on CI.🔄 Regression Risk
Additive schema only. Touches the upgrade path for existing installs and the course-deletion path (the fix target). Low risk.
🔗 Additional Notes
edflextable actually stores instance data (todayedflex_add_instancestill returnsfalse, so no data is written yet).