Deprecate 'maniphest.enabled' and 'phriction.enabled'

Summary:
Also join concepts of installed and enabled applications.
Also respect uninstalled Maniphest where disabled Maniphest was checked.

Test Plan:
Visited T1, D1.
Uninstalled Maniphest then visited T1, D1.
Disabled Maniphest then visited T1.
Visited /config/edit/maniphest.enabled/.

Reviewers: epriestley, Afaque_Hussain, edward

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5602
This commit is contained in:
Jakub Vrana
2013-04-06 11:39:59 -07:00
parent 6587c1d5a5
commit 3231df7625
14 changed files with 40 additions and 28 deletions

View File

@@ -1083,6 +1083,7 @@ return array(
// -- Maniphest ------------------------------------------------------------- // // -- Maniphest ------------------------------------------------------------- //
// Deprecated, use 'phabricator.uninstalled-applications' instead.
'maniphest.enabled' => true, 'maniphest.enabled' => true,
// Array of custom fields for Maniphest tasks. For details on adding custom // Array of custom fields for Maniphest tasks. For details on adding custom
@@ -1100,6 +1101,7 @@ return array(
// -- Phriction ------------------------------------------------------------- // // -- Phriction ------------------------------------------------------------- //
// Deprecated, use 'phabricator.uninstalled-applications' instead.
'phriction.enabled' => true, 'phriction.enabled' => true,
// -- Phame ----------------------------------------------------------------- // // -- Phame ----------------------------------------------------------------- //

View File

@@ -58,10 +58,6 @@ abstract class PhabricatorApplication {
return $this->getName().' Application'; return $this->getName().' Application';
} }
public function isEnabled() {
return true;
}
public function isInstalled() { public function isInstalled() {
if (!$this->canUninstall()) { if (!$this->canUninstall()) {
return true; return true;
@@ -78,6 +74,10 @@ abstract class PhabricatorApplication {
return empty($uninstalled[get_class($this)]); return empty($uninstalled[get_class($this)]);
} }
public static function isClassInstalled($class) {
return self::getByClass($class)->isInstalled();
}
public function isBeta() { public function isBeta() {
return false; return false;
} }
@@ -283,10 +283,6 @@ abstract class PhabricatorApplication {
continue; continue;
} }
if (!$app->isEnabled()) {
continue;
}
$apps[] = $app; $apps[] = $app;
} }

View File

@@ -529,7 +529,8 @@ final class DifferentialRevisionViewController extends DifferentialController {
'sigil' => 'workflow', 'sigil' => 'workflow',
); );
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) { $maniphest = 'PhabricatorApplicationManiphest';
if (PhabricatorApplication::isClassInstalled($maniphest)) {
$links[] = array( $links[] = array(
'icon' => 'attach', 'icon' => 'attach',
'name' => pht('Edit Maniphest Tasks'), 'name' => pht('Edit Maniphest Tasks'),

View File

@@ -4,7 +4,8 @@ abstract class DifferentialFreeformFieldSpecification
extends DifferentialFieldSpecification { extends DifferentialFieldSpecification {
private function findMentionedTasks($message) { private function findMentionedTasks($message) {
if (!PhabricatorEnv::getEnvConfig('maniphest.enabled')) { $maniphest = 'PhabricatorApplicationManiphest';
if (!PhabricatorApplication::isClassInstalled($maniphest)) {
return array(); return array();
} }

View File

@@ -7,7 +7,8 @@ final class DifferentialManiphestTasksFieldSpecification
private $maniphestTasks = array(); private $maniphestTasks = array();
public function shouldAppearOnRevisionView() { public function shouldAppearOnRevisionView() {
return PhabricatorEnv::getEnvConfig('maniphest.enabled'); return PhabricatorApplication::isClassInstalled(
'PhabricatorApplicationManiphest');
} }
public function getRequiredHandlePHIDsForRevisionView() { public function getRequiredHandlePHIDsForRevisionView() {
@@ -84,7 +85,7 @@ final class DifferentialManiphestTasksFieldSpecification
} }
public function shouldAppearOnCommitMessage() { public function shouldAppearOnCommitMessage() {
return PhabricatorEnv::getEnvConfig('maniphest.enabled'); return $this->shouldAppearOnRevisionView();
} }
public function getCommitMessageKey() { public function getCommitMessageKey() {

View File

@@ -854,7 +854,8 @@ final class DiffusionCommitController extends DiffusionController {
require_celerity_resource('phabricator-object-selector-css'); require_celerity_resource('phabricator-object-selector-css');
require_celerity_resource('javelin-behavior-phabricator-object-selector'); require_celerity_resource('javelin-behavior-phabricator-object-selector');
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) { $maniphest = 'PhabricatorApplicationManiphest';
if (PhabricatorApplication::isClassInstalled($maniphest)) {
$action = id(new PhabricatorActionView()) $action = id(new PhabricatorActionView())
->setName('Edit Maniphest Tasks') ->setName('Edit Maniphest Tasks')
->setIcon('attach') ->setIcon('attach')

View File

@@ -30,7 +30,8 @@ final class PhabricatorDirectoryMainController
private function buildMainResponse($nav, array $projects) { private function buildMainResponse($nav, array $projects) {
assert_instances_of($projects, 'PhabricatorProject'); assert_instances_of($projects, 'PhabricatorProject');
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) { $maniphest = 'PhabricatorApplicationManiphest';
if (PhabricatorApplication::isClassInstalled($maniphest)) {
$unbreak_panel = $this->buildUnbreakNowPanel(); $unbreak_panel = $this->buildUnbreakNowPanel();
$triage_panel = $this->buildNeedsTriagePanel($projects); $triage_panel = $this->buildNeedsTriagePanel($projects);
$tasks_panel = $this->buildTasksPanel(); $tasks_panel = $this->buildTasksPanel();

View File

@@ -10,8 +10,11 @@ final class PhabricatorApplicationManiphest extends PhabricatorApplication {
return '/maniphest/'; return '/maniphest/';
} }
public function isEnabled() { public function isInstalled() {
return PhabricatorEnv::getEnvConfig('maniphest.enabled'); if (!PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
return false;
}
return parent::isInstalled();
} }
public function getIconName() { public function getIconName() {

View File

@@ -14,7 +14,8 @@ final class PhabricatorManiphestConfigOptions
public function getOptions() { public function getOptions() {
return array( return array(
$this->newOption('maniphest.enabled', 'bool', true) $this->newOption('maniphest.enabled', 'bool', true)
->setDescription(pht("Enable Maniphest")), ->setDescription(pht(
"Deprecated, use 'phabricator.uninstalled-applications' instead.")),
$this->newOption('maniphest.custom-fields', 'wild', array()) $this->newOption('maniphest.custom-fields', 'wild', array())
->setSummary(pht("Custom Maniphest fields.")) ->setSummary(pht("Custom Maniphest fields."))
->setDescription( ->setDescription(

View File

@@ -18,8 +18,11 @@ final class PhabricatorApplicationPhriction extends PhabricatorApplication {
return PhabricatorEnv::getDoclink('article/Phriction_User_Guide.html'); return PhabricatorEnv::getDoclink('article/Phriction_User_Guide.html');
} }
public function isEnabled() { public function isInstalled() {
return PhabricatorEnv::getEnvConfig('phriction.enabled'); if (!PhabricatorEnv::getEnvConfig('phriction.enabled')) {
return false;
}
return parent::isInstalled();
} }
public function getTitleGlyph() { public function getTitleGlyph() {

View File

@@ -19,7 +19,8 @@ final class PhabricatorPhrictionConfigOptions
pht("Enable Phriction"), pht("Enable Phriction"),
pht("Disable Phriction"), pht("Disable Phriction"),
)) ))
->setDescription(pht("Enable or disable Phriction.")), ->setDescription(pht(
"Deprecated, use 'phabricator.uninstalled-applications' instead.")),
$this->newOption( $this->newOption(
'metamta.phriction.subject-prefix', 'string', '[Phriction]') 'metamta.phriction.subject-prefix', 'string', '[Phriction]')
->setDescription(pht("Subject prefix for Phriction email.")), ->setDescription(pht("Subject prefix for Phriction email.")),

View File

@@ -4,9 +4,8 @@ final class PhabricatorSettingsPanelConpherencePreferences
extends PhabricatorSettingsPanel { extends PhabricatorSettingsPanel {
public function isEnabled() { public function isEnabled() {
$conpherence_app = PhabricatorApplication::getByClass( return PhabricatorApplication::isClassInstalled(
'PhabricatorApplicationConpherence'); 'PhabricatorApplicationConpherence');
return $conpherence_app->isInstalled();
} }
public function getPanelKey() { public function getPanelKey() {

View File

@@ -52,9 +52,12 @@ final class PhabricatorSettingsPanelEmailPreferences
$new_tags = $request->getArr('mailtags'); $new_tags = $request->getArr('mailtags');
$mailtags = $preferences->getPreference('mailtags', array()); $mailtags = $preferences->getPreference('mailtags', array());
$all_tags = $this->getMailTags(); $all_tags = $this->getMailTags();
if (!PhabricatorEnv::getEnvConfig('maniphest.enabled')) {
$maniphest = 'PhabricatorApplicationManiphest';
if (!PhabricatorApplication::isClassInstalled($maniphest)) {
$all_tags = array_diff_key($all_tags, $this->getManiphestMailTags()); $all_tags = array_diff_key($all_tags, $this->getManiphestMailTags());
} }
foreach ($all_tags as $key => $label) { foreach ($all_tags as $key => $label) {
$mailtags[$key] = (bool)idx($new_tags, $key, false); $mailtags[$key] = (bool)idx($new_tags, $key, false);
} }
@@ -186,7 +189,8 @@ final class PhabricatorSettingsPanelEmailPreferences
$mailtags) $mailtags)
->setLabel(pht('Differential'))); ->setLabel(pht('Differential')));
if (PhabricatorEnv::getEnvConfig('maniphest.enabled')) { $maniphest = 'PhabricatorApplicationManiphest';
if (PhabricatorApplication::isClassInstalled($maniphest)) {
$form->appendChild( $form->appendChild(
$this->buildMailTagCheckboxes( $this->buildMailTagCheckboxes(
$this->getManiphestMailTags(), $this->getManiphestMailTags(),

View File

@@ -260,11 +260,9 @@ final class PhabricatorMainMenuView extends AphrontView {
'alert-notifications', 'alert-notifications',
); );
$conpherence_application = PhabricatorApplication::getByClass(
'PhabricatorApplicationConpherence');
$message_tag = ''; $message_tag = '';
if ($conpherence_application->isInstalled()) { $conpherence = 'PhabricatorApplicationConpherence';
if (PhabricatorApplication::isClassInstalled($conpherence)) {
$message_id = celerity_generate_unique_node_id(); $message_id = celerity_generate_unique_node_id();
$message_count_id = celerity_generate_unique_node_id(); $message_count_id = celerity_generate_unique_node_id();