Merge "add type check and bail out when title could not be created"
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 7 May 2012 23:03:02 +0000 (23:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 7 May 2012 23:03:03 +0000 (23:03 +0000)
1  2 
includes/job/JobQueue.php

@@@ -1,21 -1,6 +1,21 @@@
  <?php
  /**
 - * Job queue base code
 + * Job queue base code.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License along
 + * with this program; if not, write to the Free Software Foundation, Inc.,
 + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 + * http://www.gnu.org/copyleft/gpl.html
   *
   * @file
   * @defgroup JobQueue JobQueue
@@@ -201,6 -186,11 +201,11 @@@ abstract class Job 
                $namespace = $row->job_namespace;
                $dbkey = $row->job_title;
                $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 );
  
                // Remove any duplicates it may have later in the queue
         * @param $id Int: Job identifier
         * @return Job
         */
-       static function factory( $command, $title, $params = false, $id = 0 ) {
+       static function factory( $command, Title $title, $params = false, $id = 0 ) {
                global $wgJobClasses;
                if( isset( $wgJobClasses[$command] ) ) {
                        $class = $wgJobClasses[$command];