Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F93883
D7828.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D7828.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -668,6 +668,8 @@
'DrydockManagementWaitForLeaseWorkflow' => 'applications/drydock/management/DrydockManagementWaitForLeaseWorkflow.php',
'DrydockManagementWorkflow' => 'applications/drydock/management/DrydockManagementWorkflow.php',
'DrydockPHIDTypeBlueprint' => 'applications/drydock/phid/DrydockPHIDTypeBlueprint.php',
+ 'DrydockPHIDTypeLease' => 'applications/drydock/phid/DrydockPHIDTypeLease.php',
+ 'DrydockPHIDTypeResource' => 'applications/drydock/phid/DrydockPHIDTypeResource.php',
'DrydockPreallocatedHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php',
'DrydockResource' => 'applications/drydock/storage/DrydockResource.php',
'DrydockResourceCloseController' => 'applications/drydock/controller/DrydockResourceCloseController.php',
@@ -3074,6 +3076,8 @@
'DrydockManagementWaitForLeaseWorkflow' => 'DrydockManagementWorkflow',
'DrydockManagementWorkflow' => 'PhutilArgumentWorkflow',
'DrydockPHIDTypeBlueprint' => 'PhabricatorPHIDType',
+ 'DrydockPHIDTypeLease' => 'PhabricatorPHIDType',
+ 'DrydockPHIDTypeResource' => 'PhabricatorPHIDType',
'DrydockPreallocatedHostBlueprintImplementation' => 'DrydockBlueprintImplementation',
'DrydockResource' =>
array(
diff --git a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php b/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
--- a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
+++ b/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
@@ -29,6 +29,12 @@
array $handles,
array $objects) {
+ foreach ($handles as $phid => $handle) {
+ $blueprint = $objects[$phid];
+ $id = $blueprint->getID();
+
+ $handle->setURI("/drydock/blueprint/{$id}/");
+ }
}
}
diff --git a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php b/src/applications/drydock/phid/DrydockPHIDTypeLease.php
copy from src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
copy to src/applications/drydock/phid/DrydockPHIDTypeLease.php
--- a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
+++ b/src/applications/drydock/phid/DrydockPHIDTypeLease.php
@@ -1,34 +1,40 @@
<?php
-final class DrydockPHIDTypeBlueprint extends PhabricatorPHIDType {
+final class DrydockPHIDTypeLease extends PhabricatorPHIDType {
- const TYPECONST = 'DRYB';
+ const TYPECONST = 'DRYL';
public function getTypeConstant() {
return self::TYPECONST;
}
public function getTypeName() {
- return pht('Blueprint');
+ return pht('Drydock Lease');
}
public function newObject() {
- return new DrydockBlueprint();
+ return new DrydockLease();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
- return id(new DrydockBlueprintQuery())
+ return id(new DrydockLeaseQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
+ foreach ($handles as $phid => $handle) {
+ $lease = $objects[$phid];
+ $id = $lease->getID();
+
+ $handle->setURI("/drydock/lease/{$id}/");
+ }
}
}
diff --git a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php b/src/applications/drydock/phid/DrydockPHIDTypeResource.php
copy from src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
copy to src/applications/drydock/phid/DrydockPHIDTypeResource.php
--- a/src/applications/drydock/phid/DrydockPHIDTypeBlueprint.php
+++ b/src/applications/drydock/phid/DrydockPHIDTypeResource.php
@@ -1,34 +1,40 @@
<?php
-final class DrydockPHIDTypeBlueprint extends PhabricatorPHIDType {
+final class DrydockPHIDTypeResource extends PhabricatorPHIDType {
- const TYPECONST = 'DRYB';
+ const TYPECONST = 'DRYR';
public function getTypeConstant() {
return self::TYPECONST;
}
public function getTypeName() {
- return pht('Blueprint');
+ return pht('Drydock Resource');
}
public function newObject() {
- return new DrydockBlueprint();
+ return new DrydockResource();
}
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
- return id(new DrydockBlueprintQuery())
+ return id(new DrydockResourceQuery())
->withPHIDs($phids);
}
public function loadHandles(
PhabricatorHandleQuery $query,
array $handles,
array $objects) {
+ foreach ($handles as $phid => $handle) {
+ $resource = $objects[$phid];
+ $id = $resource->getID();
+
+ $handle->setURI("/drydock/resource/{$id}/");
+ }
}
}
diff --git a/src/applications/drydock/query/DrydockBlueprintQuery.php b/src/applications/drydock/query/DrydockBlueprintQuery.php
--- a/src/applications/drydock/query/DrydockBlueprintQuery.php
+++ b/src/applications/drydock/query/DrydockBlueprintQuery.php
@@ -34,7 +34,7 @@
DrydockBlueprintImplementation::getAllBlueprintImplementations();
foreach ($blueprints as $blueprint) {
- if (array_key_exists($implementations, $blueprint->getClassName())) {
+ if (array_key_exists($blueprint->getClassName(), $implementations)) {
$blueprint->attachImplementation(
$implementations[$blueprint->getClassName()]);
}
diff --git a/src/applications/drydock/query/DrydockLeaseQuery.php b/src/applications/drydock/query/DrydockLeaseQuery.php
--- a/src/applications/drydock/query/DrydockLeaseQuery.php
+++ b/src/applications/drydock/query/DrydockLeaseQuery.php
@@ -4,14 +4,20 @@
extends PhabricatorCursorPagedPolicyAwareQuery {
private $ids;
+ private $phids;
private $resourceIDs;
private $statuses;
public function withIDs(array $ids) {
$this->ids = $ids;
return $this;
}
+ public function withPHIDs(array $phids) {
+ $this->phids = $phids;
+ return $this;
+ }
+
public function withResourceIDs(array $ids) {
$this->resourceIDs = $ids;
return $this;
@@ -73,6 +79,13 @@
$this->ids);
}
+ if ($this->phids) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'phid IN (%Ls)',
+ $this->phids);
+ }
+
if ($this->statuses) {
$where[] = qsprintf(
$conn_r,
diff --git a/src/applications/drydock/query/DrydockResourceQuery.php b/src/applications/drydock/query/DrydockResourceQuery.php
--- a/src/applications/drydock/query/DrydockResourceQuery.php
+++ b/src/applications/drydock/query/DrydockResourceQuery.php
@@ -4,6 +4,7 @@
extends PhabricatorCursorPagedPolicyAwareQuery {
private $ids;
+ private $phids;
private $statuses;
private $types;
private $blueprintPHIDs;
@@ -13,6 +14,11 @@
return $this;
}
+ public function withPHIDs(array $phids) {
+ $this->phids = $phids;
+ return $this;
+ }
+
public function withTypes(array $types) {
$this->types = $types;
return $this;
@@ -55,6 +61,13 @@
$this->ids);
}
+ if ($this->phids) {
+ $where[] = qsprintf(
+ $conn_r,
+ 'phid IN (%Ls)',
+ $this->phids);
+ }
+
if ($this->types) {
$where[] = qsprintf(
$conn_r,
diff --git a/src/applications/drydock/storage/DrydockBlueprint.php b/src/applications/drydock/storage/DrydockBlueprint.php
--- a/src/applications/drydock/storage/DrydockBlueprint.php
+++ b/src/applications/drydock/storage/DrydockBlueprint.php
@@ -9,6 +9,8 @@
protected $editPolicy;
protected $details;
+ private $implementation = self::ATTACHABLE;
+
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
@@ -34,6 +36,12 @@
return id(new $class())->attachInstance($this);
}
+ public function attachImplementation(DrydockBlueprintImplementation $impl) {
+ $this->implementation = $impl;
+ return $this;
+ }
+
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php
--- a/src/applications/drydock/storage/DrydockLease.php
+++ b/src/applications/drydock/storage/DrydockLease.php
@@ -56,8 +56,7 @@
}
public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_DRYL);
+ return PhabricatorPHID::generateNewPHID(DrydockPHIDTypeLease::TYPECONST);
}
public function getInterface($type) {
diff --git a/src/applications/drydock/storage/DrydockResource.php b/src/applications/drydock/storage/DrydockResource.php
--- a/src/applications/drydock/storage/DrydockResource.php
+++ b/src/applications/drydock/storage/DrydockResource.php
@@ -27,8 +27,7 @@
}
public function generatePHID() {
- return PhabricatorPHID::generateNewPHID(
- PhabricatorPHIDConstants::PHID_TYPE_DRYR);
+ return PhabricatorPHID::generateNewPHID(DrydockPHIDTypeResource::TYPECONST);
}
public function getAttribute($key, $default = null) {
diff --git a/src/applications/phid/PhabricatorPHIDConstants.php b/src/applications/phid/PhabricatorPHIDConstants.php
--- a/src/applications/phid/PhabricatorPHIDConstants.php
+++ b/src/applications/phid/PhabricatorPHIDConstants.php
@@ -7,8 +7,6 @@
const PHID_TYPE_MAGIC = '!!!!';
const PHID_TYPE_STRY = 'STRY';
const PHID_TYPE_ACMT = 'ACMT';
- const PHID_TYPE_DRYR = 'DRYR';
- const PHID_TYPE_DRYL = 'DRYL';
const PHID_TYPE_OASC = 'OASC';
const PHID_TYPE_OASA = 'OASA';
const PHID_TYPE_TOBJ = 'TOBJ';
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/pc/uh/d5dwzwit74b5lhj7
Default Alt Text
D7828.diff (9 KB)
Attached To
Mode
D7828: Make Drydock Lease and Resource PHIDs use newer PHID infrastructure
Attached
Detach File
Event Timeline
Log In to Comment