Merge "Use camel case for variable names in Article.php"
[lhc/web/wiklou.git] / includes / api / ApiPurge.php
index 3516bf2..7667b23 100644 (file)
@@ -38,6 +38,8 @@ class ApiPurge extends ApiBase {
        public function execute() {
                $params = $this->extractRequestParams();
 
+               $this->getResult()->beginContinuation( $params['continue'], array(), array() );
+
                $forceLinkUpdate = $params['forcelinkupdate'];
                $forceRecursiveLinkUpdate = $params['forcerecursivelinkupdate'];
                $pageSet = $this->getPageSet();
@@ -54,17 +56,16 @@ class ApiPurge extends ApiBase {
 
                        if ( $forceLinkUpdate || $forceRecursiveLinkUpdate ) {
                                if ( !$this->getUser()->pingLimiter( 'linkpurge' ) ) {
-                                       global $wgEnableParserCache;
-
                                        $popts = $page->makeParserOptions( 'canonical' );
 
                                        # Parse content; note that HTML generation is only needed if we want to cache the result.
                                        $content = $page->getContent( Revision::RAW );
+                                       $enableParserCache = $this->getConfig()->get( 'EnableParserCache' );
                                        $p_result = $content->getParserOutput(
                                                $title,
                                                $page->getLatest(),
                                                $popts,
-                                               $wgEnableParserCache
+                                               $enableParserCache
                                        );
 
                                        # Update the links tables
@@ -74,7 +75,7 @@ class ApiPurge extends ApiBase {
 
                                        $r['linkupdate'] = '';
 
-                                       if ( $wgEnableParserCache ) {
+                                       if ( $enableParserCache ) {
                                                $pcache = ParserCache::singleton();
                                                $pcache->save( $p_result, $page, $popts );
                                        }
@@ -103,6 +104,8 @@ class ApiPurge extends ApiBase {
                if ( $values ) {
                        $apiResult->addValue( null, 'redirects', $values );
                }
+
+               $apiResult->endContinuation();
        }
 
        /**
@@ -129,7 +132,8 @@ class ApiPurge extends ApiBase {
        public function getAllowedParams( $flags = 0 ) {
                $result = array(
                        'forcelinkupdate' => false,
-                       'forcerecursivelinkupdate' => false
+                       'forcerecursivelinkupdate' => false,
+                       'continue' => '',
                );
                if ( $flags ) {
                        $result += $this->getPageSet()->getFinalParams( $flags );
@@ -144,52 +148,13 @@ class ApiPurge extends ApiBase {
                                'forcelinkupdate' => 'Update the links tables',
                                'forcerecursivelinkupdate' => 'Update the links table, and update ' .
                                        'the links tables for any page that uses this page as a template',
+                               'continue' => 'When more results are available, use this to continue',
                        );
        }
 
-       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',
-                               'special' => 'boolean',
-                               'missing' => 'boolean',
-                               'purged' => 'boolean',
-                               'linkupdate' => 'boolean',
-                               'iw' => array(
-                                       ApiBase::PROP_TYPE => 'string',
-                                       ApiBase::PROP_NULLABLE => true
-                               ),
-                       )
-               );
-       }
-
        public function getDescription() {
                return array( 'Purge the cache for the given titles.',
-                       'Requires a POST request if the user is not logged in'
-               );
-       }
-
-       public function getPossibleErrors() {
-               return array_merge(
-                       parent::getPossibleErrors(),
-                       $this->getPageSet()->getFinalPossibleErrors()
+                       'Requires a POST request if the user is not logged in.'
                );
        }