aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api/ApiQueryCodexIcons.php
blob: f183f2ca0c30c5231670ec32a53491a449ab45b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php

namespace MediaWiki\Api;

use MediaWiki\ResourceLoader\CodexModule;
use Wikimedia\ParamValidator\ParamValidator;

class ApiQueryCodexIcons extends ApiQueryBase {

	public function execute() {
		$params = $this->extractRequestParams();
		$iconNames = $params['names'];

		$icons = CodexModule::getIcons( null, $this->getConfig(), $iconNames );

		$result = $this->getResult();
		$result->addValue( 'query', $this->getModuleName(), $icons );
	}

	public function getCacheMode( $params ) {
		return 'public';
	}

	/**
	 * No database interaction, so maxlag check is irrelevant
	 * @return bool
	 */
	public function shouldCheckMaxlag() {
		return false;
	}

	public function getAllowedParams() {
		return [
			'names' => [
				ParamValidator::PARAM_TYPE => 'string',
				ParamValidator::PARAM_REQUIRED => true,
				ParamValidator::PARAM_ISMULTI => true,
			]
		];
	}

	protected function getExamplesMessages() {
		return [
			'action=query&list=codexicons&names=cdxIconInfo|cdxIconTrash' =>
				'apihelp-query+codexicons-example',
		];
	}

	public function getHelpUrls() {
		return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:CodexIcons';
	}
}