Init
This commit is contained in:
commit
60ca58f5ba
80 changed files with 9458 additions and 0 deletions
38
lib/bootstrap.php
Normal file
38
lib/bootstrap.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
if (!defined('ROOT')) define('ROOT', dirname(__DIR__));
|
||||
|
||||
$config = require ROOT . '/config/config.php';
|
||||
|
||||
ini_set('session.cookie_httponly', '1');
|
||||
ini_set('session.use_strict_mode', '1');
|
||||
session_name($config['session_name']);
|
||||
session_start();
|
||||
|
||||
require_once ROOT . '/lib/DB.php';
|
||||
require_once ROOT . '/lib/Auth.php';
|
||||
require_once ROOT . '/lib/ProjectTypes.php';
|
||||
require_once ROOT . '/lib/Audit.php';
|
||||
|
||||
$db = DB::connect($config['db_path']);
|
||||
DB::autoMigrate(ROOT . '/sql');
|
||||
|
||||
/**
|
||||
* Returns the deploy fingerprint as ['version','sha','branch','built'] read
|
||||
* from web/BUILD — the file is generated by deploy.sh / deploylocal.sh and
|
||||
* never committed (see .gitignore). Falls back to 'dev' if missing.
|
||||
*
|
||||
* Mirrors /opt/agenda/web/lib/layout.php:buildInfo().
|
||||
*/
|
||||
function buildInfo(): array {
|
||||
static $info = null;
|
||||
if ($info !== null) return $info;
|
||||
$info = ['version' => 'dev', 'sha' => '', 'branch' => '', 'built' => ''];
|
||||
$file = ROOT . '/web/BUILD';
|
||||
if (!is_readable($file)) return $info;
|
||||
foreach (file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) as $line) {
|
||||
if (strpos($line, '=') === false) continue;
|
||||
[$k, $v] = array_map('trim', explode('=', $line, 2));
|
||||
if (isset($info[$k])) $info[$k] = $v;
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue