Files

15 lines
1.1 KiB
PHP

<?php
require __DIR__.'/../web/config/lab.php';
$c=lab_config();$public=realpath($c['public_root']);$private=realpath($c['project_root']);
if(!$public||!$private||str_starts_with($private.'/',dirname(dirname($public)).'/'))throw new RuntimeException('Private source must be outside the public project directory.');
foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($public,FilesystemIterator::SKIP_DOTS)) as $file){
if(!$file->isFile())continue;
$relative=substr($file->getPathname(),strlen($public)+1);
if($relative==='index.php')continue;
if(!preg_match('~^(js/[^/]+\.js|themes/exoplasim/css/[^/]+\.css)$~',$relative))throw new RuntimeException('Unexpected public file: '.$relative);
}
$installer=file_get_contents(__DIR__.'/../scripts/install-web');
if(preg_match('~(/etc/nginx|render_nginx|systemctl[^\n]*nginx)~',$installer))throw new RuntimeException('Installer must not configure nginx.');
if(is_file(__DIR__.'/../deploy/exoplasim-nginx.conf'))throw new RuntimeException('Application nginx configuration remains.');
echo "Public-file boundary and ordinary PHP hosting checks passed\n";