r89544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89543‎ | r89544 | r89545 >
Date:23:48, 5 June 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
* (bug 27595) sha1 search of list=filearchive does not work

Still disabled in misermode, but switched for LIKE rather than =
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryFilearchive.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -104,6 +104,7 @@
105105 * (bug 29237) add interwiki target url attribute to api/query/interwiki
106106 * (bug 28392) mark action=undelete&timestamps as type "timestamp"
107107 * (bug 21346) Make deleted images searchable by hash (disabled in Miser Mode)
 108+* (bug 27595) sha1 search of list=filearchive does not work
108109
109110 === Languages updated in 1.19 ===
110111
Index: trunk/phase3/includes/api/ApiQueryFilearchive.php
@@ -100,7 +100,7 @@
101101 $sha1 = $params['sha1base36'];
102102 }
103103 if ( $sha1 ) {
104 - $this->addWhere( 'fa_storage_key=' . $db->addQuotes( $sha1 ) );
 104+ $this->addWhere( 'fa_storage_key ' . $db->buildLike( $sha1, $db->anyString() ) );
105105 }
106106 }
107107

Follow-up revisions

RevisionCommit summaryAuthorDate
r91198Follow-up r89544: add dot per CRbtongminh18:51, 30 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89542* (bug 21346) Make deleted images searchable by hash (disabled in Miser Mode)...reedy23:40, 5 June 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   21:38, 24 June 2011

$this->addWhere( 'fa_storage_key ' . $db->buildLike( $sha1, $db->anyString() ) );

Don't you want the period in the LIKE too? The keys are all like "abaf3d3bagg.ext".

#Comment by Bryan (talk | contribs)   18:46, 30 June 2011

Could be done, but doesn't really matter imho.

#Comment by Aaron Schulz (talk | contribs)   18:48, 30 June 2011

What if you have "abaf3d3.png" and "abaf3d3bagg.png" rows (yes, rare)? LIKE "abaf3d3%" seems problematic.

#Comment by Bryan (talk | contribs)   18:52, 30 June 2011

The sha string is forced to be 31 characters long, so that should not be problematic. Fixed nevertheless in r91198.

Status & tagging log