Merge "Rollback: Make update of recentchanges table later"
[lhc/web/wiklou.git] / includes / deferred / ViewCountUpdate.php
index 22a4649..ddd2e09 100644 (file)
  * from that table to update the 'page_counter' field in a batch operation.
  */
 class ViewCountUpdate implements DeferrableUpdate {
+       /** @var int Page ID to increment the view count */
        protected $id;
 
        /**
         * Constructor
         *
-        * @param $id Integer: page ID to increment the view count
+        * @param int $id Page ID to increment the view count
         */
        public function __construct( $id ) {
                $this->id = intval( $id );
@@ -48,7 +49,12 @@ class ViewCountUpdate implements DeferrableUpdate {
                $dbw = wfGetDB( DB_MASTER );
 
                if ( $wgHitcounterUpdateFreq <= 1 || $dbw->getType() == 'sqlite' ) {
-                       $dbw->update( 'page', array( 'page_counter = page_counter + 1' ), array( 'page_id' => $this->id ), __METHOD__ );
+                       $dbw->update(
+                               'page', array( 'page_counter = page_counter + 1' ),
+                               array( 'page_id' => $this->id ),
+                               __METHOD__
+                       );
+
                        return;
                }
 
@@ -59,7 +65,8 @@ class ViewCountUpdate implements DeferrableUpdate {
                        if ( rand() % $checkfreq == 0 && $dbw->lastErrno() == 0 ) {
                                $this->collect();
                        }
-               } catch ( DBError $e ) {}
+               } catch ( DBError $e ) {
+               }
        }
 
        protected function collect() {