本文整理汇总了PHP中PhabricatorEnv::getRequestBaseURI方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorEnv::getRequestBaseURI方法的具体用法?PHP PhabricatorEnv::getRequestBaseURI怎么用?PHP PhabricatorEnv::getRequestBaseURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhabricatorEnv
的用法示例。
在下文中一共展示了PhabricatorEnv::getRequestBaseURI方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeChecks
protected function executeChecks()
{
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
if (strpos(AphrontRequest::getHTTPHeader('Host'), '.') === false) {
$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);
}
if ($base_uri) {
return;
}
$base_uri_guess = PhabricatorEnv::getRequestBaseURI();
$summary = pht('The base URI for this install is not configured. Configuring it will ' . 'improve security and enable features.');
$message = pht('The base URI for this install is not configured. Configuring it will ' . 'improve security and allow background processes (like daemons and ' . 'scripts) to generate links.' . "\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'))->setName(pht('Base URI Not Configured'))->setSummary($summary)->setMessage($message)->addCommand(hsprintf('<tt>phabricator/ $</tt> %s', csprintf('./bin/config set phabricator.base-uri %s', $base_uri_guess)));
}
示例2: executeChecks
protected function executeChecks()
{
$base_uri = PhabricatorEnv::getEnvConfig('phabricator.base-uri');
$host_header = AphrontRequest::getHTTPHeader('Host');
if (strpos($host_header, '.') === false) {
if (!strlen(trim($host_header))) {
$name = pht('No "Host" Header');
$summary = pht('No "Host" header present in request.');
$message = pht('This request did not include a "Host" header. This may mean that ' . 'your webserver (like nginx or apache) is misconfigured so the ' . '"Host" header is not making it to Phabricator, or that you are ' . 'making a raw request without a "Host" header using a tool or ' . 'library.' . "\n\n" . 'If you are using a web browser, check your webserver ' . 'configuration. If you are using a tool or library, check how the ' . 'request is being constructed.' . "\n\n" . 'It is also possible (but very unlikely) that some other network ' . 'device (like a load balancer) is stripping the header.' . "\n\n" . 'Requests must include a valid "Host" header.');
} else {
$name = pht('Bad "Host" Header');
$summary = pht('Request has bad "Host" header.');
$message = pht('This request included an invalid "Host" header, with value "%s". ' . 'Host headers must contain a dot ("."), like "example.com". This ' . 'is required for some browsers to be able to set cookies.' . "\n\n" . 'This may mean the base URI is configured incorrectly. You must ' . 'serve Phabricator from a base URI with a dot (like ' . '"https://phabricator.mycompany.com"), not a bare domain ' . '(like "https://phabricator/"). If you are trying to use a bare ' . 'domain, change your configuration to use a full domain with a dot ' . 'in it instead.' . "\n\n" . 'This might also mean that your webserver (or some other network ' . 'device, like a load balancer) is mangling the "Host" header, or ' . 'you are using a tool or library to issue a request manually and ' . 'setting the wrong "Host" header.' . "\n\n" . 'Requests must include a valid "Host" header.', $host_header);
}
$this->newIssue('request.host')->setName($name)->setSummary($summary)->setMessage($message)->setIsFatal(true);
}
if ($base_uri) {
return;
}
$base_uri_guess = PhabricatorEnv::getRequestBaseURI();
$summary = pht('The base URI for this install is not configured. Many major features ' . 'will not work properly until you configure it.');
$message = pht('The base URI for this install is not configured, and major features ' . 'will not work properly until you configure it.' . "\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'))->setName(pht('Base URI Not Configured'))->setSummary($summary)->setMessage($message)->addCommand(hsprintf('<tt>phabricator/ $</tt> %s', csprintf('./bin/config set phabricator.base-uri %s', $base_uri_guess)));
}