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:
hamed
2026-06-29 18:24:48 +03:30
parent c71d674d22
commit 97958ecc7d
10 changed files with 591 additions and 504 deletions
+11 -4
View File
@@ -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();
}
}