r14644 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14643‎ | r14644 | r14645 >
Date:15:29, 7 June 2006
Author:yurik
Status:old
Tags:
Comment:
* Improved 'userinfo' parameter - it now supports optional parameters uiisblocked and uihasmsg - checks if the user is blocked or has messages pending.
Modified paths:
  • /trunk/extensions/BotQuery/query.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BotQuery/query.php
@@ -126,13 +126,16 @@
127127 "Example: query.php?what=namespaces",
128128 )),
129129 'userinfo' => array( 'genMetaUserInfo', true,
130 - array( 'uiextended' ),
131 - array( false ),
 130+ array( 'uiisblocked', 'uihasmsg', 'uiextended' ),
 131+ array( false, false, false ),
132132 array(
133 - "Information about current user",
 133+ "Information about current user.",
 134+ "The information will always include 'name' element, and optionally 'anonymous' or 'bot' flags.",
134135 "Parameters supported:",
 136+ "uiisblocked- If present, and current user or ip is blocked, a 'blocked' flag will be added.",
 137+ "uihasmsg - If present, and current user or ip has messages waiting, a 'messages' flag will be added.",
135138 "uiextended - If present, includes additional information such as rights and groups.",
136 - "Example: query.php?what=userinfo&uiextended",
 139+ "Example: query.php?what=userinfo&uiisblocked&uihasmsg&uiextended",
137140 )),
138141 'recentchanges' => array( 'genMetaRecentChanges', true,
139142 array( 'rcfrom', 'rclimit', 'rchide' ),
@@ -666,13 +669,15 @@
667670 $meta['name'] = $wgUser->getName();
668671 if( $wgUser->isAnon() ) $meta['anonymous'] = '';
669672 if( $wgUser->isBot() ) $meta['bot'] = '';
670 - if( $wgUser->isBlocked() ) $meta[' blocked'] = '';
 673+ if( $uiisblocked && $wgUser->isBlocked() ) $meta['blocked'] = '';
 674+ if( $uihasmsg && $wgUser->getNewtalk() ) $meta['messages'] = '';
671675 if( $uiextended ) {
672676 $meta['groups'] = $wgUser->getGroups();
673677 $meta['groups']['_element'] = 'g';
674678 $meta['rights'] = $wgUser->getRights();
675679 $meta['rights']['_element'] = 'r';
676680 }
 681+
677682 $this->data['meta']['user'] = $meta;
678683 $this->endProfiling($prop);
679684 }

Status & tagging log