r92867 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92866‎ | r92867 | r92868 >
Date:17:18, 22 July 2011
Author:questpc
Status:deferred
Tags:
Comment:
Pollstore bugfix (new user was not always properly created)
Modified paths:
  • /trunk/extensions/QPoll/qp_pollstore.php (modified) (history)

Diff [purge]

Index: trunk/extensions/QPoll/qp_pollstore.php
@@ -753,18 +753,21 @@
754754 if ( $this->username === $username ) {
755755 return;
756756 }
757 - $this->username = $username;
758757 $res = self::$db->select( 'qp_users','uid','name=' . self::$db->addQuotes( $username ), __METHOD__ );
759758 $row = self::$db->fetchObject( $res );
760 - if ( $row == false ) {
 759+ if ( $row === false ) {
761760 if ( $store_new_user_to_db ) {
762 - self::$db->insert( 'qp_users', array( 'name'=>$this->username ), __METHOD__ . ':UpdateUser' );
 761+ self::$db->insert( 'qp_users', array( 'name' => $username ), __METHOD__ . ':UpdateUser' );
763762 $this->last_uid = intval( self::$db->insertId() );
 763+ # set username, user was created
 764+ $this->username = $username;
764765 } else {
765766 $this->last_uid = null;
766767 }
767768 } else {
768769 $this->last_uid = intval( $row->uid );
 770+ # set username, used was loaded
 771+ $this->username = $username;
769772 }
770773 $res = self::$db->select( 'qp_users_polls',
771774 array( 'attempts', 'short_interpretation', 'long_interpretation' ),

Status & tagging log