Differential D9871 Diff 23765 src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/daemon/workers/storage/PhabricatorWorkerArchiveTask.php
<?php | <?php | ||||
final class PhabricatorWorkerArchiveTask extends PhabricatorWorkerTask { | final class PhabricatorWorkerArchiveTask extends PhabricatorWorkerTask { | ||||
const RESULT_SUCCESS = 0; | const RESULT_SUCCESS = 0; | ||||
const RESULT_FAILURE = 1; | const RESULT_FAILURE = 1; | ||||
const RESULT_CANCELLED = 2; | const RESULT_CANCELLED = 2; | ||||
protected $duration; | protected $duration; | ||||
protected $result; | protected $result; | ||||
public function save() { | public function save() { | ||||
if ($this->getID() === null) { | if ($this->getID() === null) { | ||||
throw new Exception( | throw new Exception('Trying to archive a task with no ID.'); | ||||
'Trying to archive a task with no ID.'); | |||||
} | } | ||||
$other = new PhabricatorWorkerActiveTask(); | $other = new PhabricatorWorkerActiveTask(); | ||||
$conn_w = $this->establishConnection('w'); | $conn_w = $this->establishConnection('w'); | ||||
$this->openTransaction(); | $this->openTransaction(); | ||||
queryfx( | queryfx( | ||||
$conn_w, | $conn_w, | ||||
Show All 28 Lines | public function unarchiveTask() { | ||||
$this->openTransaction(); | $this->openTransaction(); | ||||
$active = id(new PhabricatorWorkerActiveTask()) | $active = id(new PhabricatorWorkerActiveTask()) | ||||
->setID($this->getID()) | ->setID($this->getID()) | ||||
->setTaskClass($this->getTaskClass()) | ->setTaskClass($this->getTaskClass()) | ||||
->setLeaseOwner(null) | ->setLeaseOwner(null) | ||||
->setLeaseExpires(0) | ->setLeaseExpires(0) | ||||
->setFailureCount(0) | ->setFailureCount(0) | ||||
->setDataID($this->getDataID()) | ->setDataID($this->getDataID()) | ||||
->setPriority($this->getPriority()) | |||||
->insert(); | ->insert(); | ||||
$this->setDataID(null); | $this->setDataID(null); | ||||
$this->delete(); | $this->delete(); | ||||
$this->saveTransaction(); | $this->saveTransaction(); | ||||
return $active; | return $active; | ||||
} | } | ||||
} | } |