Merge "(bug 47070) check content model namespace on import."
[lhc/web/wiklou.git] / includes / User.php
index a2e7023..7f7a22d 100644 (file)
@@ -465,7 +465,7 @@ class User {
         * user_name and user_real_name are not provided because the whole row
         * will be loaded once more from the database when accessing them.
         *
-        * @param array $row A row from the user table
+        * @param stdClass $row A row from the user table
         * @param array $data Further data to load into the object (see User::loadFromRow for valid keys)
         * @return User
         */
@@ -1041,7 +1041,7 @@ class User {
        /**
         * Initialize this object from a row from the user table.
         *
-        * @param array $row Row from the user table to load.
+        * @param stdClass $row Row from the user table to load.
         * @param array $data Further user data to load into the object
         *
         *      user_groups             Array with groups out of the user_groups table
@@ -3777,8 +3777,9 @@ class User {
         */
        public function sendMail( $subject, $body, $from = null, $replyto = null ) {
                if ( is_null( $from ) ) {
-                       global $wgPasswordSender, $wgPasswordSenderName;
-                       $sender = new MailAddress( $wgPasswordSender, $wgPasswordSenderName );
+                       global $wgPasswordSender;
+                       $sender = new MailAddress( $wgPasswordSender,
+                               wfMessage( 'emailsender' )->inContentLanguage()->text() );
                } else {
                        $sender = new MailAddress( $from );
                }
@@ -4628,20 +4629,20 @@ class User {
                        return;
                }
 
+               $defaultOptions = self::getDefaultOptions();
+
                $userId = $this->getId();
                $insert_rows = array();
-               foreach ( $saveOptions as $key => $value ) {
-                       // Don't bother storing default values
-                       $defaultOption = self::getDefaultOption( $key );
-                       if ( ( is_null( $defaultOption ) &&
-                                       !( $value === false || is_null( $value ) ) ) ||
-                                       $value != $defaultOption ) {
-                               $insert_rows[] = array(
-                                               'up_user' => $userId,
-                                               'up_property' => $key,
-                                               'up_value' => $value,
-                                       );
+               $changedOptions = array_diff_assoc( $saveOptions, $defaultOptions );
+               foreach ( $changedOptions as $key => $value ) {
+                       if ( $value === false || is_null( $value ) ) {
+                               continue;
                        }
+                       $insert_rows[] = array(
+                               'up_user' => $userId,
+                               'up_property' => $key,
+                               'up_value' => $value,
+                       );
                }
 
                $dbw = wfGetDB( DB_MASTER );