Merge "Fixed spacing in skins folder"
[lhc/web/wiklou.git] / includes / SiteStats.php
index 01841b6..4de7333 100644 (file)
@@ -160,7 +160,7 @@ class SiteStats {
 
        /**
         * Find the number of users in a given user group.
-        * @param $group String: name of group
+        * @param string $group name of group
         * @return Integer
         */
        static function numberingroup( $group ) {
@@ -294,8 +294,6 @@ class SiteStatsUpdate implements DeferrableUpdate {
                        $this->doUpdatePendingDeltas();
                } else {
                        $dbw = wfGetDB( DB_MASTER );
-                       // Need a separate transaction because this a global lock
-                       $dbw->begin( __METHOD__ );
 
                        $lockKey = wfMemcKey( 'site_stats' ); // prepend wiki ID
                        if ( $rate ) {
@@ -308,14 +306,17 @@ class SiteStatsUpdate implements DeferrableUpdate {
                                }
                                $pd = $this->getPendingDeltas();
                                // Piggy-back the async deltas onto those of this stats update....
-                               $this->views    += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] );
-                               $this->edits    += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] );
+                               $this->views += ( $pd['ss_total_views']['+'] - $pd['ss_total_views']['-'] );
+                               $this->edits += ( $pd['ss_total_edits']['+'] - $pd['ss_total_edits']['-'] );
                                $this->articles += ( $pd['ss_good_articles']['+'] - $pd['ss_good_articles']['-'] );
-                               $this->pages    += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] );
-                               $this->users    += ( $pd['ss_users']['+'] - $pd['ss_users']['-'] );
-                               $this->images   += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] );
+                               $this->pages += ( $pd['ss_total_pages']['+'] - $pd['ss_total_pages']['-'] );
+                               $this->users += ( $pd['ss_users']['+'] - $pd['ss_users']['-'] );
+                               $this->images += ( $pd['ss_images']['+'] - $pd['ss_images']['-'] );
                        }
 
+                       // Need a separate transaction because this a global lock
+                       $dbw->begin( __METHOD__ );
+
                        // Build up an SQL query of deltas and apply them...
                        $updates = '';
                        $this->appendUpdate( $updates, 'ss_total_views', $this->views );
@@ -355,7 +356,7 @@ class SiteStatsUpdate implements DeferrableUpdate {
                                'rc_user != 0',
                                'rc_bot' => 0,
                                'rc_log_type != ' . $dbr->addQuotes( 'newusers' ) . ' OR rc_log_type IS NULL',
-                               'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays*24*3600 ) ),
+                               'rc_timestamp >= ' . $dbr->addQuotes( $dbr->timestamp( wfTimestamp( TS_UNIX ) - $wgActiveUserDays * 24 * 3600 ) ),
                        ),
                        __METHOD__
                );
@@ -397,7 +398,7 @@ class SiteStatsUpdate implements DeferrableUpdate {
 
        /**
         * @param $type string
-        * @param $sign string ('+' or '-')
+        * @param string $sign ('+' or '-')
         * @return string
         */
        private function getTypeCacheKey( $type, $sign ) {
@@ -450,7 +451,7 @@ class SiteStatsUpdate implements DeferrableUpdate {
 
        /**
         * Reduce pending delta counters after updates have been applied
-        * @param Array $pd Result of getPendingDeltas(), used for DB update
+        * @param array $pd Result of getPendingDeltas(), used for DB update
         * @return void
         */
        protected function removePendingDeltas( array $pd ) {
@@ -573,7 +574,7 @@ class SiteStatsInit {
         * @param $database DatabaseBase|bool
         * - Boolean: whether to use the master DB
         * - DatabaseBase: database connection to use
-        * @param $options Array of options, may contain the following values
+        * @param array $options of options, may contain the following values
         * - update Boolean: whether to update the current stats (true) or write fresh (false) (default: false)
         * - views Boolean: when true, do not update the number of page views (default: true)
         * - activeUsers Boolean: whether to update the number of active users (default: false)