mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 16:40:05 +01:00
Adding direct access to installtool and enabling versionNumberInFilename
This commit is contained in:
@@ -62,6 +62,8 @@ public function serves($sitePath, $siteName, $uri)
|
||||
*/
|
||||
public function isStaticFile($sitePath, $siteName, $uri)
|
||||
{
|
||||
$uri = $this->isVersionNumberInFilename($sitePath . $this->documentRoot . $uri, $uri);
|
||||
|
||||
if (file_exists($filePath = $sitePath . $this->documentRoot . $uri)
|
||||
&& ! is_dir($filePath)
|
||||
&& pathinfo($filePath)['extension'] !== 'php')
|
||||
@@ -84,6 +86,7 @@ public function isStaticFile($sitePath, $siteName, $uri)
|
||||
*/
|
||||
public function frontControllerPath($sitePath, $siteName, $uri)
|
||||
{
|
||||
$this->directLoginToInstallTool($uri);
|
||||
$this->authorizeAccess($uri);
|
||||
$uri = rtrim($uri, '/');
|
||||
$absoluteFilePath = $sitePath . $this->documentRoot . $uri;
|
||||
@@ -156,4 +159,38 @@ private function authorizeAccess($uri)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Rule for versioned static files, configured through:
|
||||
* - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
|
||||
* - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
|
||||
*
|
||||
* @param string $filePath
|
||||
* @param string $uri
|
||||
* @return string $uri
|
||||
*/
|
||||
private function isVersionNumberInFilename($filePath, $uri) {
|
||||
if ( ! file_exists($filePath) &&
|
||||
preg_match("/^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$/", $uri)
|
||||
) {
|
||||
return preg_replace("/^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$/", "$1.$3", $uri);
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Direct access to installtool via domain.dev/typo3/install/
|
||||
* Will be redirected to the sysext install script
|
||||
*
|
||||
* @param string $uri
|
||||
*/
|
||||
private function directLoginToInstallTool($uri) {
|
||||
if (preg_match("/^\/typo3\/install$/", rtrim($uri)))
|
||||
{
|
||||
header('Location: /typo3/sysext/install/Start/Install.php');
|
||||
die();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user