From: Nick Jenkins Date: Tue, 17 Oct 2006 09:27:39 +0000 (+0000) Subject: * Probably want "$this->mIsGenerator = false;", not "$mIsGenerator = false;" X-Git-Tag: 1.31.0-rc.0~55454 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=88879743df635220e5811d2eda003f0cbe4328f6;p=lhc%2Fweb%2Fwiklou.git * Probably want "$this->mIsGenerator = false;", not "$mIsGenerator = false;" * 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. --- diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index e0ed028eec..2bed8a8e52 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -319,8 +319,10 @@ abstract class ApiBase { 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"); @@ -365,8 +367,6 @@ abstract class ApiBase { * 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); } diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index ac0bc352db..c6dd72d404 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -63,7 +63,7 @@ class ApiFeedWatchlist extends ApiBase { $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']); diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 9803e033ac..3f1ae8b0ca 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -142,7 +142,6 @@ class ApiMain extends ApiBase { // // User entered incorrect parameters - print usage screen // - $httpRespCode = $e->getCode(); $errMessage = array ( 'code' => $e->getCodeString(), 'info' => $e->getMessage() @@ -153,7 +152,6 @@ class ApiMain extends ApiBase { // // Something is seriously wrong // - $httpRespCode = 0; $errMessage = array ( 'code' => 'internal_api_error', 'info' => "Exception Caught: {$e->getMessage()}" diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php index ad3d8040a0..e8587be8d9 100644 --- a/includes/api/ApiPageSet.php +++ b/includes/api/ApiPageSet.php @@ -234,7 +234,7 @@ class ApiPageSet extends ApiQueryBase { */ public function populateFromRevisionIDs($revIDs) { $this->profileIn(); - $pageIDs = array_map('intval', $revIDs); // paranoia + $revIDs = array_map('intval', $revIDs); // paranoia $this->initFromRevIDs($revIDs); $this->profileOut(); } diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index 09fd39182a..c5655f19e7 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -46,7 +46,7 @@ abstract class ApiQueryBase extends ApiBase { } /** - * Get the main Query module + * Get the main Query module */ public function getQuery() { return $this->mQueryModule; @@ -101,7 +101,7 @@ abstract class ApiQueryGeneratorBase extends ApiQueryBase { public function __construct($query, $moduleName, $paramPrefix = '') { parent :: __construct($query, $moduleName, $paramPrefix); - $mIsGenerator = false; + $this->mIsGenerator = false; } public function setGeneratorMode() { diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index a2552f6777..6b1a48fdb0 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -160,8 +160,6 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { 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);