Fix incorrect comment
[lhc/web/wiklou.git] / includes / jobqueue / JobQueueDB.php
index 6097d31..08873cc 100644 (file)
@@ -189,9 +189,9 @@ class JobQueueDB extends JobQueue {
        /**
         * @see JobQueue::doBatchPush()
         * @param array $jobs
-        * @param $flags
+        * @param int $flags
         * @throws DBError|Exception
-        * @return bool
+        * @return void
         */
        protected function doBatchPush( array $jobs, $flags ) {
                $dbw = $this->getMasterDB();
@@ -203,8 +203,6 @@ class JobQueueDB extends JobQueue {
                                $that->doBatchPushInternal( $dbw, $jobs, $flags, $method );
                        }
                );
-
-               return true;
        }
 
        /**
@@ -215,11 +213,11 @@ class JobQueueDB extends JobQueue {
         * @param int $flags
         * @param string $method
         * @throws DBError
-        * @return bool
+        * @return void
         */
        public function doBatchPushInternal( IDatabase $dbw, array $jobs, $flags, $method ) {
                if ( !count( $jobs ) ) {
-                       return true;
+                       return;
                }
 
                $rowSet = array(); // (sha1 => job) map for jobs that are de-duplicated
@@ -258,11 +256,12 @@ class JobQueueDB extends JobQueue {
                        foreach ( array_chunk( $rows, 50 ) as $rowBatch ) {
                                $dbw->insert( 'job', $rowBatch, $method );
                        }
-                       JobQueue::incrStats( 'job-insert', $this->type, count( $rows ) );
+                       JobQueue::incrStats( 'job-insert', $this->type, count( $rows ), $this->wiki );
                        JobQueue::incrStats(
                                'job-insert-duplicate',
                                $this->type,
-                               count( $rowSet ) + count( $rowList ) - count( $rows )
+                               count( $rowSet ) + count( $rowList ) - count( $rows ),
+                               $this->wiki
                        );
                } catch ( DBError $e ) {
                        if ( $flags & self::QOS_ATOMIC ) {
@@ -276,7 +275,7 @@ class JobQueueDB extends JobQueue {
 
                $this->cache->set( $this->getCacheKey( 'empty' ), 'false', JobQueueDB::CACHE_TTL_LONG );
 
-               return true;
+               return;
        }
 
        /**
@@ -313,12 +312,12 @@ class JobQueueDB extends JobQueue {
                                        $this->cache->set( $this->getCacheKey( 'empty' ), 'true', self::CACHE_TTL_LONG );
                                        break; // nothing to do
                                }
-                               JobQueue::incrStats( 'job-pop', $this->type );
+                               JobQueue::incrStats( 'job-pop', $this->type, 1, $this->wiki );
                                // Get the job object from the row...
                                $title = Title::makeTitleSafe( $row->job_namespace, $row->job_title );
                                if ( !$title ) {
                                        $dbw->delete( 'job', array( 'job_id' => $row->job_id ), __METHOD__ );
-                                       wfDebug( "Row has invalid title '{$row->job_title}'." );
+                                       wfDebug( "Row has invalid title '{$row->job_title}'.\n" );
                                        continue; // try again
                                }
                                $job = Job::factory( $row->job_cmd, $title,
@@ -337,7 +336,7 @@ class JobQueueDB extends JobQueue {
         * Reserve a row with a single UPDATE without holding row locks over RTTs...
         *
         * @param string $uuid 32 char hex string
-        * @param $rand integer Random unsigned integer (31 bits)
+        * @param int $rand Random unsigned integer (31 bits)
         * @param bool $gte Search for job_random >= $random (otherwise job_random <= $random)
         * @return stdClass|bool Row|false
         */
@@ -463,7 +462,7 @@ class JobQueueDB extends JobQueue {
                                        array( 'job_cmd' => $this->type, 'job_token' => $uuid ), __METHOD__
                                );
                                if ( !$row ) { // raced out by duplicate job removal
-                                       wfDebug( "Row deleted as duplicate by another process." );
+                                       wfDebug( "Row deleted as duplicate by another process.\n" );
                                }
                        } else {
                                break; // nothing to do
@@ -684,8 +683,9 @@ class JobQueueDB extends JobQueue {
                                                        'job_id' => $ids ),
                                                __METHOD__
                                        );
-                                       $count += $dbw->affectedRows();
-                                       JobQueue::incrStats( 'job-recycle', $this->type, $dbw->affectedRows() );
+                                       $affected = $dbw->affectedRows();
+                                       $count += $affected;
+                                       JobQueue::incrStats( 'job-recycle', $this->type, $affected, $this->wiki );
                                        $this->cache->set( $this->getCacheKey( 'empty' ), 'false', self::CACHE_TTL_LONG );
                                }
                        }
@@ -710,8 +710,9 @@ class JobQueueDB extends JobQueue {
                        );
                        if ( count( $ids ) ) {
                                $dbw->delete( 'job', array( 'job_id' => $ids ), __METHOD__ );
-                               $count += $dbw->affectedRows();
-                               JobQueue::incrStats( 'job-abandon', $this->type, $dbw->affectedRows() );
+                               $affected = $dbw->affectedRows();
+                               $count += $affected;
+                               JobQueue::incrStats( 'job-abandon', $this->type, $affected, $this->wiki );
                        }
 
                        $dbw->unlock( "jobqueue-recycle-{$this->type}", __METHOD__ );
@@ -771,7 +772,7 @@ class JobQueueDB extends JobQueue {
        }
 
        /**
-        * @param $index integer (DB_SLAVE/DB_MASTER)
+        * @param int $index (DB_SLAVE/DB_MASTER)
         * @return DBConnRef
         */
        protected function getDB( $index ) {
@@ -783,7 +784,7 @@ class JobQueueDB extends JobQueue {
        }
 
        /**
-        * @param $property
+        * @param string $property
         * @return string
         */
        private function getCacheKey( $property ) {
@@ -794,7 +795,7 @@ class JobQueueDB extends JobQueue {
        }
 
        /**
-        * @param $params
+        * @param array|bool $params
         * @return string
         */
        protected static function makeBlob( $params ) {
@@ -806,7 +807,7 @@ class JobQueueDB extends JobQueue {
        }
 
        /**
-        * @param $blob
+        * @param string $blob
         * @return bool|mixed
         */
        protected static function extractBlob( $blob ) {