X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialFileDuplicateSearch.php;h=4c6593b27236e349c1a5eee9a6cd3affc4715076;hb=a60fac96a501754b956897ee91c5cc84d4ec6799;hp=366aa81e90d7eb8027820e9406a99a35b49cfbdd;hpb=4feea6a4ec1fe0a1f7a2518d89c293fdb2df5f22;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index 366aa81e90..4c6593b272 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 ); @@ -67,7 +67,7 @@ class FileDuplicateSearchPage extends QueryPage { /** * - * @param $dupes Array of File objects + * @param array $dupes of File objects */ function showList( $dupes ) { $html = array(); @@ -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(); } @@ -215,4 +226,8 @@ class FileDuplicateSearchPage extends QueryPage { return "$plink . . $user . . $time"; } + + protected function getGroupName() { + return 'media'; + } }