public function execute() {
$this->profileIn();
- $action = $format = $version = null;
+
+ // Experimental -- in case an error occurs during data output,
+ // this clear the output buffer and print just the error information
+ ob_start();
+
try {
+ $action = $format = $version = null;
extract($this->extractRequestParams());
$this->mShowVersions = $version;
} catch (UsageException $e) {
$this->printError();
}
+
+ ob_end_flush();
$this->profileOut();
}
// Printer may not be initialized if the extractRequestParams() fails for the main module
if (!isset ($this->mPrinter))
$this->mPrinter = new $this->mFormats[API_DEFAULT_FORMAT] ($this, API_DEFAULT_FORMAT);
+
+ // In case of an error, reset anythnig that was printed before
+ ob_clean();
+
$this->printResult(true);
}
protected function getExamples() {
return array (
'Simple Use',
- ' api.php?action=query&list=allpages',
- ' api.php?action=query&list=allpages&apfrom=B&aplimit=5',
+ ' Show a list of pages starting at the letter "B"',
+ ' api.php?action=query&list=allpages&apfrom=B',
'Using as Generator',
' Show info about 4 pages starting at the letter "T"',
' api.php?action=query&generator=allpages&gaplimit=4&gapfrom=T&prop=info',