From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/specials/SpecialFileDuplicateSearch.php | 51 ++++++++++++++---------- 1 file changed, 31 insertions(+), 20 deletions(-) (limited to 'includes/specials/SpecialFileDuplicateSearch.php') diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index 3fe64e6f..4c6593b2 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -59,7 +59,7 @@ class FileDuplicateSearchPage extends QueryPage { /** * Fetch dupes from all connected file repositories. * - * @return Array of File objects + * @return array of File objects */ function getDupes() { return RepoGroup::singleton()->findBySha1( $this->hash ); @@ -101,11 +101,11 @@ class FileDuplicateSearchPage extends QueryPage { $this->setHeaders(); $this->outputHeader(); - $this->filename = isset( $par ) ? $par : $this->getRequest()->getText( 'filename' ); + $this->filename = isset( $par ) ? $par : $this->getRequest()->getText( 'filename' ); $this->file = null; $this->hash = ''; $title = Title::newFromText( $this->filename, NS_FILE ); - if( $title && $title->getText() != '' ) { + if ( $title && $title->getText() != '' ) { $this->file = wfFindFile( $title ); } @@ -113,37 +113,46 @@ class FileDuplicateSearchPage extends QueryPage { # Create the input form $out->addHTML( - Xml::openElement( 'form', array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript ) ) . - Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . - Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . - Xml::inputLabel( $this->msg( 'fileduplicatesearch-filename' )->text(), 'filename', 'filename', 50, $this->filename ) . ' ' . - Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . - Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ) + Html::openElement( + 'form', + array( 'id' => 'fileduplicatesearch', 'method' => 'get', 'action' => $wgScript ) + ) . "\n" . + Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n" . + Html::openElement( 'fieldset' ) . "\n" . + Html::element( 'legend', null, $this->msg( 'fileduplicatesearch-legend' )->text() ) . "\n" . + Xml::inputLabel( + $this->msg( 'fileduplicatesearch-filename' )->text(), + 'filename', + 'filename', + 50, + $this->filename + ) . "\n" . + Xml::submitButton( $this->msg( 'fileduplicatesearch-submit' )->text() ) . "\n" . + Html::closeElement( 'fieldset' ) . "\n" . + Html::closeElement( 'form' ) ); - if( $this->file ) { + if ( $this->file ) { $this->hash = $this->file->getSha1(); - } elseif( $this->filename !== '' ) { + } elseif ( $this->filename !== '' ) { $out->wrapWikiMsg( "

\n$1\n

", array( 'fileduplicatesearch-noresults', wfEscapeWikiText( $this->filename ) ) ); } - if( $this->hash != '' ) { + if ( $this->hash != '' ) { # Show a thumbnail of the file $img = $this->file; if ( $img ) { $thumb = $img->transform( array( 'width' => 120, 'height' => 120 ) ); - if( $thumb ) { + if ( $thumb ) { $out->addHTML( '
' . $thumb->toHtml( array( 'desc-link' => false ) ) . '
' . $this->msg( 'fileduplicatesearch-info' )->numParams( $img->getWidth(), $img->getHeight() )->params( - $this->getLanguage()->formatSize( $img->getSize() ), - $img->getMimeType() )->parseAsBlock() . + $this->getLanguage()->formatSize( $img->getSize() ), + $img->getMimeType() )->parseAsBlock() . '
' ); } } @@ -152,7 +161,7 @@ class FileDuplicateSearchPage extends QueryPage { $numRows = count( $dupes ); # Show a short summary - if( $numRows == 1 ) { + if ( $numRows == 1 ) { $out->wrapWikiMsg( "

\n$1\n

", array( 'fileduplicatesearch-result-1', wfEscapeWikiText( $this->filename ) ) @@ -172,14 +181,16 @@ class FileDuplicateSearchPage extends QueryPage { function doBatchLookups( $list ) { $batch = new LinkBatch(); - foreach( $list as $file ) { + /** @var File $file */ + foreach ( $list as $file ) { $batch->addObj( $file->getTitle() ); - if( $file->isLocal() ) { + if ( $file->isLocal() ) { $userName = $file->getUser( 'text' ); $batch->add( NS_USER, $userName ); $batch->add( NS_USER_TALK, $userName ); } } + $batch->execute(); } -- cgit v1.2.2