Page MenuHomePhabricator

D15521.id37433.diff
No OneTemporary

D15521.id37433.diff

diff --git a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php
--- a/resources/sql/autopatches/20140211.dx.2.migcommenttext.php
+++ b/resources/sql/autopatches/20140211.dx.2.migcommenttext.php
@@ -4,8 +4,7 @@
$rows = new LiskRawMigrationIterator($conn_w, 'differential_comment');
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
echo pht('Migrating Differential comment text to modern storage...')."\n";
foreach ($rows as $row) {
diff --git a/resources/sql/autopatches/20140212.dx.1.armageddon.php b/resources/sql/autopatches/20140212.dx.1.armageddon.php
--- a/resources/sql/autopatches/20140212.dx.1.armageddon.php
+++ b/resources/sql/autopatches/20140212.dx.1.armageddon.php
@@ -4,8 +4,7 @@
$rows = new LiskRawMigrationIterator($conn_w, 'differential_comment');
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
echo pht('Migrating Differential comments to modern storage...')."\n";
foreach ($rows as $row) {
diff --git a/resources/sql/autopatches/20140722.audit.3.miginlines.php b/resources/sql/autopatches/20140722.audit.3.miginlines.php
--- a/resources/sql/autopatches/20140722.audit.3.miginlines.php
+++ b/resources/sql/autopatches/20140722.audit.3.miginlines.php
@@ -10,8 +10,7 @@
echo pht('Migrating Audit inline comments to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) {
diff --git a/resources/sql/autopatches/20140722.audit.4.migtext.php b/resources/sql/autopatches/20140722.audit.4.migtext.php
--- a/resources/sql/autopatches/20140722.audit.4.migtext.php
+++ b/resources/sql/autopatches/20140722.audit.4.migtext.php
@@ -4,8 +4,7 @@
$rows = new LiskRawMigrationIterator($conn_w, 'audit_comment');
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
echo pht('Migrating Audit comment text to modern storage...')."\n";
foreach ($rows as $row) {
diff --git a/resources/sql/autopatches/20140725.audit.1.migxactions.php b/resources/sql/autopatches/20140725.audit.1.migxactions.php
--- a/resources/sql/autopatches/20140725.audit.1.migxactions.php
+++ b/resources/sql/autopatches/20140725.audit.1.migxactions.php
@@ -4,8 +4,7 @@
$rows = new LiskRawMigrationIterator($conn_w, 'audit_comment');
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
echo pht('Migrating Audit comments to modern storage...')."\n";
foreach ($rows as $row) {
diff --git a/resources/sql/patches/20130715.votecomments.php b/resources/sql/patches/20130715.votecomments.php
--- a/resources/sql/patches/20130715.votecomments.php
+++ b/resources/sql/patches/20130715.votecomments.php
@@ -46,9 +46,8 @@
PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST,
PhabricatorSlowvotePollPHIDType::TYPECONST);
- $source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ $content_source = PhabricatorContentSource::newForSource(
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
queryfx(
$conn_w,
diff --git a/resources/sql/patches/20130728.ponderxcomment.php b/resources/sql/patches/20130728.ponderxcomment.php
--- a/resources/sql/patches/20130728.ponderxcomment.php
+++ b/resources/sql/patches/20130728.ponderxcomment.php
@@ -49,8 +49,7 @@
1,
$row['content'],
PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize(),
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize(),
0,
$row['dateCreated'],
$row['dateModified']);
@@ -73,8 +72,7 @@
'null',
'null',
PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize(),
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize(),
'[]',
$row['dateCreated'],
$row['dateModified']);
diff --git a/resources/sql/patches/20130801.pastexactions.php b/resources/sql/patches/20130801.pastexactions.php
--- a/resources/sql/patches/20130801.pastexactions.php
+++ b/resources/sql/patches/20130801.pastexactions.php
@@ -34,8 +34,7 @@
'null',
$row['filePHID'],
PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize(),
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize(),
'[]',
$row['dateCreated'],
$row['dateCreated'],
diff --git a/resources/sql/patches/20130926.dinline.php b/resources/sql/patches/20130926.dinline.php
--- a/resources/sql/patches/20130926.dinline.php
+++ b/resources/sql/patches/20130926.dinline.php
@@ -10,8 +10,7 @@
echo pht('Migrating Differential inline comments to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) {
diff --git a/resources/sql/patches/20131020.pxactionmig.php b/resources/sql/patches/20131020.pxactionmig.php
--- a/resources/sql/patches/20131020.pxactionmig.php
+++ b/resources/sql/patches/20131020.pxactionmig.php
@@ -10,8 +10,7 @@
echo pht('Migrating Project transactions to new format...')."\n";
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array())->serialize();
+ PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
$rows = new LiskRawMigrationIterator($conn_w, $src_table);
foreach ($rows as $row) {
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1919,6 +1919,7 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'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 @@
'PhabricatorBotWhatsNewHandler' => 'PhabricatorBotHandler',
'PhabricatorBritishEnglishTranslation' => 'PhutilTranslation',
'PhabricatorBuiltinPatchList' => 'PhabricatorSQLPatchList',
+ 'PhabricatorBulkContentSource' => 'PhabricatorContentSource',
'PhabricatorBusyUIExample' => 'PhabricatorUIExample',
'PhabricatorCacheDAO' => 'PhabricatorLiskDAO',
'PhabricatorCacheGeneralGarbageCollector' => 'PhabricatorGarbageCollector',
@@ -6369,6 +6384,7 @@
'PhabricatorConduitCertificateToken' => 'PhabricatorConduitDAO',
'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO',
'PhabricatorConduitConsoleController' => 'PhabricatorConduitController',
+ 'PhabricatorConduitContentSource' => 'PhabricatorContentSource',
'PhabricatorConduitController' => 'PhabricatorController',
'PhabricatorConduitDAO' => 'PhabricatorLiskDAO',
'PhabricatorConduitEditField' => 'PhabricatorEditField',
@@ -6469,7 +6485,9 @@
'PhabricatorConpherencePreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorConpherenceThreadPHIDType' => 'PhabricatorPHIDType',
'PhabricatorConsoleApplication' => 'PhabricatorApplication',
+ 'PhabricatorConsoleContentSource' => 'PhabricatorContentSource',
'PhabricatorContentSource' => 'Phobject',
+ 'PhabricatorContentSourceModule' => 'PhabricatorConfigModule',
'PhabricatorContentSourceView' => 'AphrontView',
'PhabricatorContributedToObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorController' => 'AphrontController',
@@ -6535,6 +6553,7 @@
'PhabricatorDaemonBulkJobMonitorController' => 'PhabricatorDaemonController',
'PhabricatorDaemonBulkJobViewController' => 'PhabricatorDaemonController',
'PhabricatorDaemonConsoleController' => 'PhabricatorDaemonController',
+ 'PhabricatorDaemonContentSource' => 'PhabricatorContentSource',
'PhabricatorDaemonController' => 'PhabricatorController',
'PhabricatorDaemonDAO' => 'PhabricatorLiskDAO',
'PhabricatorDaemonEventListener' => 'PhabricatorEventListener',
@@ -6726,6 +6745,7 @@
'PhabricatorElasticFulltextStorageEngine' => 'PhabricatorFulltextStorageEngine',
'PhabricatorElasticSearchSetupCheck' => 'PhabricatorSetupCheck',
'PhabricatorEmailAddressesSettingsPanel' => 'PhabricatorSettingsPanel',
+ 'PhabricatorEmailContentSource' => 'PhabricatorContentSource',
'PhabricatorEmailFormatSettingsPanel' => 'PhabricatorSettingsPanel',
'PhabricatorEmailLoginController' => 'PhabricatorAuthController',
'PhabricatorEmailPreferencesSettingsPanel' => 'PhabricatorSettingsPanel',
@@ -6773,6 +6793,7 @@
'PhabricatorFactSimpleSpec' => 'PhabricatorFactSpec',
'PhabricatorFactSpec' => 'Phobject',
'PhabricatorFactUpdateIterator' => 'PhutilBufferedIterator',
+ 'PhabricatorFaxContentSource' => 'PhabricatorContentSource',
'PhabricatorFeedApplication' => 'PhabricatorApplication',
'PhabricatorFeedBuilder' => 'Phobject',
'PhabricatorFeedConfigOptions' => 'PhabricatorApplicationConfigOptions',
@@ -6935,6 +6956,7 @@
'PhabricatorHelpKeyboardShortcutController' => 'PhabricatorHelpController',
'PhabricatorHelpMainMenuBarExtension' => 'PhabricatorMainMenuBarExtension',
'PhabricatorHeraldApplication' => 'PhabricatorApplication',
+ 'PhabricatorHeraldContentSource' => 'PhabricatorContentSource',
'PhabricatorHighSecurityRequestExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorHomeApplication' => 'PhabricatorApplication',
'PhabricatorHomeController' => 'PhabricatorController',
@@ -6983,6 +7005,7 @@
'PhabricatorLibraryTestCase' => 'PhutilLibraryTestCase',
'PhabricatorLinkProfilePanel' => 'PhabricatorProfilePanel',
'PhabricatorLipsumArtist' => 'Phobject',
+ 'PhabricatorLipsumContentSource' => 'PhabricatorContentSource',
'PhabricatorLipsumGenerateWorkflow' => 'PhabricatorLipsumManagementWorkflow',
'PhabricatorLipsumManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorLipsumMondrianArtist' => 'PhabricatorLipsumArtist',
@@ -7218,6 +7241,7 @@
'PhabricatorObjectSelectorDialog' => 'Phobject',
'PhabricatorObjectUsesCredentialsEdgeType' => 'PhabricatorEdgeType',
'PhabricatorOffsetPagedQuery' => 'PhabricatorQuery',
+ 'PhabricatorOldWorldContentSource' => 'PhabricatorContentSource',
'PhabricatorOneTimeTriggerClock' => 'PhabricatorTriggerClock',
'PhabricatorOpcodeCacheSpec' => 'PhabricatorCacheSpec',
'PhabricatorOwnerPathQuery' => 'Phobject',
@@ -7375,6 +7399,7 @@
'PhabricatorPholioConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorPholioMockTestDataGenerator' => 'PhabricatorTestDataGenerator',
'PhabricatorPhortuneApplication' => 'PhabricatorApplication',
+ 'PhabricatorPhortuneContentSource' => 'PhabricatorContentSource',
'PhabricatorPhortuneManagementInvoiceWorkflow' => 'PhabricatorPhortuneManagementWorkflow',
'PhabricatorPhortuneManagementWorkflow' => 'PhabricatorManagementWorkflow',
'PhabricatorPhragmentApplication' => 'PhabricatorApplication',
@@ -8094,7 +8119,9 @@
'PhabricatorUIExampleRenderController' => 'PhabricatorController',
'PhabricatorUIExamplesApplication' => 'PhabricatorApplication',
'PhabricatorUSEnglishTranslation' => 'PhutilTranslation',
+ 'PhabricatorUnitTestContentSource' => 'PhabricatorContentSource',
'PhabricatorUnitsTestCase' => 'PhabricatorTestCase',
+ 'PhabricatorUnknownContentSource' => 'PhabricatorContentSource',
'PhabricatorUnsubscribedFromObjectEdgeType' => 'PhabricatorEdgeType',
'PhabricatorUser' => array(
'PhabricatorUserDAO',
@@ -8150,6 +8177,7 @@
'PhabricatorVeryWowEnglishTranslation' => 'PhutilTranslation',
'PhabricatorViewerDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorWatcherHasObjectEdgeType' => 'PhabricatorEdgeType',
+ 'PhabricatorWebContentSource' => 'PhabricatorContentSource',
'PhabricatorWordPressAuthProvider' => 'PhabricatorOAuth2AuthProvider',
'PhabricatorWorker' => 'Phobject',
'PhabricatorWorkerActiveTask' => 'PhabricatorWorkerTask',
diff --git a/src/applications/almanac/management/AlmanacManagementWorkflow.php b/src/applications/almanac/management/AlmanacManagementWorkflow.php
--- a/src/applications/almanac/management/AlmanacManagementWorkflow.php
+++ b/src/applications/almanac/management/AlmanacManagementWorkflow.php
@@ -3,7 +3,6 @@
abstract class AlmanacManagementWorkflow
extends PhabricatorManagementWorkflow {
-
protected function loadServices(array $names) {
if (!$names) {
return array();
@@ -37,7 +36,7 @@
$editor = id(new AlmanacServiceEditor())
->setActor($this->getViewer())
->setActingAsPHID($almanac_phid)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnMissingFields(true);
$editor->applyTransactions($service, array($xaction));
diff --git a/src/applications/audit/storage/PhabricatorAuditInlineComment.php b/src/applications/audit/storage/PhabricatorAuditInlineComment.php
--- a/src/applications/audit/storage/PhabricatorAuditInlineComment.php
+++ b/src/applications/audit/storage/PhabricatorAuditInlineComment.php
@@ -34,8 +34,7 @@
public function getTransactionCommentForSave() {
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array());
+ PhabricatorOldWorldContentSource::SOURCECONST);
$this->proxy
->setViewPolicy('public')
diff --git a/src/applications/conduit/protocol/ConduitAPIRequest.php b/src/applications/conduit/protocol/ConduitAPIRequest.php
--- a/src/applications/conduit/protocol/ConduitAPIRequest.php
+++ b/src/applications/conduit/protocol/ConduitAPIRequest.php
@@ -57,4 +57,9 @@
return $this->isClusterRequest;
}
+ public function newContentSource() {
+ return PhabricatorContentSource::newForSource(
+ PhabricatorConduitContentSource::SOURCECONST);
+ }
+
}
diff --git a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
--- a/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
+++ b/src/applications/conpherence/__tests__/ConpherenceRoomTestCase.php
@@ -147,7 +147,7 @@
id(new ConpherenceEditor())
->setActor($creator)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($conpherence, $xactions);
@@ -166,7 +166,7 @@
id(new ConpherenceEditor())
->setActor($actor)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($room, $xactions);
}
diff --git a/src/applications/conpherence/__tests__/ConpherenceTestCase.php b/src/applications/conpherence/__tests__/ConpherenceTestCase.php
--- a/src/applications/conpherence/__tests__/ConpherenceTestCase.php
+++ b/src/applications/conpherence/__tests__/ConpherenceTestCase.php
@@ -14,7 +14,7 @@
);
$editor = id(new ConpherenceEditor())
->setActor($actor)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->applyTransactions($conpherence, $xactions);
}
@@ -31,7 +31,7 @@
);
$editor = id(new ConpherenceEditor())
->setActor($actor)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->applyTransactions($conpherence, $xactions);
}
@@ -45,7 +45,7 @@
$editor = id(new ConpherenceEditor())
->setActor($actor)
- ->setContentSource(PhabricatorContentSource::newConsoleSource());
+ ->setContentSource($this->newContentSource());
$xactions = $editor->generateTransactionsFromText(
$actor,
diff --git a/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php
--- a/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php
+++ b/src/applications/conpherence/conduit/ConpherenceCreateThreadConduitAPIMethod.php
@@ -42,7 +42,7 @@
$participant_phids,
$title,
$message,
- PhabricatorContentSource::newFromConduitRequest($request));
+ $request->newContentSource());
if ($errors) {
foreach ($errors as $error_code) {
diff --git a/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php b/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
--- a/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
+++ b/src/applications/conpherence/conduit/ConpherenceUpdateThreadConduitAPIMethod.php
@@ -58,7 +58,7 @@
throw new ConduitException('ERR_USAGE_ROOM_NOT_FOUND');
}
- $source = PhabricatorContentSource::newFromConduitRequest($request);
+ $source = $request->newContentSource();
$editor = id(new ConpherenceEditor())
->setContentSource($source)
->setActor($user);
diff --git a/src/applications/conpherence/mail/ConpherenceReplyHandler.php b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
--- a/src/applications/conpherence/mail/ConpherenceReplyHandler.php
+++ b/src/applications/conpherence/mail/ConpherenceReplyHandler.php
@@ -48,11 +48,7 @@
$conpherence->attachParticipants($participants);
}
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_EMAIL,
- array(
- 'id' => $mail->getID(),
- ));
+ $content_source = $mail->newContentSource();
$editor = id(new ConpherenceEditor())
->setActor($user)
diff --git a/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCloseConduitAPIMethod.php
@@ -45,13 +45,11 @@
->setTransactionType(DifferentialTransaction::TYPE_ACTION)
->setNewValue(DifferentialAction::ACTION_CLOSE);
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_CONDUIT,
- array());
+ $content_source = $request->newContentSource();
$editor = id(new DifferentialTransactionEditor())
->setActor($viewer)
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnMissingFields(true)
->setContinueOnNoEffect(true);
diff --git a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialConduitAPIMethod.php
@@ -138,7 +138,7 @@
$editor = id(new DifferentialTransactionEditor())
->setActor($viewer)
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true);
diff --git a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateCommentConduitAPIMethod.php
@@ -77,7 +77,7 @@
$editor = id(new DifferentialTransactionEditor())
->setActor($viewer)
->setDisableEmail($request->getValue('silent'))
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
->setContinueOnMissingFields(true);
diff --git a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateDiffConduitAPIMethod.php
@@ -144,7 +144,7 @@
id(new DifferentialDiffEditor())
->setActor($viewer)
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($diff, $xactions);
diff --git a/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php b/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php
--- a/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php
+++ b/src/applications/differential/conduit/DifferentialCreateRawDiffConduitAPIMethod.php
@@ -85,7 +85,7 @@
id(new DifferentialDiffEditor())
->setActor($viewer)
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
->setLookupRepository(false) // respect user choice
->applyTransactions($diff, $xactions);
diff --git a/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php b/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php
--- a/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php
+++ b/src/applications/differential/management/PhabricatorDifferentialAttachCommitWorkflow.php
@@ -68,9 +68,7 @@
->setViewer($viewer)
->setAuthorPHID($differential_phid);
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_CONSOLE,
- array());
+ $content_source = $this->newContentSource();
$extraction_engine->updateRevisionWithCommit(
$revision,
diff --git a/src/applications/differential/storage/DifferentialInlineComment.php b/src/applications/differential/storage/DifferentialInlineComment.php
--- a/src/applications/differential/storage/DifferentialInlineComment.php
+++ b/src/applications/differential/storage/DifferentialInlineComment.php
@@ -18,8 +18,7 @@
public function getTransactionCommentForSave() {
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LEGACY,
- array());
+ PhabricatorOldWorldContentSource::SOURCECONST);
$this->proxy
->setViewPolicy('public')
diff --git a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
--- a/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
+++ b/src/applications/diffusion/conduit/DiffusionCreateCommentConduitAPIMethod.php
@@ -95,7 +95,7 @@
id(new PhabricatorAuditEditor())
->setActor($request->getUser())
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setDisableEmail($request->getValue('silent'))
->setContinueOnMissingFields(true)
->applyTransactions($commit, $xactions);
diff --git a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php
--- a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php
+++ b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php
@@ -458,8 +458,7 @@
->getPHID();
$daemon_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ PhabricatorDaemonContentSource::SOURCECONST);
$editor = $object->getApplicationTransactionEditor()
->setActor($viewer)
diff --git a/src/applications/herald/contentsource/PhabricatorHeraldContentSource.php b/src/applications/herald/contentsource/PhabricatorHeraldContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/herald/contentsource/PhabricatorHeraldContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/applications/herald/field/HeraldContentSourceField.php b/src/applications/herald/field/HeraldContentSourceField.php
--- a/src/applications/herald/field/HeraldContentSourceField.php
+++ b/src/applications/herald/field/HeraldContentSourceField.php
@@ -24,12 +24,13 @@
}
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);
}
diff --git a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
--- a/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
+++ b/src/applications/lipsum/generator/PhabricatorTestDataGenerator.php
@@ -56,8 +56,7 @@
protected function getLipsumContentSource() {
return PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_LIPSUM,
- array());
+ PhabricatorLipsumContentSource::SOURCECONST);
}
/**
diff --git a/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php b/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
--- a/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
+++ b/src/applications/maniphest/__tests__/ManiphestTaskTestCase.php
@@ -207,7 +207,7 @@
ManiphestTask $task,
array $xactions) {
- $content_source = PhabricatorContentSource::newConsoleSource();
+ $content_source = $this->newContentSource();
$editor = id(new ManiphestTransactionEditor())
->setActor($viewer)
diff --git a/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php b/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
--- a/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
+++ b/src/applications/maniphest/conduit/ManiphestConduitAPIMethod.php
@@ -192,9 +192,7 @@
return;
}
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_CONDUIT,
- array());
+ $content_source = $request->newContentSource();
$editor = id(new ManiphestTransactionEditor())
->setActor($request->getUser())
diff --git a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
--- a/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
+++ b/src/applications/maniphest/lipsum/PhabricatorManiphestTaskTestDataGenerator.php
@@ -15,9 +15,7 @@
->setSubPriority($this->generateTaskSubPriority())
->setTitle($this->generateTitle());
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_UNKNOWN,
- array());
+ $content_source = $this->getLipsumContentSource();
$template = new ManiphestTransaction();
// Accumulate Transactions
diff --git a/src/applications/metamta/contentsource/PhabricatorContentSource.php b/src/applications/metamta/contentsource/PhabricatorContentSource.php
deleted file mode 100644
--- a/src/applications/metamta/contentsource/PhabricatorContentSource.php
+++ /dev/null
@@ -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);
- }
-
-}
diff --git a/src/applications/metamta/contentsource/PhabricatorEmailContentSource.php b/src/applications/metamta/contentsource/PhabricatorEmailContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/metamta/contentsource/PhabricatorEmailContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php
@@ -371,4 +371,12 @@
->saveAndSend();
}
+ public function newContentSource() {
+ return PhabricatorContentSource::newForSource(
+ PhabricatorEmailContentSource::SOURCECONST,
+ array(
+ 'id' => $this->getID(),
+ ));
+ }
+
}
diff --git a/src/applications/nuance/item/NuanceGitHubEventItemType.php b/src/applications/nuance/item/NuanceGitHubEventItemType.php
--- a/src/applications/nuance/item/NuanceGitHubEventItemType.php
+++ b/src/applications/nuance/item/NuanceGitHubEventItemType.php
@@ -323,10 +323,9 @@
// TODO: Preserve the item's original source.
$source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ PhabricatorDaemonContentSource::SOURCECONST);
- // TOOD: This should really be the external source.
+ // TODO: This should really be the external source.
$acting_phid = $nuance_phid;
$editor = id(new ManiphestTransactionEditor())
diff --git a/src/applications/nuance/item/NuanceItemType.php b/src/applications/nuance/item/NuanceItemType.php
--- a/src/applications/nuance/item/NuanceItemType.php
+++ b/src/applications/nuance/item/NuanceItemType.php
@@ -119,8 +119,7 @@
// TODO: Maybe preserve the actor's original content source?
$source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ PhabricatorDaemonContentSource::SOURCECONST);
$editor = id(new NuanceItemEditor())
->setActor($viewer)
diff --git a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
--- a/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
+++ b/src/applications/paste/conduit/PasteCreateConduitAPIMethod.php
@@ -61,7 +61,7 @@
$editor = id(new PhabricatorPasteEditor())
->setActor($viewer)
->setContinueOnNoEffect(true)
- ->setContentSourceFromConduitRequest($request);
+ ->setContentSource($request->newContentSource());
$xactions = $editor->applyTransactions($paste, $xactions);
diff --git a/src/applications/paste/mail/PasteCreateMailReceiver.php b/src/applications/paste/mail/PasteCreateMailReceiver.php
--- a/src/applications/paste/mail/PasteCreateMailReceiver.php
+++ b/src/applications/paste/mail/PasteCreateMailReceiver.php
@@ -37,11 +37,7 @@
$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 @@
->saveAndSend();
}
+
}
diff --git a/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php b/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php
--- a/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php
+++ b/src/applications/pholio/lipsum/PhabricatorPholioMockTestDataGenerator.php
@@ -13,9 +13,8 @@
->loadOneWhere('phid = %s', $author_phid);
$mock = PholioMock::initializeNewMock($author);
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_UNKNOWN,
- array());
+ $content_source = $this->getLipsumContentSource();
+
$template = id(new PholioTransaction())
->setContentSource($content_source);
diff --git a/src/applications/phortune/contentsource/PhabricatorPhortuneContentSource.php b/src/applications/phortune/contentsource/PhabricatorPhortuneContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/phortune/contentsource/PhabricatorPhortuneContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/applications/phortune/product/PhortuneProductImplementation.php b/src/applications/phortune/product/PhortuneProductImplementation.php
--- a/src/applications/phortune/product/PhortuneProductImplementation.php
+++ b/src/applications/phortune/product/PhortuneProductImplementation.php
@@ -12,8 +12,7 @@
protected function getContentSource() {
return PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_PHORTUNE,
- array());
+ PhabricatorPhortuneContentSource::SOURCECONST);
}
public function getPurchaseName(
diff --git a/src/applications/phortune/storage/PhortuneCart.php b/src/applications/phortune/storage/PhortuneCart.php
--- a/src/applications/phortune/storage/PhortuneCart.php
+++ b/src/applications/phortune/storage/PhortuneCart.php
@@ -431,8 +431,7 @@
->setNewValue(true);
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_PHORTUNE,
- array());
+ PhabricatorPhortuneContentSource::SOURCECONST);
$editor = id(new PhortuneCartEditor())
->setActor($omnipotent_user)
diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
--- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
+++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
@@ -96,8 +96,7 @@
->setNewValue(true);
$content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_PHORTUNE,
- array());
+ PhabricatorPhortuneContentSource::SOURCECONST);
$acting_phid = id(new PhabricatorPhortuneApplication())->getPHID();
$editor = id(new PhortuneCartEditor())
diff --git a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
--- a/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
+++ b/src/applications/phriction/conduit/PhrictionCreateConduitAPIMethod.php
@@ -55,7 +55,7 @@
$editor = id(new PhrictionTransactionEditor())
->setActor($request->getUser())
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
->setDescription($request->getValue('description'));
diff --git a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
--- a/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
+++ b/src/applications/phriction/conduit/PhrictionEditConduitAPIMethod.php
@@ -50,7 +50,7 @@
$editor = id(new PhrictionTransactionEditor())
->setActor($request->getUser())
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true)
->setDescription($request->getValue('description'));
diff --git a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
--- a/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
+++ b/src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
@@ -1087,7 +1087,7 @@
$editor = id(new ManiphestTransactionEditor())
->setActor($viewer)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($task, $xactions);
}
@@ -1203,7 +1203,7 @@
$editor = id(new ManiphestTransactionEditor())
->setActor($viewer)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($task, $xactions);
}
@@ -1239,7 +1239,7 @@
$editor = id(new ManiphestTransactionEditor())
->setActor($viewer)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($task, $xactions);
@@ -1464,7 +1464,7 @@
$editor = id(new PhabricatorProjectTransactionEditor())
->setActor($user)
- ->setContentSource(PhabricatorContentSource::newConsoleSource())
+ ->setContentSource($this->newContentSource())
->setContinueOnNoEffect(true)
->applyTransactions($project, $xactions);
}
diff --git a/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php b/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php
--- a/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php
+++ b/src/applications/project/conduit/ProjectCreateConduitAPIMethod.php
@@ -71,7 +71,7 @@
$editor = id(new PhabricatorProjectTransactionEditor())
->setActor($user)
->setContinueOnNoEffect(true)
- ->setContentSourceFromConduitRequest($request);
+ ->setContentSource($request->newContentSource());
$editor->applyTransactions($project, $xactions);
diff --git a/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php b/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php
--- a/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/ReleephRequestConduitAPIMethod.php
@@ -144,10 +144,7 @@
$editor = id(new ReleephRequestTransactionalEditor())
->setActor($user)
->setContinueOnNoEffect(true)
- ->setContentSource(
- PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_CONDUIT,
- array()));
+ ->setContentSource($request->newContentSource());
$editor->applyTransactions($releeph_request, $xactions);
}
diff --git a/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php
--- a/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkRecordConduitAPIMethod.php
@@ -65,10 +65,7 @@
$editor = id(new ReleephRequestTransactionalEditor())
->setActor($request->getUser())
->setContinueOnNoEffect(true)
- ->setContentSource(
- PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_CONDUIT,
- array()));
+ ->setContentSource($request->newContentSource());
$editor->applyTransactions($releeph_request, $xactions);
}
diff --git a/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php b/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php
--- a/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php
+++ b/src/applications/releeph/conduit/work/ReleephWorkRecordPickStatusConduitAPIMethod.php
@@ -64,10 +64,7 @@
$editor = id(new ReleephRequestTransactionalEditor())
->setActor($request->getUser())
->setContinueOnNoEffect(true)
- ->setContentSource(
- PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_CONDUIT,
- array()));
+ ->setContentSource($request->newContentSource());
$xactions = array();
diff --git a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
--- a/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
+++ b/src/applications/releeph/differential/DifferentialReleephRequestFieldSpecification.php
@@ -301,8 +301,7 @@
->setContinueOnNoEffect(true)
->setContentSource(
PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_UNKNOWN,
- array()));
+ PhabricatorUnknownContentSource::SOURCECONST));
$editor->applyTransactions($releeph_request, $xactions);
}
diff --git a/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php b/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php
--- a/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php
+++ b/src/applications/repository/management/PhabricatorRepositoryManagementEditWorkflow.php
@@ -117,7 +117,7 @@
pht('Specify one or more fields to edit!'));
}
- $content_source = PhabricatorContentSource::newConsoleSource();
+ $content_source = $this->newContentSource();
$editor = id(new PhabricatorRepositoryEditor())
->setActor($actor)
diff --git a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
--- a/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
+++ b/src/applications/repository/worker/PhabricatorRepositoryCommitHeraldWorker.php
@@ -30,9 +30,7 @@
$commit->attachRepository($repository);
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ $content_source = $this->newContentSource();
$committer_phid = $data->getCommitDetail('committerPHID');
$author_phid = $data->getCommitDetail('authorPHID');
diff --git a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
--- a/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
+++ b/src/applications/repository/worker/commitmessageparser/PhabricatorRepositoryCommitMessageParserWorker.php
@@ -221,9 +221,7 @@
->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 @@
$xactions[] = $edge_xaction;
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ $content_source = $this->newContentSource();
$editor = id(new ManiphestTransactionEditor())
->setActor($actor)
diff --git a/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php b/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php
--- a/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php
+++ b/src/applications/spaces/__tests__/PhabricatorSpacesTestCase.php
@@ -215,7 +215,7 @@
->setNewValue($is_default);
}
- $content_source = PhabricatorContentSource::newConsoleSource();
+ $content_source = $this->newContentSource();
$editor = id(new PhabricatorSpacesNamespaceEditor())
->setActor($actor)
diff --git a/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php b/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php
--- a/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php
+++ b/src/applications/tokens/conduit/TokenGiveConduitAPIMethod.php
@@ -22,7 +22,7 @@
}
protected function execute(ConduitAPIRequest $request) {
- $content_source = PhabricatorContentSource::newFromConduitRequest($request);
+ $content_source = $request->newContentSource();
$editor = id(new PhabricatorTokenGivenEditor())
->setActor($request->getUser())
diff --git a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
--- a/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
+++ b/src/applications/transactions/controller/PhabricatorApplicationTransactionCommentRawController.php
@@ -37,9 +37,9 @@
$addendum = null;
if ($request->getExists('email')) {
$content_source = $xaction->getContentSource();
- $source_email = PhabricatorContentSource::SOURCE_EMAIL;
+ $source_email = PhabricatorEmailContentSource::SOURCECONST;
if ($content_source->getSource() == $source_email) {
- $source_id = $content_source->getParam('id');
+ $source_id = $content_source->getContentSourceParameter('id');
if ($source_id) {
$message = id(new PhabricatorMetaMTAReceivedMail())->loadOneWhere(
'id = %d',
diff --git a/src/applications/transactions/editengine/PhabricatorEditEngine.php b/src/applications/transactions/editengine/PhabricatorEditEngine.php
--- a/src/applications/transactions/editengine/PhabricatorEditEngine.php
+++ b/src/applications/transactions/editengine/PhabricatorEditEngine.php
@@ -1684,7 +1684,7 @@
$editor = $object->getApplicationTransactionEditor()
->setActor($viewer)
- ->setContentSourceFromConduitRequest($request)
+ ->setContentSource($request->newContentSource())
->setContinueOnNoEffect(true);
if (!$this->getIsCreate()) {
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -733,16 +733,6 @@
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 @@
// out from transcripts, but it would be cleaner if you didn't have to.
$herald_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_HERALD,
- array());
+ PhabricatorHeraldContentSource::SOURCECONST);
$herald_editor = newv(get_class($this), array())
->setContinueOnNoEffect(true)
diff --git a/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php b/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php
--- a/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php
+++ b/src/applications/transactions/replyhandler/PhabricatorApplicationTransactionReplyHandler.php
@@ -18,11 +18,7 @@
}
private function newEditor(PhabricatorMetaMTAReceivedMail $mail) {
- $content_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_EMAIL,
- array(
- 'id' => $mail->getID(),
- ));
+ $content_source = $mail->newContentSource();
$editor = $this->getMailReceiver()
->getApplicationTransactionEditor()
diff --git a/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php b/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php
--- a/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php
+++ b/src/applications/transactions/worker/PhabricatorApplicationTransactionPublishWorker.php
@@ -62,9 +62,7 @@
PhabricatorApplicationTransactionInterface $object) {
$data = $this->getTaskData();
- $daemon_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ $daemon_source = $this->newContentSource();
$viewer = PhabricatorUser::getOmnipotentUser();
$editor = $object->getApplicationTransactionEditor()
diff --git a/src/infrastructure/contentsource/PhabricatorConduitContentSource.php b/src/infrastructure/contentsource/PhabricatorConduitContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorConduitContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorConsoleContentSource.php b/src/infrastructure/contentsource/PhabricatorConsoleContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorConsoleContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorContentSource.php b/src/infrastructure/contentsource/PhabricatorContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorContentSource.php
@@ -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);
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorContentSourceModule.php b/src/infrastructure/contentsource/PhabricatorContentSourceModule.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorContentSourceModule.php
@@ -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);
+ }
+
+}
diff --git a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php b/src/infrastructure/contentsource/PhabricatorContentSourceView.php
rename from src/applications/metamta/contentsource/PhabricatorContentSourceView.php
rename to src/infrastructure/contentsource/PhabricatorContentSourceView.php
--- a/src/applications/metamta/contentsource/PhabricatorContentSourceView.php
+++ b/src/infrastructure/contentsource/PhabricatorContentSourceView.php
@@ -10,21 +10,14 @@
}
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 @@
array(
'class' => 'phabricator-content-source-view',
),
- pht('Via %s', $type));
+ pht('Via %s', $name));
}
}
diff --git a/src/infrastructure/contentsource/PhabricatorFaxContentSource.php b/src/infrastructure/contentsource/PhabricatorFaxContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorFaxContentSource.php
@@ -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).');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorLipsumContentSource.php b/src/infrastructure/contentsource/PhabricatorLipsumContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorLipsumContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorOldWorldContentSource.php b/src/infrastructure/contentsource/PhabricatorOldWorldContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorOldWorldContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorUnitTestContentSource.php b/src/infrastructure/contentsource/PhabricatorUnitTestContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorUnitTestContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php b/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorUnknownContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/contentsource/PhabricatorWebContentSource.php b/src/infrastructure/contentsource/PhabricatorWebContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/contentsource/PhabricatorWebContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php b/src/infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/daemon/contentsource/PhabricatorBulkContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/daemon/contentsource/PhabricatorDaemonContentSource.php b/src/infrastructure/daemon/contentsource/PhabricatorDaemonContentSource.php
new file mode 100644
--- /dev/null
+++ b/src/infrastructure/daemon/contentsource/PhabricatorDaemonContentSource.php
@@ -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.');
+ }
+
+}
diff --git a/src/infrastructure/daemon/workers/PhabricatorWorker.php b/src/infrastructure/daemon/workers/PhabricatorWorker.php
--- a/src/infrastructure/daemon/workers/PhabricatorWorker.php
+++ b/src/infrastructure/daemon/workers/PhabricatorWorker.php
@@ -305,4 +305,9 @@
$epoch_ago);
}
+ protected function newContentSource() {
+ return PhabricatorContentSource::newForSource(
+ PhabricatorDaemonContentSource::SOURCECONST);
+ }
+
}
diff --git a/src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php b/src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php
--- a/src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php
+++ b/src/infrastructure/daemon/workers/bulk/PhabricatorWorkerBulkJobWorker.php
@@ -121,9 +121,7 @@
->setTransactionType($type_status)
->setNewValue($status);
- $daemon_source = PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_DAEMON,
- array());
+ $daemon_source = $this->newContentSource();
$app_phid = id(new PhabricatorDaemonsApplication())->getPHID();
diff --git a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php
--- a/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php
+++ b/src/infrastructure/daemon/workers/storage/PhabricatorWorkerBulkJob.php
@@ -102,7 +102,7 @@
public function newContentSource() {
return PhabricatorContentSource::newForSource(
- PhabricatorContentSource::SOURCE_BULK,
+ PhabricatorBulkContentSource::SOURCECONST,
array(
'jobID' => $this->getID(),
));
diff --git a/src/infrastructure/management/PhabricatorManagementWorkflow.php b/src/infrastructure/management/PhabricatorManagementWorkflow.php
--- a/src/infrastructure/management/PhabricatorManagementWorkflow.php
+++ b/src/infrastructure/management/PhabricatorManagementWorkflow.php
@@ -26,4 +26,9 @@
return $epoch;
}
+ protected function newContentSource() {
+ return PhabricatorContentSource::newForSource(
+ PhabricatorConsoleContentSource::SOURCECONST);
+ }
+
}
diff --git a/src/infrastructure/testing/PhabricatorTestCase.php b/src/infrastructure/testing/PhabricatorTestCase.php
--- a/src/infrastructure/testing/PhabricatorTestCase.php
+++ b/src/infrastructure/testing/PhabricatorTestCase.php
@@ -229,5 +229,9 @@
}
}
+ protected function newContentSource() {
+ return PhabricatorContentSource::newForSource(
+ PhabricatorUnitTestContentSource::SOURCECONST);
+ }
}
diff --git a/src/view/phui/PHUITimelineEventView.php b/src/view/phui/PHUITimelineEventView.php
--- a/src/view/phui/PHUITimelineEventView.php
+++ b/src/view/phui/PHUITimelineEventView.php
@@ -622,9 +622,9 @@
));
$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')

File Metadata

Mime Type
text/plain
Expires
Sat, Mar 29, 6:25 PM (3 w, 3 d ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/nm/7k/glokjyntcy73pi3b
Default Alt Text
D15521.id37433.diff (76 KB)

Event Timeline