}
}
- $files = RepoGroup::singleton()->findFiles( array_keys( $images ) );
+ $filesToFind = array_keys( $images );
+ if( $params['localonly'] ) {
+ $files = RepoGroup::singleton()->getLocalRepo()->findFiles( $filesToFind );
+ } else {
+ $files = RepoGroup::singleton()->findFiles( $filesToFind );
+ }
$fit = true;
$count = 0;
}
// find all files with the hashes, result format is: array( hash => array( dup1, dup2 ), hash1 => ... )
- $filesBySha1s = RepoGroup::singleton()->findBySha1s( array_unique( array_values( $sha1s ) ) );
+ $filesToFindBySha1s = array_unique( array_values( $sha1s ) );
+ if( $params['localonly'] ) {
+ $filesBySha1s = RepoGroup::singleton()->getLocalRepo()->findBySha1s( $filesToFindBySha1s );
+ } else {
+ $filesBySha1s = RepoGroup::singleton()->findBySha1s( $filesToFindBySha1s );
+ }
// iterate over $images to handle continue param correct
foreach( $images as $image => $pageId ) {
}
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
'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 );
'descending'
)
),
+ 'localonly' => false,
);
}
'limit' => 'How many duplicate files to return',
'continue' => 'When more results are available, use this to continue',
'dir' => 'The direction in which to list',
+ 'localonly' => 'Look only for files in the local repository',
);
}
'' => array(
'name' => 'string',
'user' => 'string',
- 'timestamp' => 'timestamp'
+ 'timestamp' => 'timestamp',
+ 'shared' => 'boolean',
)
);
}