xref: /webtrees/app/Webtrees.php (revision cfbf56ad574e64d6e9caaa3d0e76e9a8c102b676)
18d0ebef0SGreg Roach<?php
28d0ebef0SGreg Roach/**
38d0ebef0SGreg Roach * webtrees: online genealogy
48fcd0d32SGreg Roach * Copyright (C) 2019 webtrees development team
58d0ebef0SGreg Roach * This program is free software: you can redistribute it and/or modify
68d0ebef0SGreg Roach * it under the terms of the GNU General Public License as published by
78d0ebef0SGreg Roach * the Free Software Foundation, either version 3 of the License, or
88d0ebef0SGreg Roach * (at your option) any later version.
98d0ebef0SGreg Roach * This program is distributed in the hope that it will be useful,
108d0ebef0SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of
118d0ebef0SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128d0ebef0SGreg Roach * GNU General Public License for more details.
138d0ebef0SGreg Roach * You should have received a copy of the GNU General Public License
148d0ebef0SGreg Roach * along with this program. If not, see <http://www.gnu.org/licenses/>.
158d0ebef0SGreg Roach */
168d0ebef0SGreg Roachdeclare(strict_types=1);
178d0ebef0SGreg Roach
188d0ebef0SGreg Roachnamespace Fisharebest\Webtrees;
198d0ebef0SGreg Roach
208d0ebef0SGreg Roachuse function date_default_timezone_set;
218d0ebef0SGreg Roachuse function error_reporting;
226ccdf4f0SGreg Roachuse Fisharebest\Webtrees\Exceptions\Handler;
238d0ebef0SGreg Roachuse function set_error_handler;
246ccdf4f0SGreg Roachuse function set_exception_handler;
258d0ebef0SGreg Roach
268d0ebef0SGreg Roach/**
278d0ebef0SGreg Roach * Definitions for the webtrees application.
288d0ebef0SGreg Roach */
298d0ebef0SGreg Roachclass Webtrees
308d0ebef0SGreg Roach{
318d0ebef0SGreg Roach    // Location of the file containing the database connection details.
3216d6367aSGreg Roach    public const CONFIG_FILE = __DIR__ . '/../data/config.ini.php';
338d0ebef0SGreg Roach
348d0ebef0SGreg Roach    // Enable debugging on development builds.
3516d6367aSGreg Roach    public const DEBUG = self::STABILITY !== '';
368d0ebef0SGreg Roach
378d0ebef0SGreg Roach    // We want to know about all PHP errors during development, and fewer in production.
3816d6367aSGreg Roach    public const ERROR_REPORTING = self::DEBUG ? E_ALL | E_STRICT | E_NOTICE | E_DEPRECATED : E_ALL;
398d0ebef0SGreg Roach
408d0ebef0SGreg Roach    // The name of the application.
4116d6367aSGreg Roach    public const NAME = 'webtrees';
428d0ebef0SGreg Roach
438d0ebef0SGreg Roach    // Required version of database tables/columns/indexes/etc.
4467992b6aSRichard Cissee    public const SCHEMA_VERSION = 43;
458d0ebef0SGreg Roach
468d0ebef0SGreg Roach    // e.g. "dev", "alpha", "beta.3", etc.
47963ec568SGreg Roach    public const STABILITY = 'alpha.5';
488d0ebef0SGreg Roach
498d0ebef0SGreg Roach    // Project website.
5016d6367aSGreg Roach    public const URL = 'https://www.webtrees.net/';
518d0ebef0SGreg Roach
528d0ebef0SGreg Roach    // Version number
5316d6367aSGreg Roach    public const VERSION = '2.0.0' . (self::STABILITY === '' ? '' : '-') . self::STABILITY;
548d0ebef0SGreg Roach
55*cfbf56adSGreg Roach    // Location of our modules.
5649a243cbSGreg Roach    public const MODULES_PATH = 'modules_v4/';
578d0ebef0SGreg Roach
588d0ebef0SGreg Roach    /**
598d0ebef0SGreg Roach     * Initialise the application.
608d0ebef0SGreg Roach     *
618d0ebef0SGreg Roach     * @return void
628d0ebef0SGreg Roach     */
63e364afe4SGreg Roach    public static function init(): void
648d0ebef0SGreg Roach    {
65f8e24896SGreg Roach        mb_internal_encoding('UTF-8');
66f8e24896SGreg Roach
678d0ebef0SGreg Roach        // Show all errors and warnings in development, fewer in production.
68*cfbf56adSGreg Roach        error_reporting(self::ERROR_REPORTING);
698d0ebef0SGreg Roach
708d0ebef0SGreg Roach        // PHP requires a time zone to be set. We'll set a better one later on.
718d0ebef0SGreg Roach        date_default_timezone_set('UTC');
728d0ebef0SGreg Roach
736ccdf4f0SGreg Roach        set_error_handler(Handler::phpErrorHandler());
746ccdf4f0SGreg Roach        set_exception_handler(Handler::phpExceptionHandler());
758d0ebef0SGreg Roach    }
768d0ebef0SGreg Roach}
77