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:
Jonas L 2022-02-04 11:00:41 +01:00 committed by GitHub
parent e106858fd8
commit 729a7b99e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 133 additions and 257 deletions

View file

@ -1,25 +1,5 @@
<?php
define('CONFIG_PATH', dirname(__DIR__, 2) . '/application/configs/');
require_once dirname(__DIR__, 2) . '/vendor/jooola/propel1/runtime/lib/Propel.php';
require_once CONFIG_PATH . 'conf.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/CcPref.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/CcPrefPeer.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/CcPrefQuery.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/map/CcPrefTableMap.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/om/BaseCcPref.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/om/BaseCcPrefPeer.php';
require_once dirname(__DIR__, 2) . '/application/models/airtime/om/BaseCcPrefQuery.php';
/**
* User: sourcefabric
* Date: 08/12/14.
@ -30,10 +10,10 @@ require_once dirname(__DIR__, 2) . '/application/models/airtime/om/BaseCcPrefQue
*/
class GeneralSetup extends Setup
{
// airtime.conf section header
// config file section header
protected static $_section = '[general]';
// Array of key->value pairs for airtime.conf
// Array of key->value pairs for the config file
protected static $_properties;
// Constant form field names for passing errors back to the front-end
@ -86,8 +66,8 @@ class GeneralSetup extends Setup
public function setupCorsUrl()
{
try {
$_SERVER['AIRTIME_CONF'] = AIRTIME_CONF_TEMP_PATH;
Propel::init(CONFIG_PATH . 'airtime-conf-production.php');
$_SERVER['LIBRETIME_CONFIG_FILEPATH'] = INSTALLER_CONFIG_FILEPATH;
Propel::init(PROPEL_CONFIG_FILEPATH);
$con = Propel::getConnection();
} catch (Exception $e) {
self::$message = "Failed to insert Cors URL; database isn't configured properly!";
@ -104,7 +84,6 @@ class GeneralSetup extends Setup
try {
Application_Model_Preference::SetAllowedCorsUrls(self::$cors_url);
Propel::close();
//unset($_SERVER['AIRTIME_CONF']);
} catch (Exception $e) {
self::$message = 'Failed to insert ' . self::$cors_url . ' into cc_pref' . $e;
self::$errors[] = self::CORS_URL;