Page MenuHomePhabricator

Swap order of statements to save a DB query
Closed, ResolvedPublic

Description

I was just looking at https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FComments/master/CommentsPage.php#L180

As far as I know, tableExists does a DB query, but class_exists doesn't. If the class doesn't exist, that means the extension just did an extra DB roundtrip for no real reason.

Solution: can we just swap the order of the class_exists() and tableExists so the query can be short-circuited out, when SocialProfile is not installed?

I'd write up a PR but I have no idea how to use the WMF's crazy interface.

Event Timeline

labster created this task.May 2 2016, 8:28 AM
Restricted Application added a project: Social-Tools. · View Herald TranscriptMay 2 2016, 8:28 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change 286448 had a related patch set uploaded (by Jack Phoenix):
Swap order of statements to save a DB query

https://gerrit.wikimedia.org/r/286448

Change 286448 merged by Jack Phoenix:
Swap order of statements to save a DB query

https://gerrit.wikimedia.org/r/286448

ashley closed this task as Resolved.May 2 2016, 2:52 PM
ashley claimed this task.
ashley added a subscriber: ashley.