r49406 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49405‎ | r49406 | r49407 >
Date:17:27, 11 April 2009
Author:aaron
Status:ok
Tags:
Comment:
* Filter out duplicated url parameters
* Whitespace
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -29,11 +29,16 @@
3030 $this->target = $wgRequest->getText( 'target' );
3131 # Handle our many different possible input types.
3232 # Use CVS, since the cgi handling will break on arrays.
33 - $this->oldids = array_filter( explode( ',', $wgRequest->getVal('oldid') ) );
34 - $this->artimestamps = array_filter( explode( ',', $wgRequest->getVal('artimestamp') ) );
35 - $this->logids = array_filter( explode( ',', $wgRequest->getVal('logid') ) );
36 - $this->oldimgs = array_filter( explode( ',', $wgRequest->getVal('oldimage') ) );
37 - $this->fileids = array_filter( explode( ',', $wgRequest->getVal('fileid') ) );
 33+ $this->oldids = explode( ',', $wgRequest->getVal('oldid') );
 34+ $this->oldids = array_unique( array_filter($this->oldids) );
 35+ $this->artimestamps = explode( ',', $wgRequest->getVal('artimestamp') );
 36+ $this->artimestamps = array_unique( array_filter($this->artimestamps) );
 37+ $this->logids = explode( ',', $wgRequest->getVal('logid') );
 38+ $this->logids = array_unique( array_filter($this->logids) );
 39+ $this->oldimgs = explode( ',', $wgRequest->getVal('oldimage') );
 40+ $this->oldimgs = array_unique( array_filter($this->oldimgs) );
 41+ $this->fileids = explode( ',', $wgRequest->getVal('fileid') );
 42+ $this->fileids = array_unique( array_filter($this->fileids) );
3843 # For reviewing deleted files...
3944 $this->file = $wgRequest->getVal( 'file' );
4045 # Only one target set at a time please!
@@ -260,9 +265,11 @@
261266 $result = $dbr->select( array('revision','page'), '*',
262267 array(
263268 'rev_page' => $this->page->getArticleID(),
264 - 'rev_id' => $where,
265 - 'rev_page = page_id' ),
266 - __METHOD__ );
 269+ 'rev_id' => $where,
 270+ 'rev_page = page_id'
 271+ ),
 272+ __METHOD__
 273+ );
267274 while( $row = $dbr->fetchObject( $result ) ) {
268275 $revObjs[$row->rev_id] = new Revision( $row );
269276 }
@@ -288,9 +295,11 @@
289296 $result = $dbr->select( 'archive', '*',
290297 array(
291298 'ar_namespace' => $this->page->getNamespace(),
292 - 'ar_title' => $this->page->getDBKey(),
293 - 'ar_timestamp' => $where ),
294 - __METHOD__ );
 299+ 'ar_title' => $this->page->getDBKey(),
 300+ 'ar_timestamp' => $where
 301+ ),
 302+ __METHOD__
 303+ );
295304 while( $row = $dbr->fetchObject( $result ) ) {
296305 $timestamp = wfTimestamp( TS_MW, $row->ar_timestamp );
297306 $revObjs[$timestamp] = new Revision( array(
@@ -392,9 +401,11 @@
393402 }
394403 $result = $dbr->select( 'oldimage', '*',
395404 array(
396 - 'oi_name' => $this->page->getDBKey(),
397 - 'oi_archive_name' => $where ),
398 - __METHOD__ );
 405+ 'oi_name' => $this->page->getDBKey(),
 406+ 'oi_archive_name' => $where
 407+ ),
 408+ __METHOD__
 409+ );
399410 while( $row = $dbr->fetchObject( $result ) ) {
400411 $filesObjs[$row->oi_archive_name] = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
401412 $filesObjs[$row->oi_archive_name]->user = $row->oi_user;
@@ -426,8 +437,10 @@
427438 $result = $dbr->select( 'filearchive', '*',
428439 array(
429440 'fa_name' => $this->page->getDBKey(),
430 - 'fa_id' => $where ),
431 - __METHOD__ );
 441+ 'fa_id' => $where
 442+ ),
 443+ __METHOD__
 444+ );
432445 while( $row = $dbr->fetchObject( $result ) ) {
433446 $filesObjs[$row->fa_id] = ArchivedFile::newFromRow( $row );
434447 }

Status & tagging log