$endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) );
// Prepare parameters for nested request
- $fauxReqArr = array(
+ $fauxReqArr = [
'action' => 'query',
'meta' => 'siteinfo',
'siprop' => 'general',
'wldir' => 'older', // reverse order - from newest to oldest
'wlend' => $endTime, // stop at this time
'wllimit' => min( 50, $this->getConfig()->get( 'FeedLimit' ) )
- );
+ ];
if ( $params['wlowner'] !== null ) {
$fauxReqArr['wlowner'] = $params['wlowner'];
$module = new ApiMain( $fauxReq );
$module->execute();
- $data = $module->getResult()->getResultData( array( 'query', 'watchlist' ) );
- $feedItems = array();
+ $data = $module->getResult()->getResultData( [ 'query', 'watchlist' ] );
+ $feedItems = [];
foreach ( (array)$data as $key => $info ) {
if ( ApiResult::isMetadataKey( $key ) ) {
continue;
$titleStr = $info['title'];
$title = Title::newFromText( $titleStr );
- $curidParam = array();
+ $curidParam = [];
if ( !$title || $title->isExternal() ) {
// Probably a formerly-valid title that's now conflicting with an
// interwiki prefix or the like.
if ( isset( $info['pageid'] ) ) {
$title = Title::newFromID( $info['pageid'] );
- $curidParam = array( 'curid' => $info['pageid'] );
+ $curidParam = [ 'curid' => $info['pageid'] ];
}
if ( !$title || $title->isExternal() ) {
return null;
}
}
if ( isset( $info['revid'] ) ) {
- $titleUrl = $title->getFullURL( array( 'diff' => $info['revid'] ) );
+ $titleUrl = $title->getFullURL( [ 'diff' => $info['revid'] ] );
} else {
$titleUrl = $title->getFullURL( $curidParam );
}
public function getAllowedParams( $flags = 0 ) {
$feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) );
- $ret = array(
- 'feedformat' => array(
+ $ret = [
+ 'feedformat' => [
ApiBase::PARAM_DFLT => 'rss',
ApiBase::PARAM_TYPE => $feedFormatNames
- ),
- 'hours' => array(
+ ],
+ 'hours' => [
ApiBase::PARAM_DFLT => 24,
ApiBase::PARAM_TYPE => 'integer',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => 72,
- ),
+ ],
'linktosections' => false,
- );
+ ];
- $copyParams = array(
+ $copyParams = [
'allrev' => 'allrev',
'owner' => 'wlowner',
'token' => 'wltoken',
'show' => 'wlshow',
'type' => 'wltype',
'excludeuser' => 'wlexcludeuser',
- );
+ ];
if ( $flags ) {
$wlparams = $this->getWatchlistModule()->getAllowedParams( $flags );
foreach ( $copyParams as $from => $to ) {
$p = $wlparams[$from];
if ( !is_array( $p ) ) {
- $p = array( ApiBase::PARAM_DFLT => $p );
+ $p = [ ApiBase::PARAM_DFLT => $p ];
}
if ( !isset( $p[ApiBase::PARAM_HELP_MSG] ) ) {
$p[ApiBase::PARAM_HELP_MSG] = "apihelp-query+watchlist-param-$from";
}
protected function getExamplesMessages() {
- return array(
+ return [
'action=feedwatchlist'
=> 'apihelp-feedwatchlist-example-default',
'action=feedwatchlist&allrev=&hours=6'
=> 'apihelp-feedwatchlist-example-all6hrs',
- );
+ ];
}
public function getHelpUrls() {