r27949 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27948‎ | r27949 | r27950 >
Date:14:51, 29 November 2007
Author:catrope
Status:old
Tags:
Comment:
Adding apihighlimits permission. Users with this permission can request 10 times as many rows in API requests. Enabled by default for sysops and bots.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/api/ApiBase.php (modified) (history)
  • /trunk/phase3/includes/api/ApiMain.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiMain.php
@@ -467,11 +467,12 @@
468468 }
469469
470470 private $mIsBot = null;
471 -
472471 private $mIsSysop = null;
 472+ private $mCanApiHighLimits = null;
473473
474474 /**
475475 * Returns true if the currently logged in user is a bot, false otherwise
 476+ * OBSOLETE, use canApiHighLimits() instead
476477 */
477478 public function isBot() {
478479 if (!isset ($this->mIsBot)) {
@@ -484,6 +485,7 @@
485486 /**
486487 * Similar to isBot(), this method returns true if the logged in user is
487488 * a sysop, and false if not.
 489+ * OBSOLETE, use canApiHighLimits() instead
488490 */
489491 public function isSysop() {
490492 if (!isset ($this->mIsSysop)) {
@@ -493,7 +495,16 @@
494496
495497 return $this->mIsSysop;
496498 }
 499+
 500+ public function canApiHighLimits() {
 501+ if (!is_null ($this->mCanApiHighLimits)) {
 502+ global $wgUser;
 503+ $this->mCanApiHighLimits = $wgUser->isAllowed('apihighlimits');
 504+ }
497505
 506+ return $this->mCanApiHighLimits;
 507+ }
 508+
498509 public function getShowVersions() {
499510 return $this->mShowVersions;
500511 }
Index: trunk/phase3/includes/api/ApiBase.php
@@ -485,7 +485,7 @@
486486 / Optimization: do not check user's bot status unless really needed -- skips db query
487487 / assumes $botMax >= $max
488488 if (!is_null($max) && $value > $max) {
489 - if (!is_null($botMax) && ($this->getMain()->isBot() || $this->getMain()->isSysop())) {
 489+ if (!is_null($botMax) && ($this->getMain()->canApiHighLimits())) {
490490 if ($value > $botMax) {
491491 $this->dieUsage($this->encodeParamName($paramName) . " may not be over $botMax (set to $value) for bots or sysops", $paramName);
492492 }
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1072,6 +1072,7 @@
10731073 $wgGroupPermissions['bot' ]['nominornewtalk'] = true;
10741074 $wgGroupPermissions['bot' ]['autopatrol'] = true;
10751075 $wgGroupPermissions['bot' ]['suppressredirect'] = true;
 1076+$wgGroupPermissions['bot' ]['apihighlimits'] = true;
10761077
10771078 / Most extra permission abilities go to this group
10781079 $wgGroupPermissions['sysop']['block'] = true;
@@ -1099,6 +1100,7 @@
11001101 $wgGroupPermissions['sysop']['blockemail'] = true;
11011102 $wgGroupPermissions['sysop']['markbotedits'] = true;
11021103 $wgGroupPermissions['sysop']['suppressredirect'] = true;
 1104+$wgGroupPermissions['sysop']['apihighlimits'] = true;
11031105 #$wgGroupPermissions['sysop']['mergehistory'] = true;
11041106
11051107 / Permission to change users' group assignments
Index: trunk/phase3/RELEASE-NOTES
@@ -196,7 +196,6 @@
197197 for users with special characters in their names
198198 * The number of watching users in watchlists was always reported as 1
199199 * namespaceDupes.php no longer dies when coming across an illegal title
200 -* Make API check for restrictions in the old format too.
201200 * (bug 12143) Do not show a link to patrol new pages for non existent pages
202201
203202 == Parser changes in 1.12 ==
@@ -302,6 +301,8 @@
303302 * (bug 11206) api.php should honor maxlag
304303 * Added diff generation to prop=revisions
305304 * Added support for traditional, unified and array diffs to prop=revisions
 305+* Make prop=info check for restrictions in the old format too.
 306+* Add apihighlimits permission, default for sysops and bots
306307
307308 === Languages updated in 1.12 ===
308309

Status & tagging log

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant