1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Point the Phabricator resource map back to webroot/, not webroot/rsrc/

Summary:
Ref T4222. Earlier, I adjusted the root from `webroot/` to `webroot/rsrc/`. However, this means that all the `/rsrc/x/y/z.jpg` fragments in CSS are no longer recognized as resource names.

Since we have like 9,000 things in CSS that do `url(/rsrc/xyz.jpg)` and I don't want to fix/test them all, so just make them work as-is. There's no real reason either setting is better than the other.

(Both URLs also work fine, but the parsed one will be better once we have real CDN support.)

Test Plan: Verified CSS gets managed resource URIs transformed into it.

Reviewers: btrahan, hach-que

Reviewed By: hach-que

CC: aran

Maniphest Tasks: T4222

Differential Revision: https://secure.phabricator.com/D7875
This commit is contained in:
epriestley 2014-01-01 07:46:25 -08:00
parent 5173b4954d
commit 73e88bb101
3 changed files with 1852 additions and 1840 deletions

File diff suppressed because it is too large Load diff

View file

@ -112,14 +112,26 @@ final class CelerityResourceTransformer {
public function translateResourceURI(array $matches) { public function translateResourceURI(array $matches) {
$uri = trim($matches[1], "'\" \r\t\n"); $uri = trim($matches[1], "'\" \r\t\n");
$alternatives = array_unique(
array(
$uri,
ltrim($uri, '/'),
));
foreach ($alternatives as $alternative) {
if ($this->rawURIMap !== null) { if ($this->rawURIMap !== null) {
if (isset($this->rawURIMap[$uri])) { if (isset($this->rawURIMap[$alternative])) {
$uri = $this->rawURIMap[$uri]; $uri = $this->rawURIMap[$alternative];
break;
} }
} else if ($this->celerityMap) { }
$resource_uri = $this->celerityMap->getURIForName($uri);
if ($this->celerityMap) {
$resource_uri = $this->celerityMap->getURIForName($alternative);
if ($resource_uri) { if ($resource_uri) {
$uri = $resource_uri; $uri = $resource_uri;
break;
}
} }
} }

View file

@ -10,7 +10,7 @@ final class CelerityPhabricatorResources extends CelerityResourcesOnDisk {
} }
public function getPathToResources() { public function getPathToResources() {
return $this->getPhabricatorPath('webroot/rsrc/'); return $this->getPhabricatorPath('webroot/');
} }
public function getPathToMap() { public function getPathToMap() {