prop=duplicatefiles does not show duplicates under same name
authorumherirrender <umherirrender_de.wp@web.de>
Sat, 18 Aug 2012 13:44:20 +0000 (15:44 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sat, 18 Aug 2012 13:44:20 +0000 (15:44 +0200)
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

index a4efc4c..8f0fd3b 100644 (file)
@@ -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',
                        )
                );
        }