Improve efficiency when checking if a table field exists
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Unassigned |
Bug Description
When upgrading we use a field_exists() check to see if a table has a certain column or not which is fine there as upgrade chunks are a one-time execution run when users are all logged out.
However we have begun to use field_exists() within other parts of the code and so this can get called on every page load by multiple users at once. This requires fetching the ddl.lib file and setting ul an XMLDB table object and an XMLDB field object which has overhead.
Instead we should just query the database directly and ask it if the table has the column or not
So instead of doing:
require_
$table = new XMLDBTable(
$field = new XMLDBField(
if (field_
...
}
We could just do:
if (column_
...
}
And have the column_exists function that call the database directly
description: | updated |
Changed in mahara: | |
milestone: | none → 19.10.0 |
status: | New → In Progress |
importance: | Undecided → Medium |
Changed in mahara: | |
status: | In Progress → Fix Committed |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
Patch for "master" branch: https:/ /reviews. mahara. org/9950