diff --git a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php index 705e858069..7c531f51f8 100644 --- a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php +++ b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php @@ -4,8 +4,7 @@ $conn_w = id(new DifferentialRevision())->establishConnection('w'); $rows = new LiskRawMigrationIterator($conn_w, 'differential_comment'); $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); echo pht('Migrating Differential comment text to modern storage...')."\n"; foreach ($rows as $row) { diff --git a/resources/sql/autopatches/20140212.dx.1.armageddon.php b/resources/sql/autopatches/20140212.dx.1.armageddon.php index d2749bd5cf..021e886629 100644 --- a/resources/sql/autopatches/20140212.dx.1.armageddon.php +++ b/resources/sql/autopatches/20140212.dx.1.armageddon.php @@ -4,8 +4,7 @@ $conn_w = id(new DifferentialRevision())->establishConnection('w'); $rows = new LiskRawMigrationIterator($conn_w, 'differential_comment'); $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); echo pht('Migrating Differential comments to modern storage...')."\n"; foreach ($rows as $row) { diff --git a/resources/sql/autopatches/20140722.audit.3.miginlines.php b/resources/sql/autopatches/20140722.audit.3.miginlines.php index c6778fa659..d816b534eb 100644 --- a/resources/sql/autopatches/20140722.audit.3.miginlines.php +++ b/resources/sql/autopatches/20140722.audit.3.miginlines.php @@ -10,8 +10,7 @@ $dst_table = 'audit_transaction_comment'; echo pht('Migrating Audit inline comments to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); $rows = new LiskRawMigrationIterator($conn_w, $src_table); foreach ($rows as $row) { diff --git a/resources/sql/autopatches/20140722.audit.4.migtext.php b/resources/sql/autopatches/20140722.audit.4.migtext.php index 2da4e2683e..c2a775058b 100644 --- a/resources/sql/autopatches/20140722.audit.4.migtext.php +++ b/resources/sql/autopatches/20140722.audit.4.migtext.php @@ -4,8 +4,7 @@ $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w'); $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment'); $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); echo pht('Migrating Audit comment text to modern storage...')."\n"; foreach ($rows as $row) { diff --git a/resources/sql/autopatches/20140725.audit.1.migxactions.php b/resources/sql/autopatches/20140725.audit.1.migxactions.php index e0e14e439b..4eb0897aeb 100644 --- a/resources/sql/autopatches/20140725.audit.1.migxactions.php +++ b/resources/sql/autopatches/20140725.audit.1.migxactions.php @@ -4,8 +4,7 @@ $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w'); $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment'); $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); echo pht('Migrating Audit comments to modern storage...')."\n"; foreach ($rows as $row) { diff --git a/resources/sql/patches/20130715.votecomments.php b/resources/sql/patches/20130715.votecomments.php index 0d540596b3..1066126318 100644 --- a/resources/sql/patches/20130715.votecomments.php +++ b/resources/sql/patches/20130715.votecomments.php @@ -46,9 +46,8 @@ foreach ($comments as $comment) { PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, PhabricatorSlowvotePollPHIDType::TYPECONST); - $source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + $content_source = PhabricatorContentSource::newForSource( + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); queryfx( $conn_w, diff --git a/resources/sql/patches/20130728.ponderxcomment.php b/resources/sql/patches/20130728.ponderxcomment.php index 92e858f95e..9a7413e351 100644 --- a/resources/sql/patches/20130728.ponderxcomment.php +++ b/resources/sql/patches/20130728.ponderxcomment.php @@ -49,8 +49,7 @@ foreach ($rows as $row) { 1, $row['content'], PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(), + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(), 0, $row['dateCreated'], $row['dateModified']); @@ -73,8 +72,7 @@ foreach ($rows as $row) { 'null', 'null', PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(), + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(), '[]', $row['dateCreated'], $row['dateModified']); diff --git a/resources/sql/patches/20130801.pastexactions.php b/resources/sql/patches/20130801.pastexactions.php index 1977eb984e..75c2ece940 100644 --- a/resources/sql/patches/20130801.pastexactions.php +++ b/resources/sql/patches/20130801.pastexactions.php @@ -34,8 +34,7 @@ foreach ($rows as $row) { 'null', $row['filePHID'], PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(), + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(), '[]', $row['dateCreated'], $row['dateCreated'], diff --git a/resources/sql/patches/20130926.dinline.php b/resources/sql/patches/20130926.dinline.php index f2d9e9f205..7b67adc9b7 100644 --- a/resources/sql/patches/20130926.dinline.php +++ b/resources/sql/patches/20130926.dinline.php @@ -10,8 +10,7 @@ $dst_table = 'differential_transaction_comment'; echo pht('Migrating Differential inline comments to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); $rows = new LiskRawMigrationIterator($conn_w, $src_table); foreach ($rows as $row) { diff --git a/resources/sql/patches/20131020.pxactionmig.php b/resources/sql/patches/20131020.pxactionmig.php index 7bf4416cd0..3d593d6e34 100644 --- a/resources/sql/patches/20131020.pxactionmig.php +++ b/resources/sql/patches/20131020.pxactionmig.php @@ -10,8 +10,7 @@ $dst_table = 'project_transaction'; echo pht('Migrating Project transactions to new format...')."\n"; $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array())->serialize(); + PhabricatorOldWorldContentSource::SOURCECONST)->serialize(); $rows = new LiskRawMigrationIterator($conn_w, $src_table); foreach ($rows as $row) { diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c4771045bb..150d2bd8cd 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1919,6 +1919,7 @@ phutil_register_library_map(array( 'PhabricatorBotWhatsNewHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php', 'PhabricatorBritishEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php', 'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php', + 'PhabricatorBulkContentSource' => 'infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php', 'PhabricatorBusyUIExample' => 'applications/uiexample/examples/PhabricatorBusyUIExample.php', 'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php', 'PhabricatorCacheGeneralGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheGeneralGarbageCollector.php', @@ -1993,6 +1994,7 @@ phutil_register_library_map(array( 'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php', 'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/PhabricatorConduitConnectionLog.php', 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php', + 'PhabricatorConduitContentSource' => 'infrastructure/contentsource/PhabricatorConduitContentSource.php', 'PhabricatorConduitController' => 'applications/conduit/controller/PhabricatorConduitController.php', 'PhabricatorConduitDAO' => 'applications/conduit/storage/PhabricatorConduitDAO.php', 'PhabricatorConduitEditField' => 'applications/transactions/editfield/PhabricatorConduitEditField.php', @@ -2080,8 +2082,10 @@ phutil_register_library_map(array( 'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php', 'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php', 'PhabricatorConsoleApplication' => 'applications/console/application/PhabricatorConsoleApplication.php', - 'PhabricatorContentSource' => 'applications/metamta/contentsource/PhabricatorContentSource.php', - 'PhabricatorContentSourceView' => 'applications/metamta/contentsource/PhabricatorContentSourceView.php', + 'PhabricatorConsoleContentSource' => 'infrastructure/contentsource/PhabricatorConsoleContentSource.php', + 'PhabricatorContentSource' => 'infrastructure/contentsource/PhabricatorContentSource.php', + 'PhabricatorContentSourceModule' => 'infrastructure/contentsource/PhabricatorContentSourceModule.php', + 'PhabricatorContentSourceView' => 'infrastructure/contentsource/PhabricatorContentSourceView.php', 'PhabricatorContributedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorContributedToObjectEdgeType.php', 'PhabricatorController' => 'applications/base/controller/PhabricatorController.php', 'PhabricatorCookies' => 'applications/auth/constants/PhabricatorCookies.php', @@ -2138,6 +2142,7 @@ phutil_register_library_map(array( 'PhabricatorDaemonBulkJobMonitorController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobMonitorController.php', 'PhabricatorDaemonBulkJobViewController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobViewController.php', 'PhabricatorDaemonConsoleController' => 'applications/daemon/controller/PhabricatorDaemonConsoleController.php', + 'PhabricatorDaemonContentSource' => 'infrastructure/daemon/contentsource/PhabricatorDaemonContentSource.php', 'PhabricatorDaemonController' => 'applications/daemon/controller/PhabricatorDaemonController.php', 'PhabricatorDaemonDAO' => 'applications/daemon/storage/PhabricatorDaemonDAO.php', 'PhabricatorDaemonEventListener' => 'applications/daemon/event/PhabricatorDaemonEventListener.php', @@ -2302,6 +2307,7 @@ phutil_register_library_map(array( 'PhabricatorElasticFulltextStorageEngine' => 'applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php', 'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php', 'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php', + 'PhabricatorEmailContentSource' => 'applications/metamta/contentsource/PhabricatorEmailContentSource.php', 'PhabricatorEmailFormatSettingsPanel' => 'applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php', 'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php', 'PhabricatorEmailPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php', @@ -2347,6 +2353,7 @@ phutil_register_library_map(array( 'PhabricatorFactSimpleSpec' => 'applications/fact/spec/PhabricatorFactSimpleSpec.php', 'PhabricatorFactSpec' => 'applications/fact/spec/PhabricatorFactSpec.php', 'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php', + 'PhabricatorFaxContentSource' => 'infrastructure/contentsource/PhabricatorFaxContentSource.php', 'PhabricatorFeedApplication' => 'applications/feed/application/PhabricatorFeedApplication.php', 'PhabricatorFeedBuilder' => 'applications/feed/builder/PhabricatorFeedBuilder.php', 'PhabricatorFeedConfigOptions' => 'applications/feed/config/PhabricatorFeedConfigOptions.php', @@ -2476,6 +2483,7 @@ phutil_register_library_map(array( 'PhabricatorHelpKeyboardShortcutController' => 'applications/help/controller/PhabricatorHelpKeyboardShortcutController.php', 'PhabricatorHelpMainMenuBarExtension' => 'applications/help/extension/PhabricatorHelpMainMenuBarExtension.php', 'PhabricatorHeraldApplication' => 'applications/herald/application/PhabricatorHeraldApplication.php', + 'PhabricatorHeraldContentSource' => 'applications/herald/contentsource/PhabricatorHeraldContentSource.php', 'PhabricatorHighSecurityRequestExceptionHandler' => 'aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php', 'PhabricatorHomeApplication' => 'applications/home/application/PhabricatorHomeApplication.php', 'PhabricatorHomeController' => 'applications/home/controller/PhabricatorHomeController.php', @@ -2524,6 +2532,7 @@ phutil_register_library_map(array( 'PhabricatorLibraryTestCase' => '__tests__/PhabricatorLibraryTestCase.php', 'PhabricatorLinkProfilePanel' => 'applications/search/profilepanel/PhabricatorLinkProfilePanel.php', 'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php', + 'PhabricatorLipsumContentSource' => 'infrastructure/contentsource/PhabricatorLipsumContentSource.php', 'PhabricatorLipsumGenerateWorkflow' => 'applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php', 'PhabricatorLipsumManagementWorkflow' => 'applications/lipsum/management/PhabricatorLipsumManagementWorkflow.php', 'PhabricatorLipsumMondrianArtist' => 'applications/lipsum/image/PhabricatorLipsumMondrianArtist.php', @@ -2737,6 +2746,7 @@ phutil_register_library_map(array( 'PhabricatorObjectSelectorDialog' => 'view/control/PhabricatorObjectSelectorDialog.php', 'PhabricatorObjectUsesCredentialsEdgeType' => 'applications/transactions/edges/PhabricatorObjectUsesCredentialsEdgeType.php', 'PhabricatorOffsetPagedQuery' => 'infrastructure/query/PhabricatorOffsetPagedQuery.php', + 'PhabricatorOldWorldContentSource' => 'infrastructure/contentsource/PhabricatorOldWorldContentSource.php', 'PhabricatorOneTimeTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorOneTimeTriggerClock.php', 'PhabricatorOpcodeCacheSpec' => 'applications/cache/spec/PhabricatorOpcodeCacheSpec.php', 'PhabricatorOwnerPathQuery' => 'applications/owners/query/PhabricatorOwnerPathQuery.php', @@ -2871,6 +2881,7 @@ phutil_register_library_map(array( 'PhabricatorPholioConfigOptions' => 'applications/pholio/config/PhabricatorPholioConfigOptions.php', 'PhabricatorPholioMockTestDataGenerator' => 'applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php', 'PhabricatorPhortuneApplication' => 'applications/phortune/application/PhabricatorPhortuneApplication.php', + 'PhabricatorPhortuneContentSource' => 'applications/phortune/contentsource/PhabricatorPhortuneContentSource.php', 'PhabricatorPhortuneManagementInvoiceWorkflow' => 'applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php', 'PhabricatorPhortuneManagementWorkflow' => 'applications/phortune/management/PhabricatorPhortuneManagementWorkflow.php', 'PhabricatorPhragmentApplication' => 'applications/phragment/application/PhabricatorPhragmentApplication.php', @@ -3471,7 +3482,9 @@ phutil_register_library_map(array( 'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php', 'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php', 'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php', + 'PhabricatorUnitTestContentSource' => 'infrastructure/contentsource/PhabricatorUnitTestContentSource.php', 'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php', + 'PhabricatorUnknownContentSource' => 'infrastructure/contentsource/PhabricatorUnknownContentSource.php', 'PhabricatorUnsubscribedFromObjectEdgeType' => 'applications/transactions/edges/PhabricatorUnsubscribedFromObjectEdgeType.php', 'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php', 'PhabricatorUserBlurbField' => 'applications/people/customfield/PhabricatorUserBlurbField.php', @@ -3511,6 +3524,7 @@ phutil_register_library_map(array( 'PhabricatorVeryWowEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorVeryWowEnglishTranslation.php', 'PhabricatorViewerDatasource' => 'applications/people/typeahead/PhabricatorViewerDatasource.php', 'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php', + 'PhabricatorWebContentSource' => 'infrastructure/contentsource/PhabricatorWebContentSource.php', 'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php', 'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php', 'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php', @@ -6274,6 +6288,7 @@ phutil_register_library_map(array( 'PhabricatorBotWhatsNewHandler' => 'PhabricatorBotHandler', 'PhabricatorBritishEnglishTranslation' => 'PhutilTranslation', 'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList', + 'PhabricatorBulkContentSource' => 'PhabricatorContentSource', 'PhabricatorBusyUIExample' => 'PhabricatorUIExample', 'PhabricatorCacheDAO' => 'PhabricatorLiskDAO', 'PhabricatorCacheGeneralGarbageCollector' => 'PhabricatorGarbageCollector', @@ -6369,6 +6384,7 @@ phutil_register_library_map(array( 'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO', 'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO', 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', + 'PhabricatorConduitContentSource' => 'PhabricatorContentSource', 'PhabricatorConduitController' => 'PhabricatorController', 'PhabricatorConduitDAO' => 'PhabricatorLiskDAO', 'PhabricatorConduitEditField' => 'PhabricatorEditField', @@ -6469,7 +6485,9 @@ phutil_register_library_map(array( 'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType', 'PhabricatorConsoleApplication' => 'PhabricatorApplication', + 'PhabricatorConsoleContentSource' => 'PhabricatorContentSource', 'PhabricatorContentSource' => 'Phobject', + 'PhabricatorContentSourceModule' => 'PhabricatorConfigModule', 'PhabricatorContentSourceView' => 'AphrontView', 'PhabricatorContributedToObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorController' => 'AphrontController', @@ -6535,6 +6553,7 @@ phutil_register_library_map(array( 'PhabricatorDaemonBulkJobMonitorController' => 'PhabricatorDaemonController', 'PhabricatorDaemonBulkJobViewController' => 'PhabricatorDaemonController', 'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController', + 'PhabricatorDaemonContentSource' => 'PhabricatorContentSource', 'PhabricatorDaemonController' => 'PhabricatorController', 'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO', 'PhabricatorDaemonEventListener' => 'PhabricatorEventListener', @@ -6726,6 +6745,7 @@ phutil_register_library_map(array( 'PhabricatorElasticFulltextStorageEngine' => 'PhabricatorFulltextStorageEngine', 'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel', + 'PhabricatorEmailContentSource' => 'PhabricatorContentSource', 'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorEmailLoginController' => 'PhabricatorAuthController', 'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', @@ -6773,6 +6793,7 @@ phutil_register_library_map(array( 'PhabricatorFactSimpleSpec' => 'PhabricatorFactSpec', 'PhabricatorFactSpec' => 'Phobject', 'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator', + 'PhabricatorFaxContentSource' => 'PhabricatorContentSource', 'PhabricatorFeedApplication' => 'PhabricatorApplication', 'PhabricatorFeedBuilder' => 'Phobject', 'PhabricatorFeedConfigOptions' => 'PhabricatorApplicationConfigOptions', @@ -6935,6 +6956,7 @@ phutil_register_library_map(array( 'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController', 'PhabricatorHelpMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension', 'PhabricatorHeraldApplication' => 'PhabricatorApplication', + 'PhabricatorHeraldContentSource' => 'PhabricatorContentSource', 'PhabricatorHighSecurityRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler', 'PhabricatorHomeApplication' => 'PhabricatorApplication', 'PhabricatorHomeController' => 'PhabricatorController', @@ -6983,6 +7005,7 @@ phutil_register_library_map(array( 'PhabricatorLibraryTestCase' => 'PhutilLibraryTestCase', 'PhabricatorLinkProfilePanel' => 'PhabricatorProfilePanel', 'PhabricatorLipsumArtist' => 'Phobject', + 'PhabricatorLipsumContentSource' => 'PhabricatorContentSource', 'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow', 'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist', @@ -7218,6 +7241,7 @@ phutil_register_library_map(array( 'PhabricatorObjectSelectorDialog' => 'Phobject', 'PhabricatorObjectUsesCredentialsEdgeType' => 'PhabricatorEdgeType', 'PhabricatorOffsetPagedQuery' => 'PhabricatorQuery', + 'PhabricatorOldWorldContentSource' => 'PhabricatorContentSource', 'PhabricatorOneTimeTriggerClock' => 'PhabricatorTriggerClock', 'PhabricatorOpcodeCacheSpec' => 'PhabricatorCacheSpec', 'PhabricatorOwnerPathQuery' => 'Phobject', @@ -7375,6 +7399,7 @@ phutil_register_library_map(array( 'PhabricatorPholioConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorPholioMockTestDataGenerator' => 'PhabricatorTestDataGenerator', 'PhabricatorPhortuneApplication' => 'PhabricatorApplication', + 'PhabricatorPhortuneContentSource' => 'PhabricatorContentSource', 'PhabricatorPhortuneManagementInvoiceWorkflow' => 'PhabricatorPhortuneManagementWorkflow', 'PhabricatorPhortuneManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorPhragmentApplication' => 'PhabricatorApplication', @@ -8094,7 +8119,9 @@ phutil_register_library_map(array( 'PhabricatorUIExampleRenderController' => 'PhabricatorController', 'PhabricatorUIExamplesApplication' => 'PhabricatorApplication', 'PhabricatorUSEnglishTranslation' => 'PhutilTranslation', + 'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource', 'PhabricatorUnitsTestCase' => 'PhabricatorTestCase', + 'PhabricatorUnknownContentSource' => 'PhabricatorContentSource', 'PhabricatorUnsubscribedFromObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorUser' => array( 'PhabricatorUserDAO', @@ -8150,6 +8177,7 @@ phutil_register_library_map(array( 'PhabricatorVeryWowEnglishTranslation' => 'PhutilTranslation', 'PhabricatorViewerDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType', + 'PhabricatorWebContentSource' => 'PhabricatorContentSource', 'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider', 'PhabricatorWorker' => 'Phobject', 'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask', diff --git a/src/applications/almanac/management/AlmanacManagementWorkflow.php b/src/applications/almanac/management/AlmanacManagementWorkflow.php index 840bc8b972..0f1dd6d773 100644 --- a/src/applications/almanac/management/AlmanacManagementWorkflow.php +++ b/src/applications/almanac/management/AlmanacManagementWorkflow.php @@ -3,7 +3,6 @@ abstract class AlmanacManagementWorkflow extends PhabricatorManagementWorkflow { - protected function loadServices(array $names) { if (!$names) { return array(); @@ -37,7 +36,7 @@ abstract class AlmanacManagementWorkflow $editor = id(new AlmanacServiceEditor()) ->setActor($this->getViewer()) ->setActingAsPHID($almanac_phid) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnMissingFields(true); $editor->applyTransactions($service, array($xaction)); diff --git a/src/applications/audit/storage/PhabricatorAuditInlineComment.php b/src/applications/audit/storage/PhabricatorAuditInlineComment.php index fc28bce720..ecb627efec 100644 --- a/src/applications/audit/storage/PhabricatorAuditInlineComment.php +++ b/src/applications/audit/storage/PhabricatorAuditInlineComment.php @@ -34,8 +34,7 @@ final class PhabricatorAuditInlineComment public function getTransactionCommentForSave() { $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array()); + PhabricatorOldWorldContentSource::SOURCECONST); $this->proxy ->setViewPolicy('public') diff --git a/src/applications/conduit/protocol/ConduitAPIRequest.php b/src/applications/conduit/protocol/ConduitAPIRequest.php index 831c9de43e..3e322fcb32 100644 --- a/src/applications/conduit/protocol/ConduitAPIRequest.php +++ b/src/applications/conduit/protocol/ConduitAPIRequest.php @@ -57,4 +57,9 @@ final class ConduitAPIRequest extends Phobject { return $this->isClusterRequest; } + public function newContentSource() { + return PhabricatorContentSource::newForSource( + PhabricatorConduitContentSource::SOURCECONST); + } + } diff --git a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php index 03dd615481..a4eeb3ed86 100644 --- a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php +++ b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php @@ -147,7 +147,7 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase { id(new ConpherenceEditor()) ->setActor($creator) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($conpherence, $xactions); @@ -166,7 +166,7 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase { id(new ConpherenceEditor()) ->setActor($actor) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($room, $xactions); } diff --git a/src/applications/conpherence/__tests__/ConpherenceTestCase.php b/src/applications/conpherence/__tests__/ConpherenceTestCase.php index ce9dc8ceee..1ad87d8af8 100644 --- a/src/applications/conpherence/__tests__/ConpherenceTestCase.php +++ b/src/applications/conpherence/__tests__/ConpherenceTestCase.php @@ -14,7 +14,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase { ); $editor = id(new ConpherenceEditor()) ->setActor($actor) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->applyTransactions($conpherence, $xactions); } @@ -31,7 +31,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase { ); $editor = id(new ConpherenceEditor()) ->setActor($actor) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->applyTransactions($conpherence, $xactions); } @@ -45,7 +45,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase { $editor = id(new ConpherenceEditor()) ->setActor($actor) - ->setContentSource(PhabricatorContentSource::newConsoleSource()); + ->setContentSource($this->newContentSource()); $xactions = $editor->generateTransactionsFromText( $actor, diff --git a/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php index d58b11ffa5..30540bf242 100644 --- a/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php +++ b/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php @@ -42,7 +42,7 @@ final class ConpherenceCreateThreadConduitAPIMethod $participant_phids, $title, $message, - PhabricatorContentSource::newFromConduitRequest($request)); + $request->newContentSource()); if ($errors) { foreach ($errors as $error_code) { diff --git a/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php index d5f3267a06..ebcf7f9a04 100644 --- a/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php +++ b/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php @@ -58,7 +58,7 @@ final class ConpherenceUpdateThreadConduitAPIMethod throw new ConduitException('ERR_USAGE_ROOM_NOT_FOUND'); } - $source = PhabricatorContentSource::newFromConduitRequest($request); + $source = $request->newContentSource(); $editor = id(new ConpherenceEditor()) ->setContentSource($source) ->setActor($user); diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php index 7ec5d7f445..0a07cbad29 100644 --- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php +++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php @@ -48,11 +48,7 @@ final class ConpherenceReplyHandler extends PhabricatorMailReplyHandler { $conpherence->attachParticipants($participants); } - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_EMAIL, - array( - 'id' => $mail->getID(), - )); + $content_source = $mail->newContentSource(); $editor = id(new ConpherenceEditor()) ->setActor($user) diff --git a/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php index bd097c4b2f..e613647935 100644 --- a/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php @@ -45,13 +45,11 @@ final class DifferentialCloseConduitAPIMethod ->setTransactionType(DifferentialTransaction::TYPE_ACTION) ->setNewValue(DifferentialAction::ACTION_CLOSE); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONDUIT, - array()); + $content_source = $request->newContentSource(); $editor = id(new DifferentialTransactionEditor()) ->setActor($viewer) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnMissingFields(true) ->setContinueOnNoEffect(true); diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php index 1e5f03164c..e5b71c87bb 100644 --- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php @@ -138,7 +138,7 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod { $editor = id(new DifferentialTransactionEditor()) ->setActor($viewer) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true) ->setContinueOnMissingFields(true); diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php index c5d2bdb9dc..8f4b154876 100644 --- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php @@ -77,7 +77,7 @@ final class DifferentialCreateCommentConduitAPIMethod $editor = id(new DifferentialTransactionEditor()) ->setActor($viewer) ->setDisableEmail($request->getValue('silent')) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true) ->setContinueOnMissingFields(true); diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php index 7a9ffdc6c1..8a0da78865 100644 --- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php @@ -144,7 +144,7 @@ final class DifferentialCreateDiffConduitAPIMethod id(new DifferentialDiffEditor()) ->setActor($viewer) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($diff, $xactions); diff --git a/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php index 75eb12b4f0..6f8c2e8640 100644 --- a/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php +++ b/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php @@ -85,7 +85,7 @@ final class DifferentialCreateRawDiffConduitAPIMethod id(new DifferentialDiffEditor()) ->setActor($viewer) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true) ->setLookupRepository(false) // respect user choice ->applyTransactions($diff, $xactions); diff --git a/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php b/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php index 5150dba315..1ad102e03c 100644 --- a/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php +++ b/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php @@ -68,9 +68,7 @@ final class PhabricatorDifferentialAttachCommitWorkflow ->setViewer($viewer) ->setAuthorPHID($differential_phid); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONSOLE, - array()); + $content_source = $this->newContentSource(); $extraction_engine->updateRevisionWithCommit( $revision, diff --git a/src/applications/differential/storage/DifferentialInlineComment.php b/src/applications/differential/storage/DifferentialInlineComment.php index 7fe9299428..c27d59bbe3 100644 --- a/src/applications/differential/storage/DifferentialInlineComment.php +++ b/src/applications/differential/storage/DifferentialInlineComment.php @@ -18,8 +18,7 @@ final class DifferentialInlineComment public function getTransactionCommentForSave() { $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LEGACY, - array()); + PhabricatorOldWorldContentSource::SOURCECONST); $this->proxy ->setViewPolicy('public') diff --git a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php index 5543b759d0..51a494425f 100644 --- a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php +++ b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php @@ -95,7 +95,7 @@ final class DiffusionCreateCommentConduitAPIMethod id(new PhabricatorAuditEditor()) ->setActor($request->getUser()) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setDisableEmail($request->getValue('silent')) ->setContinueOnMissingFields(true) ->applyTransactions($commit, $xactions); diff --git a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php index 5eabd85034..75a078a9d7 100644 --- a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php +++ b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php @@ -458,8 +458,7 @@ final class HarbormasterBuildEngine extends Phobject { ->getPHID(); $daemon_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + PhabricatorDaemonContentSource::SOURCECONST); $editor = $object->getApplicationTransactionEditor() ->setActor($viewer) diff --git a/src/applications/herald/contentsource/PhabricatorHeraldContentSource.php b/src/applications/herald/contentsource/PhabricatorHeraldContentSource.php new file mode 100644 index 0000000000..ad4adfce55 --- /dev/null +++ b/src/applications/herald/contentsource/PhabricatorHeraldContentSource.php @@ -0,0 +1,16 @@ +setKey(self::FIELDCONST) - ->setDefault(PhabricatorContentSource::SOURCE_WEB) + ->setDefault(PhabricatorWebContentSource::SOURCECONST) ->setOptions($map); } diff --git a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php index aacef542b1..b44895ae87 100644 --- a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php +++ b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php @@ -56,8 +56,7 @@ abstract class PhabricatorTestDataGenerator extends Phobject { protected function getLipsumContentSource() { return PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_LIPSUM, - array()); + PhabricatorLipsumContentSource::SOURCECONST); } /** diff --git a/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php b/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php index 18f433fe52..cf1da51bca 100644 --- a/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php +++ b/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php @@ -207,7 +207,7 @@ final class ManiphestTaskTestCase extends PhabricatorTestCase { ManiphestTask $task, array $xactions) { - $content_source = PhabricatorContentSource::newConsoleSource(); + $content_source = $this->newContentSource(); $editor = id(new ManiphestTransactionEditor()) ->setActor($viewer) diff --git a/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php index e72ffa4d46..d2a8de7d81 100644 --- a/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php +++ b/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php @@ -192,9 +192,7 @@ abstract class ManiphestConduitAPIMethod extends ConduitAPIMethod { return; } - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONDUIT, - array()); + $content_source = $request->newContentSource(); $editor = id(new ManiphestTransactionEditor()) ->setActor($request->getUser()) diff --git a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php index e4147ad223..5b52aaa480 100644 --- a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php +++ b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php @@ -15,9 +15,7 @@ final class PhabricatorManiphestTaskTestDataGenerator ->setSubPriority($this->generateTaskSubPriority()) ->setTitle($this->generateTitle()); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_UNKNOWN, - array()); + $content_source = $this->getLipsumContentSource(); $template = new ManiphestTransaction(); // Accumulate Transactions diff --git a/src/applications/metamta/contentsource/PhabricatorContentSource.php b/src/applications/metamta/contentsource/PhabricatorContentSource.php deleted file mode 100644 index e2320eb85f..0000000000 --- a/src/applications/metamta/contentsource/PhabricatorContentSource.php +++ /dev/null @@ -1,104 +0,0 @@ - - } - - public static function newForSource($source, array $params) { - $obj = new PhabricatorContentSource(); - $obj->source = $source; - $obj->params = $params; - - return $obj; - } - - public static function newFromSerialized($serialized) { - $dict = json_decode($serialized, true); - if (!is_array($dict)) { - $dict = array(); - } - - $obj = new PhabricatorContentSource(); - $obj->source = idx($dict, 'source', self::SOURCE_UNKNOWN); - $obj->params = idx($dict, 'params', array()); - - return $obj; - } - - public static function newConsoleSource() { - return self::newForSource( - self::SOURCE_CONSOLE, - array()); - } - - public static function newFromRequest(AphrontRequest $request) { - return self::newForSource( - self::SOURCE_WEB, - array()); - } - - public static function newFromConduitRequest(ConduitAPIRequest $request) { - return self::newForSource( - self::SOURCE_CONDUIT, - array()); - } - - public static function getSourceNameMap() { - return array( - self::SOURCE_WEB => pht('Web'), - self::SOURCE_EMAIL => pht('Email'), - self::SOURCE_CONDUIT => pht('Conduit'), - self::SOURCE_MOBILE => pht('Mobile'), - self::SOURCE_TABLET => pht('Tablet'), - self::SOURCE_FAX => pht('Fax'), - self::SOURCE_CONSOLE => pht('Console'), - self::SOURCE_LEGACY => pht('Legacy'), - self::SOURCE_HERALD => pht('Herald'), - self::SOURCE_DAEMON => pht('Daemons'), - self::SOURCE_LIPSUM => pht('Lipsum'), - self::SOURCE_UNKNOWN => pht('Old World'), - self::SOURCE_PHORTUNE => pht('Phortune'), - self::SOURCE_BULK => pht('Bulk Edit'), - ); - } - - public function serialize() { - return json_encode(array( - 'source' => $this->getSource(), - 'params' => $this->getParams(), - )); - } - - public function getSource() { - return $this->source; - } - - public function getParams() { - return $this->params; - } - - public function getParam($key, $default = null) { - return idx($this->params, $key, $default); - } - -} diff --git a/src/applications/metamta/contentsource/PhabricatorEmailContentSource.php b/src/applications/metamta/contentsource/PhabricatorEmailContentSource.php new file mode 100644 index 0000000000..78a66b4150 --- /dev/null +++ b/src/applications/metamta/contentsource/PhabricatorEmailContentSource.php @@ -0,0 +1,16 @@ +saveAndSend(); } + public function newContentSource() { + return PhabricatorContentSource::newForSource( + PhabricatorEmailContentSource::SOURCECONST, + array( + 'id' => $this->getID(), + )); + } + } diff --git a/src/applications/nuance/item/NuanceGitHubEventItemType.php b/src/applications/nuance/item/NuanceGitHubEventItemType.php index 2bccfb76b4..75f44e8964 100644 --- a/src/applications/nuance/item/NuanceGitHubEventItemType.php +++ b/src/applications/nuance/item/NuanceGitHubEventItemType.php @@ -323,10 +323,9 @@ final class NuanceGitHubEventItemType // TODO: Preserve the item's original source. $source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + PhabricatorDaemonContentSource::SOURCECONST); - // TOOD: This should really be the external source. + // TODO: This should really be the external source. $acting_phid = $nuance_phid; $editor = id(new ManiphestTransactionEditor()) diff --git a/src/applications/nuance/item/NuanceItemType.php b/src/applications/nuance/item/NuanceItemType.php index e8397b13f8..d4187bf418 100644 --- a/src/applications/nuance/item/NuanceItemType.php +++ b/src/applications/nuance/item/NuanceItemType.php @@ -119,8 +119,7 @@ abstract class NuanceItemType // TODO: Maybe preserve the actor's original content source? $source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + PhabricatorDaemonContentSource::SOURCECONST); $editor = id(new NuanceItemEditor()) ->setActor($viewer) diff --git a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php index 2dae0132d4..5cdf6afdab 100644 --- a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php +++ b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php @@ -61,7 +61,7 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod { $editor = id(new PhabricatorPasteEditor()) ->setActor($viewer) ->setContinueOnNoEffect(true) - ->setContentSourceFromConduitRequest($request); + ->setContentSource($request->newContentSource()); $xactions = $editor->applyTransactions($paste, $xactions); diff --git a/src/applications/paste/mail/PasteCreateMailReceiver.php b/src/applications/paste/mail/PasteCreateMailReceiver.php index 672667cd65..85acf7f45d 100644 --- a/src/applications/paste/mail/PasteCreateMailReceiver.php +++ b/src/applications/paste/mail/PasteCreateMailReceiver.php @@ -37,11 +37,7 @@ final class PasteCreateMailReceiver extends PhabricatorMailReceiver { $paste = PhabricatorPaste::initializeNewPaste($sender); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_EMAIL, - array( - 'id' => $mail->getID(), - )); + $content_source = $mail->newContentSource(); $editor = id(new PhabricatorPasteEditor()) ->setActor($sender) @@ -69,4 +65,5 @@ final class PasteCreateMailReceiver extends PhabricatorMailReceiver { ->saveAndSend(); } + } diff --git a/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php b/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php index ce620a0d3a..ac61327b39 100644 --- a/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php +++ b/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php @@ -13,9 +13,8 @@ final class PhabricatorPholioMockTestDataGenerator ->loadOneWhere('phid = %s', $author_phid); $mock = PholioMock::initializeNewMock($author); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_UNKNOWN, - array()); + $content_source = $this->getLipsumContentSource(); + $template = id(new PholioTransaction()) ->setContentSource($content_source); diff --git a/src/applications/phortune/contentsource/PhabricatorPhortuneContentSource.php b/src/applications/phortune/contentsource/PhabricatorPhortuneContentSource.php new file mode 100644 index 0000000000..f2f3247376 --- /dev/null +++ b/src/applications/phortune/contentsource/PhabricatorPhortuneContentSource.php @@ -0,0 +1,16 @@ +setNewValue(true); $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_PHORTUNE, - array()); + PhabricatorPhortuneContentSource::SOURCECONST); $editor = id(new PhortuneCartEditor()) ->setActor($omnipotent_user) diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php index 96f1948528..19399150e8 100644 --- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php +++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php @@ -96,8 +96,7 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker { ->setNewValue(true); $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_PHORTUNE, - array()); + PhabricatorPhortuneContentSource::SOURCECONST); $acting_phid = id(new PhabricatorPhortuneApplication())->getPHID(); $editor = id(new PhortuneCartEditor()) diff --git a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php index e3d28941bb..36c74f4a68 100644 --- a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php +++ b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php @@ -55,7 +55,7 @@ final class PhrictionCreateConduitAPIMethod extends PhrictionConduitAPIMethod { $editor = id(new PhrictionTransactionEditor()) ->setActor($request->getUser()) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true) ->setDescription($request->getValue('description')); diff --git a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php index f9c8c26a3e..e99a866529 100644 --- a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php +++ b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php @@ -50,7 +50,7 @@ final class PhrictionEditConduitAPIMethod extends PhrictionConduitAPIMethod { $editor = id(new PhrictionTransactionEditor()) ->setActor($request->getUser()) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true) ->setDescription($request->getValue('description')); diff --git a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php index 39efcadb55..e2b2f9688d 100644 --- a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php +++ b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php @@ -1087,7 +1087,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase { $editor = id(new ManiphestTransactionEditor()) ->setActor($viewer) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($task, $xactions); } @@ -1203,7 +1203,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase { $editor = id(new ManiphestTransactionEditor()) ->setActor($viewer) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($task, $xactions); } @@ -1239,7 +1239,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase { $editor = id(new ManiphestTransactionEditor()) ->setActor($viewer) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($task, $xactions); @@ -1464,7 +1464,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase { $editor = id(new PhabricatorProjectTransactionEditor()) ->setActor($user) - ->setContentSource(PhabricatorContentSource::newConsoleSource()) + ->setContentSource($this->newContentSource()) ->setContinueOnNoEffect(true) ->applyTransactions($project, $xactions); } diff --git a/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php b/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php index a209fd9a40..aefade63a2 100644 --- a/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php +++ b/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php @@ -71,7 +71,7 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod { $editor = id(new PhabricatorProjectTransactionEditor()) ->setActor($user) ->setContinueOnNoEffect(true) - ->setContentSourceFromConduitRequest($request); + ->setContentSource($request->newContentSource()); $editor->applyTransactions($project, $xactions); diff --git a/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php index 8473c0c7b5..0ac3caf15e 100644 --- a/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php +++ b/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php @@ -144,10 +144,7 @@ final class ReleephRequestConduitAPIMethod extends ReleephConduitAPIMethod { $editor = id(new ReleephRequestTransactionalEditor()) ->setActor($user) ->setContinueOnNoEffect(true) - ->setContentSource( - PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONDUIT, - array())); + ->setContentSource($request->newContentSource()); $editor->applyTransactions($releeph_request, $xactions); } diff --git a/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php index d32249fe65..9cfbe72c99 100644 --- a/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php +++ b/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php @@ -65,10 +65,7 @@ final class ReleephWorkRecordConduitAPIMethod $editor = id(new ReleephRequestTransactionalEditor()) ->setActor($request->getUser()) ->setContinueOnNoEffect(true) - ->setContentSource( - PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONDUIT, - array())); + ->setContentSource($request->newContentSource()); $editor->applyTransactions($releeph_request, $xactions); } diff --git a/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php index ead3d9dd2a..5de0108a25 100644 --- a/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php +++ b/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php @@ -64,10 +64,7 @@ final class ReleephWorkRecordPickStatusConduitAPIMethod $editor = id(new ReleephRequestTransactionalEditor()) ->setActor($request->getUser()) ->setContinueOnNoEffect(true) - ->setContentSource( - PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONDUIT, - array())); + ->setContentSource($request->newContentSource()); $xactions = array(); diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php index 26e708a00c..bdb63e6c9c 100644 --- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php +++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php @@ -301,8 +301,7 @@ final class DifferentialReleephRequestFieldSpecification extends Phobject { ->setContinueOnNoEffect(true) ->setContentSource( PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_UNKNOWN, - array())); + PhabricatorUnknownContentSource::SOURCECONST)); $editor->applyTransactions($releeph_request, $xactions); } diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php index 83447fcc18..cc33f1021c 100644 --- a/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php +++ b/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php @@ -117,7 +117,7 @@ final class PhabricatorRepositoryManagementEditWorkflow pht('Specify one or more fields to edit!')); } - $content_source = PhabricatorContentSource::newConsoleSource(); + $content_source = $this->newContentSource(); $editor = id(new PhabricatorRepositoryEditor()) ->setActor($actor) diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php index 0aa4dad187..9ad8ef2b66 100644 --- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php +++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php @@ -30,9 +30,7 @@ final class PhabricatorRepositoryCommitHeraldWorker $commit->attachRepository($repository); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + $content_source = $this->newContentSource(); $committer_phid = $data->getCommitDetail('committerPHID'); $author_phid = $data->getCommitDetail('authorPHID'); diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php index dbb912eda4..25eedf0be2 100644 --- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php +++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php @@ -221,9 +221,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker ->setViewer($actor) ->setAuthorPHID($acting_as_phid); - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + $content_source = $this->newContentSource(); $update_data = $extraction_engine->updateRevisionWithCommit( $revision, @@ -337,9 +335,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker $xactions[] = $edge_xaction; - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + $content_source = $this->newContentSource(); $editor = id(new ManiphestTransactionEditor()) ->setActor($actor) diff --git a/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php b/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php index f17d0f404a..4215ec96fe 100644 --- a/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php +++ b/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php @@ -215,7 +215,7 @@ final class PhabricatorSpacesTestCase extends PhabricatorTestCase { ->setNewValue($is_default); } - $content_source = PhabricatorContentSource::newConsoleSource(); + $content_source = $this->newContentSource(); $editor = id(new PhabricatorSpacesNamespaceEditor()) ->setActor($actor) diff --git a/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php b/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php index 4e0a463a74..eb591025b2 100644 --- a/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php +++ b/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php @@ -22,7 +22,7 @@ final class TokenGiveConduitAPIMethod extends TokenConduitAPIMethod { } protected function execute(ConduitAPIRequest $request) { - $content_source = PhabricatorContentSource::newFromConduitRequest($request); + $content_source = $request->newContentSource(); $editor = id(new PhabricatorTokenGivenEditor()) ->setActor($request->getUser()) diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php index 65b6282aa9..ae3fb7520c 100644 --- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php +++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php @@ -37,9 +37,9 @@ final class PhabricatorApplicationTransactionCommentRawController $addendum = null; if ($request->getExists('email')) { $content_source = $xaction->getContentSource(); - $source_email = PhabricatorContentSource::SOURCE_EMAIL; + $source_email = PhabricatorEmailContentSource::SOURCECONST; if ($content_source->getSource() == $source_email) { - $source_id = $content_source->getParam('id'); + $source_id = $content_source->getContentSourceParameter('id'); if ($source_id) { $message = id(new PhabricatorMetaMTAReceivedMail())->loadOneWhere( 'id = %d', diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php index 8be7c9d6f2..3e6ff9c872 100644 --- a/src/applications/transactions/editengine/PhabricatorEditEngine.php +++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php @@ -1684,7 +1684,7 @@ abstract class PhabricatorEditEngine $editor = $object->getApplicationTransactionEditor() ->setActor($viewer) - ->setContentSourceFromConduitRequest($request) + ->setContentSource($request->newContentSource()) ->setContinueOnNoEffect(true); if (!$this->getIsCreate()) { diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php index cbfaebb182..d7c0bbf5f6 100644 --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -733,16 +733,6 @@ abstract class PhabricatorApplicationTransactionEditor PhabricatorContentSource::newFromRequest($request)); } - public function setContentSourceFromConduitRequest( - ConduitAPIRequest $request) { - - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_CONDUIT, - array()); - - return $this->setContentSource($content_source); - } - public function getContentSource() { return $this->contentSource; } @@ -979,8 +969,7 @@ abstract class PhabricatorApplicationTransactionEditor // out from transcripts, but it would be cleaner if you didn't have to. $herald_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_HERALD, - array()); + PhabricatorHeraldContentSource::SOURCECONST); $herald_editor = newv(get_class($this), array()) ->setContinueOnNoEffect(true) diff --git a/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php b/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php index 560a750f00..5457708953 100644 --- a/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php +++ b/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php @@ -18,11 +18,7 @@ abstract class PhabricatorApplicationTransactionReplyHandler } private function newEditor(PhabricatorMetaMTAReceivedMail $mail) { - $content_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_EMAIL, - array( - 'id' => $mail->getID(), - )); + $content_source = $mail->newContentSource(); $editor = $this->getMailReceiver() ->getApplicationTransactionEditor() diff --git a/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php b/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php index 1b017c224e..0369fbff54 100644 --- a/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php +++ b/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php @@ -62,9 +62,7 @@ final class PhabricatorApplicationTransactionPublishWorker PhabricatorApplicationTransactionInterface $object) { $data = $this->getTaskData(); - $daemon_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + $daemon_source = $this->newContentSource(); $viewer = PhabricatorUser::getOmnipotentUser(); $editor = $object->getApplicationTransactionEditor() diff --git a/src/infrastructure/contentsource/PhabricatorConduitContentSource.php b/src/infrastructure/contentsource/PhabricatorConduitContentSource.php new file mode 100644 index 0000000000..64820a236c --- /dev/null +++ b/src/infrastructure/contentsource/PhabricatorConduitContentSource.php @@ -0,0 +1,16 @@ +getPhobjectClassConstant('SOURCECONST', 32); + } + + final public static function getAllContentSources() { + return id(new PhutilClassMapQuery()) + ->setAncestorClass(__CLASS__) + ->setUniqueMethod('getSourceTypeConstant') + ->execute(); + } + + /** + * Construct a new content source object. + * + * @param const The source type constant to build a source for. + * @param array Source parameters. + * @param bool True to suppress errors and force construction of a source + * even if the source type is not valid. + * @return PhabricatorContentSource New source object. + */ + final public static function newForSource( + $source, + array $params = array(), + $force = false) { + + $map = self::getAllContentSources(); + if (isset($map[$source])) { + $obj = clone $map[$source]; + } else { + if ($force) { + $obj = new PhabricatorUnknownContentSource(); + } else { + throw new Exception( + pht( + 'Content source type "%s" is not known to Phabricator!', + $source)); + } + } + + $obj->source = $source; + $obj->params = $params; + + return $obj; + } + + public static function newFromSerialized($serialized) { + $dict = json_decode($serialized, true); + if (!is_array($dict)) { + $dict = array(); + } + + $source = idx($dict, 'source'); + $params = idx($dict, 'params'); + if (!is_array($params)) { + $params = array(); + } + + return self::newForSource($source, $params, true); + } + + public static function newFromRequest(AphrontRequest $request) { + return self::newForSource( + PhabricatorWebContentSource::SOURCECONST); + } + + final public function serialize() { + return phutil_json_encode( + array( + 'source' => $this->getSource(), + 'params' => $this->params, + )); + } + + final public function getSource() { + return $this->source; + } + + final public function getContentSourceParameter($key, $default = null) { + return idx($this->params, $key, $default); + } + +} diff --git a/src/infrastructure/contentsource/PhabricatorContentSourceModule.php b/src/infrastructure/contentsource/PhabricatorContentSourceModule.php new file mode 100644 index 0000000000..c9bd3347f3 --- /dev/null +++ b/src/infrastructure/contentsource/PhabricatorContentSourceModule.php @@ -0,0 +1,51 @@ +getViewer(); + + $sources = PhabricatorContentSource::getAllContentSources(); + ksort($sources); + + $rows = array(); + foreach ($sources as $source) { + $rows[] = array( + $source->getSourceTypeConstant(), + get_class($source), + $source->getSourceName(), + $source->getSourceDescription(), + ); + } + + $table = id(new AphrontTableView($rows)) + ->setHeaders( + array( + pht('Key'), + pht('Class'), + pht('Source'), + pht('Description'), + )) + ->setColumnClasses( + array( + null, + null, + 'pri', + 'wide', + )); + + return id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Content Sources')) + ->setTable($table); + } + +} diff --git a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php b/src/infrastructure/contentsource/PhabricatorContentSourceView.php similarity index 61% rename from src/applications/metamta/contentsource/PhabricatorContentSourceView.php rename to src/infrastructure/contentsource/PhabricatorContentSourceView.php index 5b19f41cb2..14bacb08d9 100644 --- a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php +++ b/src/infrastructure/contentsource/PhabricatorContentSourceView.php @@ -10,21 +10,14 @@ final class PhabricatorContentSourceView extends AphrontView { } public function getSourceName() { - $map = PhabricatorContentSource::getSourceNameMap(); - $source = $this->contentSource->getSource(); - return idx($map, $source, null); - + return $this->contentSource->getSourceName(); } public function render() { require_celerity_resource('phabricator-content-source-view-css'); - $map = PhabricatorContentSource::getSourceNameMap(); - - $source = $this->contentSource->getSource(); - $type = idx($map, $source, null); - - if (!$type) { + $name = $this->getSourceName(); + if ($name === null) { return null; } @@ -33,7 +26,7 @@ final class PhabricatorContentSourceView extends AphrontView { array( 'class' => 'phabricator-content-source-view', ), - pht('Via %s', $type)); + pht('Via %s', $name)); } } diff --git a/src/infrastructure/contentsource/PhabricatorFaxContentSource.php b/src/infrastructure/contentsource/PhabricatorFaxContentSource.php new file mode 100644 index 0000000000..36da91365b --- /dev/null +++ b/src/infrastructure/contentsource/PhabricatorFaxContentSource.php @@ -0,0 +1,16 @@ +getSource(); + if (strlen($source)) { + return pht('Unknown ("%s")', $source); + } else { + return pht('Unknown'); + } + } + + public function getSourceDescription() { + return pht('Content with no known source.'); + } + +} diff --git a/src/infrastructure/contentsource/PhabricatorWebContentSource.php b/src/infrastructure/contentsource/PhabricatorWebContentSource.php new file mode 100644 index 0000000000..d788148e52 --- /dev/null +++ b/src/infrastructure/contentsource/PhabricatorWebContentSource.php @@ -0,0 +1,16 @@ +setTransactionType($type_status) ->setNewValue($status); - $daemon_source = PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_DAEMON, - array()); + $daemon_source = $this->newContentSource(); $app_phid = id(new PhabricatorDaemonsApplication())->getPHID(); diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php index ca7508d2b2..feb25a0128 100644 --- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php +++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php @@ -102,7 +102,7 @@ final class PhabricatorWorkerBulkJob public function newContentSource() { return PhabricatorContentSource::newForSource( - PhabricatorContentSource::SOURCE_BULK, + PhabricatorBulkContentSource::SOURCECONST, array( 'jobID' => $this->getID(), )); diff --git a/src/infrastructure/management/PhabricatorManagementWorkflow.php b/src/infrastructure/management/PhabricatorManagementWorkflow.php index a2305b8ff0..0cd8c0230e 100644 --- a/src/infrastructure/management/PhabricatorManagementWorkflow.php +++ b/src/infrastructure/management/PhabricatorManagementWorkflow.php @@ -26,4 +26,9 @@ abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow { return $epoch; } + protected function newContentSource() { + return PhabricatorContentSource::newForSource( + PhabricatorConsoleContentSource::SOURCECONST); + } + } diff --git a/src/infrastructure/testing/PhabricatorTestCase.php b/src/infrastructure/testing/PhabricatorTestCase.php index 068c2ed557..c9a6ba986c 100644 --- a/src/infrastructure/testing/PhabricatorTestCase.php +++ b/src/infrastructure/testing/PhabricatorTestCase.php @@ -229,5 +229,9 @@ abstract class PhabricatorTestCase extends PhutilTestCase { } } + protected function newContentSource() { + return PhabricatorContentSource::newForSource( + PhabricatorUnitTestContentSource::SOURCECONST); + } } diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php index 0d9b75782f..4da2bfe928 100644 --- a/src/view/phui/PHUITimelineEventView.php +++ b/src/view/phui/PHUITimelineEventView.php @@ -622,9 +622,9 @@ final class PHUITimelineEventView extends AphrontView { )); $content_source = $this->getContentSource(); - $source_email = PhabricatorContentSource::SOURCE_EMAIL; + $source_email = PhabricatorEmailContentSource::SOURCECONST; if ($content_source->getSource() == $source_email) { - $source_id = $content_source->getParam('id'); + $source_id = $content_source->getContentSourceParameter('id'); if ($source_id) { $items[] = id(new PhabricatorActionView()) ->setIcon('fa-envelope-o')