1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 03:20:59 +01:00

Modularize content sources

Summary:
Ref T10537. For Nuance, I want to introduce new sources (like "GitHub" or "GitHub via Nuance" or something) but this needs to modularize eventually.

Split ContentSource apart so applications can add new content sources.

Test Plan:
This change has huge surface area, so I'll hold it until post-release. I think it's fairly safe (and if it does break anything, the breaks should be fatals, not anything subtle or difficult to fix), there's just no reason not to hold it for a few hours.

- Viewed new module page.
- Grepped for all removed functions/constants.
- Viewed some transactions.
- Hovered over timestamps to get content source details.
- Added a comment via Conduit.
- Added a comment via web.
- Ran `bin/storage upgrade --namespace XXXXX --no-quickstart -f` to re-run all historic migrations.
- Generated some objects with `bin/lipsum`.
- Ran a bulk job on some tasks.
- Ran unit tests.

{F1190182}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10537

Differential Revision: https://secure.phabricator.com/D15521
This commit is contained in:
epriestley 2016-03-25 05:56:16 -07:00
parent d784d9c044
commit 601aaa5a86
83 changed files with 495 additions and 265 deletions

View file

@ -4,8 +4,7 @@ $conn_w = id(new DifferentialRevision())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'differential_comment'); $rows = new LiskRawMigrationIterator($conn_w, 'differential_comment');
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
echo pht('Migrating Differential comment text to modern storage...')."\n"; echo pht('Migrating Differential comment text to modern storage...')."\n";
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -4,8 +4,7 @@ $conn_w = id(new DifferentialRevision())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'differential_comment'); $rows = new LiskRawMigrationIterator($conn_w, 'differential_comment');
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
echo pht('Migrating Differential comments to modern storage...')."\n"; echo pht('Migrating Differential comments to modern storage...')."\n";
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -10,8 +10,7 @@ $dst_table = 'audit_transaction_comment';
echo pht('Migrating Audit inline comments to new format...')."\n"; echo pht('Migrating Audit inline comments to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table); $rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -4,8 +4,7 @@ $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'audit_comment'); $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment');
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
echo pht('Migrating Audit comment text to modern storage...')."\n"; echo pht('Migrating Audit comment text to modern storage...')."\n";
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -4,8 +4,7 @@ $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w');
$rows = new LiskRawMigrationIterator($conn_w, 'audit_comment'); $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment');
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
echo pht('Migrating Audit comments to modern storage...')."\n"; echo pht('Migrating Audit comments to modern storage...')."\n";
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -46,9 +46,8 @@ foreach ($comments as $comment) {
PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST, PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST,
PhabricatorSlowvotePollPHIDType::TYPECONST); PhabricatorSlowvotePollPHIDType::TYPECONST);
$source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
queryfx( queryfx(
$conn_w, $conn_w,

View file

@ -49,8 +49,7 @@ foreach ($rows as $row) {
1, 1,
$row['content'], $row['content'],
PhabricatorContentSource::newForSource( PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize(),
array())->serialize(),
0, 0,
$row['dateCreated'], $row['dateCreated'],
$row['dateModified']); $row['dateModified']);
@ -73,8 +72,7 @@ foreach ($rows as $row) {
'null', 'null',
'null', 'null',
PhabricatorContentSource::newForSource( PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize(),
array())->serialize(),
'[]', '[]',
$row['dateCreated'], $row['dateCreated'],
$row['dateModified']); $row['dateModified']);

View file

