Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15466032
D18166.id43711.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
20 KB
Referenced Files
None
Subscribers
None
D18166.id43711.diff
View Options
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
@@ -2331,13 +2331,13 @@
'PhabricatorChunkedFileStorageEngine' => 'applications/files/engine/PhabricatorChunkedFileStorageEngine.php',
'PhabricatorClassConfigType' => 'applications/config/type/PhabricatorClassConfigType.php',
'PhabricatorClusterConfigOptions' => 'applications/config/option/PhabricatorClusterConfigOptions.php',
- 'PhabricatorClusterDatabasesConfigOptionType' => 'infrastructure/cluster/config/PhabricatorClusterDatabasesConfigOptionType.php',
+ 'PhabricatorClusterDatabasesConfigType' => 'infrastructure/cluster/config/PhabricatorClusterDatabasesConfigType.php',
'PhabricatorClusterException' => 'infrastructure/cluster/exception/PhabricatorClusterException.php',
'PhabricatorClusterExceptionHandler' => 'infrastructure/cluster/exception/PhabricatorClusterExceptionHandler.php',
'PhabricatorClusterImpossibleWriteException' => 'infrastructure/cluster/exception/PhabricatorClusterImpossibleWriteException.php',
'PhabricatorClusterImproperWriteException' => 'infrastructure/cluster/exception/PhabricatorClusterImproperWriteException.php',
'PhabricatorClusterNoHostForRoleException' => 'infrastructure/cluster/exception/PhabricatorClusterNoHostForRoleException.php',
- 'PhabricatorClusterSearchConfigOptionType' => 'infrastructure/cluster/config/PhabricatorClusterSearchConfigOptionType.php',
+ 'PhabricatorClusterSearchConfigType' => 'infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php',
'PhabricatorClusterServiceHealthRecord' => 'infrastructure/cluster/PhabricatorClusterServiceHealthRecord.php',
'PhabricatorClusterStrandedException' => 'infrastructure/cluster/exception/PhabricatorClusterStrandedException.php',
'PhabricatorColumnProxyInterface' => 'applications/project/interface/PhabricatorColumnProxyInterface.php',
@@ -3199,7 +3199,7 @@
'PhabricatorNotificationQuery' => 'applications/notification/query/PhabricatorNotificationQuery.php',
'PhabricatorNotificationSearchEngine' => 'applications/notification/query/PhabricatorNotificationSearchEngine.php',
'PhabricatorNotificationServerRef' => 'applications/notification/client/PhabricatorNotificationServerRef.php',
- 'PhabricatorNotificationServersConfigOptionType' => 'applications/notification/config/PhabricatorNotificationServersConfigOptionType.php',
+ 'PhabricatorNotificationServersConfigType' => 'applications/notification/config/PhabricatorNotificationServersConfigType.php',
'PhabricatorNotificationStatusView' => 'applications/notification/view/PhabricatorNotificationStatusView.php',
'PhabricatorNotificationTestController' => 'applications/notification/controller/PhabricatorNotificationTestController.php',
'PhabricatorNotificationTestFeedStory' => 'applications/notification/feed/PhabricatorNotificationTestFeedStory.php',
@@ -3614,7 +3614,7 @@
'PhabricatorProjectBoardViewController' => 'applications/project/controller/PhabricatorProjectBoardViewController.php',
'PhabricatorProjectCardView' => 'applications/project/view/PhabricatorProjectCardView.php',
'PhabricatorProjectColorTransaction' => 'applications/project/xaction/PhabricatorProjectColorTransaction.php',
- 'PhabricatorProjectColorsConfigOptionType' => 'applications/project/config/PhabricatorProjectColorsConfigOptionType.php',
+ 'PhabricatorProjectColorsConfigType' => 'applications/project/config/PhabricatorProjectColorsConfigType.php',
'PhabricatorProjectColumn' => 'applications/project/storage/PhabricatorProjectColumn.php',
'PhabricatorProjectColumnDetailController' => 'applications/project/controller/PhabricatorProjectColumnDetailController.php',
'PhabricatorProjectColumnEditController' => 'applications/project/controller/PhabricatorProjectColumnEditController.php',
@@ -3652,7 +3652,7 @@
'PhabricatorProjectHovercardEngineExtension' => 'applications/project/engineextension/PhabricatorProjectHovercardEngineExtension.php',
'PhabricatorProjectIconSet' => 'applications/project/icon/PhabricatorProjectIconSet.php',
'PhabricatorProjectIconTransaction' => 'applications/project/xaction/PhabricatorProjectIconTransaction.php',
- 'PhabricatorProjectIconsConfigOptionType' => 'applications/project/config/PhabricatorProjectIconsConfigOptionType.php',
+ 'PhabricatorProjectIconsConfigType' => 'applications/project/config/PhabricatorProjectIconsConfigType.php',
'PhabricatorProjectImageTransaction' => 'applications/project/xaction/PhabricatorProjectImageTransaction.php',
'PhabricatorProjectInterface' => 'applications/project/interface/PhabricatorProjectInterface.php',
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
@@ -7581,13 +7581,13 @@
'PhabricatorChunkedFileStorageEngine' => 'PhabricatorFileStorageEngine',
'PhabricatorClassConfigType' => 'PhabricatorTextConfigType',
'PhabricatorClusterConfigOptions' => 'PhabricatorApplicationConfigOptions',
- 'PhabricatorClusterDatabasesConfigOptionType' => 'PhabricatorConfigJSONOptionType',
+ 'PhabricatorClusterDatabasesConfigType' => 'PhabricatorJSONConfigType',
'PhabricatorClusterException' => 'Exception',
'PhabricatorClusterExceptionHandler' => 'PhabricatorRequestExceptionHandler',
'PhabricatorClusterImpossibleWriteException' => 'PhabricatorClusterException',
'PhabricatorClusterImproperWriteException' => 'PhabricatorClusterException',
'PhabricatorClusterNoHostForRoleException' => 'Exception',
- 'PhabricatorClusterSearchConfigOptionType' => 'PhabricatorConfigJSONOptionType',
+ 'PhabricatorClusterSearchConfigType' => 'PhabricatorJSONConfigType',
'PhabricatorClusterServiceHealthRecord' => 'Phobject',
'PhabricatorClusterStrandedException' => 'PhabricatorClusterException',
'PhabricatorColumnsEditField' => 'PhabricatorPHIDListEditField',
@@ -8552,7 +8552,7 @@
'PhabricatorNotificationQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorNotificationSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorNotificationServerRef' => 'Phobject',
- 'PhabricatorNotificationServersConfigOptionType' => 'PhabricatorConfigJSONOptionType',
+ 'PhabricatorNotificationServersConfigType' => 'PhabricatorJSONConfigType',
'PhabricatorNotificationStatusView' => 'AphrontTagView',
'PhabricatorNotificationTestController' => 'PhabricatorNotificationController',
'PhabricatorNotificationTestFeedStory' => 'PhabricatorFeedStory',
@@ -9065,7 +9065,7 @@
'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectCardView' => 'AphrontTagView',
'PhabricatorProjectColorTransaction' => 'PhabricatorProjectTransactionType',
- 'PhabricatorProjectColorsConfigOptionType' => 'PhabricatorConfigJSONOptionType',
+ 'PhabricatorProjectColorsConfigType' => 'PhabricatorJSONConfigType',
'PhabricatorProjectColumn' => array(
'PhabricatorProjectDAO',
'PhabricatorApplicationTransactionInterface',
@@ -9116,7 +9116,7 @@
'PhabricatorProjectHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension',
'PhabricatorProjectIconSet' => 'PhabricatorIconSet',
'PhabricatorProjectIconTransaction' => 'PhabricatorProjectTransactionType',
- 'PhabricatorProjectIconsConfigOptionType' => 'PhabricatorConfigJSONOptionType',
+ 'PhabricatorProjectIconsConfigType' => 'PhabricatorJSONConfigType',
'PhabricatorProjectImageTransaction' => 'PhabricatorProjectTransactionType',
'PhabricatorProjectListController' => 'PhabricatorProjectController',
'PhabricatorProjectListView' => 'AphrontView',
diff --git a/src/applications/config/option/PhabricatorClusterConfigOptions.php b/src/applications/config/option/PhabricatorClusterConfigOptions.php
--- a/src/applications/config/option/PhabricatorClusterConfigOptions.php
+++ b/src/applications/config/option/PhabricatorClusterConfigOptions.php
@@ -20,7 +20,7 @@
}
public function getOptions() {
- $databases_type = 'custom:PhabricatorClusterDatabasesConfigOptionType';
+ $databases_type = 'cluster.databases';
$databases_help = $this->deformat(pht(<<<EOTEXT
WARNING: This is a prototype option and the description below is currently pure
fantasy.
@@ -38,7 +38,7 @@
$intro_href = PhabricatorEnv::getDoclink('Clustering Introduction');
$intro_name = pht('Clustering Introduction');
- $search_type = 'custom:PhabricatorClusterSearchConfigOptionType';
+ $search_type = 'cluster.search';
$search_help = $this->deformat(pht(<<<EOTEXT
Define one or more fulltext storage services. Here you can configure which
hosts will handle fulltext search queries and indexing. For help with
diff --git a/src/applications/config/option/PhabricatorNotificationConfigOptions.php b/src/applications/config/option/PhabricatorNotificationConfigOptions.php
--- a/src/applications/config/option/PhabricatorNotificationConfigOptions.php
+++ b/src/applications/config/option/PhabricatorNotificationConfigOptions.php
@@ -20,7 +20,7 @@
}
public function getOptions() {
- $servers_type = 'custom:PhabricatorNotificationServersConfigOptionType';
+ $servers_type = 'cluster.notifications';
$servers_help = $this->deformat(pht(<<<EOTEXT
Provide a list of notification servers to enable real-time notifications.
diff --git a/src/applications/config/type/PhabricatorConfigType.php b/src/applications/config/type/PhabricatorConfigType.php
--- a/src/applications/config/type/PhabricatorConfigType.php
+++ b/src/applications/config/type/PhabricatorConfigType.php
@@ -29,10 +29,6 @@
abstract protected function newHTTPParameterType();
- public function validateValue(PhabricatorConfigOption $option, $value) {
- return array();
- }
-
public function newTransaction(
PhabricatorConfigOption $option,
$value) {
diff --git a/src/applications/notification/config/PhabricatorNotificationServersConfigOptionType.php b/src/applications/notification/config/PhabricatorNotificationServersConfigType.php
rename from src/applications/notification/config/PhabricatorNotificationServersConfigOptionType.php
rename to src/applications/notification/config/PhabricatorNotificationServersConfigType.php
--- a/src/applications/notification/config/PhabricatorNotificationServersConfigOptionType.php
+++ b/src/applications/notification/config/PhabricatorNotificationServersConfigType.php
@@ -1,19 +1,17 @@
<?php
-final class PhabricatorNotificationServersConfigOptionType
- extends PhabricatorConfigJSONOptionType {
+final class PhabricatorNotificationServersConfigType
+ extends PhabricatorJSONConfigType {
- public function validateOption(PhabricatorConfigOption $option, $value) {
- if (!is_array($value)) {
- throw new Exception(
- pht(
- 'Notification server configuration is not valid: value must be a '.
- 'list of servers'));
- }
+ const TYPEKEY = 'cluster.notifications';
+
+ public function validateStoredValue(
+ PhabricatorConfigOption $option,
+ $value) {
foreach ($value as $index => $spec) {
if (!is_array($spec)) {
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration is not valid: each entry in '.
'the list must be a dictionary describing a service, but '.
@@ -38,7 +36,7 @@
'disabled' => 'optional bool',
));
} catch (Exception $ex) {
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration has an invalid service '.
'specification (at index "%s"): %s.',
@@ -64,7 +62,7 @@
}
break;
default:
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration describes an invalid '.
'host ("%s", at index "%s") with an unrecognized type ("%s"). '.
@@ -81,7 +79,7 @@
case 'https':
break;
default:
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration describes an invalid '.
'host ("%s", at index "%s") with an invalid protocol ("%s"). '.
@@ -95,7 +93,7 @@
$path = idx($spec, 'path');
if ($type == 'admin' && strlen($path)) {
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration describes an invalid host '.
'("%s", at index "%s"). This is an "admin" service but it has a '.
@@ -108,7 +106,7 @@
// mistakes.
$key = "{$host}:{$port}";
if (isset($map[$key])) {
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration is invalid: it describes the '.
'same host and port ("%s") multiple times. Each host and port '.
@@ -120,7 +118,7 @@
if ($value) {
if (!$has_admin) {
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration is invalid: it does not '.
'specify any enabled servers with type "admin". Notifications '.
@@ -128,7 +126,7 @@
}
if (!$has_client) {
- throw new Exception(
+ throw $this->newException(
pht(
'Notification server configuration is invalid: it does not '.
'specify any enabled servers with type "client". Notifications '.
diff --git a/src/applications/project/config/PhabricatorProjectColorsConfigOptionType.php b/src/applications/project/config/PhabricatorProjectColorsConfigOptionType.php
deleted file mode 100644
--- a/src/applications/project/config/PhabricatorProjectColorsConfigOptionType.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-final class PhabricatorProjectColorsConfigOptionType
- extends PhabricatorConfigJSONOptionType {
-
- public function validateOption(PhabricatorConfigOption $option, $value) {
- PhabricatorProjectIconSet::validateColorConfiguration($value);
- }
-
-}
diff --git a/src/applications/project/config/PhabricatorProjectColorsConfigType.php b/src/applications/project/config/PhabricatorProjectColorsConfigType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/config/PhabricatorProjectColorsConfigType.php
@@ -0,0 +1,14 @@
+<?php
+
+final class PhabricatorProjectColorsConfigType
+ extends PhabricatorJSONConfigType {
+
+ const TYPEKEY = 'project.colors';
+
+ public function validateStoredValue(
+ PhabricatorConfigOption $option,
+ $value) {
+ PhabricatorProjectIconSet::validateColorConfiguration($value);
+ }
+
+}
diff --git a/src/applications/project/config/PhabricatorProjectConfigOptions.php b/src/applications/project/config/PhabricatorProjectConfigOptions.php
--- a/src/applications/project/config/PhabricatorProjectConfigOptions.php
+++ b/src/applications/project/config/PhabricatorProjectConfigOptions.php
@@ -21,7 +21,7 @@
public function getOptions() {
$default_icons = PhabricatorProjectIconSet::getDefaultConfiguration();
- $icons_type = 'custom:PhabricatorProjectIconsConfigOptionType';
+ $icons_type = 'project.icons';
$icons_description = $this->deformat(pht(<<<EOTEXT
Allows you to change and customize the available project icons.
@@ -48,7 +48,7 @@
));
$default_colors = PhabricatorProjectIconSet::getDefaultColorMap();
- $colors_type = 'custom:PhabricatorProjectColorsConfigOptionType';
+ $colors_type = 'project.colors';
$colors_description = $this->deformat(pht(<<<EOTEXT
Allows you to relabel project colors.
diff --git a/src/applications/project/config/PhabricatorProjectIconsConfigOptionType.php b/src/applications/project/config/PhabricatorProjectIconsConfigOptionType.php
deleted file mode 100644
--- a/src/applications/project/config/PhabricatorProjectIconsConfigOptionType.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-final class PhabricatorProjectIconsConfigOptionType
- extends PhabricatorConfigJSONOptionType {
-
- public function validateOption(PhabricatorConfigOption $option, $value) {
- PhabricatorProjectIconSet::validateConfiguration($value);
- }
-
-}
diff --git a/src/applications/project/config/PhabricatorProjectIconsConfigType.php b/src/applications/project/config/PhabricatorProjectIconsConfigType.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/config/PhabricatorProjectIconsConfigType.php
@@ -0,0 +1,14 @@
+<?php
+
+final class PhabricatorProjectIconsConfigType
+ extends PhabricatorJSONConfigType {
+
+ const TYPEKEY = 'project.icons';
+
+ public function validateStoredValue(
+ PhabricatorConfigOption $option,
+ $value) {
+ PhabricatorProjectIconSet::validateConfiguration($value);
+ }
+
+}
diff --git a/src/applications/search/management/PhabricatorSearchManagementWorkflow.php b/src/applications/search/management/PhabricatorSearchManagementWorkflow.php
--- a/src/applications/search/management/PhabricatorSearchManagementWorkflow.php
+++ b/src/applications/search/management/PhabricatorSearchManagementWorkflow.php
@@ -13,7 +13,7 @@
$config_value = PhabricatorEnv::getEnvConfig($config_key);
try {
- PhabricatorClusterSearchConfigOptionType::validateValue($config_value);
+ PhabricatorClusterSearchConfigType::validateValue($config_value);
} catch (Exception $ex) {
throw new PhutilArgumentUsageException(
pht(
diff --git a/src/infrastructure/cluster/config/PhabricatorClusterDatabasesConfigOptionType.php b/src/infrastructure/cluster/config/PhabricatorClusterDatabasesConfigType.php
rename from src/infrastructure/cluster/config/PhabricatorClusterDatabasesConfigOptionType.php
rename to src/infrastructure/cluster/config/PhabricatorClusterDatabasesConfigType.php
--- a/src/infrastructure/cluster/config/PhabricatorClusterDatabasesConfigOptionType.php
+++ b/src/infrastructure/cluster/config/PhabricatorClusterDatabasesConfigType.php
@@ -1,19 +1,17 @@
<?php
-final class PhabricatorClusterDatabasesConfigOptionType
- extends PhabricatorConfigJSONOptionType {
+final class PhabricatorClusterDatabasesConfigType
+ extends PhabricatorJSONConfigType {
- public function validateOption(PhabricatorConfigOption $option, $value) {
- if (!is_array($value)) {
- throw new Exception(
- pht(
- 'Database cluster configuration is not valid: value must be a '.
- 'list of database hosts.'));
- }
+ const TYPEKEY = 'cluster.databases';
+
+ public function validateStoredValue(
+ PhabricatorConfigOption $option,
+ $value) {
foreach ($value as $index => $spec) {
if (!is_array($spec)) {
- throw new Exception(
+ throw $this->newException(
pht(
'Database cluster configuration is not valid: each entry in the '.
'list must be a dictionary describing a database host, but '.
@@ -40,7 +38,7 @@
'persistent' => 'optional bool',
));
} catch (Exception $ex) {
- throw new Exception(
+ throw $this->newException(
pht(
'Database cluster configuration has an invalid host '.
'specification (at index "%s"): %s.',
@@ -57,7 +55,7 @@
case 'replica':
break;
default:
- throw new Exception(
+ throw $this->newException(
pht(
'Database cluster configuration describes an invalid '.
'host ("%s", at index "%s") with an unrecognized role ("%s"). '.
@@ -78,7 +76,7 @@
// mistakes.
$key = "{$host}:{$port}";
if (isset($map[$key])) {
- throw new Exception(
+ throw $this->newException(
pht(
'Database cluster configuration is invalid: it describes the '.
'same host ("%s") multiple times. Each host should appear only '.
diff --git a/src/infrastructure/cluster/config/PhabricatorClusterSearchConfigOptionType.php b/src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php
rename from src/infrastructure/cluster/config/PhabricatorClusterSearchConfigOptionType.php
rename to src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php
--- a/src/infrastructure/cluster/config/PhabricatorClusterSearchConfigOptionType.php
+++ b/src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php
@@ -1,20 +1,17 @@
<?php
-final class PhabricatorClusterSearchConfigOptionType
- extends PhabricatorConfigJSONOptionType {
+final class PhabricatorClusterSearchConfigType
+ extends PhabricatorJSONConfigType {
- public function validateOption(PhabricatorConfigOption $option, $value) {
+ const TYPEKEY = 'cluster.search';
+
+ public function validateStoredValue(
+ PhabricatorConfigOption $option,
+ $value) {
self::validateValue($value);
}
public static function validateValue($value) {
- if (!is_array($value)) {
- throw new Exception(
- pht(
- 'Search cluster configuration is not valid: value must be a '.
- 'list of search hosts.'));
- }
-
$engines = PhabricatorSearchService::loadAllFulltextStorageEngines();
foreach ($value as $index => $spec) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 4, 12:55 AM (1 d, 7 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7501902
Default Alt Text
D18166.id43711.diff (20 KB)
Attached To
Mode
D18166: Convert cluster/projects config options to newer modular structure
Attached
Detach File
Event Timeline
Log In to Comment