/**
* A query action to get image information and upload history.
- *
+ *
* @addtogroup API
*/
class ApiQueryImageInfo extends ApiQueryBase {
public function execute() {
$params = $this->extractRequestParams();
- $prop = array_flip($params['prop']);
+ $prop = array_flip($params['prop']);
$this->fld_timestamp = isset($prop['timestamp']);
$this->fld_user = isset($prop['user']);
$this->fld_comment = isset($prop['comment']);
$this->fld_sha1 = isset($prop['sha1']);
$this->fld_metadata = isset($prop['metadata']);
$this->fld_archivename = isset($prop['archivename']);
-
+
if($params['urlheight'] != -1 && $params['urlwidth'] == -1)
$this->dieUsage("iiurlheight cannot be used without iiurlwidth", 'iiurlwidth');
$this->scale = ($params['urlwidth'] != -1);
$pageIds = $this->getPageSet()->getAllTitlesByNamespace();
if (!empty($pageIds[NS_IMAGE])) {
foreach ($pageIds[NS_IMAGE] as $dbKey => $pageId) {
-
+
$title = Title :: makeTitle(NS_IMAGE, $dbKey);
$img = wfFindFile($title);
} else {
$repository = $img->getRepoName();
-
+
// Get information about the current version first
// Check that the current version is within the start-end boundaries
if((is_null($params['start']) || $img->getTimestamp() <= $params['start']) &&
(is_null($params['end']) || $img->getTimestamp() >= $params['end'])) {
$data[] = $this->getInfo($img);
}
-
+
// Now get the old revisions
// Get one more to facilitate query-continue functionality
$count = count($data);
$this->setContinueEnumParameter('start', $oldie->getTimestamp());
break;
}
- $data[] = $this->getInfo($oldie);
+ $data[] = $this->getInfo($oldie);
}
}
}
$vals['url'] = $f->getURL();
}
- if($this->fld_comment)
+ if($this->fld_comment)
$vals['comment'] = $f->getDescription();
- if($this->fld_sha1)
+ if($this->fld_sha1)
$vals['sha1'] = wfBaseConvert($f->getSha1(), 36, 16, 40);
if($this->fld_metadata) {
$metadata = unserialize($f->getMetadata());
}
if($this->fld_archivename && $f->isOld())
$vals['archivename'] = $f->getArchiveName();
-
+
return $vals;
}