Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15415167
D21015.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D21015.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
@@ -8758,6 +8758,7 @@
'PhabricatorAuthDAO',
'PhabricatorApplicationTransactionInterface',
'PhabricatorPolicyInterface',
+ 'PhabricatorDestructibleInterface',
),
'PhabricatorAuthProviderConfigController' => 'PhabricatorAuthProviderController',
'PhabricatorAuthProviderConfigEditor' => 'PhabricatorApplicationTransactionEditor',
@@ -9765,10 +9766,12 @@
'PhabricatorExternalAccount' => array(
'PhabricatorUserDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorDestructibleInterface',
),
'PhabricatorExternalAccountIdentifier' => array(
'PhabricatorUserDAO',
'PhabricatorPolicyInterface',
+ 'PhabricatorDestructibleInterface',
),
'PhabricatorExternalAccountIdentifierQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorExternalAccountQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
diff --git a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
--- a/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
+++ b/src/applications/auth/storage/PhabricatorAuthProviderConfig.php
@@ -4,7 +4,8 @@
extends PhabricatorAuthDAO
implements
PhabricatorApplicationTransactionInterface,
- PhabricatorPolicyInterface {
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $providerClass;
protected $providerType;
@@ -140,4 +141,33 @@
return false;
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+
+ $viewer = $engine->getViewer();
+ $config_phid = $this->getPHID();
+
+ $accounts = id(new PhabricatorExternalAccountQuery())
+ ->setViewer($viewer)
+ ->withProviderConfigPHIDs(array($config_phid))
+ ->newIterator();
+ foreach ($accounts as $account) {
+ $engine->destroyObject($account);
+ }
+
+ $identifiers = id(new PhabricatorExternalAccountIdentifierQuery())
+ ->setViewer($viewer)
+ ->withProviderConfigPHIDs(array($config_phid))
+ ->newIterator();
+ foreach ($identifiers as $identifier) {
+ $engine->destroyObject($identifier);
+ }
+
+ $this->delete();
+ }
+
}
diff --git a/src/applications/people/storage/PhabricatorExternalAccount.php b/src/applications/people/storage/PhabricatorExternalAccount.php
--- a/src/applications/people/storage/PhabricatorExternalAccount.php
+++ b/src/applications/people/storage/PhabricatorExternalAccount.php
@@ -1,7 +1,10 @@
<?php
-final class PhabricatorExternalAccount extends PhabricatorUserDAO
- implements PhabricatorPolicyInterface {
+final class PhabricatorExternalAccount
+ extends PhabricatorUserDAO
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $userPHID;
protected $accountType;
@@ -162,4 +165,24 @@
}
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+
+ $viewer = $engine->getViewer();
+
+ $identifiers = id(new PhabricatorExternalAccountIdentifierQuery())
+ ->setViewer($viewer)
+ ->withExternalAccountPHIDs(array($this->getPHID()))
+ ->newIterator();
+ foreach ($identifiers as $identifier) {
+ $engine->destroyObject($identifier);
+ }
+
+ $this->delete();
+ }
+
}
diff --git a/src/applications/people/storage/PhabricatorExternalAccountIdentifier.php b/src/applications/people/storage/PhabricatorExternalAccountIdentifier.php
--- a/src/applications/people/storage/PhabricatorExternalAccountIdentifier.php
+++ b/src/applications/people/storage/PhabricatorExternalAccountIdentifier.php
@@ -2,7 +2,9 @@
final class PhabricatorExternalAccountIdentifier
extends PhabricatorUserDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorDestructibleInterface {
protected $externalAccountPHID;
protected $providerConfigPHID;
@@ -64,4 +66,13 @@
return false;
}
+
+/* -( PhabricatorDestructibleInterface )----------------------------------- */
+
+
+ public function destroyObjectPermanently(
+ PhabricatorDestructionEngine $engine) {
+ $this->delete();
+ }
+
}
diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -1110,19 +1110,21 @@
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {
+ $viewer = $engine->getViewer();
+
$this->openTransaction();
$this->delete();
$externals = id(new PhabricatorExternalAccountQuery())
- ->setViewer($engine->getViewer())
+ ->setViewer($viewer)
->withUserPHIDs(array($this->getPHID()))
- ->execute();
+ ->newIterator();
foreach ($externals as $external) {
- $external->delete();
+ $engine->destroyObject($external);
}
$prefs = id(new PhabricatorUserPreferencesQuery())
- ->setViewer($engine->getViewer())
+ ->setViewer($viewer)
->withUsers(array($this))
->execute();
foreach ($prefs as $pref) {
@@ -1137,7 +1139,7 @@
}
$keys = id(new PhabricatorAuthSSHKeyQuery())
- ->setViewer($engine->getViewer())
+ ->setViewer($viewer)
->withObjectPHIDs(array($this->getPHID()))
->execute();
foreach ($keys as $key) {
diff --git a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php
@@ -359,6 +359,10 @@
return $results;
}
+ final public function newIterator() {
+ return new PhabricatorQueryIterator($this);
+ }
+
final public function executeWithCursorPager(AphrontCursorPagerView $pager) {
$limit = $pager->getPageSize();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 4:32 AM (1 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7389102
Default Alt Text
D21015.diff (6 KB)
Attached To
Mode
D21015: Make AuthProvider, ExternalAccount, and ExternalAccountIdentifier all Destructible
Attached
Detach File
Event Timeline
Log In to Comment