From: umherirrender Date: Sat, 18 Aug 2012 13:44:20 +0000 (+0200) Subject: prop=duplicatefiles does not show duplicates under same name X-Git-Tag: 1.31.0-rc.0~22643^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=5964a39755ddb2035b0b4d38ca2f02a161e14686;p=lhc%2Fweb%2Fwiklou.git 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 --- 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', ) ); }