class ApiUndelete extends ApiBase {
public function execute() {
- $params = $this->extractRequestParams();
+ $this->useTransactionalTimeLimit();
- if ( !$this->getUser()->isAllowed( 'undelete' ) ) {
+ $params = $this->extractRequestParams();
+ $user = $this->getUser();
+ if ( !$user->isAllowed( 'undelete' ) ) {
$this->dieUsageMsg( 'permdenied-undelete' );
}
- if ( $this->getUser()->isBlocked() ) {
- $this->dieUsageMsg( 'blockedtext' );
+ if ( $user->isBlocked() ) {
+ $this->dieBlocked( $user->getBlock() );
}
$titleObj = Title::newFromText( $params['title'] );
}
if ( $retval[1] ) {
- wfRunHooks( 'FileUndeleteComplete',
+ Hooks::run( 'FileUndeleteComplete',
array( $titleObj, $params['fileids'], $this->getUser(), $params['reason'] ) );
}
return 'csrf';
}
- public function getExamplesMessages() {
+ protected function getExamplesMessages() {
return array(
'action=undelete&title=Main%20Page&token=123ABC&reason=Restoring%20main%20page'
=> 'apihelp-undelete-example-page',