- 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.
31 lines
992 B
PHP
31 lines
992 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
|
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
|
|
|
class Kernel extends BaseKernel
|
|
{
|
|
use MicroKernelTrait;
|
|
|
|
// 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 'prod' === $this->environment ? $this->writableBase() . '/cache' : parent::getCacheDir();
|
|
}
|
|
|
|
public function getLogDir(): string
|
|
{
|
|
return 'prod' === $this->environment ? $this->writableBase() . '/log' : parent::getLogDir();
|
|
}
|
|
}
|