diff options
Diffstat (limited to 'includes/api/ApiQueryDuplicateFiles.php')
-rw-r--r-- | includes/api/ApiQueryDuplicateFiles.php | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index 8f0fd3be..18dcba85 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -66,10 +66,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { $skipUntilThisDup = false; if ( isset( $params['continue'] ) ) { $cont = explode( '|', $params['continue'] ); - if ( count( $cont ) != 2 ) { - $this->dieUsage( 'Invalid continue param. You should pass the ' . - 'original value returned by the previous query', '_badcontinue' ); - } + $this->dieContinueUsageIf( count( $cont ) != 2 ); $fromImage = $cont[0]; $skipUntilThisDup = $cont[1]; // Filter out any images before $fromImage @@ -95,6 +92,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { $sha1s = array(); foreach ( $files as $file ) { + /** @var $file File */ $sha1s[$file->getName()] = $file->getSha1(); } @@ -116,6 +114,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { if( $params['dir'] == 'descending' ) { $dupFiles = array_reverse( $dupFiles ); } + /** @var $dupFile File */ foreach ( $dupFiles as $dupFile ) { $dupName = $dupFile->getName(); if( $image == $dupName && $dupFile->isLocal() ) { @@ -133,7 +132,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { break; } if ( !is_null( $resultPageSet ) ) { - $titles[] = $file->getTitle(); + $titles[] = $dupFile->getTitle(); } else { $r = array( 'name' => $dupName, @@ -204,12 +203,6 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { return 'List all files that are duplicates of the given file(s) based on hash values'; } - public function getPossibleErrors() { - return array_merge( parent::getPossibleErrors(), array( - array( 'code' => '_badcontinue', 'info' => 'Invalid continue param. You should pass the original value returned by the previous query' ), - ) ); - } - public function getExamples() { return array( 'api.php?action=query&titles=File:Albert_Einstein_Head.jpg&prop=duplicatefiles', @@ -220,8 +213,4 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Properties#duplicatefiles_.2F_df'; } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } } |