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:
parent
d784d9c044
commit
601aaa5a86
83 changed files with 495 additions and 265 deletions
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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']);
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -34,8 +34,7 @@ final class PhabricatorAuditInlineComment
|
|||
|
||||
public function getTransactionCommentForSave() {
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_LEGACY,
|
||||
array());
|
||||
PhabricatorOldWorldContentSource::SOURCECONST);
|
||||
|
||||
$this->proxy
|
||||
->setViewPolicy('public')
|
||||
|
|
|
@ -57,4 +57,9 @@ final class ConduitAPIRequest extends Phobject {
|
|||
return $this->isClusterRequest;
|
||||
}
|
||||
|
||||
public function newContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorConduitContentSource::SOURCECONST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -42,7 +42,7 @@ final class ConpherenceCreateThreadConduitAPIMethod
|
|||
$participant_phids,
|
||||
$title,
|
||||
$message,
|
||||
PhabricatorContentSource::newFromConduitRequest($request));
|
||||
$request->newContentSource());
|
||||
|
||||
if ($errors) {
|
||||
foreach ($errors as $error_code) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -138,7 +138,7 @@ abstract class DifferentialConduitAPIMethod extends ConduitAPIMethod {
|
|||
|
||||
$editor = id(new DifferentialTransactionEditor())
|
||||
->setActor($viewer)
|
||||
->setContentSourceFromConduitRequest($request)
|
||||
->setContentSource($request->newContentSource())
|
||||
->setContinueOnNoEffect(true)
|
||||
->setContinueOnMissingFields(true);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ final class DifferentialCreateDiffConduitAPIMethod
|
|||
|
||||
id(new DifferentialDiffEditor())
|
||||
->setActor($viewer)
|
||||
->setContentSourceFromConduitRequest($request)
|
||||
->setContentSource($request->newContentSource())
|
||||
->setContinueOnNoEffect(true)
|
||||
->applyTransactions($diff, $xactions);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -18,8 +18,7 @@ final class DifferentialInlineComment
|
|||
|
||||
public function getTransactionCommentForSave() {
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_LEGACY,
|
||||
array());
|
||||
PhabricatorOldWorldContentSource::SOURCECONST);
|
||||
|
||||
$this->proxy
|
||||
->setViewPolicy('public')
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -24,12 +24,13 @@ final class HeraldContentSourceField extends HeraldField {
|
|||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
$map = PhabricatorContentSource::getSourceNameMap();
|
||||
$map = PhabricatorContentSource::getAllContentSources();
|
||||
$map = mpull($map, 'getSourceName');
|
||||
asort($map);
|
||||
|
||||
return id(new HeraldSelectFieldValue())
|
||||
->setKey(self::FIELDCONST)
|
||||
->setDefault(PhabricatorContentSource::SOURCE_WEB)
|
||||
->setDefault(PhabricatorWebContentSource::SOURCECONST)
|
||||
->setOptions($map);
|
||||
}
|
||||
|
||||
|
|
|
@ -56,8 +56,7 @@ abstract class PhabricatorTestDataGenerator extends Phobject {
|
|||
|
||||
protected function getLipsumContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_LIPSUM,
|
||||
array());
|
||||
PhabricatorLipsumContentSource::SOURCECONST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -371,4 +371,12 @@ EOBODY
|
|||
->saveAndSend();
|
||||
}
|
||||
|
||||
public function newContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorEmailContentSource::SOURCECONST,
|
||||
array(
|
||||
'id' => $this->getID(),
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -12,8 +12,7 @@ abstract class PhortuneProductImplementation extends Phobject {
|
|||
|
||||
protected function getContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_PHORTUNE,
|
||||
array());
|
||||
PhabricatorPhortuneContentSource::SOURCECONST);
|
||||
}
|
||||
|
||||
public function getPurchaseName(
|
||||
|
|
|
@ -431,8 +431,7 @@ final class PhortuneCart extends PhortuneDAO
|
|||
->setNewValue(true);
|
||||
|
||||
$content_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_PHORTUNE,
|
||||
array());
|
||||
PhabricatorPhortuneContentSource::SOURCECONST);
|
||||
|
||||
$editor = id(new PhortuneCartEditor())
|
||||
->setActor($omnipotent_user)
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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'));
|
||||
|
||||
|
|
|
@ -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'));
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -1684,7 +1684,7 @@ abstract class PhabricatorEditEngine
|
|||
|
||||
$editor = $object->getApplicationTransactionEditor()
|
||||
->setActor($viewer)
|
||||
->setContentSourceFromConduitRequest($request)
|
||||
->setContentSource($request->newContentSource())
|
||||
->setContinueOnNoEffect(true);
|
||||
|
||||
if (!$this->getIsCreate()) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
|
@ -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).');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -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.');
|
||||
}
|
||||
|
||||
}
|
|
@ -305,4 +305,9 @@ abstract class PhabricatorWorker extends Phobject {
|
|||
$epoch_ago);
|
||||
}
|
||||
|
||||
protected function newContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorDaemonContentSource::SOURCECONST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -121,9 +121,7 @@ abstract class PhabricatorWorkerBulkJobWorker
|
|||
->setTransactionType($type_status)
|
||||
->setNewValue($status);
|
||||
|
||||
$daemon_source = PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_DAEMON,
|
||||
array());
|
||||
$daemon_source = $this->newContentSource();
|
||||
|
||||
$app_phid = id(new PhabricatorDaemonsApplication())->getPHID();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ final class PhabricatorWorkerBulkJob
|
|||
|
||||
public function newContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorContentSource::SOURCE_BULK,
|
||||
PhabricatorBulkContentSource::SOURCECONST,
|
||||
array(
|
||||
'jobID' => $this->getID(),
|
||||
));
|
||||
|
|
|
@ -26,4 +26,9 @@ abstract class PhabricatorManagementWorkflow extends PhutilArgumentWorkflow {
|
|||
return $epoch;
|
||||
}
|
||||
|
||||
protected function newContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorConsoleContentSource::SOURCECONST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -229,5 +229,9 @@ abstract class PhabricatorTestCase extends PhutilTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
protected function newContentSource() {
|
||||
return PhabricatorContentSource::newForSource(
|
||||
PhabricatorUnitTestContentSource::SOURCECONST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in a new issue