1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 10:12:41 +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:
epriestley 2012-06-06 08:15:42 -07:00
parent 3e87112d69
commit 259638e900
4 changed files with 20 additions and 10 deletions

View file

@ -974,9 +974,8 @@ return array(
'phd.start-taskmasters' => 4, 'phd.start-taskmasters' => 4,
// Path to custom celerity resource map. Absolute or relative to // Path to custom celerity resource map. Absolute or relative to
// 'phabricator/src'. Defaults to '__celerity_resource_map__.php'. // 'phabricator/src'. See also `scripts/celerity_mapper.php`.
// See also `scripts/celerity_mapper.php`. 'celerity.resource-path' => '__celerity_resource_map__.php',
'celerity.resource-path' => null,
// This value is an input to the hash function when building resource hashes. // 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 // It has no security value, but if you accidentally poison user caches (by

View file

@ -48,9 +48,6 @@ function __warmup__() {
$loader = new PhutilSymbolLoader(); $loader = new PhutilSymbolLoader();
$loader->selectAndLoadSymbols(); $loader->selectAndLoadSymbols();
// Force load of the Celerity map.
CelerityResourceMap::getInstance();
define('__WARMUP__', true); define('__WARMUP__', true);
} }

View file

@ -35,12 +35,13 @@ final class CelerityResourceMap {
if (empty(self::$instance)) { if (empty(self::$instance)) {
self::$instance = new CelerityResourceMap(); self::$instance = new CelerityResourceMap();
$root = phutil_get_library_root('phabricator'); $root = phutil_get_library_root('phabricator');
$path = PhabricatorEnv::getEnvConfig(
'celerity.resource-map', $path = PhabricatorEnv::getEnvConfig('celerity.resource-path');
'__celerity_resource_map__.php');
$ok = include_once Filesystem::resolvePath($path, $root); $ok = include_once Filesystem::resolvePath($path, $root);
if (!$ok) { 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; return self::$instance;

View file

@ -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 { try {
$response = $controller->willBeginExecution(); $response = $controller->willBeginExecution();
@ -172,6 +176,7 @@ try {
$response = id(new AphrontRedirectResponse()) $response = id(new AphrontRedirectResponse())
->setURI($ex->getURI()); ->setURI($ex->getURI());
} catch (Exception $ex) { } catch (Exception $ex) {
$original_exception = $ex;
$response = $application->handleException($ex); $response = $application->handleException($ex);
} }
@ -184,6 +189,14 @@ try {
if ($access_log) { if ($access_log) {
$access_log->write(); $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()); phabricator_fatal('[Rendering Exception] '.$ex->getMessage());
} }