mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #55731
[Bug 1827445] A change has been merged
Reviewed: https://reviews.mahara.org/10392
Committed: https://git.mahara.org/mahara/mahara/commit/fb37ef6e28a2156efcd35ce3d0a53268b4f93d59
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch: master
commit fb37ef6e28a2156efcd35ce3d0a53268b4f93d59
Author: Cecilia Vela Gurovic <ceciliavg@xxxxxxxxxxxxxxx>
Date: Thu Oct 3 13:50:55 2019 +1300
Bug 1827445: db_table_exists alternative without changing SQL exceptions
and the same for db_column_exists
behatnotneeded
Change-Id: Id69e285b39aff1dca7edbbf16847c3b7a436baa5
--
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1827445
Title:
Improve efficiency when checking if a table field exists
Status in Mahara:
Fix Committed
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_once('ddl.php');
$table = new XMLDBTable('tablename');
$field = new XMLDBField('fieldname');
if (field_exists($table, $field)) {
...
}
We could just do:
if (column_exists('tablename', 'fieldname')) {
...
}
And have the column_exists function that call the database directly
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1827445/+subscriptions
References