Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203958

Change subject: Made job factory() callers use Title::makeTitle
......................................................................

Made job factory() callers use Title::makeTitle

* The titles are not from user input and this simplifies the code

Change-Id: I067049cca5661b387076f0c28bc0b71d22162a0f
---
M includes/jobqueue/JobQueueDB.php
M includes/jobqueue/JobQueueRedis.php
2 files changed, 5 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/203958/1

diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php
index d5f47ff..9e85e40 100644
--- a/includes/jobqueue/JobQueueDB.php
+++ b/includes/jobqueue/JobQueueDB.php
@@ -314,12 +314,7 @@
                                }
                                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}'.\n" );
-                                       continue; // try again
-                               }
+                               $title = Title::makeTitle( $row->job_namespace, 
$row->job_title );
                                $job = Job::factory( $row->job_cmd, $title,
                                        self::extractBlob( $row->job_params ), 
$row->job_id );
                                $job->metadata['id'] = $row->job_id;
diff --git a/includes/jobqueue/JobQueueRedis.php 
b/includes/jobqueue/JobQueueRedis.php
index 6c823fb..82537f4 100644
--- a/includes/jobqueue/JobQueueRedis.php
+++ b/includes/jobqueue/JobQueueRedis.php
@@ -631,15 +631,11 @@
         * @return Job|bool
         */
        protected function getJobFromFields( array $fields ) {
-               $title = Title::makeTitleSafe( $fields['namespace'], 
$fields['title'] );
-               if ( $title ) {
-                       $job = Job::factory( $fields['type'], $title, 
$fields['params'] );
-                       $job->metadata['uuid'] = $fields['uuid'];
+               $title = Title::makeTitle( $fields['namespace'], 
$fields['title'] );
+               $job = Job::factory( $fields['type'], $title, $fields['params'] 
);
+               $job->metadata['uuid'] = $fields['uuid'];
 
-                       return $job;
-               }
-
-               return false;
+               return $job;
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/203958
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I067049cca5661b387076f0c28bc0b71d22162a0f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to