feat(legacy): consolidate constants (#1558)
* remove unused file * fix paths leading slash * remove useless imports * refactor(legacy): use constants everywhere * fix path leading slash * remove useless import * consolidate legacy contants * format code * reuse LIBRETIME_CONFIG_DIR * fix test config path * remove ci legacy log dir creation * some logs improvements
This commit is contained in:
parent
e106858fd8
commit
729a7b99e0
34 changed files with 133 additions and 257 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once dirname(__DIR__) . '/application/preload.php';
|
||||
|
||||
$configRun = false;
|
||||
$extensions = get_loaded_extensions();
|
||||
$airtimeSetup = false;
|
||||
|
@ -13,7 +15,7 @@ function showConfigCheckPage()
|
|||
checkConfiguration();
|
||||
}
|
||||
|
||||
require_once CONFIG_PATH . 'config-check.php';
|
||||
require_once CONFIG_PATH . '/config-check.php';
|
||||
|
||||
exit();
|
||||
}
|
||||
|
@ -25,38 +27,20 @@ function isApiCall()
|
|||
return strpos($path, 'api') !== false;
|
||||
}
|
||||
|
||||
// Define application path constants
|
||||
define('ROOT_PATH', dirname(__DIR__) . '/');
|
||||
define('LIB_PATH', ROOT_PATH . 'library/');
|
||||
define('BUILD_PATH', ROOT_PATH . 'build/');
|
||||
define('SETUP_PATH', BUILD_PATH . 'airtime-setup/');
|
||||
define('APPLICATION_PATH', ROOT_PATH . 'application/');
|
||||
define('CONFIG_PATH', APPLICATION_PATH . 'configs/');
|
||||
define('VENDOR_PATH', ROOT_PATH . 'vendor/');
|
||||
define('REST_MODULE_CONTROLLER_PATH', APPLICATION_PATH . 'modules/rest/controllers/');
|
||||
|
||||
define('AIRTIME_CONFIG_STOR', '/etc/airtime/');
|
||||
|
||||
define('AIRTIME_CONFIG', 'airtime.conf');
|
||||
|
||||
//Rest Module Controllers - for custom Rest_RouteController.php
|
||||
set_include_path(REST_MODULE_CONTROLLER_PATH . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(APPLICATION_PATH . '/modules/rest/controllers/' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
// Vendors (Composer, zend-loader is explicitly specified due to https://github.com/zf1/zend-application/pull/2#issuecomment-102599655)
|
||||
set_include_path(VENDOR_PATH . PATH_SEPARATOR . VENDOR_PATH . 'zf1s/zend-loader/library/' . PATH_SEPARATOR . get_include_path());
|
||||
set_include_path(VENDOR_PATH . PATH_SEPARATOR . VENDOR_PATH . '/zf1s/zend-loader/library/' . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
// Ensure library/ is on include_path
|
||||
set_include_path(LIB_PATH . PATH_SEPARATOR . get_include_path());
|
||||
|
||||
require_once VENDOR_PATH . 'autoload.php';
|
||||
|
||||
if (!class_exists('Propel')) {
|
||||
exit('Error: Propel not found. Did you install Airtime\'s third-party dependencies with composer? (Check the README.)');
|
||||
}
|
||||
|
||||
require_once CONFIG_PATH . 'conf.php';
|
||||
|
||||
require_once SETUP_PATH . 'load.php';
|
||||
require_once SETUP_PATH . '/load.php';
|
||||
|
||||
// This allows us to pass ?config as a parameter to any page
|
||||
// and get to the config checklist.
|
||||
|
@ -64,16 +48,13 @@ if (array_key_exists('config', $_GET)) {
|
|||
showConfigCheckPage();
|
||||
}
|
||||
|
||||
$filename = isset($_SERVER['AIRTIME_CONF']) ?
|
||||
$_SERVER['AIRTIME_CONF'] : AIRTIME_CONFIG_STOR . AIRTIME_CONFIG;
|
||||
|
||||
// If a configuration file exists, forward to our boot script
|
||||
if (file_exists($filename)) {
|
||||
require_once APPLICATION_PATH . 'airtime-boot.php';
|
||||
if (file_exists(LIBRETIME_CONFIG_FILEPATH)) {
|
||||
require_once APPLICATION_PATH . '/airtime-boot.php';
|
||||
}
|
||||
// Otherwise, we'll need to run our configuration setup
|
||||
else {
|
||||
$airtimeSetup = true;
|
||||
|
||||
require_once SETUP_PATH . 'setup-config.php';
|
||||
require_once SETUP_PATH . '/setup-config.php';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue