mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +01:00
Move Facebook setup checks to post-install
Summary: Technically we should have these for all the OAuth providers but I don't think anyone really has trouble with them and it can probably be done generically after T1536. Preserve the functionality, at least. Test Plan: Broke my config, verified warnings appeared. Reviewers: btrahan, vrana Reviewed By: btrahan CC: aran Maniphest Tasks: T2228 Differential Revision: https://secure.phabricator.com/D4506
This commit is contained in:
parent
e6b7ad2e00
commit
a8bd1f4998
3 changed files with 39 additions and 39 deletions
|
@ -1205,6 +1205,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
|
'PhabricatorSetupCheck' => 'applications/config/check/PhabricatorSetupCheck.php',
|
||||||
'PhabricatorSetupCheckAPC' => 'applications/config/check/PhabricatorSetupCheckAPC.php',
|
'PhabricatorSetupCheckAPC' => 'applications/config/check/PhabricatorSetupCheckAPC.php',
|
||||||
'PhabricatorSetupCheckExtraConfig' => 'applications/config/check/PhabricatorSetupCheckExtraConfig.php',
|
'PhabricatorSetupCheckExtraConfig' => 'applications/config/check/PhabricatorSetupCheckExtraConfig.php',
|
||||||
|
'PhabricatorSetupCheckFacebook' => 'applications/config/check/PhabricatorSetupCheckFacebook.php',
|
||||||
'PhabricatorSetupCheckGD' => 'applications/config/check/PhabricatorSetupCheckGD.php',
|
'PhabricatorSetupCheckGD' => 'applications/config/check/PhabricatorSetupCheckGD.php',
|
||||||
'PhabricatorSetupCheckInvalidConfig' => 'applications/config/check/PhabricatorSetupCheckInvalidConfig.php',
|
'PhabricatorSetupCheckInvalidConfig' => 'applications/config/check/PhabricatorSetupCheckInvalidConfig.php',
|
||||||
'PhabricatorSetupCheckMail' => 'applications/config/check/PhabricatorSetupCheckMail.php',
|
'PhabricatorSetupCheckMail' => 'applications/config/check/PhabricatorSetupCheckMail.php',
|
||||||
|
@ -2557,6 +2558,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorSettingsPanelSearchPreferences' => 'PhabricatorSettingsPanel',
|
'PhabricatorSettingsPanelSearchPreferences' => 'PhabricatorSettingsPanel',
|
||||||
'PhabricatorSetupCheckAPC' => 'PhabricatorSetupCheck',
|
'PhabricatorSetupCheckAPC' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorSetupCheckExtraConfig' => 'PhabricatorSetupCheck',
|
'PhabricatorSetupCheckExtraConfig' => 'PhabricatorSetupCheck',
|
||||||
|
'PhabricatorSetupCheckFacebook' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorSetupCheckGD' => 'PhabricatorSetupCheck',
|
'PhabricatorSetupCheckGD' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorSetupCheckInvalidConfig' => 'PhabricatorSetupCheck',
|
'PhabricatorSetupCheckInvalidConfig' => 'PhabricatorSetupCheck',
|
||||||
'PhabricatorSetupCheckMail' => 'PhabricatorSetupCheck',
|
'PhabricatorSetupCheckMail' => 'PhabricatorSetupCheck',
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorSetupCheckFacebook extends PhabricatorSetupCheck {
|
||||||
|
|
||||||
|
protected function executeChecks() {
|
||||||
|
$fb_auth = PhabricatorEnv::getEnvConfig('facebook.auth-enabled');
|
||||||
|
if (!$fb_auth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PhabricatorEnv::getEnvConfig('facebook.application-id')) {
|
||||||
|
$message = pht(
|
||||||
|
'You have enabled Facebook authentication, but have not provided a '.
|
||||||
|
'Facebook Application ID. Provide one or disable Facebook '.
|
||||||
|
'authentication.');
|
||||||
|
|
||||||
|
$this->newIssue('config.facebook.application-id')
|
||||||
|
->setName(pht("Facebook Application ID Not Set"))
|
||||||
|
->setMessage($message)
|
||||||
|
->addPhabricatorConfig('facebook.auth-enabled')
|
||||||
|
->addPhabricatorConfig('facebook.application-id');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!PhabricatorEnv::getEnvConfig('facebook.application-secret')) {
|
||||||
|
$message = pht(
|
||||||
|
'You have enabled Facebook authentication, but have not provided a '.
|
||||||
|
'Facebook Application Secret. Provide one or disable Facebook '.
|
||||||
|
'authentication.');
|
||||||
|
|
||||||
|
$this->newIssue('config.facebook.application-secret')
|
||||||
|
->setName(pht("Facebook Application Secret Not Set"))
|
||||||
|
->setMessage($message)
|
||||||
|
->addPhabricatorConfig('facebook.auth-enabled')
|
||||||
|
->addPhabricatorConfig('facebook.application-secret');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -360,39 +360,6 @@ final class PhabricatorSetup {
|
||||||
|
|
||||||
self::write("[OKAY] Basic configuration OKAY\n");
|
self::write("[OKAY] Basic configuration OKAY\n");
|
||||||
|
|
||||||
|
|
||||||
self::writeHeader('FACEBOOK INTEGRATION');
|
|
||||||
$fb_auth = PhabricatorEnv::getEnvConfig('facebook.auth-enabled');
|
|
||||||
if (!$fb_auth) {
|
|
||||||
self::write(" skip 'facebook.auth-enabled' not enabled.\n");
|
|
||||||
} else {
|
|
||||||
self::write(" okay 'facebook.auth-enabled' is enabled.\n");
|
|
||||||
$app_id = PhabricatorEnv::getEnvConfig('facebook.application-id');
|
|
||||||
$app_secret = PhabricatorEnv::getEnvConfig('facebook.application-secret');
|
|
||||||
|
|
||||||
if (!$app_id) {
|
|
||||||
self::writeFailure();
|
|
||||||
self::write(
|
|
||||||
"Setup failure! 'facebook.auth-enabled' is true but there is no ".
|
|
||||||
"setting for 'facebook.application-id'.\n");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
self::write(" okay 'facebook.application-id' is set.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$app_secret) {
|
|
||||||
self::writeFailure();
|
|
||||||
self::write(
|
|
||||||
"Setup failure! 'facebook.auth-enabled' is true but there is no ".
|
|
||||||
"setting for 'facebook.application-secret'.");
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
self::write(" okay 'facebook.application-secret is set.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
self::write("[OKAY] Facebook integration OKAY\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
self::writeHeader("MySQL DATABASE & STORAGE CONFIGURATION");
|
self::writeHeader("MySQL DATABASE & STORAGE CONFIGURATION");
|
||||||
|
|
||||||
$conf = PhabricatorEnv::newObjectFromConfig('mysql.configuration-provider');
|
$conf = PhabricatorEnv::newObjectFromConfig('mysql.configuration-provider');
|
||||||
|
@ -496,12 +463,6 @@ final class PhabricatorSetup {
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function writeNote($note) {
|
|
||||||
$note = "*** NOTE: ".wordwrap($note, 75, "\n", true);
|
|
||||||
$note = "\n".str_replace("\n", "\n ", $note)."\n\n";
|
|
||||||
self::write($note);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function writeHeader($header) {
|
public static function writeHeader($header) {
|
||||||
$template = '>>>'.str_repeat('-', 77);
|
$template = '>>>'.str_repeat('-', 77);
|
||||||
$template = substr_replace(
|
$template = substr_replace(
|
||||||
|
|
Loading…
Reference in a new issue