MediaWiki REL1_35
ApiQueryGeneratorBase.php
Go to the documentation of this file.
1<?php
28abstract class ApiQueryGeneratorBase extends ApiQueryBase {
29
30 private $mGeneratorPageSet = null;
31
39 public function setGeneratorMode( ApiPageSet $generatorPageSet ) {
40 $this->mGeneratorPageSet = $generatorPageSet;
41 }
42
48 public function isInGeneratorMode() {
49 return $this->mGeneratorPageSet !== null;
50 }
51
57 protected function getPageSet() {
58 if ( $this->mGeneratorPageSet !== null ) {
60 }
61
62 return parent::getPageSet();
63 }
64
70 public function encodeParamName( $paramName ) {
71 if ( $this->mGeneratorPageSet !== null ) {
72 return 'g' . parent::encodeParamName( $paramName );
73 } else {
74 return parent::encodeParamName( $paramName );
75 }
76 }
77
83 protected function setContinueEnumParameter( $paramName, $paramValue ) {
84 if ( $this->mGeneratorPageSet !== null ) {
85 $this->getContinuationManager()->addGeneratorContinueParam( $this, $paramName, $paramValue );
86 } else {
87 parent::setContinueEnumParameter( $paramName, $paramValue );
88 }
89 }
90
92 protected function getHelpFlags() {
93 // Corresponding messages: api-help-flag-generator
94 $flags = parent::getHelpFlags();
95 $flags[] = 'generator';
96 return $flags;
97 }
98
103 abstract public function executeGenerator( $resultPageSet );
104}
getContinuationManager()
Get the continuation manager.
Definition ApiBase.php:662
This class contains a list of pages that the client has requested.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Overridden to set the generator param if in generator mode.
getPageSet()
Get the PageSet object to work on.
setGeneratorMode(ApiPageSet $generatorPageSet)
Switch this module to generator mode.
executeGenerator( $resultPageSet)
Execute this module as a generator.
getHelpFlags()
Generates the list of flags for the help screen and for action=paraminfo.Corresponding messages: api-...
encodeParamName( $paramName)
Overrides ApiBase to prepend 'g' to every generator parameter.
isInGeneratorMode()
Indicate whether the module is in generator mode.