*
* API for MediaWiki 1.8+
*
- * Copyright (C) 2006 Yuri Astrakhan <FirstnameLastname@gmail.com>
+ * Copyright (C) 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
/**
+ * This query adds <images> subelement to all pages with the list of images embedded into those pages.
+ *
* @addtogroup API
*/
class ApiQueryImages extends ApiQueryGeneratorBase {
private function run($resultPageSet = null) {
+ if ($this->getPageSet()->getGoodTitleCount() == 0)
+ return; // nothing to do
+
$this->addFields(array (
'il_from',
'il_to'
$lastId = $row->il_from;
}
- $entry = array();
- $title = Title :: makeTitle(NS_IMAGE, $row->il_to);
- $vals = ApiQueryBase :: addTitleInfo($entry, $title);
- $data[] = $entry;
+ $vals = array();
+ ApiQueryBase :: addTitleInfo($vals, Title :: makeTitle(NS_IMAGE, $row->il_to));
+ $data[] = $vals;
}
if($lastId != 0) {
$db->freeResult($res);
}
- private function addPageSubItems($pageId, $data) {
- $result = $this->getResult();
- $result->setIndexedTagName($data, 'i');
- $result->addValue(array ('query', 'pages', intval($pageId)),
- 'images',
- $data);
- }
-
protected function getDescription() {
- return 'Returns all links from the given page(s)';
+ return 'Returns all images contained on the given page(s)';
}
protected function getExamples() {
return __CLASS__ . ': $Id$';
}
}
-?>
+