Support config-driven choice between MySQL and SQLite via DB_DRIVER constant, defaulting to MySQL for backward compatibility. All SQL adaptation lives in Database.php (UDFs + query rewriting), so model files need no changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> SQLite: remove FK constraints, revert 0→null sentinel changes The SQLite schema had FOREIGN KEY constraints that don't exist in the MySQL schema. These forced a cascade of 0→null changes to satisfy FK enforcement. Removing them keeps the two backends behaviorally consistent and minimises the diff. Real SQLite compat fixes (UDFs, query rewriting, rowCount→count, Router fixes, EditAlbum guard) are preserved. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
38 lines
1.1 KiB
PHP
38 lines
1.1 KiB
PHP
<?php
|
|
/*****************************************************************************
|
|
* app.php
|
|
* Initiates key classes and determines which controller to use.
|
|
*
|
|
* Kabuki CMS (C) 2013-2015, Aaron van Geffen
|
|
*****************************************************************************/
|
|
|
|
// Include the project's configuration.
|
|
require_once 'config.php';
|
|
|
|
// Set up the autoloader.
|
|
require_once 'vendor/autoload.php';
|
|
|
|
// Initialise the database.
|
|
Registry::set('start', microtime(true));
|
|
if (defined('DB_DRIVER') && DB_DRIVER === 'sqlite')
|
|
Registry::set('db', new Database('sqlite', ['file' => DB_FILE]));
|
|
else
|
|
Registry::set('db', new Database('mysql', [
|
|
'host' => DB_SERVER, 'user' => DB_USER,
|
|
'password' => DB_PASS, 'name' => DB_NAME,
|
|
]));
|
|
|
|
// Handle errors our own way.
|
|
ErrorHandler::enable();
|
|
|
|
// Do some authentication checks.
|
|
Session::start();
|
|
$user = Authentication::isLoggedIn() ? Member::fromId($_SESSION['user_id']) : new Guest();
|
|
$user->updateAccessTime();
|
|
Registry::set('user', $user);
|
|
|
|
// The real magic starts here!
|
|
ob_start();
|
|
Dispatcher::dispatch();
|
|
ob_end_flush();
|