[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 abstract class PhabricatorWorkerTask extends PhabricatorWorkerDAO { 4 5 // NOTE: If you provide additional fields here, make sure they are handled 6 // correctly in the archiving process. 7 protected $taskClass; 8 protected $leaseOwner; 9 protected $leaseExpires; 10 protected $failureCount; 11 protected $dataID; 12 protected $priority; 13 14 private $data; 15 private $executionException; 16 17 public function getConfiguration() { 18 return array( 19 self::CONFIG_COLUMN_SCHEMA => array( 20 'taskClass' => 'text64', 21 'leaseOwner' => 'text64?', 22 'leaseExpires' => 'epoch?', 23 'failureCount' => 'uint32', 24 'failureTime' => 'epoch?', 25 'priority' => 'uint32', 26 ), 27 ) + parent::getConfiguration(); 28 } 29 30 final public function setExecutionException(Exception $execution_exception) { 31 $this->executionException = $execution_exception; 32 return $this; 33 } 34 35 final public function getExecutionException() { 36 return $this->executionException; 37 } 38 39 final public function setData($data) { 40 $this->data = $data; 41 return $this; 42 } 43 44 final public function getData() { 45 return $this->data; 46 } 47 48 final public function isArchived() { 49 return ($this instanceof PhabricatorWorkerArchiveTask); 50 } 51 52 final public function getWorkerInstance() { 53 $id = $this->getID(); 54 $class = $this->getTaskClass(); 55 56 if (!class_exists($class)) { 57 throw new PhabricatorWorkerPermanentFailureException( 58 "Task class '{$class}' does not exist!"); 59 } 60 61 if (!is_subclass_of($class, 'PhabricatorWorker')) { 62 throw new PhabricatorWorkerPermanentFailureException( 63 "Task class '{$class}' does not extend PhabricatorWorker."); 64 } 65 66 return newv($class, array($this->getData())); 67 } 68 69 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |