Provide short URL to file description page in imageinfo API
[lhc/web/wiklou.git] / includes / api / ApiUndelete.php
index 39b63f4..469fe7f 100644 (file)
 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'] );
@@ -69,7 +71,7 @@ class ApiUndelete extends ApiBase {
                }
 
                if ( $retval[1] ) {
-                       wfRunHooks( 'FileUndeleteComplete',
+                       Hooks::run( 'FileUndeleteComplete',
                                array( $titleObj, $params['fileids'], $this->getUser(), $params['reason'] ) );
                }
 
@@ -121,7 +123,7 @@ class ApiUndelete extends ApiBase {
                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',