Go to the documentation of this file.
31 parent::__construct( $query, $moduleName,
'df' );
43 $this->
run( $resultPageSet );
49 private function run( $resultPageSet =
null ) {
51 $namespaces = $this->
getPageSet()->getGoodAndMissingTitlesByNamespace();
52 if ( empty( $namespaces[
NS_FILE] ) ) {
57 if ( $params[
'dir'] ==
'descending' ) {
58 $images = array_reverse( $images );
61 $skipUntilThisDup =
false;
62 if ( isset( $params[
'continue'] ) ) {
63 $cont = explode(
'|', $params[
'continue'] );
65 $fromImage = $cont[0];
66 $skipUntilThisDup = $cont[1];
68 foreach ( $images as $image => $pageId ) {
69 if ( $image < $fromImage ) {
70 unset( $images[$image] );
77 $filesToFind = array_keys( $images );
78 if ( $params[
'localonly'] ) {
89 foreach ( $files as
$file ) {
96 $filesToFindBySha1s = array_unique( array_values( $sha1s ) );
97 if ( $params[
'localonly'] ) {
104 foreach ( $images as $image => $pageId ) {
105 if ( !isset( $sha1s[$image] ) ) {
108 $sha1 = $sha1s[$image];
109 $dupFiles = $filesBySha1s[$sha1];
110 if ( $params[
'dir'] ==
'descending' ) {
111 $dupFiles = array_reverse( $dupFiles );
114 foreach ( $dupFiles as $dupFile ) {
115 $dupName = $dupFile->getName();
116 if ( $image == $dupName && $dupFile->isLocal() ) {
119 if ( $skipUntilThisDup !==
false && $dupName < $skipUntilThisDup ) {
122 $skipUntilThisDup =
false;
123 if ( ++$count > $params[
'limit'] ) {
130 if ( !is_null( $resultPageSet ) ) {
131 $titles[] = $dupFile->getTitle();
135 'user' => $dupFile->getUser(
'text' ),
136 'timestamp' =>
wfTimestamp( TS_ISO_8601, $dupFile->getTimestamp() ),
137 'shared' => !$dupFile->isLocal(),
150 if ( !is_null( $resultPageSet ) ) {
151 $resultPageSet->populateFromTitles( $titles );
174 'localonly' =>
false,
180 'action=query&titles=File:Albert_Einstein_Head.jpg&prop=duplicatefiles'
181 =>
'apihelp-query+duplicatefiles-example-simple',
182 'action=query&generator=allimages&prop=duplicatefiles'
183 =>
'apihelp-query+duplicatefiles-example-generated',
188 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Duplicatefiles';
This is the main query class.
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
getExamplesMessages()
Returns usage examples for this module.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
__construct(ApiQuery $query, $moduleName)
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
const PARAM_MIN
(integer) Lowest value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
Implements some public methods and some protected utility functions which are required by multiple ch...
getPageSet()
Get the PageSet object to work on.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
const LIMIT_BIG1
Fast query, standard limit.
run( $resultPageSet=null)
const PARAM_MAX
(integer) Max value allowed for the parameter, for PARAM_TYPE 'integer' and 'limit'.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
executeGenerator( $resultPageSet)
Execute this module as a generator.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
const LIMIT_BIG2
Fast query, apihighlimits limit.
const PARAM_DFLT
(null|boolean|integer|string) Default value of the parameter.
const PARAM_MAX2
(integer) Max value allowed for the parameter for users with the apihighlimits right,...
getHelpUrls()
Return links to more detailed help pages about the module.
A query module to list duplicates of the given file(s)
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.