. */ declare(strict_types=1); namespace Fisharebest\Webtrees; use ErrorException; use function date_default_timezone_set; use function error_reporting; use function set_error_handler; /** * Definitions for the webtrees application. */ class Webtrees { // Location of the file containing the database connection details. public const CONFIG_FILE = __DIR__ . '/../data/config.ini.php'; // Enable debugging on development builds. public const DEBUG = self::STABILITY !== ''; // We want to know about all PHP errors during development, and fewer in production. public const ERROR_REPORTING = self::DEBUG ? E_ALL | E_STRICT | E_NOTICE | E_DEPRECATED : E_ALL; // The name of the application. public const NAME = 'webtrees'; // Required version of database tables/columns/indexes/etc. public const SCHEMA_VERSION = 41; // e.g. "dev", "alpha", "beta.3", etc. public const STABILITY = 'dev'; // Project website. public const URL = 'https://www.webtrees.net/'; // Version number public const VERSION = '2.0.0' . (self::STABILITY === '' ? '' : '-') . self::STABILITY; // Location of our modules and themes. These are used as URLs and folder paths. public const MODULES_PATH = 'modules_v3/'; // Location of themes (core and custom). public const THEMES_PATH = 'themes/'; // Location of CSS/JS/etc. assets. See also webpack.mix.js. public const ASSETS_PATH = 'public/assets-2.0.0/'; // Location of our installation of CK editor. public const CKEDITOR_PATH = 'public/ckeditor-4.5.2-custom/'; /** * Initialise the application. * * @return void */ public static function init() { // Show all errors and warnings in development, fewer in production. error_reporting(self::ERROR_REPORTING); // PHP requires a time zone to be set. We'll set a better one later on. date_default_timezone_set('UTC'); // Convert PHP warnings/notices into exceptions set_error_handler(function (int $errno, string $errstr, string $errfile, int $errline): bool { // Ignore errors that are silenced with '@' if (error_reporting() & $errno) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } return true; }); } }