Merge "(bug 32348) Allow descending order for list=alllinks"
[lhc/web/wiklou.git] / includes / api / ApiPurge.php
index b803fd4..d9acba4 100644 (file)
@@ -88,14 +88,13 @@ class ApiPurge extends ApiBase {
                                if ( !$user->pingLimiter() ) {
                                        global $wgParser, $wgEnableParserCache;
 
-                                       $popts = ParserOptions::newFromContext( $this->getContext() );
-                                       $popts->setTidy( true );
+                                       $popts = $page->makeParserOptions( 'canonical' );
                                        $p_result = $wgParser->parse( $page->getRawText(), $title, $popts,
                                                true, true, $page->getLatest() );
 
                                        # Update the links tables
-                                       $u = new LinksUpdate( $title, $p_result );
-                                       $u->doUpdate();
+                                       $updates = $p_result->getSecondaryDataUpdates( $title );
+                                       DataUpdate::runUpdates( $updates );
 
                                        $r['linkupdate'] = '';
 
@@ -104,7 +103,8 @@ class ApiPurge extends ApiBase {
                                                $pcache->save( $p_result, $page, $popts );
                                        }
                                } else {
-                                       $this->setWarning( $this->parseMsg( array( 'actionthrottledtext' ) ) );
+                                       $error = $this->parseMsg( array( 'actionthrottledtext' ) );
+                                       $this->setWarning( $error['info'] );
                                        $forceLinkUpdate = false;
                                }
                        }
@@ -134,6 +134,34 @@ class ApiPurge extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       ApiBase::PROP_LIST => true,
+                       '' => array(
+                               'ns' => array(
+                                       ApiBase::PROP_TYPE => 'namespace',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'title' => array(
+                                       ApiBase::PROP_TYPE => 'string',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'pageid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'revid' => array(
+                                       ApiBase::PROP_TYPE => 'integer',
+                                       ApiBase::PROP_NULLABLE => true
+                               ),
+                               'invalid' => 'boolean',
+                               'missing' => 'boolean',
+                               'purged' => 'boolean',
+                               'linkupdate' => 'boolean'
+                       )
+               );
+       }
+
        public function getDescription() {
                return array( 'Purge the cache for the given titles.',
                        'Requires a POST request if the user is not logged in.'