<?php
-/*
+/**
* Created on Sep 2, 2008
*
* API for MediaWiki 1.14+
*
- * Copyright (C) 2008 Chad Horohoe
+ * Copyright © 2008 Chad Horohoe
*
* 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
*/
if ( !defined( 'MEDIAWIKI' ) ) {
- require_once ( 'ApiBase.php' );
+ require_once( 'ApiBase.php' );
}
/**
class ApiPurge extends ApiBase {
public function __construct( $main, $action ) {
- parent :: __construct( $main, $action );
+ parent::__construct( $main, $action );
}
/**
public function execute() {
global $wgUser;
$params = $this->extractRequestParams();
- if ( !$wgUser->isAllowed( 'purge' ) )
+ if ( !$wgUser->isAllowed( 'purge' ) ) {
$this->dieUsageMsg( array( 'cantpurge' ) );
- if ( !isset( $params['titles'] ) )
+ }
+ if ( !isset( $params['titles'] ) ) {
$this->dieUsageMsg( array( 'missingparam', 'titles' ) );
+ }
$result = array();
foreach ( $params['titles'] as $t ) {
$r = array();
$title = Title::newFromText( $t );
- if ( !$title instanceof Title )
- {
+ if ( !$title instanceof Title ) {
$r['title'] = $t;
$r['invalid'] = '';
$result[] = $r;
continue;
}
ApiQueryBase::addTitleInfo( $r, $title );
- if ( !$title->exists() )
- {
+ if ( !$title->exists() ) {
$r['missing'] = '';
$result[] = $r;
continue;
}
public function getAllowedParams() {
- return array (
+ return array(
'titles' => array(
- ApiBase :: PARAM_ISMULTI => true
+ ApiBase::PARAM_ISMULTI => true
)
);
}
public function getParamDescription() {
- return array (
+ return array(
'titles' => 'A list of titles',
);
}
public function getDescription() {
- return array (
+ return array(
'Purge the cache for the given titles.'
);
}
-
- public function getPossibleErrors() {
+
+ public function getPossibleErrors() {
return array_merge( parent::getPossibleErrors(), array(
array( 'cantpurge' ),
array( 'missingparam', 'titles' ),
- ) );
+ ) );
}
protected function getExamples() {