From 5964a39755ddb2035b0b4d38ca2f02a161e14686 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Sat, 18 Aug 2012 15:44:20 +0200 Subject: [PATCH] prop=duplicatefiles does not show duplicates under same name When under the same name on the repo a file exist, with the same hash, prop=duplicatefiles does not list this file. Checking also isLocal, when looking for the file itself helps. Adding also a shared='' to indicate, that the duplicate with same name is not the file itself. Follow up I745cae7a Change-Id: I4e613cb6d592521befe8bc876e251a89b3fa3047 --- includes/api/ApiQueryDuplicateFiles.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index a4efc4c1c3..8f0fd3be72 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -118,8 +118,8 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { } foreach ( $dupFiles as $dupFile ) { $dupName = $dupFile->getName(); - if( $image == $dupName ) { - continue; //ignore the file itself + if( $image == $dupName && $dupFile->isLocal() ) { + continue; //ignore the local file itself } if( $skipUntilThisDup !== false && $dupName < $skipUntilThisDup ) { continue; //skip to pos after the image from continue param @@ -140,6 +140,9 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { 'user' => $dupFile->getUser( 'text' ), 'timestamp' => wfTimestamp( TS_ISO_8601, $dupFile->getTimestamp() ) ); + if( !$dupFile->isLocal() ) { + $r['shared'] = ''; + } $fit = $this->addPageSubItem( $pageId, $r ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $image . '|' . $dupName ); @@ -191,7 +194,8 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { '' => array( 'name' => 'string', 'user' => 'string', - 'timestamp' => 'timestamp' + 'timestamp' => 'timestamp', + 'shared' => 'boolean', ) ); } -- 2.20.1