Installation & Uninstallion of Applications

Summary: Created Applications application which allows uninstallation & installation of application.

Test Plan: In "Applications" application, clicked on uninstalled the application by cliking Uninstall and chekcing whether they are really uninstalled(Disabling URI & in appearance in the side pane). Then Clicked on the install button of the uninstalled application to check whether they are installed.

Reviewers: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4715
This commit is contained in:
Afaque Hussain
2013-01-29 09:14:03 -08:00
committed by epriestley
parent 683df86d54
commit 5017c80b31
18 changed files with 253 additions and 38 deletions

View File

@@ -62,10 +62,25 @@ abstract class PhabricatorApplication {
return true;
}
public function isInstalled() {
$uninstalled =
PhabricatorEnv::getEnvConfig('phabricator.uninstalled-applications');
if (isset($uninstalled[get_class($this)])) {
return false;
} else {
return true;
}
}
public function isBeta() {
return false;
}
public function canUninstall() {
return true;
}
public function getPHID() {
return 'PHID-APPS-'.get_class($this);
}
@@ -212,6 +227,22 @@ abstract class PhabricatorApplication {
/* -( Application Management )--------------------------------------------- */
public static function getAllApplications() {
$classes = id(new PhutilSymbolLoader())
->setAncestorClass(__CLASS__)
->setConcreteOnly(true)
->selectAndLoadSymbols();
$apps = array();
foreach ($classes as $class) {
$app = newv($class['name'], array());
$apps[] = $app;
}
return $apps;
}
public static function getAllInstalledApplications() {
static $applications;
@@ -219,6 +250,11 @@ abstract class PhabricatorApplication {
$show_beta =
PhabricatorEnv::getEnvConfig('phabricator.show-beta-applications');
$uninstalled =
PhabricatorEnv::getEnvConfig('phabricator.uninstalled-applications');
if (empty($applications)) {
$classes = id(new PhutilSymbolLoader())
->setAncestorClass(__CLASS__)
@@ -227,22 +263,29 @@ abstract class PhabricatorApplication {
$apps = array();
foreach ($classes as $class) {
$app = newv($class['name'], array());
if (!$app->isEnabled()) {
continue;
}
if (!$show_beta && $app->isBeta()) {
continue;
}
$apps[] = $app;
if (isset($uninstalled[$class['name']])) {
continue;
}
$app = newv($class['name'], array());
if (!$app->isEnabled()) {
continue;
}
if (!$show_beta && $app->isBeta()) {
continue;
}
$apps[] = $app;
}
$applications = $apps;
}
return $applications;
}
}