https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102135

Revision: 102135
Author:   ashley
Date:     2011-11-06 00:54:13 +0000 (Sun, 06 Nov 2011)
Log Message:
-----------
SocialProfile: as per Markus' in-depth review:
*make the code do what the docs claim it does (default value of $type)
*use DB_SLAVE for read-only access instead of DB_MASTER and rename the handler 
variable accordingly

Modified Paths:
--------------
    
trunk/extensions/SocialProfile/UserSystemMessages/UserSystemMessagesClass.php

Modified: 
trunk/extensions/SocialProfile/UserSystemMessages/UserSystemMessagesClass.php
===================================================================
--- 
trunk/extensions/SocialProfile/UserSystemMessages/UserSystemMessagesClass.php   
    2011-11-06 00:41:15 UTC (rev 102134)
+++ 
trunk/extensions/SocialProfile/UserSystemMessages/UserSystemMessagesClass.php   
    2011-11-06 00:54:13 UTC (rev 102135)
@@ -16,7 +16,7 @@
         * @param $type Integer: 0 by default
         * @param $message Mixed: message to be sent out
         */
-       public function addMessage( $userName, $type, $message ) {
+       public function addMessage( $userName, $type = 0, $message ) {
                $userId = User::idFromName( $userName );
                $dbw = wfGetDB( DB_MASTER );
 
@@ -56,7 +56,7 @@
         * @return $requests
         */
        public function getMessageList( $type, $limit = 0, $page = 0 ) {
-               $dbw = wfGetDB( DB_MASTER );
+               $dbr = wfGetDB( DB_SLAVE );
 
                if ( $limit > 0 ) {
                        $limitvalue = 0;
@@ -68,7 +68,7 @@
                }
 
                $params['ORDER BY'] = 'ug_id DESC';
-               $res = $dbw->select(
+               $res = $dbr->select(
                        array( 'user_gift', 'gift' ),
                        array(
                                'ug_id', 'ug_user_id_from', 
'ug_user_name_from', 'ug_gift_id',


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to