$this->mAllowedGenerators = array_merge($this->mListModuleNames, $this->mPropModuleNames);\r
}\r
\r
- public function GetDB() {\r
+ public function getDB() {\r
if (!isset ($this->mSlaveDB))\r
$this->mSlaveDB = & wfGetDB(DB_SLAVE);\r
return $this->mSlaveDB;\r
}\r
\r
- public function GetData() {\r
+ public function getData() {\r
return $this->mData;\r
}\r
\r
* #4 Output all normalization and redirect resolution information\r
* #5 Execute all requested modules\r
*/\r
- public function Execute() {\r
+ public function execute() {\r
$meta = $prop = $list = $generator = $titles = $pageids = $revids = null;\r
$redirects = null;\r
- extract($this->ExtractRequestParams());\r
+ extract($this->extractRequestParams());\r
\r
//\r
// Create and initialize PageSet\r
$dataSource = 'titles';\r
if (isset ($pageids)) {\r
if (isset ($dataSource))\r
- $this->DieUsage("Cannot use 'pageids' at the same time as '$dataSource'", 'multisource');\r
+ $this->dieUsage("Cannot use 'pageids' at the same time as '$dataSource'", 'multisource');\r
$dataSource = 'pageids';\r
}\r
if (isset ($revids)) {\r
if (isset ($dataSource))\r
- $this->DieUsage("Cannot use 'revids' at the same time as '$dataSource'", 'multisource');\r
+ $this->dieUsage("Cannot use 'revids' at the same time as '$dataSource'", 'multisource');\r
$dataSource = 'revids';\r
}\r
\r
\r
switch ($dataSource) {\r
case 'titles' :\r
- $this->mData->PopulateTitles($titles);\r
+ $this->mData->populateTitles($titles);\r
break;\r
case 'pageids' :\r
- $this->mData->PopulatePageIDs($pageids);\r
+ $this->mData->populatePageIDs($pageids);\r
break;\r
case 'titles' :\r
- $this->mData->PopulateRevIDs($revids);\r
+ $this->mData->populateRevIDs($revids);\r
break;\r
default :\r
// Do nothing - some queries do not need any of the data sources.\r
// If generator is provided, get a new dataset to work on\r
//\r
if (isset ($generator))\r
- $this->ExecuteGenerator($generator, $redirects);\r
+ $this->executeGenerator($generator, $redirects);\r
\r
// Instantiate required modules\r
// During instantiation, modules may optimize data requests through the $this->mData object \r
$modules[] = new $this->mQueryListModules[$moduleName] ($this, $moduleName);\r
\r
// Title normalizations\r
- foreach ($this->mData->GetNormalizedTitles() as $rawTitleStr => $titleStr) {\r
- $this->GetResult()->AddMessage('query', 'normalized', array (\r
+ foreach ($this->mData->getNormalizedTitles() as $rawTitleStr => $titleStr) {\r
+ $this->getResult()->addMessage('query', 'normalized', array (\r
'from' => $rawTitleStr,\r
'to' => $titleStr\r
), 'n');\r
\r
// Show redirect information\r
if ($redirects) {\r
- foreach ($this->mData->GetRedirectTitles() as $titleStrFrom => $titleStrTo) {\r
- $this->GetResult()->AddMessage('query', 'redirects', array (\r
+ foreach ($this->mData->getRedirectTitles() as $titleStrFrom => $titleStrTo) {\r
+ $this->getResult()->addMessage('query', 'redirects', array (\r
'from' => $titleStrFrom,\r
'to' => $titleStrTo\r
), 'r');\r
}\r
\r
// Execute all requested modules.\r
- foreach ($modules as $module)\r
- $module->Execute();\r
+ foreach ($modules as $module) {\r
+ $module->profileIn();\r
+ $module->execute();\r
+ $module->profileOut();\r
+ }\r
}\r
\r
- protected function ExecuteGenerator($generator, $redirects) {\r
+ protected function executeGenerator($generator, $redirects) {\r
\r
// Find class that implements requested generator\r
if (isset ($this->mQueryListModules[$generator]))\r
if (isset ($this->mQueryPropModules[$generator]))\r
$className = $this->mQueryPropModules[$generator];\r
else\r
- $this->DieDebug("Unknown generator=$generator");\r
+ $this->dieDebug("Unknown generator=$generator");\r
\r
$module = new $className ($this, $generator, true);\r
\r
// change $this->mData\r
\r
// TODO: implement\r
- $this->DieUsage("Generator execution has not been implemented", 'notimplemented');\r
+ $this->dieUsage("Generator execution has not been implemented", 'notimplemented');\r
}\r
\r
- protected function GetAllowedParams() {\r
+ protected function getAllowedParams() {\r
return array (\r
'meta' => array (\r
GN_ENUM_ISMULTI => true,\r
/**\r
* Override the parent to generate help messages for all available query modules.\r
*/\r
- public function MakeHelpMsg() {\r
+ public function makeHelpMsg() {\r
\r
// Use parent to make default message for the query module\r
- $msg = parent :: MakeHelpMsg();\r
+ $msg = parent :: makeHelpMsg();\r
\r
// Make sure the internal object is empty\r
// (just in case a sub-module decides to optimize during instantiation)\r
\r
$astriks = str_repeat('--- ', 8);\r
$msg .= "\n$astriks Query: Meta $astriks\n\n";\r
- $msg .= $this->MakeHelpMsgHelper($this->mQueryMetaModules, 'meta');\r
+ $msg .= $this->makeHelpMsgHelper($this->mQueryMetaModules, 'meta');\r
$msg .= "\n$astriks Query: Prop $astriks\n\n";\r
- $msg .= $this->MakeHelpMsgHelper($this->mQueryPropModules, 'prop');\r
+ $msg .= $this->makeHelpMsgHelper($this->mQueryPropModules, 'prop');\r
$msg .= "\n$astriks Query: List $astriks\n\n";\r
- $msg .= $this->MakeHelpMsgHelper($this->mQueryListModules, 'list');\r
+ $msg .= $this->makeHelpMsgHelper($this->mQueryListModules, 'list');\r
\r
return $msg;\r
}\r
\r
- private function MakeHelpMsgHelper($moduleList, $paramName) {\r
+ private function makeHelpMsgHelper($moduleList, $paramName) {\r
$msg = '';\r
\r
foreach ($moduleList as $moduleName => $moduleClass) {\r
$msg .= "* $paramName=$moduleName *";\r
- $module = new $moduleClass ($this, $moduleName);\r
- $msg2 = $module->MakeHelpMsg();\r
+ $module = new $moduleClass ($this, $moduleName, null);\r
+ $msg2 = $module->makeHelpMsg();\r
if ($msg2 !== false)\r
$msg .= $msg2;\r
$msg .= "\n";\r
- if ($module->GetCanGenerate())\r
+ if ($module->getCanGenerate())\r
$msg .= " * Can be used as a generator\n";\r
}\r
\r
return $msg;\r
}\r
\r
- protected function GetParamDescription() {\r
+ protected function getParamDescription() {\r
return array (\r
'meta' => 'Which meta data to get about the site',\r
'prop' => 'Which properties to get for the titles/revisions/pageids',\r
);\r
}\r
\r
- protected function GetDescription() {\r
+ protected function getDescription() {\r
return array (\r
'Query API module allows applications to get needed pieces of data from the MediaWiki databases,',\r
'and is loosely based on the Query API interface currently available on all MediaWiki servers.',\r
);\r
}\r
\r
- protected function GetExamples() {\r
+ protected function getExamples() {\r
return array (\r
'api.php?action=query&what=content&titles=ArticleA|ArticleB'\r
);\r