当前位置: 首页>>代码示例>>PHP>>正文


PHP Job::extractBlob方法代码示例

本文整理汇总了PHP中Job::extractBlob方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::extractBlob方法的具体用法?PHP Job::extractBlob怎么用?PHP Job::extractBlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Job的用法示例。


在下文中一共展示了Job::extractBlob方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pop

 /**
  * Pop a job off the front of the queue
  * @static
  * @return Job or false if there's no jobs
  */
 static function pop()
 {
     wfProfileIn(__METHOD__);
     $dbr =& wfGetDB(DB_SLAVE);
     // Get a job from the slave
     $row = $dbr->selectRow('job', '*', '', __METHOD__, array('ORDER BY' => 'job_id', 'LIMIT' => 1));
     if ($row === false) {
         wfProfileOut(__METHOD__);
         return false;
     }
     // Try to delete it from the master
     $dbw =& wfGetDB(DB_MASTER);
     $dbw->delete('job', array('job_id' => $row->job_id), __METHOD__);
     $affected = $dbw->affectedRows();
     $dbw->immediateCommit();
     if (!$affected) {
         // Failed, someone else beat us to it
         // Try getting a random row
         $row = $dbw->selectRow('job', array('MIN(job_id) as minjob', 'MAX(job_id) as maxjob'), '', __METHOD__);
         if ($row === false || is_null($row->minjob) || is_null($row->maxjob)) {
             // No jobs to get
             wfProfileOut(__METHOD__);
             return false;
         }
         // Get the random row
         $row = $dbw->selectRow('job', '*', array('job_id' => mt_rand($row->minjob, $row->maxjob)), __METHOD__);
         if ($row === false) {
             // Random job gone before we got the chance to select it
             // Give up
             wfProfileOut(__METHOD__);
             return false;
         }
         // Delete the random row
         $dbw->delete('job', array('job_id' => $row->job_id), __METHOD__);
         $affected = $dbw->affectedRows();
         $dbw->immediateCommit();
         if (!$affected) {
             // Random job gone before we exclusively deleted it
             // Give up
             wfProfileOut(__METHOD__);
             return false;
         }
     }
     // If execution got to here, there's a row in $row that has been deleted from the database
     // by this thread. Hence the concurrent pop was successful.
     $namespace = $row->job_namespace;
     $dbkey = $row->job_title;
     $title = Title::makeTitleSafe($namespace, $dbkey);
     $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
     $dbw->delete('job', $job->insertFields(), __METHOD__);
     wfProfileOut(__METHOD__);
     return $job;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:59,代码来源:JobQueue.php

示例2: execute

 /**
  * Executed when the user opens the DSMW administration special page
  * Calculates the PushFeed list and the pullfeed list (and everything that
  * is displayed on the psecial page
  *
  * @global <Object> $wgOut Output page instance
  * @global <String> $wgServerName
  * @global <String> $wgScriptPath
  * @return <bool>
  */
 public function execute()
 {
     global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath, $wgUser;
     if (!$this->userCanExecute($wgUser)) {
         // If the user is not authorized, show an error.
         $this->displayRestrictionError();
         return;
     }
     /**** Get status of refresh job, if any ****/
     $dbr =& wfGetDB(DB_SLAVE);
     $row = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWUpdateJob'), __METHOD__);
     if ($row !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row->job_namespace, $row->job_title);
         $updatejob = Job::factory($row->job_cmd, $title, Job::extractBlob($row->job_params), $row->job_id);
     } else {
         $updatejob = NULL;
     }
     $row1 = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWPropertyTypeJob'), __METHOD__);
     if ($row1 !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row1->job_namespace, $row1->job_title);
         $propertiesjob = Job::factory($row1->job_cmd, $title, Job::extractBlob($row1->job_params), $row1->job_id);
     } else {
         $propertiesjob = NULL;
     }
     /**** Execute actions if any ****/
     $action = $wgRequest->getText('action');
     if ($action == 'logootize') {
         if ($updatejob === NULL) {
             // careful, there might be race conditions here
             $title = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
             $newjob = new DSMWUpdateJob($title);
             $newjob->insert();
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-articleupstarted') . '</b></font></p>');
         } else {
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-articleuprunning') . '</b></font></p>');
         }
     } elseif ($action == 'addProperties') {
         if ($propertiesjob === NULL) {
             $title1 = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
             $newjob1 = new DSMWPropertyTypeJob($title1);
             $newjob1->insert();
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-typeupstarted') . '</b></font></p>');
         } else {
             $wgOut->addHTML('<p><font color="red"><b>' . wfMsg('dsmw-special-admin-typeuprunning') . '</b></font></p>');
         }
     }
     $wgOut->setPagetitle('DSMW Settings');
     $wgOut->addHTML(Html::element('p', array(), wfMsg('dsmw-special-admin-intro')));
     $wgOut->addHTML(Html::rawElement('form', array('name' => 'properties', 'action' => '', 'method' => 'POST'), Html::hidden('action', 'addProperties') . '<br />' . Html::element('h2', array(), wfMsg('dsmw-special-admin-propheader')) . Html::element('p', array(), wfMsg('dsmw-special-admin-proptext')) . Html::input('updateProperties', wfMsg('dsmw-special-admin-propheader'), 'submit')));
     $wgOut->addHTML(Html::rawElement('form', array('name' => 'logoot', 'action' => '', 'method' => 'POST'), Html::hidden('action', 'logootize') . '<br />' . Html::element('h2', array(), wfMsg('dsmw-special-admin-upheader')) . Html::element('p', array(), wfMsg('dsmw-special-admin-uptext')) . Html::input('updateArticles', wfMsg('dsmw-special-admin-upbutton'), 'submit')));
     return false;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:64,代码来源:DSMWAdmin.php

示例3: pop

 /**
  * Pop a job off the front of the queue
  * @static
  * @param $offset Number of jobs to skip
  * @return Job or false if there's no jobs
  */
 static function pop($offset = 0)
 {
     wfProfileIn(__METHOD__);
     $dbr = wfGetDB(DB_SLAVE);
     /* Get a job from the slave, start with an offset, 
     			scan full set afterwards, avoid hitting purged rows
     
     			NB: If random fetch previously was used, offset 
     				will always be ahead of few entries 
     		*/
     $row = $dbr->selectRow('job', '*', "job_id >= {$offset}", __METHOD__, array('ORDER BY' => 'job_id', 'LIMIT' => 1));
     // Refetching without offset is needed as some of job IDs could have had delayed commits
     // and have lower IDs than jobs already executed, blame concurrency :)
     //
     if ($row === false) {
         if ($offset != 0) {
             $row = $dbr->selectRow('job', '*', '', __METHOD__, array('ORDER BY' => 'job_id', 'LIMIT' => 1));
         }
         if ($row === false) {
             wfProfileOut(__METHOD__);
             return false;
         }
     }
     $offset = $row->job_id;
     // Try to delete it from the master
     $dbw = wfGetDB(DB_MASTER);
     $dbw->delete('job', array('job_id' => $row->job_id), __METHOD__);
     $affected = $dbw->affectedRows();
     $dbw->immediateCommit();
     if (!$affected) {
         // Failed, someone else beat us to it
         // Try getting a random row
         $row = $dbw->selectRow('job', array('MIN(job_id) as minjob', 'MAX(job_id) as maxjob'), "job_id >= {$offset}", __METHOD__);
         if ($row === false || is_null($row->minjob) || is_null($row->maxjob)) {
             // No jobs to get
             wfProfileOut(__METHOD__);
             return false;
         }
         // Get the random row
         $row = $dbw->selectRow('job', '*', 'job_id >= ' . mt_rand($row->minjob, $row->maxjob), __METHOD__);
         if ($row === false) {
             // Random job gone before we got the chance to select it
             // Give up
             wfProfileOut(__METHOD__);
             return false;
         }
         // Delete the random row
         $dbw->delete('job', array('job_id' => $row->job_id), __METHOD__);
         $affected = $dbw->affectedRows();
         $dbw->immediateCommit();
         if (!$affected) {
             // Random job gone before we exclusively deleted it
             // Give up
             wfProfileOut(__METHOD__);
             return false;
         }
     }
     // If execution got to here, there's a row in $row that has been deleted from the database
     // by this thread. Hence the concurrent pop was successful.
     $namespace = $row->job_namespace;
     $dbkey = $row->job_title;
     $title = Title::makeTitleSafe($namespace, $dbkey);
     $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
     $dbw->delete('job', $job->insertFields(), __METHOD__);
     wfProfileOut(__METHOD__);
     return $job;
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:74,代码来源:JobQueue.php

示例4: execute

 public function execute($par)
 {
     global $wgOut, $wgRequest, $wgServer, $wgArticlePath, $wgUser, $smwgAdminRefreshStore;
     if (!$this->userCanExecute($wgUser)) {
         // If the user is not authorized, show an error.
         $this->displayRestrictionError();
         return;
     }
     $this->setHeaders();
     /**** Get status of refresh job, if any ****/
     $dbr = wfGetDB(DB_SLAVE);
     $row = $dbr->selectRow('job', '*', array('job_cmd' => 'SMWRefreshJob'), __METHOD__);
     if ($row !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row->job_namespace, $row->job_title);
         $refreshjob = Job::factory($row->job_cmd, $title, Job::extractBlob($row->job_params), $row->job_id);
     } else {
         $refreshjob = null;
     }
     /**** Execute actions if any ****/
     $action = $wgRequest->getText('action');
     if ($action == 'updatetables') {
         $sure = $wgRequest->getText('udsure');
         if ($sure == 'yes') {
             $wgOut->disable();
             // raw output
             ob_start();
             print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Semantic MediaWiki</title></head><body><p><pre>";
             header("Content-type: text/html; charset=UTF-8");
             $result = smwfGetStore()->setup();
             wfRunHooks('smwInitializeTables');
             print '</pre></p>';
             if ($result === true) {
                 print '<p><b>' . wfMsg('smw_smwadmin_setupsuccess') . "</b></p>\n";
             }
             $returntitle = SpecialPage::getTitleFor('SMWAdmin');
             print '<p> ' . wfMsg('smw_smwadmin_return', '<a href="' . htmlspecialchars($returntitle->getFullURL()) . '">Special:SMWAdmin</a>') . "</p>\n";
             print '</body></html>';
             ob_flush();
             flush();
             return;
         }
     } elseif ($smwgAdminRefreshStore && $action == 'refreshstore') {
         // managing refresh jobs for the store
         $sure = $wgRequest->getText('rfsure');
         if ($sure == 'yes') {
             if (is_null($refreshjob)) {
                 // careful, there might be race conditions here
                 $title = SpecialPage::getTitleFor('SMWAdmin');
                 $jobParams = array('spos' => 1, 'prog' => 0, 'rc' => 2);
                 // wikia change start - jobqueue migration
                 $task = new \Wikia\Tasks\Tasks\JobWrapperTask();
                 $task->call('SMWRefreshJob', $title, $jobParams);
                 $task->queue();
                 // wikia change end
                 $wgOut->addHTML('<p>' . wfMsg('smw_smwadmin_updatestarted') . '</p>');
             } else {
                 $wgOut->addHTML('<p>' . wfMsg('smw_smwadmin_updatenotstarted') . '</p>');
             }
         } elseif ($sure == 'stop') {
             $dbw = wfGetDB(DB_MASTER);
             // delete (all) existing iteration jobs
             $dbw->delete('job', array('job_cmd' => 'SMWRefreshJob'), __METHOD__);
             $wgOut->addHTML('<p>' . wfMsg('smw_smwadmin_updatestopped') . '</p>');
         } else {
             $wgOut->addHTML('<p>' . wfMsg('smw_smwadmin_updatenotstopped') . '</p>');
         }
         return;
     }
     /**** Normal output ****/
     $html = '<p>' . wfMsg('smw_smwadmin_docu') . "</p>\n";
     // creating tables and converting contents from older versions
     $html .= '<form name="buildtables" action="" method="POST">' . "\n" . '<input type="hidden" name="action" value="updatetables" />' . "\n";
     $html .= '<br /><h2>' . wfMsg('smw_smwadmin_db') . "</h2>\n" . '<p>' . wfMsg('smw_smwadmin_dbdocu') . "</p>\n";
     $html .= '<p>' . wfMsg('smw_smwadmin_permissionswarn') . "</p>\n" . '<input type="hidden" name="udsure" value="yes"/>' . '<input type="submit" value="' . wfMsg('smw_smwadmin_dbbutton') . '"/></form>' . "\n";
     $html .= '<br /><h2>' . wfMsg('smw_smwadmin_datarefresh') . "</h2>\n" . '<p>' . wfMsg('smw_smwadmin_datarefreshdocu') . "</p>\n";
     if (!is_null($refreshjob)) {
         $prog = $refreshjob->getProgress();
         $html .= '<p>' . wfMsg('smw_smwadmin_datarefreshprogress') . "</p>\n" . '<p><div style="float: left; background: #DDDDDD; border: 1px solid grey; width: 300px; "><div style="background: #AAF; width: ' . round($prog * 300) . 'px; height: 20px; "> </div></div> &#160;' . round($prog * 100, 4) . '%</p><br /><br />';
         if ($smwgAdminRefreshStore) {
             $html .= '<form name="refreshwiki" action="" method="POST">' . '<input type="hidden" name="action" value="refreshstore" />' . '<input type="submit" value="' . htmlspecialchars(wfMsg('smw_smwadmin_datarefreshstop')) . '" /> ' . ' <input type="checkbox" name="rfsure" value="stop"/> ' . htmlspecialchars(wfMsg('smw_smwadmin_datarefreshstopconfirm')) . '</form>' . "\n";
         }
     } elseif ($smwgAdminRefreshStore) {
         $html .= '<form name="refreshwiki" action="" method="POST">' . '<input type="hidden" name="action" value="refreshstore" />' . '<input type="hidden" name="rfsure" value="yes"/>' . '<input type="submit" value="' . wfMsg('smw_smwadmin_datarefreshbutton') . '"/>' . '</form>' . "\n";
     }
     $html .= '<br /><h2>' . wfMsg('smw_smwadmin_announce') . "</h2>\n" . '<p>' . wfMsg('smw_smwadmin_announcedocu') . "</p>\n" . '<p>' . wfMsg('smw_smwadmin_announcebutton') . "</p>\n" . '<form name="announcewiki" action="http://semantic-mediawiki.org/wiki/Special:SMWRegistry" method="GET">' . '<input type="hidden" name="url" value="' . $wgServer . str_replace('$1', '', $wgArticlePath) . '" />' . '<input type="hidden" name="return" value="Special:SMWAdmin" />' . '<input type="submit" value="' . wfMsg('smw_smwadmin_announce') . '"/></form>' . "\n";
     $html .= '<br /><h2>' . wfMsg('smw_smwadmin_support') . "</h2>\n" . '<p>' . wfMsg('smw_smwadmin_supportdocu') . "</p>\n" . "<ul>\n" . '<li>' . wfMsg('smw_smwadmin_installfile') . "</li>\n" . '<li>' . wfMsg('smw_smwadmin_smwhomepage') . "</li>\n" . '<li>' . wfMsg('smw_smwadmin_mediazilla') . "</li>\n" . '<li>' . wfMsg('smw_smwadmin_questions') . "</li>\n" . "</ul>\n";
     $wgOut->addHTML($html);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:89,代码来源:SMW_SpecialSMWAdmin.php

示例5: execute

 /**
  * Executed when the user opens the DSMW administration special page
  * Calculates the PushFeed list and the pullfeed list (and everything that
  * is displayed on the psecial page
  *
  * @global <Object> $wgOut Output page instance
  * @global <String> $wgServerName
  * @global <String> $wgScriptPath
  * @return <bool>
  */
 function execute()
 {
     global $wgOut, $wgRequest, $wgServerName, $wgScriptPath, $wgDSMWIP, $wgServerName, $wgScriptPath;
     /*, $wgSitename, $wgCachePages, $wgUser, $wgTitle, $wgDenyAccessMessage, $wgAllowAnonUsers, $wgRequest, $wgMessageCache, $wgWatchingMessages, $wgDBtype, $namespace_titles;*/
     $urlServer = 'http://' . $wgServerName . $wgScriptPath;
     /**** Get status of refresh job, if any ****/
     $dbr =& wfGetDB(DB_SLAVE);
     $row = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWUpdateJob'), __METHOD__);
     if ($row !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row->job_namespace, $row->job_title);
         $updatejob = Job::factory($row->job_cmd, $title, Job::extractBlob($row->job_params), $row->job_id);
     } else {
         $updatejob = NULL;
     }
     $row1 = $dbr->selectRow('job', '*', array('job_cmd' => 'DSMWPropertyTypeJob'), __METHOD__);
     if ($row1 !== false) {
         // similar to Job::pop_type, but without deleting the job
         $title = Title::makeTitleSafe($row1->job_namespace, $row1->job_title);
         $propertiesjob = Job::factory($row1->job_cmd, $title, Job::extractBlob($row1->job_params), $row1->job_id);
     } else {
         $propertiesjob = NULL;
     }
     /**** Execute actions if any ****/
     $action = $wgRequest->getText('action');
     if ($action == 'logootize') {
         if ($updatejob === NULL) {
             // careful, there might be race conditions here
             $title = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
             $newjob = new DSMWUpdateJob($title);
             $newjob->insert();
             $wgOut->addHTML('<p><font color="red"><b>Articles update process started.</b></font></p>');
         } else {
             $wgOut->addHTML('<p><font color="red"><b>Articles update process is already running.</b></font></p>');
         }
     } elseif ($action == 'addProperties') {
         if ($propertiesjob === NULL) {
             $title1 = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
             $newjob1 = new DSMWPropertyTypeJob($title1);
             $newjob1->insert();
             $wgOut->addHTML('<p><font color="red"><b>Properties type update process started.</b></font></p>');
         } else {
             $wgOut->addHTML('<p><font color="red"><b>Properties type update process is already running.</b></font></p>');
         }
     } elseif ($action == 'updatetables') {
         $wgOut->disable();
         // raw output
         ob_start();
         print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\" dir=\"ltr\">\n<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>Setting up Storage for Distributed Semantic MediaWiki</title></head><body><p><pre>";
         header("Content-type: text/html; charset=UTF-8");
         $db =& wfGetDB(DB_MASTER);
         $result = DSMWDBHelpers::setup($db);
         print '</pre></p>';
         if ($result === true) {
             print '<p><b>The database was set up successfully.</b></p>';
         }
         $returntitle = Title::makeTitle(NS_SPECIAL, 'DSMWAdmin');
         print '<p> <a href="' . htmlspecialchars($returntitle->getFullURL()) . '">Special:DSMWAdmin</a></p>';
         print '</body></html>';
         ob_flush();
         flush();
         return;
     }
     $wgOut->setPagetitle("DSMW Settings");
     $output = '<p>This page helps you during installation of Distributed Semantic MediaWiki.</p>';
     // creating tables
     $output .= '<form name="buildtables" action="" method="POST">' . '<input type="hidden" name="action" value="updatetables">';
     $output .= '<br /><h2>Database: DSMW tables installation</h2>' . '<p>Distributed Semantic MediaWiki requires some tables to be created in the database.</p>';
     $output .= '<input type="submit" value="Initialise tables"/></form>';
     // creating properties
     $output .= '<form name="properties" action="" method="POST">' . '<input type="hidden" name="action" value="addProperties">';
     $output .= '<br /><h2>Update properties type</h2>' . '<p>Distributed Semantic MediaWiki requires some properties type to be set.</p>';
     $output .= '<input type="submit" value="Update properties type"/></form>';
     //Pass wiki article through Logoot
     $output .= '<form name="logoot" action="" method="POST">' . '<input type="hidden" name="action" value="logootize" />';
     $output .= '<br /><h2>DSMW update older articles</h2>' . '<p>For reasons of conflict management, DSMW works only with articles created after it\'s installation.
                     Therefore you need to update articles created before it\'s installation in order to edit them.</p>';
     $output .= '<input type="submit" value="Articles update"/></form>';
     $wgOut->addHTML($output);
     return false;
 }
开发者ID:hala54,项目名称:DSMW,代码行数:91,代码来源:DSMWAdmin.php

示例6: pop

 /**
  * Pop a job off the front of the queue
  *
  * @param $offset Integer: Number of jobs to skip
  * @return Job or false if there's no jobs
  */
 static function pop($offset = 0)
 {
     global $wgJobTypesExcludedFromDefaultQueue;
     wfProfileIn(__METHOD__);
     $dbr = wfGetDB(DB_SLAVE);
     /* Get a job from the slave, start with an offset,
     			scan full set afterwards, avoid hitting purged rows
     
     			NB: If random fetch previously was used, offset
     				will always be ahead of few entries
     		*/
     $conditions = array();
     if (count($wgJobTypesExcludedFromDefaultQueue) != 0) {
         foreach ($wgJobTypesExcludedFromDefaultQueue as $cmdType) {
             $conditions[] = "job_cmd != " . $dbr->addQuotes($cmdType);
         }
     }
     $offset = intval($offset);
     $options = array('ORDER BY' => 'job_id', 'USE INDEX' => 'PRIMARY');
     $row = $dbr->selectRow('job', '*', array_merge($conditions, array("job_id >= {$offset}")), __METHOD__, $options);
     // Refetching without offset is needed as some of job IDs could have had delayed commits
     // and have lower IDs than jobs already executed, blame concurrency :)
     //
     if ($row === false) {
         if ($offset != 0) {
             $row = $dbr->selectRow('job', '*', $conditions, __METHOD__, $options);
         }
         if ($row === false) {
             wfProfileOut(__METHOD__);
             return false;
         }
     }
     // Try to delete it from the master
     $dbw = wfGetDB(DB_MASTER);
     $dbw->delete('job', array('job_id' => $row->job_id), __METHOD__);
     $affected = $dbw->affectedRows();
     $dbw->commit();
     if (!$affected) {
         // Failed, someone else beat us to it
         // Try getting a random row
         $row = $dbw->selectRow('job', array('MIN(job_id) as minjob', 'MAX(job_id) as maxjob'), '1=1', __METHOD__);
         if ($row === false || is_null($row->minjob) || is_null($row->maxjob)) {
             // No jobs to get
             wfProfileOut(__METHOD__);
             return false;
         }
         // Get the random row
         $row = $dbw->selectRow('job', '*', 'job_id >= ' . mt_rand($row->minjob, $row->maxjob), __METHOD__);
         if ($row === false) {
             // Random job gone before we got the chance to select it
             // Give up
             wfProfileOut(__METHOD__);
             return false;
         }
         // Delete the random row
         $dbw->delete('job', array('job_id' => $row->job_id), __METHOD__);
         $affected = $dbw->affectedRows();
         $dbw->commit();
         if (!$affected) {
             // Random job gone before we exclusively deleted it
             // Give up
             wfProfileOut(__METHOD__);
             return false;
         }
     }
     // If execution got to here, there's a row in $row that has been deleted from the database
     // by this thread. Hence the concurrent pop was successful.
     wfIncrStats('job-pop');
     $namespace = $row->job_namespace;
     $dbkey = $row->job_title;
     $title = Title::makeTitleSafe($namespace, $dbkey);
     $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
     $job->removeDuplicates();
     wfProfileOut(__METHOD__);
     return $job;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:83,代码来源:JobQueue.php


注:本文中的Job::extractBlob方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。