replace TYPE= with ENGINE=, (supported since 4.0, TYPE deprecated since 4.1)
[lhc/web/wiklou.git] / includes / JobQueue.php
index eb62f36..c9b2146 100644 (file)
@@ -7,9 +7,9 @@ if ( !defined( 'MEDIAWIKI' ) ) {
 class Job {
        var $command,
                $title,
-               $params, 
+               $params,
                $id,
-               $removeDuplicates, 
+               $removeDuplicates,
                $error;
 
        /*-------------------------------------------------------------------------
@@ -17,7 +17,7 @@ class Job {
         *------------------------------------------------------------------------*/
        /**
         * Add an array of refreshLinks jobs to the queue
-        * @param array $titles Array of title objects. 
+        * @param array $titles Array of title objects.
         * @static
         */
        function queueLinksJobs( $titles ) {
@@ -42,7 +42,7 @@ class Job {
                $dbr =& wfGetDB( DB_SLAVE );
 
                // Get a job from the slave
-               $row = $dbr->selectRow( 'job', '*', '', $fname, 
+               $row = $dbr->selectRow( 'job', '*', '', $fname,
                        array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 )
                );
 
@@ -60,7 +60,7 @@ class Job {
                if ( !$affected ) {
                        // Failed, someone else beat us to it
                        // Try getting a random row
-                       $row = $dbw->selectRow( 'job', array( 'MIN(job_id) as minjob', 
+                       $row = $dbw->selectRow( 'job', array( 'MIN(job_id) as minjob',
                                'MAX(job_id) as maxjob' ), '', $fname );
                        if ( $row === false || is_null( $row->minjob ) || is_null( $row->maxjob ) ) {
                                // No jobs to get
@@ -68,7 +68,7 @@ class Job {
                                return false;
                        }
                        // Get the random row
-                       $row = $dbw->selectRow( 'job', '*', 
+                       $row = $dbw->selectRow( 'job', '*',
                                array( 'job_id' => mt_rand( $row->minjob, $row->maxjob ) ),     $fname );
                        if ( $row === false ) {
                                // Random job gone before we got the chance to select it
@@ -86,7 +86,7 @@ class Job {
                                // Give up
                                wfProfileOut( $fname );
                                return false;
-                       }                               
+                       }
                }
                
                // If execution got to here, there's a row in $row that has been deleted from the database
@@ -162,6 +162,8 @@ class Job {
         */
        function refreshLinks() {
                global $wgParser;
+               $fname = 'Job::refreshLinks';
+               wfProfileIn( $fname );
                
                $dbw =& wfGetDB( DB_MASTER );
 
@@ -170,19 +172,26 @@ class Job {
                
                if ( is_null( $this->title ) ) {
                        $this->error = "refreshLinks: Invalid title";
+                       wfProfileOut( $fname );
                        return false;
                }
 
                $revision = Revision::newFromTitle( $this->title );
                if ( !$revision ) {
                        $this->error = 'refreshLinks: Article not found "' . $this->title->getPrefixedDBkey() . '"';
+                       wfProfileOut( $fname );
                        return false;
                }
 
+               wfProfileIn( "$fname-parse" );
                $options = new ParserOptions;
                $parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() );
+               wfProfileOut( "$fname-parse" );
+               wfProfileIn( "$fname-update" );
                $update = new LinksUpdate( $this->title, $parserOutput, false );
                $update->doUpdate();
+               wfProfileOut( "$fname-update" );
+               wfProfileOut( $fname );
                return true;
        }
 
@@ -195,10 +204,11 @@ class Job {
                        return $s;
                } else {
                        return "{$this->command} {$this->params}";
-               }                       
+               }
        }
 
        function getLastError() {
                return $this->error;
        }
 }
+?>