mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
I guess this can support JS too.
This commit is contained in:
parent
0c8b04d5a8
commit
9f04548ab9
5 changed files with 49 additions and 1 deletions
|
@ -111,12 +111,24 @@ foreach ($file_map as $path => $info) {
|
|||
$package_map = array();
|
||||
foreach ($package_spec as $name => $package) {
|
||||
$hashes = array();
|
||||
$type = null;
|
||||
foreach ($package as $symbol) {
|
||||
if (empty($hash_map[$symbol])) {
|
||||
throw new Exception(
|
||||
"Package specification for '{$name}' includes '{$symbol}', but that ".
|
||||
"symbol is not defined anywhere.");
|
||||
}
|
||||
if ($type === null) {
|
||||
$type = $runtime_map[$symbol]['type'];
|
||||
} else {
|
||||
$ntype = $runtime_map[$symbol]['type'];
|
||||
if ($type !== $ntype) {
|
||||
throw new Exception(
|
||||
"Package specification for '{$name}' mixes resources of type ".
|
||||
"'{$type}' with resources of type '{$ntype}'. Each package may only ".
|
||||
"contain one type of resource.");
|
||||
}
|
||||
}
|
||||
$hashes[] = $symbol.':'.$hash_map[$symbol];
|
||||
}
|
||||
$key = substr(md5(implode("\n", $hashes)), 0, 8);
|
||||
|
@ -124,7 +136,7 @@ foreach ($package_spec as $name => $package) {
|
|||
'name' => $name,
|
||||
'symbols' => $package,
|
||||
'uri' => '/res/pkg/'.$key.'/'.$name,
|
||||
'type' => 'css', // TODO LOL
|
||||
'type' => $type,
|
||||
);
|
||||
foreach ($package as $symbol) {
|
||||
$package_map['reverse'][$symbol] = $key;
|
||||
|
|
|
@ -97,6 +97,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialUnitStatus' => 'applications/differential/constants/unitstatus',
|
||||
'Javelin' => 'infratructure/javelin/api',
|
||||
'LiskDAO' => 'storage/lisk/dao',
|
||||
'Phabricator404Controller' => 'applications/base/controller/404',
|
||||
'PhabricatorAuthController' => 'applications/auth/controlller/base',
|
||||
'PhabricatorConduitAPIController' => 'applications/conduit/controller/api',
|
||||
'PhabricatorConduitConnectionLog' => 'applications/conduit/storage/connectionlog',
|
||||
|
@ -240,6 +241,7 @@ phutil_register_library_map(array(
|
|||
'DifferentialRevisionListController' => 'DifferentialController',
|
||||
'DifferentialRevisionUpdateHistoryView' => 'AphrontView',
|
||||
'DifferentialRevisionViewController' => 'DifferentialController',
|
||||
'Phabricator404Controller' => 'PhabricatorController',
|
||||
'PhabricatorAuthController' => 'PhabricatorController',
|
||||
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
|
||||
'PhabricatorConduitConnectionLog' => 'PhabricatorConduitDAO',
|
||||
|
|
|
@ -28,6 +28,7 @@ abstract class AphrontApplicationConfiguration {
|
|||
abstract public function getApplicationName();
|
||||
abstract public function getURIMap();
|
||||
abstract public function buildRequest();
|
||||
abstract public function build404Controller();
|
||||
|
||||
final public function setRequest(AphrontRequest $request) {
|
||||
$this->request = $request;
|
||||
|
@ -45,6 +46,10 @@ abstract class AphrontApplicationConfiguration {
|
|||
$path = $request->getPath();
|
||||
list($controller_class, $uri_data) = $mapper->mapPath($path);
|
||||
|
||||
if (!$controller_class) {
|
||||
return $this->build404Controller();
|
||||
}
|
||||
|
||||
PhutilSymbolLoader::loadClass($controller_class);
|
||||
$controller = newv($controller_class, array($request));
|
||||
|
||||
|
|
|
@ -155,5 +155,9 @@ class AphrontDefaultApplicationConfiguration
|
|||
return $response;
|
||||
}
|
||||
|
||||
public function build404Controller() {
|
||||
return new Phabricator404Controller($request);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
class Phabricator404Controller extends PhabricatorController {
|
||||
|
||||
public function processRequest() {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue