From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/job/JobQueue.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'includes/job/JobQueue.php') diff --git a/includes/job/JobQueue.php b/includes/job/JobQueue.php index 0d917ba3..e7c66719 100644 --- a/includes/job/JobQueue.php +++ b/includes/job/JobQueue.php @@ -213,6 +213,10 @@ abstract class Job { throw new MWException( "Invalid job command `{$command}`" ); } + /** + * @param $params + * @return string + */ static function makeBlob( $params ) { if ( $params !== false ) { return serialize( $params ); @@ -221,6 +225,10 @@ abstract class Job { } } + /** + * @param $blob + * @return bool|mixed + */ static function extractBlob( $blob ) { if ( (string)$blob !== '' ) { return unserialize( $blob ); @@ -244,6 +252,10 @@ abstract class Job { } $dbw = wfGetDB( DB_MASTER ); $rows = array(); + + /** + * @var $job Job + */ foreach ( $jobs as $job ) { $rows[] = $job->insertFields(); if ( count( $rows ) >= 50 ) { @@ -323,13 +335,16 @@ abstract class Job { if ( $this->removeDuplicates ) { $res = $dbw->select( 'job', array( '1' ), $fields, __METHOD__ ); if ( $dbw->numRows( $res ) ) { - return; + return true; } } wfIncrStats( 'job-insert' ); return $dbw->insert( 'job', $fields, __METHOD__ ); } + /** + * @return array + */ protected function insertFields() { $dbw = wfGetDB( DB_MASTER ); return array( @@ -337,6 +352,7 @@ abstract class Job { 'job_cmd' => $this->command, 'job_namespace' => $this->title->getNamespace(), 'job_title' => $this->title->getDBkey(), + 'job_timestamp' => $dbw->timestamp(), 'job_params' => Job::makeBlob( $this->params ) ); } @@ -362,6 +378,9 @@ abstract class Job { } } + /** + * @return string + */ function toString() { $paramString = ''; if ( $this->params ) { -- cgit v1.2.2