mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-16 16:58:38 +01:00
Modernize remaining edge types
Summary: Modernize remaining edges to subclass `PhabricatorEdgeType`. Largely based on D11045. Test Plan: Browsed around and performed various actions include subscribing, unsubscribing and watching. Reviewers: #blessed_reviewers, epriestley Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11116
This commit is contained in:
parent
d0d1866103
commit
7c2a7d0365
58 changed files with 824 additions and 421 deletions
|
@ -1,7 +1,7 @@
|
|||
/* These are here so `grep` will find them if we ever change things: */
|
||||
|
||||
/* PhabricatorProjectProjectHasMemberEdgeType::EDGECONST = 13 */
|
||||
/* PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER = 21 */
|
||||
/* PhabricatorObjectHasSubscriberEdgeType::EDGECONST = 21 */
|
||||
|
||||
INSERT IGNORE INTO {$NAMESPACE}_project.edge (src, type, dst, dateCreated)
|
||||
SELECT src, 21, dst, dateCreated FROM {$NAMESPACE}_project.edge
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* For `grep`: */
|
||||
|
||||
/* PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER = 21 */
|
||||
/* PhabricatorObjectHasSubscriberEdgeType::EDGECONST = 21 */
|
||||
|
||||
INSERT IGNORE INTO {$NAMESPACE}_differential.edge (src, type, dst, seq)
|
||||
SELECT rev.phid, 21, rel.objectPHID, rel.sequence
|
||||
|
|
|
@ -19,7 +19,7 @@ foreach (new LiskMigrationIterator($table) as $request) {
|
|||
'INSERT IGNORE INTO %T (src, type, dst) VALUES (%s, %d, %s)',
|
||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||
$request->getCommitPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER,
|
||||
PhabricatorObjectHasSubscriberEdgeType::EDGECONST,
|
||||
$request->getAuditorPHID());
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ foreach (new LiskMigrationIterator($table) as $macro) {
|
|||
foreach ($phids as $phid) {
|
||||
$editor->addEdge(
|
||||
$macro->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE,
|
||||
PhabricatorObjectHasFileEdgeType::EDGECONST ,
|
||||
$phid);
|
||||
}
|
||||
$editor->save();
|
||||
|
|
|
@ -22,7 +22,7 @@ foreach ($revs as $rev) {
|
|||
foreach ($unsubscribed as $user_phid => $_) {
|
||||
$editor->addEdge(
|
||||
$rev['phid'],
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER,
|
||||
PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST ,
|
||||
$user_phid);
|
||||
}
|
||||
$editor->save();
|
||||
|
|
|
@ -24,7 +24,7 @@ foreach (new LiskMigrationIterator($table) as $document) {
|
|||
if (!$document->getContributorCount() ||
|
||||
!$document->getRecentContributorPHIDs()) {
|
||||
$updated = true;
|
||||
$type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_CONTRIBUTOR;
|
||||
$type = PhabricatorObjectHasContributorEdgeType::EDGECONST;
|
||||
$contributors = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$document->getPHID(),
|
||||
$type);
|
||||
|
|
|
@ -123,7 +123,7 @@ foreach ($map as $credential_type => $credential_usernames) {
|
|||
$credential->getPHID(),
|
||||
$repository->getID());
|
||||
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_USES_CREDENTIAL;
|
||||
$edge_type = PhabricatorObjectUsesCredentialsEdgeType::EDGECONST;
|
||||
|
||||
id(new PhabricatorEdgeEditor())
|
||||
->addEdge($repository->getPHID(), $edge_type, $credential->getPHID())
|
||||
|
|
|
@ -1291,6 +1291,8 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationsListController' => 'applications/meta/controller/PhabricatorApplicationsListController.php',
|
||||
'PhabricatorAsanaAuthProvider' => 'applications/auth/provider/PhabricatorAsanaAuthProvider.php',
|
||||
'PhabricatorAsanaConfigOptions' => 'applications/doorkeeper/option/PhabricatorAsanaConfigOptions.php',
|
||||
'PhabricatorAsanaSubtaskHasObjectEdgeType' => 'applications/doorkeeper/edge/PhabricatorAsanaSubtaskHasObjectEdgeType.php',
|
||||
'PhabricatorAsanaTaskHasObjectEdgeType' => 'applications/doorkeeper/edge/PhabricatorAsanaTaskHasObjectEdgeType.php',
|
||||
'PhabricatorAuditActionConstants' => 'applications/audit/constants/PhabricatorAuditActionConstants.php',
|
||||
'PhabricatorAuditAddCommentController' => 'applications/audit/controller/PhabricatorAuditAddCommentController.php',
|
||||
'PhabricatorAuditApplication' => 'applications/audit/application/PhabricatorAuditApplication.php',
|
||||
|
@ -1525,6 +1527,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConsoleApplication' => 'applications/console/application/PhabricatorConsoleApplication.php',
|
||||
'PhabricatorContentSource' => 'applications/metamta/contentsource/PhabricatorContentSource.php',
|
||||
'PhabricatorContentSourceView' => 'applications/metamta/contentsource/PhabricatorContentSourceView.php',
|
||||
'PhabricatorContributedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorContributedToObjectEdgeType.php',
|
||||
'PhabricatorController' => 'applications/base/controller/PhabricatorController.php',
|
||||
'PhabricatorCookies' => 'applications/auth/constants/PhabricatorCookies.php',
|
||||
'PhabricatorCoreConfigOptions' => 'applications/config/option/PhabricatorCoreConfigOptions.php',
|
||||
|
@ -1542,6 +1545,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCountdownSearchEngine' => 'applications/countdown/query/PhabricatorCountdownSearchEngine.php',
|
||||
'PhabricatorCountdownView' => 'applications/countdown/view/PhabricatorCountdownView.php',
|
||||
'PhabricatorCountdownViewController' => 'applications/countdown/controller/PhabricatorCountdownViewController.php',
|
||||
'PhabricatorCredentialsUsedByObjectEdgeType' => 'applications/passphrase/edge/PhabricatorCredentialsUsedByObjectEdgeType.php',
|
||||
'PhabricatorCrumbView' => 'view/layout/PhabricatorCrumbView.php',
|
||||
'PhabricatorCrumbsView' => 'view/layout/PhabricatorCrumbsView.php',
|
||||
'PhabricatorCursorPagedPolicyAwareQuery' => 'infrastructure/query/policy/PhabricatorCursorPagedPolicyAwareQuery.php',
|
||||
|
@ -1754,6 +1758,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFileEditController' => 'applications/files/controller/PhabricatorFileEditController.php',
|
||||
'PhabricatorFileEditor' => 'applications/files/editor/PhabricatorFileEditor.php',
|
||||
'PhabricatorFileFilePHIDType' => 'applications/files/phid/PhabricatorFileFilePHIDType.php',
|
||||
'PhabricatorFileHasObjectEdgeType' => 'applications/files/edge/PhabricatorFileHasObjectEdgeType.php',
|
||||
'PhabricatorFileImageMacro' => 'applications/macro/storage/PhabricatorFileImageMacro.php',
|
||||
'PhabricatorFileInfoController' => 'applications/files/controller/PhabricatorFileInfoController.php',
|
||||
'PhabricatorFileLinkListView' => 'view/layout/PhabricatorFileLinkListView.php',
|
||||
|
@ -1847,10 +1852,10 @@ phutil_register_library_map(array(
|
|||
'PhabricatorIteratedMD5PasswordHasher' => 'infrastructure/util/password/PhabricatorIteratedMD5PasswordHasher.php',
|
||||
'PhabricatorJIRAAuthProvider' => 'applications/auth/provider/PhabricatorJIRAAuthProvider.php',
|
||||
'PhabricatorJavelinLinter' => 'infrastructure/lint/linter/PhabricatorJavelinLinter.php',
|
||||
'PhabricatorJiraIssueHasObjectEdgeType' => 'applications/doorkeeper/edge/PhabricatorJiraIssueHasObjectEdgeType.php',
|
||||
'PhabricatorJumpNavHandler' => 'applications/search/engine/PhabricatorJumpNavHandler.php',
|
||||
'PhabricatorKeyValueDatabaseCache' => 'applications/cache/PhabricatorKeyValueDatabaseCache.php',
|
||||
'PhabricatorLDAPAuthProvider' => 'applications/auth/provider/PhabricatorLDAPAuthProvider.php',
|
||||
'PhabricatorLegacyEdgeType' => 'infrastructure/edges/type/PhabricatorLegacyEdgeType.php',
|
||||
'PhabricatorLegalpadApplication' => 'applications/legalpad/application/PhabricatorLegalpadApplication.php',
|
||||
'PhabricatorLegalpadConfigOptions' => 'applications/legalpad/config/PhabricatorLegalpadConfigOptions.php',
|
||||
'PhabricatorLegalpadDocumentPHIDType' => 'applications/legalpad/phid/PhabricatorLegalpadDocumentPHIDType.php',
|
||||
|
@ -2014,6 +2019,14 @@ phutil_register_library_map(array(
|
|||
'PhabricatorObjectHandle' => 'applications/phid/PhabricatorObjectHandle.php',
|
||||
'PhabricatorObjectHandleConstants' => 'applications/phid/handle/const/PhabricatorObjectHandleConstants.php',
|
||||
'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/PhabricatorObjectHandleStatus.php',
|
||||
'PhabricatorObjectHasAsanaSubtaskEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasAsanaSubtaskEdgeType.php',
|
||||
'PhabricatorObjectHasAsanaTaskEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasAsanaTaskEdgeType.php',
|
||||
'PhabricatorObjectHasContributorEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasContributorEdgeType.php',
|
||||
'PhabricatorObjectHasFileEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasFileEdgeType.php',
|
||||
'PhabricatorObjectHasJiraIssueEdgeType' => 'applications/doorkeeper/edge/PhabricatorObjectHasJiraIssueEdgeType.php',
|
||||
'PhabricatorObjectHasSubscriberEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasSubscriberEdgeType.php',
|
||||
'PhabricatorObjectHasUnsubscriberEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasUnsubscriberEdgeType.php',
|
||||
'PhabricatorObjectHasWatcherEdgeType' => 'applications/transactions/edges/PhabricatorObjectHasWatcherEdgeType.php',
|
||||
'PhabricatorObjectListQuery' => 'applications/phid/query/PhabricatorObjectListQuery.php',
|
||||
'PhabricatorObjectListQueryTestCase' => 'applications/phid/query/__tests__/PhabricatorObjectListQueryTestCase.php',
|
||||
'PhabricatorObjectMailReceiver' => 'applications/metamta/receiver/PhabricatorObjectMailReceiver.php',
|
||||
|
@ -2023,6 +2036,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorObjectQuery' => 'applications/phid/query/PhabricatorObjectQuery.php',
|
||||
'PhabricatorObjectRemarkupRule' => 'infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php',
|
||||
'PhabricatorObjectSelectorDialog' => 'view/control/PhabricatorObjectSelectorDialog.php',
|
||||
'PhabricatorObjectUsesCredentialsEdgeType' => 'applications/transactions/edges/PhabricatorObjectUsesCredentialsEdgeType.php',
|
||||
'PhabricatorOffsetPagedQuery' => 'infrastructure/query/PhabricatorOffsetPagedQuery.php',
|
||||
'PhabricatorOwnerPathQuery' => 'applications/owners/query/PhabricatorOwnerPathQuery.php',
|
||||
'PhabricatorOwnersApplication' => 'applications/owners/application/PhabricatorOwnersApplication.php',
|
||||
|
@ -2432,6 +2446,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorStorageSchemaSpec' => 'infrastructure/storage/schema/PhabricatorStorageSchemaSpec.php',
|
||||
'PhabricatorStorageSetupCheck' => 'applications/config/check/PhabricatorStorageSetupCheck.php',
|
||||
'PhabricatorSubscribableInterface' => 'applications/subscriptions/interface/PhabricatorSubscribableInterface.php',
|
||||
'PhabricatorSubscribedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorSubscribedToObjectEdgeType.php',
|
||||
'PhabricatorSubscribersQuery' => 'applications/subscriptions/query/PhabricatorSubscribersQuery.php',
|
||||
'PhabricatorSubscriptionsApplication' => 'applications/subscriptions/application/PhabricatorSubscriptionsApplication.php',
|
||||
'PhabricatorSubscriptionsEditController' => 'applications/subscriptions/controller/PhabricatorSubscriptionsEditController.php',
|
||||
|
@ -2461,6 +2476,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorTestCase' => 'infrastructure/testing/PhabricatorTestCase.php',
|
||||
'PhabricatorTestController' => 'applications/base/controller/__tests__/PhabricatorTestController.php',
|
||||
'PhabricatorTestDataGenerator' => 'applications/lipsum/generator/PhabricatorTestDataGenerator.php',
|
||||
'PhabricatorTestNoCycleEdgeType' => 'applications/transactions/edges/PhabricatorTestNoCycleEdgeType.php',
|
||||
'PhabricatorTestStorageEngine' => 'applications/files/engine/PhabricatorTestStorageEngine.php',
|
||||
'PhabricatorTestWorker' => 'infrastructure/daemon/workers/__tests__/PhabricatorTestWorker.php',
|
||||
'PhabricatorTime' => 'infrastructure/time/PhabricatorTime.php',
|
||||
|
@ -2516,6 +2532,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUIStatusExample' => 'applications/uiexample/examples/PhabricatorUIStatusExample.php',
|
||||
'PhabricatorUITooltipExample' => 'applications/uiexample/examples/PhabricatorUITooltipExample.php',
|
||||
'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php',
|
||||
'PhabricatorUnsubscribedFromObjectEdgeType' => 'applications/transactions/edges/PhabricatorUnsubscribedFromObjectEdgeType.php',
|
||||
'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php',
|
||||
'PhabricatorUserBlurbField' => 'applications/people/customfield/PhabricatorUserBlurbField.php',
|
||||
'PhabricatorUserConfigOptions' => 'applications/people/config/PhabricatorUserConfigOptions.php',
|
||||
|
@ -2544,6 +2561,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUserTitleField' => 'applications/people/customfield/PhabricatorUserTitleField.php',
|
||||
'PhabricatorUserTransaction' => 'applications/people/storage/PhabricatorUserTransaction.php',
|
||||
'PhabricatorVCSResponse' => 'applications/repository/response/PhabricatorVCSResponse.php',
|
||||
'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php',
|
||||
'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php',
|
||||
'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php',
|
||||
'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php',
|
||||
|
@ -4434,6 +4452,8 @@ phutil_register_library_map(array(
|
|||
'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController',
|
||||
'PhabricatorAsanaAuthProvider' => 'PhabricatorOAuth2AuthProvider',
|
||||
'PhabricatorAsanaConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorAsanaSubtaskHasObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorAsanaTaskHasObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
|
||||
'PhabricatorAuditApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorAuditCommentEditor' => 'PhabricatorEditor',
|
||||
|
@ -4688,6 +4708,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
|
||||
'PhabricatorConsoleApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorContentSourceView' => 'AphrontView',
|
||||
'PhabricatorContributedToObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorController' => 'AphrontController',
|
||||
'PhabricatorCookies' => 'Phobject',
|
||||
'PhabricatorCoreConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
|
@ -4708,6 +4729,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCountdownSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'PhabricatorCountdownView' => 'AphrontTagView',
|
||||
'PhabricatorCountdownViewController' => 'PhabricatorCountdownController',
|
||||
'PhabricatorCredentialsUsedByObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorCrumbView' => 'AphrontView',
|
||||
'PhabricatorCrumbsView' => 'AphrontView',
|
||||
'PhabricatorCursorPagedPolicyAwareQuery' => 'PhabricatorPolicyAwareQuery',
|
||||
|
@ -4936,6 +4958,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorFileEditController' => 'PhabricatorFileController',
|
||||
'PhabricatorFileEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||
'PhabricatorFileFilePHIDType' => 'PhabricatorPHIDType',
|
||||
'PhabricatorFileHasObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorFileImageMacro' => array(
|
||||
'PhabricatorFileDAO',
|
||||
'PhabricatorSubscribableInterface',
|
||||
|
@ -5032,9 +5055,9 @@ phutil_register_library_map(array(
|
|||
'PhabricatorIteratedMD5PasswordHasher' => 'PhabricatorPasswordHasher',
|
||||
'PhabricatorJIRAAuthProvider' => 'PhabricatorOAuth1AuthProvider',
|
||||
'PhabricatorJavelinLinter' => 'ArcanistLinter',
|
||||
'PhabricatorJiraIssueHasObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorKeyValueDatabaseCache' => 'PhutilKeyValueCache',
|
||||
'PhabricatorLDAPAuthProvider' => 'PhabricatorAuthProvider',
|
||||
'PhabricatorLegacyEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorLegalpadApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorLegalpadConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
'PhabricatorLegalpadDocumentPHIDType' => 'PhabricatorPHIDType',
|
||||
|
@ -5191,6 +5214,14 @@ phutil_register_library_map(array(
|
|||
'PhabricatorOAuthServerTokenController' => 'PhabricatorAuthController',
|
||||
'PhabricatorObjectHandle' => 'PhabricatorPolicyInterface',
|
||||
'PhabricatorObjectHandleStatus' => 'PhabricatorObjectHandleConstants',
|
||||
'PhabricatorObjectHasAsanaSubtaskEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasAsanaTaskEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasContributorEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasFileEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasJiraIssueEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasSubscriberEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasUnsubscriberEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectHasWatcherEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectListQueryTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorObjectMailReceiver' => 'PhabricatorMailReceiver',
|
||||
'PhabricatorObjectMailReceiverTestCase' => 'PhabricatorTestCase',
|
||||
|
@ -5198,6 +5229,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorObjectMentionsObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorObjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||
'PhabricatorObjectRemarkupRule' => 'PhutilRemarkupRule',
|
||||
'PhabricatorObjectUsesCredentialsEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorOffsetPagedQuery' => 'PhabricatorQuery',
|
||||
'PhabricatorOwnersApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorOwnersConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||
|
@ -5659,6 +5691,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorStorageManagementWorkflow' => 'PhabricatorManagementWorkflow',
|
||||
'PhabricatorStorageSchemaSpec' => 'PhabricatorConfigSchemaSpec',
|
||||
'PhabricatorStorageSetupCheck' => 'PhabricatorSetupCheck',
|
||||
'PhabricatorSubscribedToObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorSubscribersQuery' => 'PhabricatorQuery',
|
||||
'PhabricatorSubscriptionsApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorSubscriptionsEditController' => 'PhabricatorController',
|
||||
|
@ -5685,6 +5718,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorTestApplication' => 'PhabricatorApplication',
|
||||
'PhabricatorTestCase' => 'ArcanistPhutilTestCase',
|
||||
'PhabricatorTestController' => 'PhabricatorController',
|
||||
'PhabricatorTestNoCycleEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorTestStorageEngine' => 'PhabricatorFileStorageEngine',
|
||||
'PhabricatorTestWorker' => 'PhabricatorWorker',
|
||||
'PhabricatorTimeTestCase' => 'PhabricatorTestCase',
|
||||
|
@ -5739,6 +5773,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUIStatusExample' => 'PhabricatorUIExample',
|
||||
'PhabricatorUITooltipExample' => 'PhabricatorUIExample',
|
||||
'PhabricatorUnitsTestCase' => 'PhabricatorTestCase',
|
||||
'PhabricatorUnsubscribedFromObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorUser' => array(
|
||||
'PhabricatorUserDAO',
|
||||
'PhutilPerson',
|
||||
|
@ -5780,6 +5815,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorUserTitleField' => 'PhabricatorUserCustomField',
|
||||
'PhabricatorUserTransaction' => 'PhabricatorApplicationTransaction',
|
||||
'PhabricatorVCSResponse' => 'AphrontResponse',
|
||||
'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType',
|
||||
'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider',
|
||||
'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask',
|
||||
'PhabricatorWorkerArchiveTask' => 'PhabricatorWorkerTask',
|
||||
|
|
|
@ -455,7 +455,7 @@ final class PhabricatorAuditTransaction
|
|||
case PhabricatorProjectObjectHasProjectEdgeType::EDGECONST:
|
||||
$tags[] = self::MAILTAG_PROJECTS;
|
||||
break;
|
||||
case PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||
case PhabricatorObjectHasSubscriberEdgeType::EDGECONST:
|
||||
$tags[] = self::MAILTAG_ADD_CCS;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -255,7 +255,7 @@ final class ConpherenceEditor extends PhabricatorApplicationTransactionEditor {
|
|||
switch ($xaction->getTransactionType()) {
|
||||
case ConpherenceTransactionType::TYPE_FILES:
|
||||
$editor = new PhabricatorEdgeEditor();
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
$old = array_fill_keys($xaction->getOldValue(), true);
|
||||
$new = array_fill_keys($xaction->getNewValue(), true);
|
||||
$add_edges = array_keys(array_diff_key($new, $old));
|
||||
|
|
|
@ -43,7 +43,7 @@ final class ConpherenceReplyHandler extends PhabricatorMailReplyHandler {
|
|||
->attachParticipants(array())
|
||||
->attachFilePHIDs(array());
|
||||
} else {
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
$file_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$conpherence->getPHID(),
|
||||
$edge_type);
|
||||
|
|
|
@ -200,7 +200,7 @@ final class ConpherenceThreadQuery
|
|||
}
|
||||
|
||||
private function loadFilePHIDs(array $conpherences) {
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
$file_edges = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs(array_keys($conpherences))
|
||||
->withEdgeTypes(array($edge_type))
|
||||
|
|
|
@ -30,7 +30,7 @@ final class DifferentialAsanaRepresentationField
|
|||
public function renderPropertyViewValue(array $handles) {
|
||||
$viewer = $this->getViewer();
|
||||
$src_phid = $this->getObject()->getPHID();
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANATASK;
|
||||
$edge_type = PhabricatorObjectHasAsanaTaskEdgeType::EDGECONST;
|
||||
|
||||
$query = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs(array($src_phid))
|
||||
|
|
|
@ -249,7 +249,7 @@ final class DifferentialJIRAIssuesField
|
|||
$revision = $this->getObject();
|
||||
$revision_phid = $revision->getPHID();
|
||||
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_PHOB_HAS_JIRAISSUE;
|
||||
$edge_type = PhabricatorJiraIssueHasObjectEdgeType::EDGECONST;
|
||||
$xobjs = $this->loadDoorkeeperExternalObjects($xaction->getNewValue());
|
||||
$edge_dsts = mpull($xobjs, 'getPHID');
|
||||
|
||||
|
|
|
@ -1506,7 +1506,7 @@ final class DifferentialTransactionEditor
|
|||
|
||||
$unsubscribed_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$object->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER);
|
||||
PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST);
|
||||
|
||||
$subscribed_phids = PhabricatorSubscribersQuery::loadSubscribersForPHID(
|
||||
$object->getPHID());
|
||||
|
|
|
@ -628,7 +628,7 @@ final class DifferentialRevisionQuery
|
|||
'AND e_ccs.type = %s '.
|
||||
'AND e_ccs.dst in (%Ls)',
|
||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER,
|
||||
PhabricatorObjectHasSubscriberEdgeType::EDGECONST,
|
||||
$this->ccs);
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,7 @@ final class DifferentialRevisionQuery
|
|||
assert_instances_of($revisions, 'DifferentialRevision');
|
||||
|
||||
$type_reviewer = DifferentialRevisionHasReviewerEdgeType::EDGECONST;
|
||||
$type_subscriber = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER;
|
||||
$type_subscriber = PhabricatorObjectHasSubscriberEdgeType::EDGECONST;
|
||||
|
||||
$edges = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs(mpull($revisions, 'getPHID'))
|
||||
|
|
|
@ -214,7 +214,7 @@ final class DifferentialRevision extends DifferentialDAO
|
|||
|
||||
$subscriber_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$this->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER);
|
||||
PhabricatorObjectHasSubscriberEdgeType::EDGECONST);
|
||||
$subscriber_phids = array_reverse($subscriber_phids);
|
||||
foreach ($subscriber_phids as $phid) {
|
||||
$data[] = array(
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorAsanaSubtaskHasObjectEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 80002;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasAsanaSubtaskEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorAsanaTaskHasObjectEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 80000;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasAsanaTaskEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorJiraIssueHasObjectEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 80004;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasJiraIssueEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasAsanaSubtaskEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 80003;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorAsanaSubtaskHasObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasAsanaTaskEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 80001;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorAsanaTaskHasObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasJiraIssueEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 80005;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorJiraIssueHasObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -90,8 +90,8 @@ final class DoorkeeperAsanaFeedWorker extends DoorkeeperFeedWorker {
|
|||
'pull an OAuth token out of.');
|
||||
}
|
||||
|
||||
$etype_main = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANATASK;
|
||||
$etype_sub = PhabricatorEdgeConfig::TYPE_PHOB_HAS_ASANASUBTASK;
|
||||
$etype_main = PhabricatorObjectHasAsanaTaskEdgeType::EDGECONST;
|
||||
$etype_sub = PhabricatorObjectHasAsanaSubtaskEdgeType::EDGECONST;
|
||||
|
||||
$equery = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs(array($src_phid))
|
||||
|
|
|
@ -32,7 +32,7 @@ final class DoorkeeperJIRAFeedWorker extends DoorkeeperFeedWorker {
|
|||
|
||||
$jira_issue_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$object->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_PHOB_HAS_JIRAISSUE);
|
||||
PhabricatorJiraIssueHasObjectEdgeType::EDGECONST);
|
||||
if (!$jira_issue_phids) {
|
||||
$this->log("Story is about an object with no linked JIRA issues.\n");
|
||||
return;
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorFileHasObjectEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 26;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -116,7 +116,7 @@ final class PhabricatorFileQuery
|
|||
// We need to load attached objects to perform policy checks for files.
|
||||
// First, load the edges.
|
||||
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_FILE_HAS_OBJECT;
|
||||
$edge_type = PhabricatorFileHasObjectEdgeType::EDGECONST;
|
||||
$file_phids = mpull($files, 'getPHID');
|
||||
$edges = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs($file_phids)
|
||||
|
|
|
@ -991,7 +991,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
* @return this
|
||||
*/
|
||||
public function attachToObject($phid) {
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
|
||||
id(new PhabricatorEdgeEditor())
|
||||
->addEdge($phid, $edge_type, $this->getPHID())
|
||||
|
@ -1008,7 +1008,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
* @return this
|
||||
*/
|
||||
public function detachFromObject($phid) {
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
$edge_type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
|
||||
id(new PhabricatorEdgeEditor())
|
||||
->removeEdge($phid, $edge_type, $this->getPHID())
|
||||
|
|
|
@ -110,12 +110,12 @@ final class LegalpadDocumentEditor
|
|||
$object->setDocumentBodyPHID($body->getPHID());
|
||||
|
||||
$actor = $this->getActor();
|
||||
$type = PhabricatorEdgeConfig::TYPE_CONTRIBUTED_TO_OBJECT;
|
||||
$type = PhabricatorContributedToObjectEdgeType::EDGECONST;
|
||||
id(new PhabricatorEdgeEditor())
|
||||
->addEdge($actor->getPHID(), $type, $object->getPHID())
|
||||
->save();
|
||||
|
||||
$type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_CONTRIBUTOR;
|
||||
$type = PhabricatorObjectHasContributorEdgeType::EDGECONST;
|
||||
$contributors = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$object->getPHID(),
|
||||
$type);
|
||||
|
|
|
@ -136,7 +136,7 @@ final class LegalpadDocumentQuery
|
|||
$conn_r,
|
||||
'JOIN edge contributor ON contributor.src = d.phid
|
||||
AND contributor.type = %d',
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_CONTRIBUTOR);
|
||||
PhabricatorObjectHasContributorEdgeType::EDGECONST);
|
||||
}
|
||||
|
||||
if ($this->signerPHIDs !== null) {
|
||||
|
@ -226,7 +226,7 @@ final class LegalpadDocumentQuery
|
|||
|
||||
private function loadContributors(array $documents) {
|
||||
$document_map = mpull($documents, null, 'getPHID');
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_CONTRIBUTOR;
|
||||
$edge_type = PhabricatorObjectHasContributorEdgeType::EDGECONST;
|
||||
$contributor_data = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs(array_keys($document_map))
|
||||
->withEdgeTypes(array($edge_type))
|
||||
|
|
|
@ -726,7 +726,7 @@ final class ManiphestTaskQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
|||
'AND e_ccs.type = %s '.
|
||||
'AND e_ccs.dst in (%Ls)',
|
||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE,
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER,
|
||||
PhabricatorObjectHasSubscriberEdgeType::EDGECONST,
|
||||
$this->subscriberPHIDs);
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ final class PassphraseCredentialViewController extends PassphraseController {
|
|||
|
||||
$used_by_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$credential->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_CREDENTIAL_USED_BY_OBJECT);
|
||||
PhabricatorCredentialsUsedByObjectEdgeType::EDGECONST);
|
||||
|
||||
if ($used_by_phids) {
|
||||
$this->loadHandles($used_by_phids);
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorCredentialsUsedByObjectEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 40;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectUsesCredentialsEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,7 @@ final class PhabricatorProjectWatchController
|
|||
break;
|
||||
}
|
||||
|
||||
$type_member = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;
|
||||
$type_member = PhabricatorObjectHasWatcherEdgeType::EDGECONST;
|
||||
$member_spec = array(
|
||||
$edge_action => array($viewer->getPHID() => $viewer->getPHID()),
|
||||
);
|
||||
|
|
|
@ -180,7 +180,7 @@ final class PhabricatorProjectTransactionEditor
|
|||
$edge_type = $xaction->getMetadataValue('edge:type');
|
||||
switch ($edge_type) {
|
||||
case PhabricatorProjectProjectHasMemberEdgeType::EDGECONST:
|
||||
case PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER:
|
||||
case PhabricatorObjectHasWatcherEdgeType::EDGECONST:
|
||||
$old = $xaction->getOldValue();
|
||||
$new = $xaction->getNewValue();
|
||||
|
||||
|
@ -221,7 +221,7 @@ final class PhabricatorProjectTransactionEditor
|
|||
foreach ($rem as $rem_phid) {
|
||||
$edge_editor->removeEdge(
|
||||
$object->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER,
|
||||
PhabricatorObjectHasWatcherEdgeType::EDGECONST,
|
||||
$rem_phid);
|
||||
}
|
||||
$edge_editor->save();
|
||||
|
|
|
@ -139,7 +139,7 @@ final class PhabricatorProjectQuery
|
|||
$project_phids = mpull($projects, 'getPHID');
|
||||
|
||||
$member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
|
||||
$watcher_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;
|
||||
$watcher_type = PhabricatorObjectHasWatcherEdgeType::EDGECONST;
|
||||
|
||||
$need_edge_types = array();
|
||||
if ($this->needMembers) {
|
||||
|
|
|
@ -242,7 +242,7 @@ final class PhabricatorRepositoryEditor
|
|||
|
||||
$editor = new PhabricatorEdgeEditor();
|
||||
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_USES_CREDENTIAL;
|
||||
$edge_type = PhabricatorObjectUsesCredentialsEdgeType::EDGECONST;
|
||||
$src_phid = $object->getPHID();
|
||||
|
||||
if ($old_phid) {
|
||||
|
|
|
@ -65,7 +65,7 @@ final class PhabricatorSubscriptionsEditor extends PhabricatorEditor {
|
|||
if ($this->implicitSubscribePHIDs) {
|
||||
$unsub = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$src,
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER);
|
||||
PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST);
|
||||
$unsub = array_fill_keys($unsub, true);
|
||||
$this->implicitSubscribePHIDs = array_diff_key(
|
||||
$this->implicitSubscribePHIDs,
|
||||
|
@ -80,8 +80,8 @@ final class PhabricatorSubscriptionsEditor extends PhabricatorEditor {
|
|||
$add = array_diff_key($add, $del);
|
||||
|
||||
if ($add || $del) {
|
||||
$u_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER;
|
||||
$s_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER;
|
||||
$u_type = PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST;
|
||||
$s_type = PhabricatorObjectHasSubscriberEdgeType::EDGECONST;
|
||||
|
||||
$editor = new PhabricatorEdgeEditor();
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ final class PhabricatorSubscriptionsUIEventListener
|
|||
if ($user->isLoggedIn()) {
|
||||
$src_phid = $object->getPHID();
|
||||
$dst_phid = $user->getPHID();
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER;
|
||||
$edge_type = PhabricatorObjectHasSubscriberEdgeType::EDGECONST;
|
||||
|
||||
$edges = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs(array($src_phid))
|
||||
|
|
|
@ -29,7 +29,7 @@ final class PhabricatorSubscribersQuery extends PhabricatorQuery {
|
|||
public function execute() {
|
||||
$query = new PhabricatorEdgeQuery();
|
||||
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_SUBSCRIBER;
|
||||
$edge_type = PhabricatorObjectHasSubscriberEdgeType::EDGECONST;
|
||||
|
||||
$query->withSourcePHIDs($this->objectPHIDs);
|
||||
$query->withEdgeTypes(array($edge_type));
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorContributedToObjectEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 34;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasContributorEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasContributorEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 33;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorContributedToObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTransactionAddString(
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s contributor(s): %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getTransactionRemoveString(
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s contributor(s): %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getTransactionEditString(
|
||||
$actor,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited contributor(s), added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedAddString(
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s contributor(s) for %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$object,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getFeedRemoveString(
|
||||
$actor,
|
||||
$object,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s contributor(s) for %s: %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$object,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedEditString(
|
||||
$actor,
|
||||
$object,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited contributor(s) for %s, added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasFileEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 25;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorFileHasObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTransactionAddString(
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s file(s): %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getTransactionRemoveString(
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s file(s): %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getTransactionEditString(
|
||||
$actor,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited file(s), added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedAddString(
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s file(s) for %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$object,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getFeedRemoveString(
|
||||
$actor,
|
||||
$object,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s file(s) for %s: %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$object,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedEditString(
|
||||
$actor,
|
||||
$object,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited file(s) for %s, added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasSubscriberEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 21;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorSubscribedToObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTransactionAddString(
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s subscriber(s): %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getTransactionRemoveString(
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s subscriber(s): %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getTransactionEditString(
|
||||
$actor,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited subscriber(s), added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedAddString(
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s subscriber(s) for %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$object,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getFeedRemoveString(
|
||||
$actor,
|
||||
$object,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s subscriber(s) for %s: %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$object,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedEditString(
|
||||
$actor,
|
||||
$object,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited subscriber(s) for %s, added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasUnsubscriberEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 23;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorUnsubscribedFromObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTransactionAddString(
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s unsubscriber(s): %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getTransactionRemoveString(
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s unsubscriber(s): %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getTransactionEditString(
|
||||
$actor,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited unsubscriber(s), added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedAddString(
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s unsubscriber(s) for %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$object,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getFeedRemoveString(
|
||||
$actor,
|
||||
$object,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s unsubscriber(s) for %s: %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$object,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedEditString(
|
||||
$actor,
|
||||
$object,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited unsubscriber(s) for %s, added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectHasWatcherEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 47;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorWatcherHasObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getTransactionAddString(
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s watcher(s): %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getTransactionRemoveString(
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s watcher(s): %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getTransactionEditString(
|
||||
$actor,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited watcher(s), added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedAddString(
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
return pht(
|
||||
'%s added %s watcher(s) for %s: %s.',
|
||||
$actor,
|
||||
$add_count,
|
||||
$object,
|
||||
$add_edges);
|
||||
}
|
||||
|
||||
public function getFeedRemoveString(
|
||||
$actor,
|
||||
$object,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s removed %s watcher(s) for %s: %s.',
|
||||
$actor,
|
||||
$rem_count,
|
||||
$object,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
public function getFeedEditString(
|
||||
$actor,
|
||||
$object,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
return pht(
|
||||
'%s edited watcher(s) for %s, added %s: %s; removed %s: %s.',
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorObjectUsesCredentialsEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 39;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorCredentialsUsedByObjectEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorSubscribedToObjectEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 22;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasSubscriberEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorTestNoCycleEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 9000;
|
||||
|
||||
public function shouldPreventCycles() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorUnsubscribedFromObjectEdgeType
|
||||
extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 24;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorWatcherHasObjectEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
const EDGECONST = 48;
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return PhabricatorObjectHasWatcherEdgeType::EDGECONST;
|
||||
}
|
||||
|
||||
public function shouldWriteInverseTransactions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -102,7 +102,7 @@ final class PhabricatorApplicationTransactionCommentEditor
|
|||
foreach ($file_phids as $file_phid) {
|
||||
$editor->addEdge(
|
||||
$xaction->getObjectPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE,
|
||||
PhabricatorObjectHasFileEdgeType::EDGECONST ,
|
||||
$file_phid);
|
||||
}
|
||||
$editor->save();
|
||||
|
|
|
@ -1866,7 +1866,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
|
||||
$unsub = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$object->getPHID(),
|
||||
PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER);
|
||||
PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST);
|
||||
$unsub = array_fuse($unsub);
|
||||
if (isset($unsub[$actor_phid])) {
|
||||
// If the user has previously unsubscribed from this object explicitly,
|
||||
|
@ -2140,7 +2140,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
|
||||
|
||||
if ($project_phids) {
|
||||
$watcher_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;
|
||||
$watcher_type = PhabricatorObjectHasWatcherEdgeType::EDGECONST;
|
||||
|
||||
$query = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs($project_phids)
|
||||
|
@ -2525,7 +2525,7 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
$editor = new PhabricatorEdgeEditor();
|
||||
|
||||
$src = $object->getPHID();
|
||||
$type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_FILE;
|
||||
$type = PhabricatorObjectHasFileEdgeType::EDGECONST;
|
||||
foreach ($file_phids as $dst) {
|
||||
$editor->addEdge($src, $type, $dst);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ final class PhabricatorEdgeTestCase extends PhabricatorTestCase {
|
|||
$phid2 = $obj2->getPHID();
|
||||
|
||||
$editor = id(new PhabricatorEdgeEditor())
|
||||
->addEdge($phid1, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid2)
|
||||
->addEdge($phid2, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid1);
|
||||
->addEdge($phid1, PhabricatorTestNoCycleEdgeType::EDGECONST , $phid2)
|
||||
->addEdge($phid2, PhabricatorTestNoCycleEdgeType::EDGECONST , $phid1);
|
||||
|
||||
$caught = null;
|
||||
try {
|
||||
|
@ -38,11 +38,11 @@ final class PhabricatorEdgeTestCase extends PhabricatorTestCase {
|
|||
// fail (it introduces a cycle).
|
||||
|
||||
$editor = id(new PhabricatorEdgeEditor())
|
||||
->addEdge($phid1, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid2)
|
||||
->addEdge($phid1, PhabricatorTestNoCycleEdgeType::EDGECONST , $phid2)
|
||||
->save();
|
||||
|
||||
$editor = id(new PhabricatorEdgeEditor())
|
||||
->addEdge($phid2, PhabricatorEdgeConfig::TYPE_TEST_NO_CYCLE, $phid1);
|
||||
->addEdge($phid2, PhabricatorTestNoCycleEdgeType::EDGECONST , $phid1);
|
||||
|
||||
$caught = null;
|
||||
try {
|
||||
|
|
|
@ -5,133 +5,6 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
|||
const TABLE_NAME_EDGE = 'edge';
|
||||
const TABLE_NAME_EDGEDATA = 'edgedata';
|
||||
|
||||
const TYPE_OBJECT_HAS_SUBSCRIBER = 21;
|
||||
const TYPE_SUBSCRIBED_TO_OBJECT = 22;
|
||||
|
||||
const TYPE_OBJECT_HAS_UNSUBSCRIBER = 23;
|
||||
const TYPE_UNSUBSCRIBED_FROM_OBJECT = 24;
|
||||
|
||||
const TYPE_OBJECT_HAS_FILE = 25;
|
||||
const TYPE_FILE_HAS_OBJECT = 26;
|
||||
|
||||
const TYPE_OBJECT_HAS_CONTRIBUTOR = 33;
|
||||
const TYPE_CONTRIBUTED_TO_OBJECT = 34;
|
||||
|
||||
const TYPE_OBJECT_USES_CREDENTIAL = 39;
|
||||
const TYPE_CREDENTIAL_USED_BY_OBJECT = 40;
|
||||
|
||||
const TYPE_OBJECT_HAS_WATCHER = 47;
|
||||
const TYPE_WATCHER_HAS_OBJECT = 48;
|
||||
|
||||
/* !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! */
|
||||
|
||||
// HEY! DO NOT ADD NEW CONSTANTS HERE!
|
||||
// Instead, subclass PhabricatorEdgeType.
|
||||
|
||||
/* !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! STOP !!!! */
|
||||
|
||||
const TYPE_TEST_NO_CYCLE = 9000;
|
||||
|
||||
const TYPE_PHOB_HAS_ASANATASK = 80001;
|
||||
const TYPE_ASANATASK_HAS_PHOB = 80000;
|
||||
|
||||
const TYPE_PHOB_HAS_ASANASUBTASK = 80003;
|
||||
const TYPE_ASANASUBTASK_HAS_PHOB = 80002;
|
||||
|
||||
const TYPE_PHOB_HAS_JIRAISSUE = 80004;
|
||||
const TYPE_JIRAISSUE_HAS_PHOB = 80005;
|
||||
|
||||
|
||||
/**
|
||||
* Build @{class:PhabricatorLegacyEdgeType} objects for edges which have not
|
||||
* yet been modernized. This allows code to act as though we've completed
|
||||
* the edge type migration before we actually do all the work, by building
|
||||
* these fake type objects.
|
||||
*
|
||||
* @param list<const> List of edge types that objects should not be built for.
|
||||
* This is used to avoid constructing duplicate objects for edge constants
|
||||
* which have migrated and already have a real object.
|
||||
* @return list<PhabricatorLegacyEdgeType> Real-looking edge type objects for
|
||||
* unmigrated edge types.
|
||||
*/
|
||||
public static function getLegacyTypes(array $exclude) {
|
||||
$consts = array_merge(
|
||||
range(1, 50),
|
||||
array(9000),
|
||||
range(80000, 80005));
|
||||
|
||||
$exclude[] = 15; // Was TYPE_COMMIT_HAS_PROJECT
|
||||
$exclude[] = 16; // Was TYPE_PROJECT_HAS_COMMIT
|
||||
|
||||
$exclude[] = 27; // Was TYPE_ACCOUNT_HAS_MEMBER
|
||||
$exclude[] = 28; // Was TYPE_MEMBER_HAS_ACCOUNT
|
||||
|
||||
$exclude[] = 43; // Was TYPE_OBJECT_HAS_COLUMN
|
||||
$exclude[] = 44; // Was TYPE_COLUMN_HAS_OBJECT
|
||||
|
||||
$consts = array_diff($consts, $exclude);
|
||||
|
||||
$map = array();
|
||||
foreach ($consts as $const) {
|
||||
$prevent_cycles = self::shouldPreventCycles($const);
|
||||
$inverse_constant = self::getInverse($const);
|
||||
|
||||
$map[$const] = id(new PhabricatorLegacyEdgeType())
|
||||
->setEdgeConstant($const)
|
||||
->setShouldPreventCycles($prevent_cycles)
|
||||
->setInverseEdgeConstant($inverse_constant)
|
||||
->setStrings(
|
||||
array(
|
||||
self::getAddStringForEdgeType($const),
|
||||
self::getRemoveStringForEdgeType($const),
|
||||
self::getEditStringForEdgeType($const),
|
||||
self::getFeedStringForEdgeType($const),
|
||||
));
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
private static function getInverse($edge_type) {
|
||||
static $map = array(
|
||||
self::TYPE_OBJECT_HAS_SUBSCRIBER => self::TYPE_SUBSCRIBED_TO_OBJECT,
|
||||
self::TYPE_SUBSCRIBED_TO_OBJECT => self::TYPE_OBJECT_HAS_SUBSCRIBER,
|
||||
|
||||
self::TYPE_OBJECT_HAS_UNSUBSCRIBER => self::TYPE_UNSUBSCRIBED_FROM_OBJECT,
|
||||
self::TYPE_UNSUBSCRIBED_FROM_OBJECT => self::TYPE_OBJECT_HAS_UNSUBSCRIBER,
|
||||
|
||||
self::TYPE_OBJECT_HAS_FILE => self::TYPE_FILE_HAS_OBJECT,
|
||||
self::TYPE_FILE_HAS_OBJECT => self::TYPE_OBJECT_HAS_FILE,
|
||||
|
||||
self::TYPE_OBJECT_HAS_CONTRIBUTOR => self::TYPE_CONTRIBUTED_TO_OBJECT,
|
||||
self::TYPE_CONTRIBUTED_TO_OBJECT => self::TYPE_OBJECT_HAS_CONTRIBUTOR,
|
||||
|
||||
self::TYPE_PHOB_HAS_ASANATASK => self::TYPE_ASANATASK_HAS_PHOB,
|
||||
self::TYPE_ASANATASK_HAS_PHOB => self::TYPE_PHOB_HAS_ASANATASK,
|
||||
|
||||
self::TYPE_PHOB_HAS_ASANASUBTASK => self::TYPE_ASANASUBTASK_HAS_PHOB,
|
||||
self::TYPE_ASANASUBTASK_HAS_PHOB => self::TYPE_PHOB_HAS_ASANASUBTASK,
|
||||
|
||||
self::TYPE_PHOB_HAS_JIRAISSUE => self::TYPE_JIRAISSUE_HAS_PHOB,
|
||||
self::TYPE_JIRAISSUE_HAS_PHOB => self::TYPE_PHOB_HAS_JIRAISSUE,
|
||||
|
||||
self::TYPE_OBJECT_USES_CREDENTIAL => self::TYPE_CREDENTIAL_USED_BY_OBJECT,
|
||||
self::TYPE_CREDENTIAL_USED_BY_OBJECT => self::TYPE_OBJECT_USES_CREDENTIAL,
|
||||
|
||||
self::TYPE_OBJECT_HAS_WATCHER => self::TYPE_WATCHER_HAS_OBJECT,
|
||||
self::TYPE_WATCHER_HAS_OBJECT => self::TYPE_OBJECT_HAS_WATCHER,
|
||||
);
|
||||
|
||||
return idx($map, $edge_type);
|
||||
}
|
||||
|
||||
private static function shouldPreventCycles($edge_type) {
|
||||
static $map = array(
|
||||
self::TYPE_TEST_NO_CYCLE => true,
|
||||
);
|
||||
return isset($map[$edge_type]);
|
||||
}
|
||||
|
||||
public static function establishConnection($phid_type, $conn_type) {
|
||||
$map = PhabricatorPHIDType::getAllTypes();
|
||||
if (isset($map[$phid_type])) {
|
||||
|
@ -157,95 +30,4 @@ final class PhabricatorEdgeConfig extends PhabricatorEdgeConstants {
|
|||
return newv($class, array())->establishConnection($conn_type);
|
||||
}
|
||||
|
||||
public static function getEditStringForEdgeType($type) {
|
||||
switch ($type) {
|
||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||
return '%s edited subscriber(s), added %d: %s; removed %d: %s.';
|
||||
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
||||
case self::TYPE_UNSUBSCRIBED_FROM_OBJECT:
|
||||
case self::TYPE_FILE_HAS_OBJECT:
|
||||
case self::TYPE_CONTRIBUTED_TO_OBJECT:
|
||||
return '%s edited object(s), added %d: %s; removed %d: %s.';
|
||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||
return '%s edited unsubcriber(s), added %d: %s; removed %d: %s.';
|
||||
case self::TYPE_OBJECT_HAS_FILE:
|
||||
return '%s edited file(s), added %d: %s; removed %d: %s.';
|
||||
case self::TYPE_OBJECT_HAS_CONTRIBUTOR:
|
||||
return '%s edited contributor(s), added %d: %s; removed %d: %s.';
|
||||
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
||||
case self::TYPE_UNSUBSCRIBED_FROM_OBJECT:
|
||||
case self::TYPE_FILE_HAS_OBJECT:
|
||||
case self::TYPE_CONTRIBUTED_TO_OBJECT:
|
||||
default:
|
||||
return '%s edited object(s), added %d: %s; removed %d: %s.';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function getAddStringForEdgeType($type) {
|
||||
switch ($type) {
|
||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||
return '%s added %d subscriber(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||
return '%s added %d unsubcriber(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_FILE:
|
||||
return '%s added %d file(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_CONTRIBUTOR:
|
||||
return '%s added %d contributor(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_WATCHER:
|
||||
return '%s added %d watcher(s): %s.';
|
||||
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
||||
case self::TYPE_UNSUBSCRIBED_FROM_OBJECT:
|
||||
case self::TYPE_FILE_HAS_OBJECT:
|
||||
case self::TYPE_CONTRIBUTED_TO_OBJECT:
|
||||
default:
|
||||
return '%s added %d object(s): %s.';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function getRemoveStringForEdgeType($type) {
|
||||
switch ($type) {
|
||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||
return '%s removed %d subscriber(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||
return '%s removed %d unsubcriber(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_FILE:
|
||||
return '%s removed %d file(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_CONTRIBUTOR:
|
||||
return '%s removed %d contributor(s): %s.';
|
||||
case self::TYPE_OBJECT_HAS_WATCHER:
|
||||
return '%s removed %d watcher(s): %s.';
|
||||
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
||||
case self::TYPE_UNSUBSCRIBED_FROM_OBJECT:
|
||||
case self::TYPE_FILE_HAS_OBJECT:
|
||||
case self::TYPE_CONTRIBUTED_TO_OBJECT:
|
||||
default:
|
||||
return '%s removed %d object(s): %s.';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function getFeedStringForEdgeType($type) {
|
||||
switch ($type) {
|
||||
case self::TYPE_OBJECT_HAS_SUBSCRIBER:
|
||||
return '%s updated subscribers of %s.';
|
||||
case self::TYPE_OBJECT_HAS_UNSUBSCRIBER:
|
||||
return '%s updated unsubcribers of %s.';
|
||||
case self::TYPE_OBJECT_HAS_FILE:
|
||||
return '%s updated files of %s.';
|
||||
case self::TYPE_OBJECT_HAS_CONTRIBUTOR:
|
||||
return '%s updated contributors of %s.';
|
||||
case self::TYPE_OBJECT_HAS_WATCHER:
|
||||
return '%s updated watchers for %s.';
|
||||
case self::TYPE_SUBSCRIBED_TO_OBJECT:
|
||||
case self::TYPE_UNSUBSCRIBED_FROM_OBJECT:
|
||||
case self::TYPE_FILE_HAS_OBJECT:
|
||||
case self::TYPE_CONTRIBUTED_TO_OBJECT:
|
||||
default:
|
||||
return '%s updated objects of %s.';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
*/
|
||||
abstract class PhabricatorEdgeType extends Phobject {
|
||||
|
||||
// TODO: Make this final after we remove PhabricatorLegacyEdgeType.
|
||||
/* final */ public function getEdgeConstant() {
|
||||
final public function getEdgeConstant() {
|
||||
$class = new ReflectionClass($this);
|
||||
|
||||
$const = $class->getConstant('EDGECONST');
|
||||
|
@ -159,13 +158,6 @@ abstract class PhabricatorEdgeType extends Phobject {
|
|||
|
||||
$map = array();
|
||||
|
||||
|
||||
// TODO: Remove this once everything is migrated.
|
||||
$exclude = mpull($types, 'getEdgeConstant');
|
||||
$map = PhabricatorEdgeConfig::getLegacyTypes($exclude);
|
||||
unset($types['PhabricatorLegacyEdgeType']);
|
||||
|
||||
|
||||
foreach ($types as $class => $type) {
|
||||
$const = $type->getEdgeConstant();
|
||||
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Supports legacy edges. Do not use or extend this class!
|
||||
*
|
||||
* TODO: Move all edge constants out of @{class:PhabricatorEdgeConfig}, then
|
||||
* throw this away.
|
||||
*/
|
||||
final class PhabricatorLegacyEdgeType extends PhabricatorEdgeType {
|
||||
|
||||
private $edgeConstant;
|
||||
private $inverseEdgeConstant;
|
||||
private $shouldPreventCycles;
|
||||
private $strings;
|
||||
|
||||
public function getEdgeConstant() {
|
||||
return $this->edgeConstant;
|
||||
}
|
||||
|
||||
public function getInverseEdgeConstant() {
|
||||
return $this->inverseEdgeConstant;
|
||||
}
|
||||
|
||||
public function shouldPreventCycles() {
|
||||
return $this->shouldPreventCycles;
|
||||
}
|
||||
|
||||
public function setEdgeConstant($edge_constant) {
|
||||
$this->edgeConstant = $edge_constant;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setInverseEdgeConstant($inverse_edge_constant) {
|
||||
$this->inverseEdgeConstant = $inverse_edge_constant;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setShouldPreventCycles($should_prevent_cycles) {
|
||||
$this->shouldPreventCycles = $should_prevent_cycles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setStrings(array $strings) {
|
||||
$this->strings = $strings;
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getString($idx, array $argv) {
|
||||
array_unshift($argv, idx($this->strings, $idx, ''));
|
||||
|
||||
// TODO: Burn this class in a fire. Just hiding this from lint for now.
|
||||
$pht_func = 'pht';
|
||||
return call_user_func_array($pht_func, $argv);
|
||||
}
|
||||
|
||||
public function getTransactionAddString(
|
||||
$actor,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
$args = func_get_args();
|
||||
return $this->getString(0, $args);
|
||||
}
|
||||
|
||||
public function getTransactionRemoveString(
|
||||
$actor,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
$args = func_get_args();
|
||||
return $this->getString(1, $args);
|
||||
}
|
||||
|
||||
public function getTransactionEditString(
|
||||
$actor,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
$args = func_get_args();
|
||||
return $this->getString(2, $args);
|
||||
}
|
||||
|
||||
public function getFeedAddString(
|
||||
$actor,
|
||||
$object,
|
||||
$add_count,
|
||||
$add_edges) {
|
||||
|
||||
$args = func_get_args();
|
||||
return $this->getString(3, $args);
|
||||
}
|
||||
|
||||
public function getFeedRemoveString(
|
||||
$actor,
|
||||
$object,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
$args = func_get_args();
|
||||
return $this->getString(3, $args);
|
||||
}
|
||||
|
||||
public function getFeedEditString(
|
||||
$actor,
|
||||
$object,
|
||||
$total_count,
|
||||
$add_count,
|
||||
$add_edges,
|
||||
$rem_count,
|
||||
$rem_edges) {
|
||||
|
||||
$args = func_get_args();
|
||||
return $this->getString(3, $args);
|
||||
}
|
||||
|
||||
}
|
|
@ -325,34 +325,34 @@ abstract class PhabricatorBaseEnglishTranslation
|
|||
),
|
||||
),
|
||||
|
||||
'%s edited file(s), added %d: %s; removed %d: %s.' =>
|
||||
'%s edited file(s), added %s: %s; removed %s: %s.' =>
|
||||
'%s edited files, added: %3$s; removed: %5$s.',
|
||||
|
||||
'%s added %d file(s): %s.' => array(
|
||||
'%s added %s file(s): %s.' => array(
|
||||
array(
|
||||
'%s added a file: %3$s.',
|
||||
'%s added files: %3$s.',
|
||||
),
|
||||
),
|
||||
|
||||
'%s removed %d file(s): %s.' => array(
|
||||
'%s removed %s file(s): %s.' => array(
|
||||
array(
|
||||
'%s removed a file: %3$s.',
|
||||
'%s removed files: %3$s.',
|
||||
),
|
||||
),
|
||||
|
||||
'%s edited contributor(s), added %d: %s; removed %d: %s.' =>
|
||||
'%s edited contributor(s), added %s: %s; removed %s: %s.' =>
|
||||
'%s edited contributors, added: %3$s; removed: %5$s.',
|
||||
|
||||
'%s added %d contributor(s): %s.' => array(
|
||||
'%s added %s contributor(s): %s.' => array(
|
||||
array(
|
||||
'%s added a contributor: %3$s.',
|
||||
'%s added contributors: %3$s.',
|
||||
),
|
||||
),
|
||||
|
||||
'%s removed %d contributor(s): %s.' => array(
|
||||
'%s removed %s contributor(s): %s.' => array(
|
||||
array(
|
||||
'%s removed a contributor: %3$s.',
|
||||
'%s removed contributors: %3$s.',
|
||||
|
@ -379,23 +379,6 @@ abstract class PhabricatorBaseEnglishTranslation
|
|||
),
|
||||
),
|
||||
|
||||
'%s edited object(s), added %d: %s; removed %d: %s.' =>
|
||||
'%s edited objects, added: %3$s; removed: %5$s.',
|
||||
|
||||
'%s added %d object(s): %s.' => array(
|
||||
array(
|
||||
'%s added a object: %3$s.',
|
||||
'%s added objects: %3$s.',
|
||||
),
|
||||
),
|
||||
|
||||
'%s removed %d object(s): %s.' => array(
|
||||
array(
|
||||
'%s removed a object: %3$s.',
|
||||
'%s removed objects: %3$s.',
|
||||
),
|
||||
),
|
||||
|
||||
'%d other(s)' => array(
|
||||
'1 other',
|
||||
'%d others',
|
||||
|
@ -683,14 +666,14 @@ abstract class PhabricatorBaseEnglishTranslation
|
|||
'%s commits',
|
||||
),
|
||||
|
||||
'%s removed %d JIRA issue(s): %s.' => array(
|
||||
'%s removed %s JIRA issue(s): %s.' => array(
|
||||
array(
|
||||
'%s removed a JIRA issue: %3$s.',
|
||||
'%s removed JIRA issues: %3$s.',
|
||||
),
|
||||
),
|
||||
|
||||
'%s added %d JIRA issue(s): %s.' => array(
|
||||
'%s added %s JIRA issue(s): %s.' => array(
|
||||
array(
|
||||
'%s added a JIRA issue: %3$s.',
|
||||
'%s added JIRA issues: %3$s.',
|
||||
|
@ -704,7 +687,7 @@ abstract class PhabricatorBaseEnglishTranslation
|
|||
),
|
||||
),
|
||||
|
||||
'%s updated JIRA issue(s): added %d %s; removed %d %s.' =>
|
||||
'%s updated JIRA issue(s): added %s %s; removed %d %s.' =>
|
||||
'%s updated JIRA issues: added %3$s; removed %5$s.',
|
||||
|
||||
'%s edited %s task(s), added %s: %s; removed %s: %s.' =>
|
||||
|
|
Loading…
Add table
Reference in a new issue