Skip to content

Commit

Permalink
Merge pull request #12 from netlogix/feature/neos-8
Browse files Browse the repository at this point in the history
FEATURE: Neos 8.0
  • Loading branch information
saschanowak committed Apr 9, 2022
2 parents 5fe4631 + 480f14b commit b27159a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
27 changes: 20 additions & 7 deletions Classes/Service/ControllerContextFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@
class ControllerContextFactory
{

/**
* @param UriInterface $uri
* @return ControllerContext
*/
public function buildControllerContext(UriInterface $uri): ControllerContext
{
$_SERVER['FLOW_REWRITEURLS'] = '1';
$httpRequest = ServerRequest::fromGlobals()
->withUri($uri)
$httpRequest = self::createHttpRequestFromGlobals($uri)
->withAttribute(
ServerRequestAttributes::ROUTING_PARAMETERS,
RouteParameters::createEmpty()->withParameter('requestUriHost', $uri->getHost())
Expand All @@ -48,4 +42,23 @@ public function buildControllerContext(UriInterface $uri): ControllerContext
);
}

private static function createHttpRequestFromGlobals(UriInterface $uri): ServerRequest
{
$_SERVER['FLOW_REWRITEURLS'] = '1';
$fromGlobals = ServerRequest::fromGlobals();

return new ServerRequest(
$fromGlobals->getMethod(),
$uri,
$fromGlobals->getHeaders(),
$fromGlobals->getBody(),
$fromGlobals->getProtocolVersion(),
array_merge(
$fromGlobals->getServerParams(),
// Empty SCRIPT_NAME to prevent "./flow" in Uri
['SCRIPT_NAME' => '']
)
);
}

}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Netlogix:
language: ['en_US', 'en']

source: '#550e8400-e29b-11d4-a716-446655440000'
destination: '${"/var/www/default/" + site + "/" + dimensions + "/500.html"}'
destination: '${"%FLOW_PATH_DATA%Persistent/ErrorPages/" + site + "-" + dimensions + "-500.html"}'
```

## Generate error pages
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"type": "neos-package",
"license": "MIT",
"require": {
"php": "^7.2 || ^8.0",
"php": "^7.3 || ^8.0",
"ext-curl": "*",
"guzzlehttp/guzzle": "~6.0 || ~7.0",
"neos/neos": "~7.0"
"neos/neos": "^7.0 || ^8.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit b27159a

Please sign in to comment.