summaryrefslogtreecommitdiff
path: root/includes/job/JobQueue.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/job/JobQueue.php')
-rw-r--r--includes/job/JobQueue.php21
1 files changed, 20 insertions, 1 deletions
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 ) {