X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryDuplicateFiles.php;h=ae93bb1b4a13564c08741f237462bf20f73e3bf0;hb=6d0dfac93c8354f69500b660e19901442d49a5c9;hp=3282c71775f0211f7af19320c182434ef15de28e;hpb=d1150378f15b4dd699220bee41d0ce3af8868a18;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryDuplicateFiles.php b/includes/api/ApiQueryDuplicateFiles.php index 3282c71775..ae93bb1b4a 100644 --- a/includes/api/ApiQueryDuplicateFiles.php +++ b/includes/api/ApiQueryDuplicateFiles.php @@ -87,9 +87,9 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { $fit = true; $count = 0; - $titles = array(); + $titles = []; - $sha1s = array(); + $sha1s = []; foreach ( $files as $file ) { /** @var $file File */ $sha1s[$file->getName()] = $file->getSha1(); @@ -107,7 +107,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { // iterate over $images to handle continue param correct foreach ( $images as $image => $pageId ) { if ( !isset( $sha1s[$image] ) ) { - continue; //file does not exist + continue; // file does not exist } $sha1 = $sha1s[$image]; $dupFiles = $filesBySha1s[$sha1]; @@ -118,14 +118,14 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { foreach ( $dupFiles as $dupFile ) { $dupName = $dupFile->getName(); if ( $image == $dupName && $dupFile->isLocal() ) { - continue; //ignore the local file itself + continue; // ignore the local file itself } if ( $skipUntilThisDup !== false && $dupName < $skipUntilThisDup ) { - continue; //skip to pos after the image from continue param + continue; // skip to pos after the image from continue param } $skipUntilThisDup = false; if ( ++$count > $params['limit'] ) { - $fit = false; //break outer loop + $fit = false; // break outer loop // We're one over limit which shows that // there are additional images to be had. Stop here... $this->setContinueEnumParameter( 'continue', $image . '|' . $dupName ); @@ -134,12 +134,12 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { if ( !is_null( $resultPageSet ) ) { $titles[] = $dupFile->getTitle(); } else { - $r = array( + $r = [ 'name' => $dupName, 'user' => $dupFile->getUser( 'text' ), 'timestamp' => wfTimestamp( TS_ISO_8601, $dupFile->getTimestamp() ), 'shared' => !$dupFile->isLocal(), - ); + ]; $fit = $this->addPageSubItem( $pageId, $r ); if ( !$fit ) { $this->setContinueEnumParameter( 'continue', $image . '|' . $dupName ); @@ -157,35 +157,35 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase { } public function getAllowedParams() { - return array( - 'limit' => array( + return [ + 'limit' => [ ApiBase::PARAM_DFLT => 10, ApiBase::PARAM_TYPE => 'limit', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 - ), - 'continue' => array( + ], + 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', - ), - 'dir' => array( + ], + 'dir' => [ ApiBase::PARAM_DFLT => 'ascending', - ApiBase::PARAM_TYPE => array( + ApiBase::PARAM_TYPE => [ 'ascending', 'descending' - ) - ), + ] + ], 'localonly' => false, - ); + ]; } protected function getExamplesMessages() { - return array( + return [ 'action=query&titles=File:Albert_Einstein_Head.jpg&prop=duplicatefiles' => 'apihelp-query+duplicatefiles-example-simple', 'action=query&generator=allimages&prop=duplicatefiles' => 'apihelp-query+duplicatefiles-example-generated', - ); + ]; } public function getHelpUrls() {