1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 00:38:51 +02:00

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -14,7 +14,8 @@ final class PhabricatorManiphestConfigOptions
public function getOptions() {
return array(
$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())
->setSummary(pht("Custom Maniphest fields."))
->setDescription(

View file

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

View file

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

View file

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

View file

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

View file

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