r75038 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75037‎ | r75038 | r75039 >
Date:21:03, 19 October 2010
Author:hartman
Status:deferred
Tags:
Comment:
Automatically follow redirects, avoids having to skip them.
Modified paths:
  • /branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/AddMedia/searchLibs/mediaWikiSearch.js
@@ -135,16 +135,17 @@
136136 // Build the image request
137137 var request = {
138138 'action':'query',
139 - 'generator':'search',
140 - 'gsrsearch': search_query ,
141 - 'gsrnamespace':6, // (only search the "file" namespace (audio, video, images)
142 - 'gsrwhat': 'text',
143 - 'gsrlimit': this.provider.limit,
144 - 'gsroffset': this.provider.offset,
145 - 'prop':'imageinfo|revisions|categories',
146 - 'iiprop':'url|mime|size|metadata',
147 - 'iiurlwidth': parseInt( this.rsd.thumb_width ),
148 - 'rvprop':'content'
 139+ 'generator': 'search',
 140+ 'gsrsearch': search_query ,
 141+ 'gsrnamespace': 6, // (only search the "file" namespace (audio, video, images)
 142+ 'gsrwhat': 'text',
 143+ 'gsrlimit': this.provider.limit,
 144+ 'gsroffset': this.provider.offset,
 145+ 'prop': 'imageinfo|revisions|categories',
 146+ 'iiprop': 'url|mime|size|metadata',
 147+ 'iiurlwidth': parseInt( this.rsd.thumb_width ),
 148+ 'rvprop': 'content',
 149+ 'redirects': '';
149150 };
150151
151152 // Do the api request:
@@ -184,19 +185,12 @@
185186 for ( var page_id in data.query.pages ) {
186187 var page = data.query.pages[ page_id ];
187188
188 - // Make sure the reop is shared (don't show for now it confusing things)
 189+ // Make sure the repo is shared (don't show for now it confusing things)
189190 // @@todo support remote repository better
190191 if ( page.imagerepository == 'shared' ) {
191192 continue;
192193 }
193194
194 - // Make sure the page is not a redirect
195 - if ( page.revisions && page.revisions[0] &&
196 - page.revisions[0]['*'] && page.revisions[0]['*'].indexOf( '#REDIRECT' ) === 0 ) {
197 - // skip page is redirect
198 - continue;
199 - }
200 -
201195 // Skip if its an empty or missing imageinfo:
202196 if ( !page.imageinfo ){
203197 continue;

Follow-up revisions

RevisionCommit summaryAuthorDate
r75039Fix syntax error in r75038hartman21:04, 19 October 2010

Status & tagging log