Merge "mediawiki.page.gallery.resize: Remove weird mw.hook call"
[lhc/web/wiklou.git] / includes / specials / SpecialActiveusers.php
index f739d3b..8dc4b3c 100644 (file)
  * @ingroup SpecialPage
  */
 class ActiveUsersPager extends UsersPager {
-
        /**
         * @var FormOptions
         */
        protected $opts;
 
        /**
-        * @var Array
+        * @var array
         */
        protected $hideGroups = array();
 
        /**
-        * @var Array
+        * @var array
         */
        protected $hideRights = array();
 
        /**
-        * @param $context IContextSource
-        * @param $group null Unused
+        * @param IContextSource $context
+        * @param null $group Unused
         * @param string $par Parameter passed to the page
         */
        function __construct( IContextSource $context = null, $group = null, $par = null ) {
@@ -93,12 +92,16 @@ class ActiveUsersPager extends UsersPager {
        function getQueryInfo() {
                $dbr = $this->getDatabase();
 
+               $activeUserSeconds = $this->getConfig()->get( 'ActiveUserDays' ) * 86400;
+               $timestamp = $dbr->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds );
                $conds = array(
                        'qcc_type' => 'activeusers',
                        'qcc_namespace' => NS_USER,
                        'user_name = qcc_title',
                        'rc_user_text = qcc_title',
-                       'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ) // Don't count wikidata.
+                       'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ), // Don't count wikidata.
+                       'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' ),
+                       'rc_timestamp >= ' . $dbr->addQuotes( $timestamp ),
                );
                if ( $this->requestedUser != '' ) {
                        $conds[] = 'qcc_title >= ' . $dbr->addQuotes( $this->requestedUser );
@@ -194,20 +197,31 @@ class ActiveUsersPager extends UsersPager {
                $self = $this->getTitle();
                $limit = $this->mLimit ? Html::hidden( 'limit', $this->mLimit ) : '';
 
-               $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) ); # Form tag
+               # Form tag
+               $out = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript ) );
                $out .= Xml::fieldset( $this->msg( 'activeusers' )->text() ) . "\n";
                $out .= Html::hidden( 'title', $self->getPrefixedDBkey() ) . $limit . "\n";
 
+               # Username field
                $out .= Xml::inputLabel( $this->msg( 'activeusers-from' )->text(),
-                       'username', 'offset', 20, $this->requestedUser, array( 'tabindex' => 1 ) ) . '<br />';# Username field
+                       'username', 'offset', 20, $this->requestedUser, array( 'tabindex' => 1 ) ) . '<br />';
 
                $out .= Xml::checkLabel( $this->msg( 'activeusers-hidebots' )->text(),
                        'hidebots', 'hidebots', $this->opts->getValue( 'hidebots' ), array( 'tabindex' => 2 ) );
 
-               $out .= Xml::checkLabel( $this->msg( 'activeusers-hidesysops' )->text(),
-                       'hidesysops', 'hidesysops', $this->opts->getValue( 'hidesysops' ), array( 'tabindex' => 3 ) ) . '<br />';
-
-               $out .= Xml::submitButton( $this->msg( 'allpagessubmit' )->text(), array( 'tabindex' => 4 ) ) . "\n";# Submit button and form bottom
+               $out .= Xml::checkLabel(
+                       $this->msg( 'activeusers-hidesysops' )->text(),
+                       'hidesysops',
+                       'hidesysops',
+                       $this->opts->getValue( 'hidesysops' ),
+                       array( 'tabindex' => 3 )
+               ) . '<br />';
+
+               # Submit button and form bottom
+               $out .= Xml::submitButton(
+                       $this->msg( 'allpagessubmit' )->text(),
+                       array( 'tabindex' => 4 )
+               ) . "\n";
                $out .= Xml::closeElement( 'fieldset' );
                $out .= Xml::closeElement( 'form' );
 
@@ -230,7 +244,7 @@ class SpecialActiveUsers extends SpecialPage {
        /**
         * Show the special page
         *
-        * @param $par Mixed: parameter passed to the page or null
+        * @param string $par Parameter passed to the page or null
         */
        public function execute( $par ) {
                global $wgActiveUserDays;
@@ -270,8 +284,8 @@ class SpecialActiveUsers extends SpecialPage {
        }
 
        /**
-        * @param integer $period Seconds (do updates no more often than this)
-        * @return integer How many seconds old the cache is
+        * @param intr $period Seconds (do updates no more often than this)
+        * @return int How many seconds old the cache is
         */
        public static function mergeActiveUsers( $period ) {
                global $wgActiveUserDays;
@@ -311,7 +325,7 @@ class SpecialActiveUsers extends SpecialPage {
         * Update the query cache as needed
         *
         * @param DatabaseBase $dbw
-        * @param integer $window Maximum time range of new data to scan (in seconds)
+        * @param int $window Maximum time range of new data to scan (in seconds)
         * @return bool Success
         */
        protected static function doQueryCacheUpdate( DatabaseBase $dbw, $window ) {