r57097 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57096‎ | r57097 | r57098 >
Date:10:35, 30 September 2009
Author:werdna
Status:ok
Tags:
Comment:
Add signature prefetching logic to Parser, supports r56706.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -3933,22 +3933,30 @@
39343934 /**
39353935 * Fetch the user's signature text, if any, and normalize to
39363936 * validated, ready-to-insert wikitext.
 3937+ * If you have pre-fetched the nickname or the fancySig option, you can
 3938+ * specify them here to save a database query.
39373939 *
39383940 * @param User $user
39393941 * @return string
3940 - * @private
39413942 */
3942 - function getUserSig( &$user ) {
 3943+ function getUserSig( &$user, $nickname = false, $fancySig = null ) {
39433944 global $wgMaxSigChars;
39443945
39453946 $username = $user->getName();
3946 - $nickname = $user->getOption( 'nickname' );
 3947+
 3948+ // If not given, retrieve from the user object.
 3949+ if ( $nickname === false )
 3950+ $nickname = $user->getOption( 'nickname' );
 3951+
 3952+ if ( is_null( $fancySig ) )
 3953+ $fancySig = $user->getBoolOption( 'fancysig' );
 3954+
39473955 $nickname = $nickname == null ? $username : $nickname;
39483956
39493957 if( mb_strlen( $nickname ) > $wgMaxSigChars ) {
39503958 $nickname = $username;
39513959 wfDebug( __METHOD__ . ": $username has overlong signature.\n" );
3952 - } elseif( $user->getBoolOption( 'fancysig' ) !== false ) {
 3960+ } elseif( $fancySig !== false ) {
39533961 # Sig. might contain markup; validate this
39543962 if( $this->validateSig( $nickname ) !== false ) {
39553963 # Validated; clean up (if needed) and return it

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56706LiquidThreads:...werdna14:50, 21 September 2009

Status & tagging log