2013-01-22 22:57:02 +01:00
|
|
|
<?php
|
|
|
|
|
2015-01-02 05:27:45 +01:00
|
|
|
final class PhabricatorBaseURISetupCheck extends PhabricatorSetupCheck {
|
2013-01-22 22:57:02 +01:00
|
|
|
|
|
|
|
protected function executeChecks() {
|
|
|
|
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
|
2013-01-29 02:45:56 +01:00
|
|
|
|
2013-02-10 00:01:57 +01:00
|
|
|
if (strpos(AphrontRequest::getHTTPHeader('Host'), '.') === false) {
|
2013-01-29 02:45:56 +01:00
|
|
|
$summary = pht(
|
|
|
|
'The domain does not contain a dot. This is necessary for some web '.
|
|
|
|
'browsers to be able to set cookies.');
|
|
|
|
|
|
|
|
$message = pht(
|
|
|
|
'The domain in the base URI must contain a dot ("."), e.g. '.
|
|
|
|
'"http://example.com", not just a bare name like "http://example/". '.
|
|
|
|
'Some web browsers will not set cookies on domains with no TLD.');
|
|
|
|
|
|
|
|
$this
|
|
|
|
->newIssue('config.phabricator.domain')
|
|
|
|
->setShortName(pht('Dotless Domain'))
|
|
|
|
->setName(pht('No Dot Character in Domain'))
|
|
|
|
->setSummary($summary)
|
|
|
|
->setMessage($message)
|
|
|
|
->setIsFatal(true);
|
|
|
|
}
|
|
|
|
|
2013-01-22 22:57:02 +01:00
|
|
|
if ($base_uri) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$base_uri_guess = PhabricatorEnv::getRequestBaseURI();
|
|
|
|
|
|
|
|
$summary = pht(
|
2014-12-30 17:01:44 +01:00
|
|
|
'The base URI for this install is not configured. Many major features '.
|
|
|
|
'will not work properly until you configure it.');
|
2013-01-22 22:57:02 +01:00
|
|
|
|
|
|
|
$message = pht(
|
2014-12-30 17:01:44 +01:00
|
|
|
'The base URI for this install is not configured, and major features '.
|
|
|
|
'will not work properly until you configure it.'.
|
2013-01-22 22:57:02 +01:00
|
|
|
"\n\n".
|
|
|
|
'You should set the base URI to the URI you will use to access '.
|
|
|
|
'Phabricator, like "http://phabricator.example.com/".'.
|
|
|
|
"\n\n".
|
|
|
|
'Include the protocol (http or https), domain name, and port number if '.
|
|
|
|
'you are using a port other than 80 (http) or 443 (https).'.
|
|
|
|
"\n\n".
|
|
|
|
'Based on this request, it appears that the correct setting is:'.
|
|
|
|
"\n\n".
|
|
|
|
'%s'.
|
|
|
|
"\n\n".
|
|
|
|
'To configure the base URI, run the command shown below.',
|
|
|
|
$base_uri_guess);
|
|
|
|
|
|
|
|
$this
|
|
|
|
->newIssue('config.phabricator.base-uri')
|
|
|
|
->setShortName(pht('No Base URI'))
|
2014-06-09 20:36:49 +02:00
|
|
|
->setName(pht('Base URI Not Configured'))
|
2013-01-22 22:57:02 +01:00
|
|
|
->setSummary($summary)
|
|
|
|
->setMessage($message)
|
|
|
|
->addCommand(
|
2013-01-29 20:29:56 +01:00
|
|
|
hsprintf(
|
|
|
|
'<tt>phabricator/ $</tt> %s',
|
|
|
|
csprintf(
|
|
|
|
'./bin/config set phabricator.base-uri %s',
|
|
|
|
$base_uri_guess)));
|
2013-01-22 22:57:02 +01:00
|
|
|
}
|
|
|
|
}
|