add type check and bail out when title could not be created

Change-Id: I5d931892d8f8f70a3dc13d0ed73413de47d43f53
This commit is contained in:
jeroendedauw 2012-05-02 17:04:29 +02:00
parent 4f17f49b78
commit c4e407cf6c

View file

@ -186,6 +186,11 @@ abstract class Job {
$namespace = $row->job_namespace; $namespace = $row->job_namespace;
$dbkey = $row->job_title; $dbkey = $row->job_title;
$title = Title::makeTitleSafe( $namespace, $dbkey ); $title = Title::makeTitleSafe( $namespace, $dbkey );
if ( is_null( $title ) ) {
return false;
}
$job = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id ); $job = Job::factory( $row->job_cmd, $title, Job::extractBlob( $row->job_params ), $row->job_id );
// Remove any duplicates it may have later in the queue // Remove any duplicates it may have later in the queue
@ -204,7 +209,7 @@ abstract class Job {
* @param $id Int: Job identifier * @param $id Int: Job identifier
* @return Job * @return Job
*/ */
static function factory( $command, $title, $params = false, $id = 0 ) { static function factory( $command, Title $title, $params = false, $id = 0 ) {
global $wgJobClasses; global $wgJobClasses;
if( isset( $wgJobClasses[$command] ) ) { if( isset( $wgJobClasses[$command] ) ) {
$class = $wgJobClasses[$command]; $class = $wgJobClasses[$command];