* rm unused global declaration.
* rm references usage in a foreach iteration ($info does not seem to be assigned to anything, so no benefit to using refs).
* Define local var in error printout.
* rm a few local vars that look unused.
* Make paranoia check do something.
case 'timestamp' :
if ($multi)
ApiBase :: dieDebug(__METHOD__, "Multi-values not supported for $paramName");
- if (!preg_match('/^[0-9]{14}$/', $value))
+ if (!preg_match('/^[0-9]{14}$/', $value)) {
+ $valueName = ""; // TODO: initialization
$this->dieUsage("Invalid value '$value' for timestamp parameter $paramName", "badtimestamp_{$valueName}");
+ }
break;
default :
ApiBase :: dieDebug(__METHOD__, "Param $paramName's type is unknown - $type");
* Validate the value against the minimum and user/bot maximum limits. Prints usage info on failure.
*/
function validateLimit($varname, $value, $min, $max, $botMax) {
- global $wgUser;
-
if ($value < $min) {
$this->dieUsage("$varname may not be less than $min (set to $value)", $varname);
}
$data = & $result->GetData();
$feedItems = array ();
- foreach ($data['query']['watchlist'] as $index => & $info) {
+ foreach ($data['query']['watchlist'] as $index => $info) {
$title = $info['title'];
$titleUrl = Title :: newFromText($title)->getFullUrl();
$feedItems[] = new FeedItem($title, '', $titleUrl, $info['timestamp'], $info['user']);
//
// User entered incorrect parameters - print usage screen
//
- $httpRespCode = $e->getCode();
$errMessage = array (
'code' => $e->getCodeString(),
'info' => $e->getMessage()
//
// Something is seriously wrong
//
- $httpRespCode = 0;
$errMessage = array (
'code' => 'internal_api_error',
'info' => "Exception Caught: {$e->getMessage()}"
*/
public function populateFromRevisionIDs($revIDs) {
$this->profileIn();
- $pageIDs = array_map('intval', $revIDs); // paranoia
+ $revIDs = array_map('intval', $revIDs); // paranoia
$this->initFromRevIDs($revIDs);
$this->profileOut();
}
}
/**
- * Get the main Query module
+ * Get the main Query module
*/
public function getQuery() {
return $this->mQueryModule;
public function __construct($query, $moduleName, $paramPrefix = '') {
parent :: __construct($query, $moduleName, $paramPrefix);
- $mIsGenerator = false;
+ $this->mIsGenerator = false;
}
public function setGeneratorMode() {
if ($title->userCanRead()) {
if (is_null($resultPageSet)) {
- $id = intval($row->page_id);
-
$vals = array ();
$vals['pageid'] = intval($row->page_id);
$vals['revid'] = intval($row->rev_id);