Aude has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/260236

Change subject: Move ApiQueryGeneratorBase to it's own file
......................................................................

Move ApiQueryGeneratorBase to it's own file

Change-Id: Ia8e9ab256c8a7a72bb407090f7a4a49484e529e4
---
M autoload.php
M includes/api/ApiQueryBase.php
A includes/api/ApiQueryGeneratorBase.php
3 files changed, 104 insertions(+), 79 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/36/260236/1

diff --git a/autoload.php b/autoload.php
index dea31ab..1387ebd 100644
--- a/autoload.php
+++ b/autoload.php
@@ -90,7 +90,7 @@
        'ApiQueryExternalLinks' => __DIR__ . 
'/includes/api/ApiQueryExternalLinks.php',
        'ApiQueryFileRepoInfo' => __DIR__ . 
'/includes/api/ApiQueryFileRepoInfo.php',
        'ApiQueryFilearchive' => __DIR__ . 
'/includes/api/ApiQueryFilearchive.php',
-       'ApiQueryGeneratorBase' => __DIR__ . '/includes/api/ApiQueryBase.php',
+       'ApiQueryGeneratorBase' => __DIR__ . 
'/includes/api/ApiQueryGeneratorBase.php',
        'ApiQueryIWBacklinks' => __DIR__ . 
'/includes/api/ApiQueryIWBacklinks.php',
        'ApiQueryIWLinks' => __DIR__ . '/includes/api/ApiQueryIWLinks.php',
        'ApiQueryImageInfo' => __DIR__ . '/includes/api/ApiQueryImageInfo.php',
diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php
index 01968c2..ad92e53 100644
--- a/includes/api/ApiQueryBase.php
+++ b/includes/api/ApiQueryBase.php
@@ -682,81 +682,3 @@
 
        /**@}*/
 }
-
-/**
- * @ingroup API
- */
-abstract class ApiQueryGeneratorBase extends ApiQueryBase {
-
-       private $mGeneratorPageSet = null;
-
-       /**
-        * Switch this module to generator mode. By default, generator mode is
-        * switched off and the module acts like a normal query module.
-        * @since 1.21 requires pageset parameter
-        * @param ApiPageSet $generatorPageSet ApiPageSet object that the 
module will get
-        *        by calling getPageSet() when in generator mode.
-        */
-       public function setGeneratorMode( ApiPageSet $generatorPageSet ) {
-               if ( $generatorPageSet === null ) {
-                       ApiBase::dieDebug( __METHOD__, 'Required parameter 
missing - $generatorPageSet' );
-               }
-               $this->mGeneratorPageSet = $generatorPageSet;
-       }
-
-       /**
-        * Get the PageSet object to work on.
-        * If this module is generator, the pageSet object is different from 
other module's
-        * @return ApiPageSet
-        */
-       protected function getPageSet() {
-               if ( $this->mGeneratorPageSet !== null ) {
-                       return $this->mGeneratorPageSet;
-               }
-
-               return parent::getPageSet();
-       }
-
-       /**
-        * Overrides ApiBase to prepend 'g' to every generator parameter
-        * @param string $paramName Parameter name
-        * @return string Prefixed parameter name
-        */
-       public function encodeParamName( $paramName ) {
-               if ( $this->mGeneratorPageSet !== null ) {
-                       return 'g' . parent::encodeParamName( $paramName );
-               } else {
-                       return parent::encodeParamName( $paramName );
-               }
-       }
-
-       /**
-        * Overridden to set the generator param if in generator mode
-        * @param string $paramName Parameter name
-        * @param string|array $paramValue Parameter value
-        */
-       protected function setContinueEnumParameter( $paramName, $paramValue ) {
-               if ( $this->mGeneratorPageSet !== null ) {
-                       
$this->getContinuationManager()->addGeneratorContinueParam( $this, $paramName, 
$paramValue );
-               } else {
-                       parent::setContinueEnumParameter( $paramName, 
$paramValue );
-               }
-       }
-
-       /**
-        * @see ApiBase::getHelpFlags()
-        *
-        * Corresponding messages: api-help-flag-generator
-        */
-       protected function getHelpFlags() {
-               $flags = parent::getHelpFlags();
-               $flags[] = 'generator';
-               return $flags;
-       }
-
-       /**
-        * Execute this module as a generator
-        * @param ApiPageSet $resultPageSet All output should be appended to 
this object
-        */
-       abstract public function executeGenerator( $resultPageSet );
-}
diff --git a/includes/api/ApiQueryGeneratorBase.php 
b/includes/api/ApiQueryGeneratorBase.php
new file mode 100644
index 0000000..67fe0d6
--- /dev/null
+++ b/includes/api/ApiQueryGeneratorBase.php
@@ -0,0 +1,103 @@
+<?php
+/**
+ *
+ *
+ * Created on Sep 7, 2006
+ *
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * @ingroup API
+ */
+abstract class ApiQueryGeneratorBase extends ApiQueryBase {
+
+       private $mGeneratorPageSet = null;
+
+       /**
+        * Switch this module to generator mode. By default, generator mode is
+        * switched off and the module acts like a normal query module.
+        * @since 1.21 requires pageset parameter
+        * @param ApiPageSet $generatorPageSet ApiPageSet object that the 
module will get
+        *        by calling getPageSet() when in generator mode.
+        */
+       public function setGeneratorMode( ApiPageSet $generatorPageSet ) {
+               if ( $generatorPageSet === null ) {
+                       ApiBase::dieDebug( __METHOD__, 'Required parameter 
missing - $generatorPageSet' );
+               }
+               $this->mGeneratorPageSet = $generatorPageSet;
+       }
+
+       /**
+        * Get the PageSet object to work on.
+        * If this module is generator, the pageSet object is different from 
other module's
+        * @return ApiPageSet
+        */
+       protected function getPageSet() {
+               if ( $this->mGeneratorPageSet !== null ) {
+                       return $this->mGeneratorPageSet;
+               }
+
+               return parent::getPageSet();
+       }
+
+       /**
+        * Overrides ApiBase to prepend 'g' to every generator parameter
+        * @param string $paramName Parameter name
+        * @return string Prefixed parameter name
+        */
+       public function encodeParamName( $paramName ) {
+               if ( $this->mGeneratorPageSet !== null ) {
+                       return 'g' . parent::encodeParamName( $paramName );
+               } else {
+                       return parent::encodeParamName( $paramName );
+               }
+       }
+
+       /**
+        * Overridden to set the generator param if in generator mode
+        * @param string $paramName Parameter name
+        * @param string|array $paramValue Parameter value
+        */
+       protected function setContinueEnumParameter( $paramName, $paramValue ) {
+               if ( $this->mGeneratorPageSet !== null ) {
+                       
$this->getContinuationManager()->addGeneratorContinueParam( $this, $paramName, 
$paramValue );
+               } else {
+                       parent::setContinueEnumParameter( $paramName, 
$paramValue );
+               }
+       }
+
+       /**
+        * @see ApiBase::getHelpFlags()
+        *
+        * Corresponding messages: api-help-flag-generator
+        */
+       protected function getHelpFlags() {
+               $flags = parent::getHelpFlags();
+               $flags[] = 'generator';
+               return $flags;
+       }
+
+       /**
+        * Execute this module as a generator
+        * @param ApiPageSet $resultPageSet All output should be appended to 
this object
+        */
+       abstract public function executeGenerator( $resultPageSet );
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/260236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia8e9ab256c8a7a72bb407090f7a4a49484e529e4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to