Implement DestructibleInterface for Owners Packages
Summary: Fixes T9945. This is straightforward. The two sub-object types are very lightweight so I just deleted them directly instead of loading + delete()'ing (or implementing DestructibleInterface on them, which would require they have PHIDs). Also improve a US English localization. Test Plan: - Used `bin/remove destroy PHID-... --trace` to destroy a package. - Verified it was gone. - Inspected the SQL in the log for general reasonableness. Reviewers: chad Reviewed By: chad Maniphest Tasks: T9945 Differential Revision: https://secure.phabricator.com/D14729
This commit is contained in:
@@ -6784,6 +6784,7 @@ phutil_register_library_map(array(
|
|||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
'PhabricatorApplicationTransactionInterface',
|
'PhabricatorApplicationTransactionInterface',
|
||||||
'PhabricatorCustomFieldInterface',
|
'PhabricatorCustomFieldInterface',
|
||||||
|
'PhabricatorDestructibleInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorOwnersPackageDatasource' => 'PhabricatorTypeaheadDatasource',
|
'PhabricatorOwnersPackageDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'PhabricatorOwnersPackageEditEngine' => 'PhabricatorEditEngine',
|
'PhabricatorOwnersPackageEditEngine' => 'PhabricatorEditEngine',
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ final class PhabricatorOwnersPackage
|
|||||||
implements
|
implements
|
||||||
PhabricatorPolicyInterface,
|
PhabricatorPolicyInterface,
|
||||||
PhabricatorApplicationTransactionInterface,
|
PhabricatorApplicationTransactionInterface,
|
||||||
PhabricatorCustomFieldInterface {
|
PhabricatorCustomFieldInterface,
|
||||||
|
PhabricatorDestructibleInterface {
|
||||||
|
|
||||||
protected $name;
|
protected $name;
|
||||||
protected $originalName;
|
protected $originalName;
|
||||||
@@ -338,4 +339,30 @@ final class PhabricatorOwnersPackage
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function destroyObjectPermanently(
|
||||||
|
PhabricatorDestructionEngine $engine) {
|
||||||
|
|
||||||
|
$this->openTransaction();
|
||||||
|
$conn_w = $this->establishConnection('w');
|
||||||
|
|
||||||
|
queryfx(
|
||||||
|
$conn_w,
|
||||||
|
'DELETE FROM %T WHERE packageID = %d',
|
||||||
|
id(new PhabricatorOwnersPath())->getTableName(),
|
||||||
|
$this->getID());
|
||||||
|
|
||||||
|
queryfx(
|
||||||
|
$conn_w,
|
||||||
|
'DELETE FROM %T WHERE packageID = %d',
|
||||||
|
id(new PhabricatorOwnersOwner())->getTableName(),
|
||||||
|
$this->getID());
|
||||||
|
|
||||||
|
$this->delete();
|
||||||
|
$this->saveTransaction();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1501,6 +1501,11 @@ final class PhabricatorUSEnglishTranslation
|
|||||||
|
|
||||||
'%s updated %s for %s, added %s: %s; removed %s: %s.' =>
|
'%s updated %s for %s, added %s: %s; removed %s: %s.' =>
|
||||||
'%s updated %s for %s, added: %5$s; removed; %7$s.',
|
'%s updated %s for %s, added: %5$s; removed; %7$s.',
|
||||||
|
|
||||||
|
'Permanently destroyed %s object(s).' => array(
|
||||||
|
'Permanently destroyed %s object.',
|
||||||
|
'Permanently destroyed %s objects.',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user