Last modified: 2012-12-13 18:08:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T43855, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 41855 - Hard coding LIKE in db queries isn't database agnostic
Hard coding LIKE in db queries isn't database agnostic
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
TimedMediaHandler (Other open bugs)
unspecified
All All
: Unprioritized minor (vote)
: ---
Assigned To: Michael Dale
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-11-07 17:20 UTC by Sam Reed (reedy)
Modified: 2012-12-13 18:08 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sam Reed (reedy) 2012-11-07 17:20:42 UTC
In SpecialTimedMediaHandler:

	private $formats = array(
		'ogg' => 'img_name LIKE "%.ogv" OR img_name LIKE "%.ogg"',
		'webm' => 'img_name LIKE "%.webm"',
	);

Code like that isn't database agnostic. Should use $db->buildLike()
Comment 1 Jan Gerber 2012-11-07 18:37:27 UTC
would be nice to add a file_extension row to avoid like queries all together
Comment 2 db [inactive,noenotif] 2012-11-09 19:12:22 UTC
What about using the mime type to find the files, instead of the file extension?

audio/webm

application/ogg
audio/ogg
audio/x-ogg
video/ogg
video/x-ogg
Comment 3 Sam Reed (reedy) 2012-11-09 19:53:05 UTC
(In reply to comment #1)
> would be nice to add a file_extension row to avoid like queries all together

Is there a feature request bug for doing that? If not, one should probably be opened....
Comment 4 Jan Gerber 2012-11-27 08:59:07 UTC
https://gerrit.wikimedia.org/r/#/c/35140 uses img_minor_mime to replace the like query.
https://gerrit.wikimedia.org/r/#/c/35139/ adds an index to image for better performance

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links