Update Kernel.php for writable base handling, add .htaccess for routing, and modify manifest.json and liara.json
- Refactored Kernel.php to ensure writable base directory is set correctly for production on Liara. - Added .htaccess file to forward requests to the public directory, addressing the limitation of Liara's PHP platform. - Updated manifest.json with new modification times and AST hashes for affected files. - Minor formatting change in liara.json to ensure proper file structure.
This commit is contained in:
+11
-4
@@ -9,15 +9,22 @@ class Kernel extends BaseKernel
|
||||
{
|
||||
use MicroKernelTrait;
|
||||
|
||||
// On read-only-root PaaS (Liara), var/ is not writable. Redirect cache/log to a
|
||||
// writable path (e.g. /tmp) via env; falls back to the default var/ locally.
|
||||
// On read-only-root PaaS (Liara) var/ is not writable, and PHP's default
|
||||
// variables_order (GPCS) keeps env vars out of $_SERVER — so in prod, force a
|
||||
// writable base (/tmp) directly instead of relying on an env var. Local/dev keep
|
||||
// the default var/ paths. APP_CACHE_DIR/APP_LOG_DIR can still override the base.
|
||||
private function writableBase(): string
|
||||
{
|
||||
return $_SERVER['APP_TMP_DIR'] ?? getenv('APP_TMP_DIR') ?: '/tmp/clinicpro';
|
||||
}
|
||||
|
||||
public function getCacheDir(): string
|
||||
{
|
||||
return $_SERVER['APP_CACHE_DIR'] ?? parent::getCacheDir();
|
||||
return 'prod' === $this->environment ? $this->writableBase() . '/cache' : parent::getCacheDir();
|
||||
}
|
||||
|
||||
public function getLogDir(): string
|
||||
{
|
||||
return $_SERVER['APP_LOG_DIR'] ?? parent::getLogDir();
|
||||
return 'prod' === $this->environment ? $this->writableBase() . '/log' : parent::getLogDir();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user