Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/storage/DrydockLease.php
Show First 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | return array( | ||||
'columns' => array('resourcePHID', 'status'), | 'columns' => array('resourcePHID', 'status'), | ||||
), | ), | ||||
'key_status' => array( | 'key_status' => array( | ||||
'columns' => array('status'), | 'columns' => array('status'), | ||||
), | ), | ||||
'key_owner' => array( | 'key_owner' => array( | ||||
'columns' => array('ownerPHID'), | 'columns' => array('ownerPHID'), | ||||
), | ), | ||||
'key_recent' => array( | |||||
'columns' => array('resourcePHID', 'dateModified'), | |||||
), | |||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function setAttribute($key, $value) { | public function setAttribute($key, $value) { | ||||
$this->attributes[$key] = $value; | $this->attributes[$key] = $value; | ||||
return $this; | return $this; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 262 Lines • ▼ Show 20 Lines | PhabricatorWorker::scheduleTask( | ||||
'isExpireTask' => ($epoch !== null), | 'isExpireTask' => ($epoch !== null), | ||||
), | ), | ||||
array( | array( | ||||
'objectPHID' => $this->getPHID(), | 'objectPHID' => $this->getPHID(), | ||||
'delayUntil' => ($epoch ? (int)$epoch : null), | 'delayUntil' => ($epoch ? (int)$epoch : null), | ||||
)); | )); | ||||
} | } | ||||
public function getAllocatedResourcePHIDs() { | |||||
return $this->getAttribute('internal.resourcePHIDs.allocated', array()); | |||||
} | |||||
public function setAllocatedResourcePHIDs(array $phids) { | |||||
return $this->setAttribute('internal.resourcePHIDs.allocated', $phids); | |||||
} | |||||
public function addAllocatedResourcePHIDs(array $phids) { | |||||
$allocated_phids = $this->getAllocatedResourcePHIDs(); | |||||
foreach ($phids as $phid) { | |||||
$allocated_phids[$phid] = $phid; | |||||
} | |||||
return $this->setAllocatedResourcePHIDs($allocated_phids); | |||||
} | |||||
public function removeAllocatedResourcePHIDs(array $phids) { | |||||
$allocated_phids = $this->getAllocatedResourcePHIDs(); | |||||
foreach ($phids as $phid) { | |||||
unset($allocated_phids[$phid]); | |||||
} | |||||
return $this->setAllocatedResourcePHIDs($allocated_phids); | |||||
} | |||||
public function getReclaimedResourcePHIDs() { | |||||
return $this->getAttribute('internal.resourcePHIDs.reclaimed', array()); | |||||
} | |||||
public function setReclaimedResourcePHIDs(array $phids) { | |||||
return $this->setAttribute('internal.resourcePHIDs.reclaimed', $phids); | |||||
} | |||||
public function addReclaimedResourcePHIDs(array $phids) { | |||||
$reclaimed_phids = $this->getReclaimedResourcePHIDs(); | |||||
foreach ($phids as $phid) { | |||||
$reclaimed_phids[$phid] = $phid; | |||||
} | |||||
return $this->setReclaimedResourcePHIDs($reclaimed_phids); | |||||
} | |||||
public function removeReclaimedResourcePHIDs(array $phids) { | |||||
$reclaimed_phids = $this->getReclaimedResourcePHIDs(); | |||||
foreach ($phids as $phid) { | |||||
unset($reclaimed_phids[$phid]); | |||||
} | |||||
return $this->setReclaimedResourcePHIDs($reclaimed_phids); | |||||
} | |||||
public function setAwakenTaskIDs(array $ids) { | public function setAwakenTaskIDs(array $ids) { | ||||
$this->setAttribute('internal.awakenTaskIDs', $ids); | $this->setAttribute('internal.awakenTaskIDs', $ids); | ||||
return $this; | return $this; | ||||
} | } | ||||
public function setAllowedBlueprintPHIDs(array $phids) { | public function setAllowedBlueprintPHIDs(array $phids) { | ||||
$this->setAttribute('internal.blueprintPHIDs', $phids); | $this->setAttribute('internal.blueprintPHIDs', $phids); | ||||
return $this; | return $this; | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | public function awakenTasks() { | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getURI() { | public function getURI() { | ||||
$id = $this->getID(); | $id = $this->getID(); | ||||
return "/drydock/lease/{$id}/"; | return "/drydock/lease/{$id}/"; | ||||
} | } | ||||
public function getDisplayName() { | |||||
return pht('Drydock Lease %d', $this->getID()); | |||||
} | |||||
/* -( Status )------------------------------------------------------------- */ | /* -( Status )------------------------------------------------------------- */ | ||||
public function getStatusObject() { | public function getStatusObject() { | ||||
return DrydockLeaseStatus::newStatusObject($this->getStatus()); | return DrydockLeaseStatus::newStatusObject($this->getStatus()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0