mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-09 16:32:39 +01:00
Fix minor issues with D2630
Summary: - The config is called "resource-path" and the script references "resource-path", but the actual value checked for is "resource-map". - Use nonempty(), since defaulting with getEnvConfig() will give you null if the setting exists but is set to null. This default is nearly useless so maybe we should change it to use coalesce(). - Remove Celerity map initialization from warmup. We don't currently initialize the environment in warmup, and Celerity initialization now depends on the environment. Test Plan: Ran patch locally and on FPM-Warmup. Reviewers: vrana, btrahan Reviewed By: vrana CC: hsb, aran Differential Revision: https://secure.phabricator.com/D2662
This commit is contained in:
parent
3e87112d69
commit
259638e900
4 changed files with 20 additions and 10 deletions
|
@ -974,9 +974,8 @@ return array(
|
|||
'phd.start-taskmasters' => 4,
|
||||
|
||||
// Path to custom celerity resource map. Absolute or relative to
|
||||
// 'phabricator/src'. Defaults to '__celerity_resource_map__.php'.
|
||||
// See also `scripts/celerity_mapper.php`.
|
||||
'celerity.resource-path' => null,
|
||||
// 'phabricator/src'. See also `scripts/celerity_mapper.php`.
|
||||
'celerity.resource-path' => '__celerity_resource_map__.php',
|
||||
|
||||
// This value is an input to the hash function when building resource hashes.
|
||||
// It has no security value, but if you accidentally poison user caches (by
|
||||
|
|
|
@ -48,9 +48,6 @@ function __warmup__() {
|
|||
$loader = new PhutilSymbolLoader();
|
||||
$loader->selectAndLoadSymbols();
|
||||
|
||||
// Force load of the Celerity map.
|
||||
CelerityResourceMap::getInstance();
|
||||
|
||||
define('__WARMUP__', true);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,12 +35,13 @@ final class CelerityResourceMap {
|
|||
if (empty(self::$instance)) {
|
||||
self::$instance = new CelerityResourceMap();
|
||||
$root = phutil_get_library_root('phabricator');
|
||||
$path = PhabricatorEnv::getEnvConfig(
|
||||
'celerity.resource-map',
|
||||
'__celerity_resource_map__.php');
|
||||
|
||||
$path = PhabricatorEnv::getEnvConfig('celerity.resource-path');
|
||||
$ok = include_once Filesystem::resolvePath($path, $root);
|
||||
if (!$ok) {
|
||||
throw new Exception("Failed to load Celerity resource map!");
|
||||
throw new Exception(
|
||||
"Failed to load Celerity resource map! Check the ".
|
||||
"'celerity.resource-path' setting in your configuration.");
|
||||
}
|
||||
}
|
||||
return self::$instance;
|
||||
|
|
|
@ -152,6 +152,10 @@ if ($access_log) {
|
|||
));
|
||||
}
|
||||
|
||||
// If execution throws an exception and then trying to render that exception
|
||||
// throws another exception, we want to show the original exception, as it is
|
||||
// likely the root cause of the rendering exception.
|
||||
$original_exception = null;
|
||||
try {
|
||||
$response = $controller->willBeginExecution();
|
||||
|
||||
|
@ -172,6 +176,7 @@ try {
|
|||
$response = id(new AphrontRedirectResponse())
|
||||
->setURI($ex->getURI());
|
||||
} catch (Exception $ex) {
|
||||
$original_exception = $ex;
|
||||
$response = $application->handleException($ex);
|
||||
}
|
||||
|
||||
|
@ -184,6 +189,14 @@ try {
|
|||
if ($access_log) {
|
||||
$access_log->write();
|
||||
}
|
||||
if ($original_exception) {
|
||||
$ex = new PhutilAggregateException(
|
||||
"Multiple exceptions during processing and rendering.",
|
||||
array(
|
||||
$original_exception,
|
||||
$ex,
|
||||
));
|
||||
}
|
||||
phabricator_fatal('[Rendering Exception] '.$ex->getMessage());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue