https://bugzilla.wikimedia.org/show_bug.cgi?id=44917

iboyinc <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #3 from iboyinc <[email protected]> ---
G'day all,

Which version I have, no idea.  But I've downed the Git Snapshot from
http://www.mediawiki.org/wiki/Extension:User_Merge_and_Delete so I only assume
I have 1.7.

I got the <insert vulgarity> with it and found the prob.  selectField returns
(in this case) an int and not an array of ints.  Below is a patch.  I also
updated the "print" statement to output the counts rather than the user ids.

        /**
         * Function to add edit count
         *
         * Adds edit count of both users
         *
         * @param $newuserID int ID of user to merge references TO
         * @param $olduserID int ID of user to remove references FROM
         *
         * @return bool Always returns true - throws exceptions on failure.
         *
         * @author Matthew April <[email protected]>
         */
        private function mergeEditcount( $newuserID, $olduserID ) {
                $dbw = wfGetDB( DB_MASTER );

                # old user edit count
                $oldEdits = $dbw->selectField( 'user',
                                'user_editcount',
                                array( 'user_id' => $olduserID ),
                                __METHOD__
                          );

                # new user edit count
                $newEdits = $dbw->selectField( 'user',
                                'user_editcount',
                                array( 'user_id' => $newuserID ),
                                __METHOD__
                          );

                # add edits
                $totalEdits = $oldEdits + $newEdits;

                # don't run querys if neither user has any edits
                if ( $totalEdits > 0 ) {
                        # update new user with total edits
                        $dbw->update( 'user',
                                array( 'user_editcount' => $totalEdits ),
                                array( 'user_id' => $newuserID ),
                                __METHOD__
                        );

                        # clear old users edits
                        $dbw->update( 'user',
                                array( 'user_editcount' => 0 ),
                                array( 'user_id' => $olduserID ),
                                __METHOD__
                        );
                }

                $this->getOutput()->addHTML( $this->msg(
'usermerge-editcount-success', $oldEdits, $newEdits )->escaped() . "<br />\n"
);

                return true;
        }

Cheers,
Idiot Boy Incorporated

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to