Page MenuHomeWickedGov Phorge

ApiCentralNoticeQueryActiveCampaigns.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

ApiCentralNoticeQueryActiveCampaigns.php

<?php
use MediaWiki\Api\ApiQuery;
use MediaWiki\Api\ApiQueryBase;
use Wikimedia\ParamValidator\ParamValidator;
/**
* Query of currently active CentralNotice campaigns.
*/
class ApiCentralNoticeQueryActiveCampaigns extends ApiQueryBase {
public function __construct( ApiQuery $query, string $moduleName ) {
// Though there are no parameters, we set a prefix for them, just in case we
// add parameters later.
parent::__construct( $query, $moduleName, 'cnac' );
}
public function execute() {
$params = $this->extractRequestParams();
$this->getResult()->addValue(
[ 'query', $this->getModuleName() ],
'campaigns',
Campaign::getActiveCampaignsAndBanners( $params[ 'includefuture' ] )
);
}
/** @inheritDoc */
public function getAllowedParams() {
return [
'includefuture' => [
ParamValidator::PARAM_TYPE => 'boolean',
]
];
}
/**
* @inheritDoc
*/
protected function getExamplesMessages() {
return [
'action=query&list=centralnoticeactivecampaigns&format=json'
=> 'apihelp-query+centralnoticeactivecampaigns-example-1',
];
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Oct 3, 03:00 (3 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
44/53/344da589a58b0834957bdb1268c5
Default Alt Text
ApiCentralNoticeQueryActiveCampaigns.php (1 KB)

Event Timeline