@ -34,8 +34,7 @@ foreach ($rows as $row) {
'null', 'null',
$row['filePHID'], $row['filePHID'],
PhabricatorContentSource::newForSource( PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize(),
array())->serialize(),
'[]', '[]',
$row['dateCreated'], $row['dateCreated'],
$row['dateCreated'], $row['dateCreated'],

View file

@ -10,8 +10,7 @@ $dst_table = 'differential_transaction_comment';
echo pht('Migrating Differential inline comments to new format...')."\n"; echo pht('Migrating Differential inline comments to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table); $rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -10,8 +10,7 @@ $dst_table = 'project_transaction';
echo pht('Migrating Project transactions to new format...')."\n"; echo pht('Migrating Project transactions to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
array())->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table); $rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) { foreach ($rows as $row) {

View file

@ -1919,6 +1919,7 @@ phutil_register_library_map(array(
'PhabricatorBotWhatsNewHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php', 'PhabricatorBotWhatsNewHandler' => 'infrastructure/daemon/bot/handler/PhabricatorBotWhatsNewHandler.php',
'PhabricatorBritishEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php', 'PhabricatorBritishEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorBritishEnglishTranslation.php',
'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php', 'PhabricatorBuiltinPatchList' => 'infrastructure/storage/patch/PhabricatorBuiltinPatchList.php',
'PhabricatorBulkContentSource' => 'infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php',
'PhabricatorBusyUIExample' => 'applications/uiexample/examples/PhabricatorBusyUIExample.php', 'PhabricatorBusyUIExample' => 'applications/uiexample/examples/PhabricatorBusyUIExample.php',
'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php', 'PhabricatorCacheDAO' => 'applications/cache/storage/PhabricatorCacheDAO.php',
'PhabricatorCacheGeneralGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheGeneralGarbageCollector.php', 'PhabricatorCacheGeneralGarbageCollector' => 'applications/cache/garbagecollector/PhabricatorCacheGeneralGarbageCollector.php',
@ -1993,6 +1994,7 @@ phutil_register_library_map(array(
'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php', 'PhabricatorConduitCertificateToken' => 'applications/conduit/storage/PhabricatorConduitCertificateToken.php',
'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/PhabricatorConduitConnectionLog.php', 'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/PhabricatorConduitConnectionLog.php',
'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php', 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/PhabricatorConduitConsoleController.php',
'PhabricatorConduitContentSource' => 'infrastructure/contentsource/PhabricatorConduitContentSource.php',
'PhabricatorConduitController' => 'applications/conduit/controller/PhabricatorConduitController.php', 'PhabricatorConduitController' => 'applications/conduit/controller/PhabricatorConduitController.php',
'PhabricatorConduitDAO' => 'applications/conduit/storage/PhabricatorConduitDAO.php', 'PhabricatorConduitDAO' => 'applications/conduit/storage/PhabricatorConduitDAO.php',
'PhabricatorConduitEditField' => 'applications/transactions/editfield/PhabricatorConduitEditField.php', 'PhabricatorConduitEditField' => 'applications/transactions/editfield/PhabricatorConduitEditField.php',
@ -2080,8 +2082,10 @@ phutil_register_library_map(array(
'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php', 'PhabricatorConpherencePreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorConpherencePreferencesSettingsPanel.php',
'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php', 'PhabricatorConpherenceThreadPHIDType' => 'applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php',
'PhabricatorConsoleApplication' => 'applications/console/application/PhabricatorConsoleApplication.php', 'PhabricatorConsoleApplication' => 'applications/console/application/PhabricatorConsoleApplication.php',
'PhabricatorContentSource' => 'applications/metamta/contentsource/PhabricatorContentSource.php', 'PhabricatorConsoleContentSource' => 'infrastructure/contentsource/PhabricatorConsoleContentSource.php',
'PhabricatorContentSourceView' => 'applications/metamta/contentsource/PhabricatorContentSourceView.php', 'PhabricatorContentSource' => 'infrastructure/contentsource/PhabricatorContentSource.php',
'PhabricatorContentSourceModule' => 'infrastructure/contentsource/PhabricatorContentSourceModule.php',
'PhabricatorContentSourceView' => 'infrastructure/contentsource/PhabricatorContentSourceView.php',
'PhabricatorContributedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorContributedToObjectEdgeType.php', 'PhabricatorContributedToObjectEdgeType' => 'applications/transactions/edges/PhabricatorContributedToObjectEdgeType.php',
'PhabricatorController' => 'applications/base/controller/PhabricatorController.php', 'PhabricatorController' => 'applications/base/controller/PhabricatorController.php',
'PhabricatorCookies' => 'applications/auth/constants/PhabricatorCookies.php', 'PhabricatorCookies' => 'applications/auth/constants/PhabricatorCookies.php',
@ -2138,6 +2142,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonBulkJobMonitorController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobMonitorController.php', 'PhabricatorDaemonBulkJobMonitorController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobMonitorController.php',
'PhabricatorDaemonBulkJobViewController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobViewController.php', 'PhabricatorDaemonBulkJobViewController' => 'applications/daemon/controller/PhabricatorDaemonBulkJobViewController.php',
'PhabricatorDaemonConsoleController' => 'applications/daemon/controller/PhabricatorDaemonConsoleController.php', 'PhabricatorDaemonConsoleController' => 'applications/daemon/controller/PhabricatorDaemonConsoleController.php',
'PhabricatorDaemonContentSource' => 'infrastructure/daemon/contentsource/PhabricatorDaemonContentSource.php',
'PhabricatorDaemonController' => 'applications/daemon/controller/PhabricatorDaemonController.php', 'PhabricatorDaemonController' => 'applications/daemon/controller/PhabricatorDaemonController.php',
'PhabricatorDaemonDAO' => 'applications/daemon/storage/PhabricatorDaemonDAO.php', 'PhabricatorDaemonDAO' => 'applications/daemon/storage/PhabricatorDaemonDAO.php',
'PhabricatorDaemonEventListener' => 'applications/daemon/event/PhabricatorDaemonEventListener.php', 'PhabricatorDaemonEventListener' => 'applications/daemon/event/PhabricatorDaemonEventListener.php',
@ -2302,6 +2307,7 @@ phutil_register_library_map(array(
'PhabricatorElasticFulltextStorageEngine' => 'applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php', 'PhabricatorElasticFulltextStorageEngine' => 'applications/search/fulltextstorage/PhabricatorElasticFulltextStorageEngine.php',
'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php', 'PhabricatorElasticSearchSetupCheck' => 'applications/config/check/PhabricatorElasticSearchSetupCheck.php',
'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php', 'PhabricatorEmailAddressesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailAddressesSettingsPanel.php',
'PhabricatorEmailContentSource' => 'applications/metamta/contentsource/PhabricatorEmailContentSource.php',
'PhabricatorEmailFormatSettingsPanel' => 'applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php', 'PhabricatorEmailFormatSettingsPanel' => 'applications/settings/panel/PhabricatorEmailFormatSettingsPanel.php',
'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php', 'PhabricatorEmailLoginController' => 'applications/auth/controller/PhabricatorEmailLoginController.php',
'PhabricatorEmailPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php', 'PhabricatorEmailPreferencesSettingsPanel' => 'applications/settings/panel/PhabricatorEmailPreferencesSettingsPanel.php',
@ -2347,6 +2353,7 @@ phutil_register_library_map(array(
'PhabricatorFactSimpleSpec' => 'applications/fact/spec/PhabricatorFactSimpleSpec.php', 'PhabricatorFactSimpleSpec' => 'applications/fact/spec/PhabricatorFactSimpleSpec.php',
'PhabricatorFactSpec' => 'applications/fact/spec/PhabricatorFactSpec.php', 'PhabricatorFactSpec' => 'applications/fact/spec/PhabricatorFactSpec.php',
'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php', 'PhabricatorFactUpdateIterator' => 'applications/fact/extract/PhabricatorFactUpdateIterator.php',
'PhabricatorFaxContentSource' => 'infrastructure/contentsource/PhabricatorFaxContentSource.php',
'PhabricatorFeedApplication' => 'applications/feed/application/PhabricatorFeedApplication.php', 'PhabricatorFeedApplication' => 'applications/feed/application/PhabricatorFeedApplication.php',
'PhabricatorFeedBuilder' => 'applications/feed/builder/PhabricatorFeedBuilder.php', 'PhabricatorFeedBuilder' => 'applications/feed/builder/PhabricatorFeedBuilder.php',
'PhabricatorFeedConfigOptions' => 'applications/feed/config/PhabricatorFeedConfigOptions.php', 'PhabricatorFeedConfigOptions' => 'applications/feed/config/PhabricatorFeedConfigOptions.php',
@ -2476,6 +2483,7 @@ phutil_register_library_map(array(
'PhabricatorHelpKeyboardShortcutController' => 'applications/help/controller/PhabricatorHelpKeyboardShortcutController.php', 'PhabricatorHelpKeyboardShortcutController' => 'applications/help/controller/PhabricatorHelpKeyboardShortcutController.php',
'PhabricatorHelpMainMenuBarExtension' => 'applications/help/extension/PhabricatorHelpMainMenuBarExtension.php', 'PhabricatorHelpMainMenuBarExtension' => 'applications/help/extension/PhabricatorHelpMainMenuBarExtension.php',
'PhabricatorHeraldApplication' => 'applications/herald/application/PhabricatorHeraldApplication.php', 'PhabricatorHeraldApplication' => 'applications/herald/application/PhabricatorHeraldApplication.php',
'PhabricatorHeraldContentSource' => 'applications/herald/contentsource/PhabricatorHeraldContentSource.php',
'PhabricatorHighSecurityRequestExceptionHandler' => 'aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php', 'PhabricatorHighSecurityRequestExceptionHandler' => 'aphront/handler/PhabricatorHighSecurityRequestExceptionHandler.php',
'PhabricatorHomeApplication' => 'applications/home/application/PhabricatorHomeApplication.php', 'PhabricatorHomeApplication' => 'applications/home/application/PhabricatorHomeApplication.php',
'PhabricatorHomeController' => 'applications/home/controller/PhabricatorHomeController.php', 'PhabricatorHomeController' => 'applications/home/controller/PhabricatorHomeController.php',
@ -2524,6 +2532,7 @@ phutil_register_library_map(array(
'PhabricatorLibraryTestCase' => '__tests__/PhabricatorLibraryTestCase.php', 'PhabricatorLibraryTestCase' => '__tests__/PhabricatorLibraryTestCase.php',
'PhabricatorLinkProfilePanel' => 'applications/search/profilepanel/PhabricatorLinkProfilePanel.php', 'PhabricatorLinkProfilePanel' => 'applications/search/profilepanel/PhabricatorLinkProfilePanel.php',
'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php', 'PhabricatorLipsumArtist' => 'applications/lipsum/image/PhabricatorLipsumArtist.php',
'PhabricatorLipsumContentSource' => 'infrastructure/contentsource/PhabricatorLipsumContentSource.php',
'PhabricatorLipsumGenerateWorkflow' => 'applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php', 'PhabricatorLipsumGenerateWorkflow' => 'applications/lipsum/management/PhabricatorLipsumGenerateWorkflow.php',
'PhabricatorLipsumManagementWorkflow' => 'applications/lipsum/management/PhabricatorLipsumManagementWorkflow.php', 'PhabricatorLipsumManagementWorkflow' => 'applications/lipsum/management/PhabricatorLipsumManagementWorkflow.php',
'PhabricatorLipsumMondrianArtist' => 'applications/lipsum/image/PhabricatorLipsumMondrianArtist.php', 'PhabricatorLipsumMondrianArtist' => 'applications/lipsum/image/PhabricatorLipsumMondrianArtist.php',
@ -2737,6 +2746,7 @@ phutil_register_library_map(array(
'PhabricatorObjectSelectorDialog' => 'view/control/PhabricatorObjectSelectorDialog.php', 'PhabricatorObjectSelectorDialog' => 'view/control/PhabricatorObjectSelectorDialog.php',
'PhabricatorObjectUsesCredentialsEdgeType' => 'applications/transactions/edges/PhabricatorObjectUsesCredentialsEdgeType.php', 'PhabricatorObjectUsesCredentialsEdgeType' => 'applications/transactions/edges/PhabricatorObjectUsesCredentialsEdgeType.php',
'PhabricatorOffsetPagedQuery' => 'infrastructure/query/PhabricatorOffsetPagedQuery.php', 'PhabricatorOffsetPagedQuery' => 'infrastructure/query/PhabricatorOffsetPagedQuery.php',
'PhabricatorOldWorldContentSource' => 'infrastructure/contentsource/PhabricatorOldWorldContentSource.php',
'PhabricatorOneTimeTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorOneTimeTriggerClock.php', 'PhabricatorOneTimeTriggerClock' => 'infrastructure/daemon/workers/clock/PhabricatorOneTimeTriggerClock.php',
'PhabricatorOpcodeCacheSpec' => 'applications/cache/spec/PhabricatorOpcodeCacheSpec.php', 'PhabricatorOpcodeCacheSpec' => 'applications/cache/spec/PhabricatorOpcodeCacheSpec.php',
'PhabricatorOwnerPathQuery' => 'applications/owners/query/PhabricatorOwnerPathQuery.php', 'PhabricatorOwnerPathQuery' => 'applications/owners/query/PhabricatorOwnerPathQuery.php',
@ -2871,6 +2881,7 @@ phutil_register_library_map(array(
'PhabricatorPholioConfigOptions' => 'applications/pholio/config/PhabricatorPholioConfigOptions.php', 'PhabricatorPholioConfigOptions' => 'applications/pholio/config/PhabricatorPholioConfigOptions.php',
'PhabricatorPholioMockTestDataGenerator' => 'applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php', 'PhabricatorPholioMockTestDataGenerator' => 'applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php',
'PhabricatorPhortuneApplication' => 'applications/phortune/application/PhabricatorPhortuneApplication.php', 'PhabricatorPhortuneApplication' => 'applications/phortune/application/PhabricatorPhortuneApplication.php',
'PhabricatorPhortuneContentSource' => 'applications/phortune/contentsource/PhabricatorPhortuneContentSource.php',
'PhabricatorPhortuneManagementInvoiceWorkflow' => 'applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php', 'PhabricatorPhortuneManagementInvoiceWorkflow' => 'applications/phortune/management/PhabricatorPhortuneManagementInvoiceWorkflow.php',
'PhabricatorPhortuneManagementWorkflow' => 'applications/phortune/management/PhabricatorPhortuneManagementWorkflow.php', 'PhabricatorPhortuneManagementWorkflow' => 'applications/phortune/management/PhabricatorPhortuneManagementWorkflow.php',
'PhabricatorPhragmentApplication' => 'applications/phragment/application/PhabricatorPhragmentApplication.php', 'PhabricatorPhragmentApplication' => 'applications/phragment/application/PhabricatorPhragmentApplication.php',
@ -3471,7 +3482,9 @@ phutil_register_library_map(array(
'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php', 'PhabricatorUIExampleRenderController' => 'applications/uiexample/controller/PhabricatorUIExampleRenderController.php',
'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php', 'PhabricatorUIExamplesApplication' => 'applications/uiexample/application/PhabricatorUIExamplesApplication.php',
'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php', 'PhabricatorUSEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorUSEnglishTranslation.php',
'PhabricatorUnitTestContentSource' => 'infrastructure/contentsource/PhabricatorUnitTestContentSource.php',
'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php', 'PhabricatorUnitsTestCase' => 'view/__tests__/PhabricatorUnitsTestCase.php',
'PhabricatorUnknownContentSource' => 'infrastructure/contentsource/PhabricatorUnknownContentSource.php',
'PhabricatorUnsubscribedFromObjectEdgeType' => 'applications/transactions/edges/PhabricatorUnsubscribedFromObjectEdgeType.php', 'PhabricatorUnsubscribedFromObjectEdgeType' => 'applications/transactions/edges/PhabricatorUnsubscribedFromObjectEdgeType.php',
'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php', 'PhabricatorUser' => 'applications/people/storage/PhabricatorUser.php',
'PhabricatorUserBlurbField' => 'applications/people/customfield/PhabricatorUserBlurbField.php', 'PhabricatorUserBlurbField' => 'applications/people/customfield/PhabricatorUserBlurbField.php',
@ -3511,6 +3524,7 @@ phutil_register_library_map(array(
'PhabricatorVeryWowEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorVeryWowEnglishTranslation.php', 'PhabricatorVeryWowEnglishTranslation' => 'infrastructure/internationalization/translation/PhabricatorVeryWowEnglishTranslation.php',
'PhabricatorViewerDatasource' => 'applications/people/typeahead/PhabricatorViewerDatasource.php', 'PhabricatorViewerDatasource' => 'applications/people/typeahead/PhabricatorViewerDatasource.php',
'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php', 'PhabricatorWatcherHasObjectEdgeType' => 'applications/transactions/edges/PhabricatorWatcherHasObjectEdgeType.php',
'PhabricatorWebContentSource' => 'infrastructure/contentsource/PhabricatorWebContentSource.php',
'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php', 'PhabricatorWordPressAuthProvider' => 'applications/auth/provider/PhabricatorWordPressAuthProvider.php',
'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php', 'PhabricatorWorker' => 'infrastructure/daemon/workers/PhabricatorWorker.php',
'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php', 'PhabricatorWorkerActiveTask' => 'infrastructure/daemon/workers/storage/PhabricatorWorkerActiveTask.php',
@ -6274,6 +6288,7 @@ phutil_register_library_map(array(
'PhabricatorBotWhatsNewHandler' => 'PhabricatorBotHandler', 'PhabricatorBotWhatsNewHandler' => 'PhabricatorBotHandler',
'PhabricatorBritishEnglishTranslation' => 'PhutilTranslation', 'PhabricatorBritishEnglishTranslation' => 'PhutilTranslation',
'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList', 'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList',
'PhabricatorBulkContentSource' => 'PhabricatorContentSource',
'PhabricatorBusyUIExample' => 'PhabricatorUIExample', 'PhabricatorBusyUIExample' => 'PhabricatorUIExample',
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO', 'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
'PhabricatorCacheGeneralGarbageCollector' => 'PhabricatorGarbageCollector', 'PhabricatorCacheGeneralGarbageCollector' => 'PhabricatorGarbageCollector',
@ -6369,6 +6384,7 @@ phutil_register_library_map(array(
'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO', 'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO',
'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO', 'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO',
'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController',
'PhabricatorConduitContentSource' => 'PhabricatorContentSource',
'PhabricatorConduitController' => 'PhabricatorController', 'PhabricatorConduitController' => 'PhabricatorController',
'PhabricatorConduitDAO' => 'PhabricatorLiskDAO', 'PhabricatorConduitDAO' => 'PhabricatorLiskDAO',
'PhabricatorConduitEditField' => 'PhabricatorEditField', 'PhabricatorConduitEditField' => 'PhabricatorEditField',
@ -6469,7 +6485,9 @@ phutil_register_library_map(array(
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType', 'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
'PhabricatorConsoleApplication' => 'PhabricatorApplication', 'PhabricatorConsoleApplication' => 'PhabricatorApplication',
'PhabricatorConsoleContentSource' => 'PhabricatorContentSource',
'PhabricatorContentSource' => 'Phobject', 'PhabricatorContentSource' => 'Phobject',
'PhabricatorContentSourceModule' => 'PhabricatorConfigModule',
'PhabricatorContentSourceView' => 'AphrontView', 'PhabricatorContentSourceView' => 'AphrontView',
'PhabricatorContributedToObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorContributedToObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorController' => 'AphrontController', 'PhabricatorController' => 'AphrontController',
@ -6535,6 +6553,7 @@ phutil_register_library_map(array(
'PhabricatorDaemonBulkJobMonitorController' => 'PhabricatorDaemonController', 'PhabricatorDaemonBulkJobMonitorController' => 'PhabricatorDaemonController',
'PhabricatorDaemonBulkJobViewController' => 'PhabricatorDaemonController', 'PhabricatorDaemonBulkJobViewController' => 'PhabricatorDaemonController',
'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController', 'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController',
'PhabricatorDaemonContentSource' => 'PhabricatorContentSource',
'PhabricatorDaemonController' => 'PhabricatorController', 'PhabricatorDaemonController' => 'PhabricatorController',
'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO', 'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO',
'PhabricatorDaemonEventListener' => 'PhabricatorEventListener', 'PhabricatorDaemonEventListener' => 'PhabricatorEventListener',
@ -6726,6 +6745,7 @@ phutil_register_library_map(array(
'PhabricatorElasticFulltextStorageEngine' => 'PhabricatorFulltextStorageEngine', 'PhabricatorElasticFulltextStorageEngine' => 'PhabricatorFulltextStorageEngine',
'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck', 'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailContentSource' => 'PhabricatorContentSource',
'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailLoginController' => 'PhabricatorAuthController', 'PhabricatorEmailLoginController' => 'PhabricatorAuthController',
'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel', 'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
@ -6773,6 +6793,7 @@ phutil_register_library_map(array(
'PhabricatorFactSimpleSpec' => 'PhabricatorFactSpec', 'PhabricatorFactSimpleSpec' => 'PhabricatorFactSpec',
'PhabricatorFactSpec' => 'Phobject', 'PhabricatorFactSpec' => 'Phobject',
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator', 'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
'PhabricatorFaxContentSource' => 'PhabricatorContentSource',
'PhabricatorFeedApplication' => 'PhabricatorApplication', 'PhabricatorFeedApplication' => 'PhabricatorApplication',
'PhabricatorFeedBuilder' => 'Phobject', 'PhabricatorFeedBuilder' => 'Phobject',
'PhabricatorFeedConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorFeedConfigOptions' => 'PhabricatorApplicationConfigOptions',
@ -6935,6 +6956,7 @@ phutil_register_library_map(array(
'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController', 'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController',
'PhabricatorHelpMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension', 'PhabricatorHelpMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorHeraldApplication' => 'PhabricatorApplication', 'PhabricatorHeraldApplication' => 'PhabricatorApplication',
'PhabricatorHeraldContentSource' => 'PhabricatorContentSource',
'PhabricatorHighSecurityRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler', 'PhabricatorHighSecurityRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorHomeApplication' => 'PhabricatorApplication', 'PhabricatorHomeApplication' => 'PhabricatorApplication',
'PhabricatorHomeController' => 'PhabricatorController', 'PhabricatorHomeController' => 'PhabricatorController',
@ -6983,6 +7005,7 @@ phutil_register_library_map(array(
'PhabricatorLibraryTestCase' => 'PhutilLibraryTestCase', 'PhabricatorLibraryTestCase' => 'PhutilLibraryTestCase',
'PhabricatorLinkProfilePanel' => 'PhabricatorProfilePanel', 'PhabricatorLinkProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorLipsumArtist' => 'Phobject', 'PhabricatorLipsumArtist' => 'Phobject',
'PhabricatorLipsumContentSource' => 'PhabricatorContentSource',
'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow', 'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow',
'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist', 'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist',
@ -7218,6 +7241,7 @@ phutil_register_library_map(array(
'PhabricatorObjectSelectorDialog' => 'Phobject', 'PhabricatorObjectSelectorDialog' => 'Phobject',
'PhabricatorObjectUsesCredentialsEdgeType' => 'PhabricatorEdgeType', 'PhabricatorObjectUsesCredentialsEdgeType' => 'PhabricatorEdgeType',
'PhabricatorOffsetPagedQuery' => 'PhabricatorQuery', 'PhabricatorOffsetPagedQuery' => 'PhabricatorQuery',
'PhabricatorOldWorldContentSource' => 'PhabricatorContentSource',
'PhabricatorOneTimeTriggerClock' => 'PhabricatorTriggerClock', 'PhabricatorOneTimeTriggerClock' => 'PhabricatorTriggerClock',
'PhabricatorOpcodeCacheSpec' => 'PhabricatorCacheSpec', 'PhabricatorOpcodeCacheSpec' => 'PhabricatorCacheSpec',
'PhabricatorOwnerPathQuery' => 'Phobject', 'PhabricatorOwnerPathQuery' => 'Phobject',
@ -7375,6 +7399,7 @@ phutil_register_library_map(array(
'PhabricatorPholioConfigOptions' => 'PhabricatorApplicationConfigOptions', 'PhabricatorPholioConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPholioMockTestDataGenerator' => 'PhabricatorTestDataGenerator', 'PhabricatorPholioMockTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorPhortuneApplication' => 'PhabricatorApplication', 'PhabricatorPhortuneApplication' => 'PhabricatorApplication',
'PhabricatorPhortuneContentSource' => 'PhabricatorContentSource',
'PhabricatorPhortuneManagementInvoiceWorkflow' => 'PhabricatorPhortuneManagementWorkflow', 'PhabricatorPhortuneManagementInvoiceWorkflow' => 'PhabricatorPhortuneManagementWorkflow',
'PhabricatorPhortuneManagementWorkflow' => 'PhabricatorManagementWorkflow', 'PhabricatorPhortuneManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorPhragmentApplication' => 'PhabricatorApplication', 'PhabricatorPhragmentApplication' => 'PhabricatorApplication',
@ -8094,7 +8119,9 @@ phutil_register_library_map(array(
'PhabricatorUIExampleRenderController' => 'PhabricatorController', 'PhabricatorUIExampleRenderController' => 'PhabricatorController',
'PhabricatorUIExamplesApplication' => 'PhabricatorApplication', 'PhabricatorUIExamplesApplication' => 'PhabricatorApplication',
'PhabricatorUSEnglishTranslation' => 'PhutilTranslation', 'PhabricatorUSEnglishTranslation' => 'PhutilTranslation',
'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource',
'PhabricatorUnitsTestCase' => 'PhabricatorTestCase', 'PhabricatorUnitsTestCase' => 'PhabricatorTestCase',
'PhabricatorUnknownContentSource' => 'PhabricatorContentSource',
'PhabricatorUnsubscribedFromObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorUnsubscribedFromObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorUser' => array( 'PhabricatorUser' => array(
'PhabricatorUserDAO', 'PhabricatorUserDAO',
@ -8150,6 +8177,7 @@ phutil_register_library_map(array(
'PhabricatorVeryWowEnglishTranslation' => 'PhutilTranslation', 'PhabricatorVeryWowEnglishTranslation' => 'PhutilTranslation',
'PhabricatorViewerDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorViewerDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorWebContentSource' => 'PhabricatorContentSource',
'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider', 'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorWorker' => 'Phobject', 'PhabricatorWorker' => 'Phobject',
'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask', 'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask',

View file

@ -3,7 +3,6 @@
abstract class AlmanacManagementWorkflow abstract class AlmanacManagementWorkflow
extends PhabricatorManagementWorkflow { extends PhabricatorManagementWorkflow {
protected function loadServices(array $names) { protected function loadServices(array $names) {
if (!$names) { if (!$names) {
return array(); return array();
@ -37,7 +36,7 @@ abstract class AlmanacManagementWorkflow
$editor = id(new AlmanacServiceEditor()) $editor = id(new AlmanacServiceEditor())
->setActor($this->getViewer()) ->setActor($this->getViewer())
->setActingAsPHID($almanac_phid) ->setActingAsPHID($almanac_phid)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnMissingFields(true); ->setContinueOnMissingFields(true);
$editor->applyTransactions($service, array($xaction)); $editor->applyTransactions($service, array($xaction));

View file

@ -34,8 +34,7 @@ final class PhabricatorAuditInlineComment
public function getTransactionCommentForSave() { public function getTransactionCommentForSave() {
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST);
array());
$this->proxy $this->proxy
->setViewPolicy('public') ->setViewPolicy('public')

View file

@ -57,4 +57,9 @@ final class ConduitAPIRequest extends Phobject {
return $this->isClusterRequest; return $this->isClusterRequest;
} }
public function newContentSource() {
return PhabricatorContentSource::newForSource(
PhabricatorConduitContentSource::SOURCECONST);
}
} }

View file

@ -147,7 +147,7 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase {
id(new ConpherenceEditor()) id(new ConpherenceEditor())
->setActor($creator) ->setActor($creator)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($conpherence, $xactions); ->applyTransactions($conpherence, $xactions);
@ -166,7 +166,7 @@ final class ConpherenceRoomTestCase extends ConpherenceTestCase {
id(new ConpherenceEditor()) id(new ConpherenceEditor())
->setActor($actor) ->setActor($actor)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($room, $xactions); ->applyTransactions($room, $xactions);
} }

View file

@ -14,7 +14,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase {
); );
$editor = id(new ConpherenceEditor()) $editor = id(new ConpherenceEditor())
->setActor($actor) ->setActor($actor)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->applyTransactions($conpherence, $xactions); ->applyTransactions($conpherence, $xactions);
} }
@ -31,7 +31,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase {
); );
$editor = id(new ConpherenceEditor()) $editor = id(new ConpherenceEditor())
->setActor($actor) ->setActor($actor)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->applyTransactions($conpherence, $xactions); ->applyTransactions($conpherence, $xactions);
} }
@ -45,7 +45,7 @@ abstract class ConpherenceTestCase extends PhabricatorTestCase {
$editor = id(new ConpherenceEditor()) $editor = id(new ConpherenceEditor())
->setActor($actor) ->setActor($actor)
->setContentSource(PhabricatorContentSource::newConsoleSource()); ->setContentSource($this->newContentSource());
$xactions = $editor->generateTransactionsFromText( $xactions = $editor->generateTransactionsFromText(
$actor, $actor,

View file

@ -42,7 +42,7 @@ final class ConpherenceCreateThreadConduitAPIMethod
$participant_phids, $participant_phids,
$title, $title,
$message, $message,
PhabricatorContentSource::newFromConduitRequest($request)); $request->newContentSource());
if ($errors) { if ($errors) {
foreach ($errors as $error_code) { foreach ($errors as $error_code) {

View file

@ -58,7 +58,7 @@ final class ConpherenceUpdateThreadConduitAPIMethod
throw new ConduitException('ERR_USAGE_ROOM_NOT_FOUND'); throw new ConduitException('ERR_USAGE_ROOM_NOT_FOUND');
} }
$source = PhabricatorContentSource::newFromConduitRequest($request); $source = $request->newContentSource();
$editor = id(new ConpherenceEditor()) $editor = id(new ConpherenceEditor())
->setContentSource($source) ->setContentSource($source)
->setActor($user); ->setActor($user);

View file

@ -48,11 +48,7 @@ final class ConpherenceReplyHandler extends PhabricatorMailReplyHandler {
$conpherence->attachParticipants($participants); $conpherence->attachParticipants($participants);
} }
$content_source = PhabricatorContentSource::newForSource( $content_source = $mail->newContentSource();
PhabricatorContentSource::SOURCE_EMAIL,
array(
'id' => $mail->getID(),
));
$editor = id(new ConpherenceEditor()) $editor = id(new ConpherenceEditor())
->setActor($user) ->setActor($user)

View file

@ -45,13 +45,11 @@ final class DifferentialCloseConduitAPIMethod
->setTransactionType(DifferentialTransaction::TYPE_ACTION) ->setTransactionType(DifferentialTransaction::TYPE_ACTION)
->setNewValue(DifferentialAction::ACTION_CLOSE); ->setNewValue(DifferentialAction::ACTION_CLOSE);
$content_source = PhabricatorContentSource::newForSource( $content_source = $request->newContentSource();
PhabricatorContentSource::SOURCE_CONDUIT,
array());
$editor = id(new DifferentialTransactionEditor()) $editor = id(new DifferentialTransactionEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnMissingFields(true) ->setContinueOnMissingFields(true)
->setContinueOnNoEffect(true); ->setContinueOnNoEffect(true);

View file

@ -138,7 +138,7 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod {
$editor = id(new DifferentialTransactionEditor()) $editor = id(new DifferentialTransactionEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true); ->setContinueOnMissingFields(true);

View file

@ -77,7 +77,7 @@ final class DifferentialCreateCommentConduitAPIMethod
$editor = id(new DifferentialTransactionEditor()) $editor = id(new DifferentialTransactionEditor())
->setActor($viewer) ->setActor($viewer)
->setDisableEmail($request->getValue('silent')) ->setDisableEmail($request->getValue('silent'))
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true); ->setContinueOnMissingFields(true);

View file

@ -144,7 +144,7 @@ final class DifferentialCreateDiffConduitAPIMethod
id(new DifferentialDiffEditor()) id(new DifferentialDiffEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($diff, $xactions); ->applyTransactions($diff, $xactions);

View file

@ -85,7 +85,7 @@ final class DifferentialCreateRawDiffConduitAPIMethod
id(new DifferentialDiffEditor()) id(new DifferentialDiffEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setLookupRepository(false) // respect user choice ->setLookupRepository(false) // respect user choice
->applyTransactions($diff, $xactions); ->applyTransactions($diff, $xactions);

View file

@ -68,9 +68,7 @@ final class PhabricatorDifferentialAttachCommitWorkflow
->setViewer($viewer) ->setViewer($viewer)
->setAuthorPHID($differential_phid); ->setAuthorPHID($differential_phid);
$content_source = PhabricatorContentSource::newForSource( $content_source = $this->newContentSource();
PhabricatorContentSource::SOURCE_CONSOLE,
array());
$extraction_engine->updateRevisionWithCommit( $extraction_engine->updateRevisionWithCommit(
$revision, $revision,

View file

@ -18,8 +18,7 @@ final class DifferentialInlineComment
public function getTransactionCommentForSave() { public function getTransactionCommentForSave() {
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LEGACY, PhabricatorOldWorldContentSource::SOURCECONST);
array());
$this->proxy $this->proxy
->setViewPolicy('public') ->setViewPolicy('public')

View file

@ -95,7 +95,7 @@ final class DiffusionCreateCommentConduitAPIMethod
id(new PhabricatorAuditEditor()) id(new PhabricatorAuditEditor())
->setActor($request->getUser()) ->setActor($request->getUser())
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setDisableEmail($request->getValue('silent')) ->setDisableEmail($request->getValue('silent'))
->setContinueOnMissingFields(true) ->setContinueOnMissingFields(true)
->applyTransactions($commit, $xactions); ->applyTransactions($commit, $xactions);

View file

@ -458,8 +458,7 @@ final class HarbormasterBuildEngine extends Phobject {
->getPHID(); ->getPHID();
$daemon_source = PhabricatorContentSource::newForSource( $daemon_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_DAEMON, PhabricatorDaemonContentSource::SOURCECONST);
array());
$editor = $object->getApplicationTransactionEditor() $editor = $object->getApplicationTransactionEditor()
->setActor($viewer) ->setActor($viewer)

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorHeraldContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'herald';
public function getSourceName() {
return pht('Herald');
}
public function getSourceDescription() {
return pht('Changes triggered by Herald rules.');
}
}

View file

@ -24,12 +24,13 @@ final class HeraldContentSourceField extends HeraldField {
} }
public function getHeraldFieldValueType($condition) { public function getHeraldFieldValueType($condition) {
$map = PhabricatorContentSource::getSourceNameMap(); $map = PhabricatorContentSource::getAllContentSources();
$map = mpull($map, 'getSourceName');
asort($map); asort($map);
return id(new HeraldSelectFieldValue()) return id(new HeraldSelectFieldValue())
->setKey(self::FIELDCONST) ->setKey(self::FIELDCONST)
->setDefault(PhabricatorContentSource::SOURCE_WEB) ->setDefault(PhabricatorWebContentSource::SOURCECONST)
->setOptions($map); ->setOptions($map);
} }

View file

@ -56,8 +56,7 @@ abstract class PhabricatorTestDataGenerator extends Phobject {
protected function getLipsumContentSource() { protected function getLipsumContentSource() {
return PhabricatorContentSource::newForSource( return PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_LIPSUM, PhabricatorLipsumContentSource::SOURCECONST);
array());
} }
/** /**

View file

@ -207,7 +207,7 @@ final class ManiphestTaskTestCase extends PhabricatorTestCase {
ManiphestTask $task, ManiphestTask $task,
array $xactions) { array $xactions) {
$content_source = PhabricatorContentSource::newConsoleSource(); $content_source = $this->newContentSource();
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())
->setActor($viewer) ->setActor($viewer)

View file

@ -192,9 +192,7 @@ abstract class ManiphestConduitAPIMethod extends ConduitAPIMethod {
return; return;
} }
$content_source = PhabricatorContentSource::newForSource( $content_source = $request->newContentSource();
PhabricatorContentSource::SOURCE_CONDUIT,
array());
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())
->setActor($request->getUser()) ->setActor($request->getUser())

View file

@ -15,9 +15,7 @@ final class PhabricatorManiphestTaskTestDataGenerator
->setSubPriority($this->generateTaskSubPriority()) ->setSubPriority($this->generateTaskSubPriority())
->setTitle($this->generateTitle()); ->setTitle($this->generateTitle());
$content_source = PhabricatorContentSource::newForSource( $content_source = $this->getLipsumContentSource();
PhabricatorContentSource::SOURCE_UNKNOWN,
array());
$template = new ManiphestTransaction(); $template = new ManiphestTransaction();
// Accumulate Transactions // Accumulate Transactions

View file

@ -1,104 +0,0 @@
<?php
final class PhabricatorContentSource extends Phobject {
const SOURCE_UNKNOWN = 'unknown';
const SOURCE_WEB = 'web';
const SOURCE_EMAIL = 'email';
const SOURCE_CONDUIT = 'conduit';
const SOURCE_MOBILE = 'mobile';
const SOURCE_TABLET = 'tablet';
const SOURCE_FAX = 'fax';
const SOURCE_CONSOLE = 'console';
const SOURCE_HERALD = 'herald';
const SOURCE_LEGACY = 'legacy';
const SOURCE_DAEMON = 'daemon';
const SOURCE_LIPSUM = 'lipsum';
const SOURCE_PHORTUNE = 'phortune';
const SOURCE_BULK = 'bulk';
private $source;
private $params = array();
private function __construct() {
// <empty>
}
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);
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorEmailContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'email';
public function getSourceName() {
return pht('Email');
}
public function getSourceDescription() {
return pht('Content sent by electronic mail, also known as e-mail.');
}
}

View file

@ -371,4 +371,12 @@ EOBODY
->saveAndSend(); ->saveAndSend();
} }
public function newContentSource() {
return PhabricatorContentSource::newForSource(
PhabricatorEmailContentSource::SOURCECONST,
array(
'id' => $this->getID(),
));
}
} }

View file

@ -323,10 +323,9 @@ final class NuanceGitHubEventItemType
// TODO: Preserve the item's original source. // TODO: Preserve the item's original source.
$source = PhabricatorContentSource::newForSource( $source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_DAEMON, PhabricatorDaemonContentSource::SOURCECONST);
array());
// TOOD: This should really be the external source. // TODO: This should really be the external source.
$acting_phid = $nuance_phid; $acting_phid = $nuance_phid;
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())

View file

@ -119,8 +119,7 @@ abstract class NuanceItemType
// TODO: Maybe preserve the actor's original content source? // TODO: Maybe preserve the actor's original content source?
$source = PhabricatorContentSource::newForSource( $source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_DAEMON, PhabricatorDaemonContentSource::SOURCECONST);
array());
$editor = id(new NuanceItemEditor()) $editor = id(new NuanceItemEditor())
->setActor($viewer) ->setActor($viewer)

View file

@ -61,7 +61,7 @@ final class PasteCreateConduitAPIMethod extends PasteConduitAPIMethod {
$editor = id(new PhabricatorPasteEditor()) $editor = id(new PhabricatorPasteEditor())
->setActor($viewer) ->setActor($viewer)
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSourceFromConduitRequest($request); ->setContentSource($request->newContentSource());
$xactions = $editor->applyTransactions($paste, $xactions); $xactions = $editor->applyTransactions($paste, $xactions);

View file

@ -37,11 +37,7 @@ final class PasteCreateMailReceiver extends PhabricatorMailReceiver {
$paste = PhabricatorPaste::initializeNewPaste($sender); $paste = PhabricatorPaste::initializeNewPaste($sender);
$content_source = PhabricatorContentSource::newForSource( $content_source = $mail->newContentSource();
PhabricatorContentSource::SOURCE_EMAIL,
array(
'id' => $mail->getID(),
));
$editor = id(new PhabricatorPasteEditor()) $editor = id(new PhabricatorPasteEditor())
->setActor($sender) ->setActor($sender)
@ -69,4 +65,5 @@ final class PasteCreateMailReceiver extends PhabricatorMailReceiver {
->saveAndSend(); ->saveAndSend();
} }
} }

View file

@ -13,9 +13,8 @@ final class PhabricatorPholioMockTestDataGenerator
->loadOneWhere('phid = %s', $author_phid); ->loadOneWhere('phid = %s', $author_phid);
$mock = PholioMock::initializeNewMock($author); $mock = PholioMock::initializeNewMock($author);
$content_source = PhabricatorContentSource::newForSource( $content_source = $this->getLipsumContentSource();
PhabricatorContentSource::SOURCE_UNKNOWN,
array());
$template = id(new PholioTransaction()) $template = id(new PholioTransaction())
->setContentSource($content_source); ->setContentSource($content_source);

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorPhortuneContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'phortune';
public function getSourceName() {
return pht('Phortune');
}
public function getSourceDescription() {
return pht('Updates from subscriptions and payment processors.');
}
}

View file

@ -12,8 +12,7 @@ abstract class PhortuneProductImplementation extends Phobject {
protected function getContentSource() { protected function getContentSource() {
return PhabricatorContentSource::newForSource( return PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_PHORTUNE, PhabricatorPhortuneContentSource::SOURCECONST);
array());
} }
public function getPurchaseName( public function getPurchaseName(

View file

@ -431,8 +431,7 @@ final class PhortuneCart extends PhortuneDAO
->setNewValue(true); ->setNewValue(true);
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_PHORTUNE, PhabricatorPhortuneContentSource::SOURCECONST);
array());
$editor = id(new PhortuneCartEditor()) $editor = id(new PhortuneCartEditor())
->setActor($omnipotent_user) ->setActor($omnipotent_user)

View file

@ -96,8 +96,7 @@ final class PhortuneSubscriptionWorker extends PhabricatorWorker {
->setNewValue(true); ->setNewValue(true);
$content_source = PhabricatorContentSource::newForSource( $content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_PHORTUNE, PhabricatorPhortuneContentSource::SOURCECONST);
array());
$acting_phid = id(new PhabricatorPhortuneApplication())->getPHID(); $acting_phid = id(new PhabricatorPhortuneApplication())->getPHID();
$editor = id(new PhortuneCartEditor()) $editor = id(new PhortuneCartEditor())

View file

@ -55,7 +55,7 @@ final class PhrictionCreateConduitAPIMethod extends PhrictionConduitAPIMethod {
$editor = id(new PhrictionTransactionEditor()) $editor = id(new PhrictionTransactionEditor())
->setActor($request->getUser()) ->setActor($request->getUser())
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setDescription($request->getValue('description')); ->setDescription($request->getValue('description'));

View file

@ -50,7 +50,7 @@ final class PhrictionEditConduitAPIMethod extends PhrictionConduitAPIMethod {
$editor = id(new PhrictionTransactionEditor()) $editor = id(new PhrictionTransactionEditor())
->setActor($request->getUser()) ->setActor($request->getUser())
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setDescription($request->getValue('description')); ->setDescription($request->getValue('description'));

View file

@ -1087,7 +1087,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($task, $xactions); ->applyTransactions($task, $xactions);
} }
@ -1203,7 +1203,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($task, $xactions); ->applyTransactions($task, $xactions);
} }
@ -1239,7 +1239,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())
->setActor($viewer) ->setActor($viewer)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($task, $xactions); ->applyTransactions($task, $xactions);
@ -1464,7 +1464,7 @@ final class PhabricatorProjectCoreTestCase extends PhabricatorTestCase {
$editor = id(new PhabricatorProjectTransactionEditor()) $editor = id(new PhabricatorProjectTransactionEditor())
->setActor($user) ->setActor($user)
->setContentSource(PhabricatorContentSource::newConsoleSource()) ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->applyTransactions($project, $xactions); ->applyTransactions($project, $xactions);
} }

View file

@ -71,7 +71,7 @@ final class ProjectCreateConduitAPIMethod extends ProjectConduitAPIMethod {
$editor = id(new PhabricatorProjectTransactionEditor()) $editor = id(new PhabricatorProjectTransactionEditor())
->setActor($user) ->setActor($user)
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSourceFromConduitRequest($request); ->setContentSource($request->newContentSource());
$editor->applyTransactions($project, $xactions); $editor->applyTransactions($project, $xactions);

View file

@ -144,10 +144,7 @@ final class ReleephRequestConduitAPIMethod extends ReleephConduitAPIMethod {
$editor = id(new ReleephRequestTransactionalEditor()) $editor = id(new ReleephRequestTransactionalEditor())
->setActor($user) ->setActor($user)
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSource( ->setContentSource($request->newContentSource());
PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_CONDUIT,
array()));
$editor->applyTransactions($releeph_request, $xactions); $editor->applyTransactions($releeph_request, $xactions);
} }

View file

@ -65,10 +65,7 @@ final class ReleephWorkRecordConduitAPIMethod
$editor = id(new ReleephRequestTransactionalEditor()) $editor = id(new ReleephRequestTransactionalEditor())
->setActor($request->getUser()) ->setActor($request->getUser())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSource( ->setContentSource($request->newContentSource());
PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_CONDUIT,
array()));
$editor->applyTransactions($releeph_request, $xactions); $editor->applyTransactions($releeph_request, $xactions);
} }

View file

@ -64,10 +64,7 @@ final class ReleephWorkRecordPickStatusConduitAPIMethod
$editor = id(new ReleephRequestTransactionalEditor()) $editor = id(new ReleephRequestTransactionalEditor())
->setActor($request->getUser()) ->setActor($request->getUser())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSource( ->setContentSource($request->newContentSource());
PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_CONDUIT,
array()));
$xactions = array(); $xactions = array();

View file

@ -301,8 +301,7 @@ final class DifferentialReleephRequestFieldSpecification extends Phobject {
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)
->setContentSource( ->setContentSource(
PhabricatorContentSource::newForSource( PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_UNKNOWN, PhabricatorUnknownContentSource::SOURCECONST));
array()));
$editor->applyTransactions($releeph_request, $xactions); $editor->applyTransactions($releeph_request, $xactions);
} }

View file

@ -117,7 +117,7 @@ final class PhabricatorRepositoryManagementEditWorkflow
pht('Specify one or more fields to edit!')); pht('Specify one or more fields to edit!'));
} }
$content_source = PhabricatorContentSource::newConsoleSource(); $content_source = $this->newContentSource();
$editor = id(new PhabricatorRepositoryEditor()) $editor = id(new PhabricatorRepositoryEditor())
->setActor($actor) ->setActor($actor)

View file

@ -30,9 +30,7 @@ final class PhabricatorRepositoryCommitHeraldWorker
$commit->attachRepository($repository); $commit->attachRepository($repository);
$content_source = PhabricatorContentSource::newForSource( $content_source = $this->newContentSource();
PhabricatorContentSource::SOURCE_DAEMON,
array());
$committer_phid = $data->getCommitDetail('committerPHID'); $committer_phid = $data->getCommitDetail('committerPHID');
$author_phid = $data->getCommitDetail('authorPHID'); $author_phid = $data->getCommitDetail('authorPHID');

View file

@ -221,9 +221,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
->setViewer($actor) ->setViewer($actor)
->setAuthorPHID($acting_as_phid); ->setAuthorPHID($acting_as_phid);
$content_source = PhabricatorContentSource::newForSource( $content_source = $this->newContentSource();
PhabricatorContentSource::SOURCE_DAEMON,
array());
$update_data = $extraction_engine->updateRevisionWithCommit( $update_data = $extraction_engine->updateRevisionWithCommit(
$revision, $revision,
@ -337,9 +335,7 @@ abstract class PhabricatorRepositoryCommitMessageParserWorker
$xactions[] = $edge_xaction; $xactions[] = $edge_xaction;
$content_source = PhabricatorContentSource::newForSource( $content_source = $this->newContentSource();
PhabricatorContentSource::SOURCE_DAEMON,
array());
$editor = id(new ManiphestTransactionEditor()) $editor = id(new ManiphestTransactionEditor())
->setActor($actor) ->setActor($actor)

View file

@ -215,7 +215,7 @@ final class PhabricatorSpacesTestCase extends PhabricatorTestCase {
->setNewValue($is_default); ->setNewValue($is_default);
} }
$content_source = PhabricatorContentSource::newConsoleSource(); $content_source = $this->newContentSource();
$editor = id(new PhabricatorSpacesNamespaceEditor()) $editor = id(new PhabricatorSpacesNamespaceEditor())
->setActor($actor) ->setActor($actor)

View file

@ -22,7 +22,7 @@ final class TokenGiveConduitAPIMethod extends TokenConduitAPIMethod {
} }
protected function execute(ConduitAPIRequest $request) { protected function execute(ConduitAPIRequest $request) {
$content_source = PhabricatorContentSource::newFromConduitRequest($request); $content_source = $request->newContentSource();
$editor = id(new PhabricatorTokenGivenEditor()) $editor = id(new PhabricatorTokenGivenEditor())
->setActor($request->getUser()) ->setActor($request->getUser())

View file

@ -37,9 +37,9 @@ final class PhabricatorApplicationTransactionCommentRawController
$addendum = null; $addendum = null;
if ($request->getExists('email')) { if ($request->getExists('email')) {
$content_source = $xaction->getContentSource(); $content_source = $xaction->getContentSource();
$source_email = PhabricatorContentSource::SOURCE_EMAIL; $source_email = PhabricatorEmailContentSource::SOURCECONST;
if ($content_source->getSource() == $source_email) { if ($content_source->getSource() == $source_email) {
$source_id = $content_source->getParam('id'); $source_id = $content_source->getContentSourceParameter('id');
if ($source_id) { if ($source_id) {
$message = id(new PhabricatorMetaMTAReceivedMail())->loadOneWhere( $message = id(new PhabricatorMetaMTAReceivedMail())->loadOneWhere(
'id = %d', 'id = %d',

View file

@ -1684,7 +1684,7 @@ abstract class PhabricatorEditEngine
$editor = $object->getApplicationTransactionEditor() $editor = $object->getApplicationTransactionEditor()
->setActor($viewer) ->setActor($viewer)
->setContentSourceFromConduitRequest($request) ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true); ->setContinueOnNoEffect(true);
if (!$this->getIsCreate()) { if (!$this->getIsCreate()) {

View file

@ -733,16 +733,6 @@ abstract class PhabricatorApplicationTransactionEditor
PhabricatorContentSource::newFromRequest($request)); PhabricatorContentSource::newFromRequest($request));
} }
public function setContentSourceFromConduitRequest(
ConduitAPIRequest $request) {
$content_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_CONDUIT,
array());
return $this->setContentSource($content_source);
}
public function getContentSource() { public function getContentSource() {
return $this->contentSource; return $this->contentSource;
} }
@ -979,8 +969,7 @@ abstract class PhabricatorApplicationTransactionEditor
// out from transcripts, but it would be cleaner if you didn't have to. // out from transcripts, but it would be cleaner if you didn't have to.
$herald_source = PhabricatorContentSource::newForSource( $herald_source = PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_HERALD, PhabricatorHeraldContentSource::SOURCECONST);
array());
$herald_editor = newv(get_class($this), array()) $herald_editor = newv(get_class($this), array())
->setContinueOnNoEffect(true) ->setContinueOnNoEffect(true)

View file

@ -18,11 +18,7 @@ abstract class PhabricatorApplicationTransactionReplyHandler
} }
private function newEditor(PhabricatorMetaMTAReceivedMail $mail) { private function newEditor(PhabricatorMetaMTAReceivedMail $mail) {
$content_source = PhabricatorContentSource::newForSource( $content_source = $mail->newContentSource();
PhabricatorContentSource::SOURCE_EMAIL,
array(
'id' => $mail->getID(),
));
$editor = $this->getMailReceiver() $editor = $this->getMailReceiver()
->getApplicationTransactionEditor() ->getApplicationTransactionEditor()

View file

@ -62,9 +62,7 @@ final class PhabricatorApplicationTransactionPublishWorker
PhabricatorApplicationTransactionInterface $object) { PhabricatorApplicationTransactionInterface $object) {
$data = $this->getTaskData(); $data = $this->getTaskData();
$daemon_source = PhabricatorContentSource::newForSource( $daemon_source = $this->newContentSource();
PhabricatorContentSource::SOURCE_DAEMON,
array());
$viewer = PhabricatorUser::getOmnipotentUser(); $viewer = PhabricatorUser::getOmnipotentUser();
$editor = $object->getApplicationTransactionEditor() $editor = $object->getApplicationTransactionEditor()

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorConduitContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'conduit';
public function getSourceName() {
return pht('Conduit');
}
public function getSourceDescription() {
return pht('Content from the Conduit API.');
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorConsoleContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'console';
public function getSourceName() {
return pht('Console');
}
public function getSourceDescription() {
return pht('Content generated by CLI administrative tools.');
}
}

View file

@ -0,0 +1,92 @@
<?php
abstract class PhabricatorContentSource extends Phobject {
private $source;
private $params = array();
abstract public function getSourceName();
abstract public function getSourceDescription();
final public function getSourceTypeConstant() {
return $this->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);
}
}

View file

@ -0,0 +1,51 @@
<?php
final class PhabricatorContentSourceModule
extends PhabricatorConfigModule {
public function getModuleKey() {
return 'contentsource';
}
public function getModuleName() {
return pht('Content Sources');
}
public function renderModuleStatus(AphrontRequest $request) {
$viewer = $request->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);
}
}

View file

@ -10,21 +10,14 @@ final class PhabricatorContentSourceView extends AphrontView {
} }
public function getSourceName() { public function getSourceName() {
$map = PhabricatorContentSource::getSourceNameMap(); return $this->contentSource->getSourceName();
$source = $this->contentSource->getSource();
return idx($map, $source, null);
} }
public function render() { public function render() {
require_celerity_resource('phabricator-content-source-view-css'); require_celerity_resource('phabricator-content-source-view-css');
$map = PhabricatorContentSource::getSourceNameMap(); $name = $this->getSourceName();
if ($name === null) {
$source = $this->contentSource->getSource();
$type = idx($map, $source, null);
if (!$type) {
return null; return null;
} }
@ -33,7 +26,7 @@ final class PhabricatorContentSourceView extends AphrontView {
array( array(
'class' => 'phabricator-content-source-view', 'class' => 'phabricator-content-source-view',
), ),
pht('Via %s', $type)); pht('Via %s', $name));
} }
} }

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorFaxContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'fax';
public function getSourceName() {
return pht('Fax');
}
public function getSourceDescription() {
return pht('Content received via fax (telefacsimile).');
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorLipsumContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'lipsum';
public function getSourceName() {
return pht('Lipsum');
}
public function getSourceDescription() {
return pht('Test data created with bin/lipsum.');
}
}

View file

@ -0,0 +1,17 @@
<?php
final class PhabricatorOldWorldContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'legacy';
public function getSourceName() {
return pht('Old World');
}
public function getSourceDescription() {
return pht(
'Content from the distant past, before content sources existed.');
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorUnitTestContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'unittest';
public function getSourceName() {
return pht('Unit Test');
}
public function getSourceDescription() {
return pht('Content created by unit tests.');
}
}

View file

@ -0,0 +1,21 @@
<?php
final class PhabricatorUnknownContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'unknown';
public function getSourceName() {
$source = $this->getSource();
if (strlen($source)) {
return pht('Unknown ("%s")', $source);
} else {
return pht('Unknown');
}
}
public function getSourceDescription() {
return pht('Content with no known source.');
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorWebContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'web';
public function getSourceName() {
return pht('Web');
}
public function getSourceDescription() {
return pht('Content created from the web UI.');
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorBulkContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'bulk';
public function getSourceName() {
return pht('Bulk Update');
}
public function getSourceDescription() {
return pht('Changes made by bulk update.');
}
}

View file

@ -0,0 +1,16 @@
<?php
final class PhabricatorDaemonContentSource
extends PhabricatorContentSource {
const SOURCECONST = 'daemon';
public function getSourceName() {
return pht('Daemon');
}
public function getSourceDescription() {
return pht('Updates from background processing in daemons.');
}
}

View file

@ -305,4 +305,9 @@ abstract class PhabricatorWorker extends Phobject {
$epoch_ago); $epoch_ago);
} }
protected function newContentSource() {
return PhabricatorContentSource::newForSource(
PhabricatorDaemonContentSource::SOURCECONST);
}
} }

View file

@ -121,9 +121,7 @@ abstract class PhabricatorWorkerBulkJobWorker
->setTransactionType($type_status) ->setTransactionType($type_status)
->setNewValue($status); ->setNewValue($status);
$daemon_source = PhabricatorContentSource::newForSource( $daemon_source = $this->newContentSource();
PhabricatorContentSource::SOURCE_DAEMON,
array());
$app_phid = id(new PhabricatorDaemonsApplication())->getPHID(); $app_phid = id(new PhabricatorDaemonsApplication())->getPHID();

View file

@ -102,7 +102,7 @@ final class PhabricatorWorkerBulkJob
public function newContentSource() { public function newContentSource() {
return PhabricatorContentSource::newForSource( return PhabricatorContentSource::newForSource(
PhabricatorContentSource::SOURCE_BULK, PhabricatorBulkContentSource::SOURCECONST,
array( array(
'jobID' => $this->getID(), 'jobID' => $this->getID(),
)); ));

View file

@ -26,4 +26,9 @@ abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow {
return $epoch; return $epoch;
} }
protected function newContentSource() {
return PhabricatorContentSource::newForSource(
PhabricatorConsoleContentSource::SOURCECONST);
}
} }

View file

@ -229,5 +229,9 @@ abstract class PhabricatorTestCase extends PhutilTestCase {
} }
} }
protected function newContentSource() {
return PhabricatorContentSource::newForSource(
PhabricatorUnitTestContentSource::SOURCECONST);
}
} }

View file

@ -622,9 +622,9 @@ final class PHUITimelineEventView extends AphrontView {
)); ));
$content_source = $this->getContentSource(); $content_source = $this->getContentSource();
$source_email = PhabricatorContentSource::SOURCE_EMAIL; $source_email = PhabricatorEmailContentSource::SOURCECONST;
if ($content_source->getSource() == $source_email) { if ($content_source->getSource() == $source_email) {
$source_id = $content_source->getParam('id'); $source_id = $content_source->getContentSourceParameter('id');
if ($source_id) { if ($source_id) {
$items[] = id(new PhabricatorActionView()) $items[] = id(new PhabricatorActionView())
->setIcon('fa-envelope-o') ->setIcon('fa-envelope-o')