(bug 10055) Populate email address and real name properties of User objects passed...
[lhc/web/wiklou.git] / includes / SpecialContributions.php
index b3de8ea..d2d9b03 100644 (file)
@@ -7,16 +7,16 @@
 class ContribsPager extends IndexPager {
        public $mDefaultDirection = true;
        var $messages, $target;
+       var $namespace = '', $mDb;
 
        function __construct( $target, $namespace = false ) {
-               global $wgUser;
-
                parent::__construct();
                foreach( explode( ' ', 'uctop diff newarticle rollbacklink diff hist minoreditletter' ) as $msg ) {
                        $this->messages[$msg] = wfMsgExt( $msg, array( 'escape') );
                }
                $this->target = $target;
                $this->namespace = $namespace;
+               $this->mDb = wfGetDB( DB_SLAVE, 'contributions' );
        }
 
        function getDefaultQuery() {
@@ -46,7 +46,7 @@ class ContribsPager extends IndexPager {
 
                if ( $this->target == 'newbies' ) {
                        $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ );
-                       $condition[] = 'rev_user >' . (int)($max - $max / 2/*100*/);
+                       $condition[] = 'rev_user >' . (int)($max - $max / 100);
                        $index = 'user_timestamp';
                } else {
                        $condition['rev_user_text'] = $this->target;
@@ -56,7 +56,7 @@ class ContribsPager extends IndexPager {
        }
 
        function getNamespaceCond() {
-               if ( $this->namespace !== false ) {
+               if ( $this->namespace !== '' ) {
                        return array( 'page_namespace' => (int)$this->namespace );
                } else {
                        return array();
@@ -157,6 +157,16 @@ class ContribsPager extends IndexPager {
                wfProfileOut( __METHOD__ );
                return $ret;
        }
+       
+       /**
+        * Get the Database object in use
+        *
+        * @return Database
+        */
+       public function getDatabase() {
+               return $this->mDb;
+       }
+       
 }
 
 /**
@@ -226,6 +236,11 @@ function wfSpecialContributions( $par = null ) {
                $wgOut->addWikiText( wfMsg( 'nocontribs' ) );
                return;
        }
+
+       # Show a message about slave lag, if applicable
+       if( ( $lag = $pager->getDatabase()->getLag() ) > 0 )
+               $wgOut->showLagWarning( $lag );
+
        $wgOut->addHTML( 
                '<p>' . $pager->getNavigationBar() . '</p>' .
                $pager->getBody() .
@@ -267,7 +282,7 @@ function contributionsSub( $nt, $id ) {
        $talk = $nt->getTalkPage();
        if( $talk ) {
                # Talk page link
-               $tools[] = $sk->makeLinkObj( $talk, $wgLang->getNsText( NS_TALK ) );
+               $tools[] = $sk->makeLinkObj( $talk, wfMsgHtml( 'talkpagelinktext' ) );
                if( ( $id != 0 && $wgSysopUserBans ) || ( $id == 0 && User::isIP( $nt->getText() ) ) ) {
                        # Block link
                        if( $wgUser->isAllowed( 'block' ) )