From 4d868fac00ab3cf96fc622127b0ae4f79b511892 Mon Sep 17 00:00:00 2001 From: jo Date: Mon, 31 Jan 2022 12:36:40 +0100 Subject: [PATCH] feat: remove unused web_server_user config entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - remove InstallStorageDirectory function BREAKING CHANGE: The configuration schema has changed: - TheĀ `general.web_server_user` configuration field is not used anymore. --- legacy/application/configs/conf.php | 2 - legacy/build/airtime.example.conf | 4 -- .../application/helpers/AirtimeInstall.php | 41 ++----------------- legacy/tests/config/airtime.conf | 1 - 4 files changed, 4 insertions(+), 44 deletions(-) diff --git a/legacy/application/configs/conf.php b/legacy/application/configs/conf.php index 0d47880fd..e600907f4 100644 --- a/legacy/application/configs/conf.php +++ b/legacy/application/configs/conf.php @@ -13,8 +13,6 @@ class Config $CC_CONFIG = []; - // Name of the web server user - $CC_CONFIG['webServerUser'] = $values['general']['web_server_user']; $CC_CONFIG['rabbitmq'] = $values['rabbitmq']; $CC_CONFIG['baseDir'] = $values['general']['base_dir']; diff --git a/legacy/build/airtime.example.conf b/legacy/build/airtime.example.conf index 049af4f7b..4c90f44c1 100644 --- a/legacy/build/airtime.example.conf +++ b/legacy/build/airtime.example.conf @@ -19,9 +19,6 @@ # api_key: The API key for your Airtime installation. # The value is generated the first time you use Airtime. # -# web_server_user: The default webserver user. -# The default is www-data. -# # base_url: The host name for your webserver. # The default is localhost. # @@ -59,7 +56,6 @@ # [general] api_key = -web_server_user = www-data base_url = localhost base_port = 80 base_dir = / diff --git a/legacy/tests/application/helpers/AirtimeInstall.php b/legacy/tests/application/helpers/AirtimeInstall.php index 80d87c7cc..46908664e 100644 --- a/legacy/tests/application/helpers/AirtimeInstall.php +++ b/legacy/tests/application/helpers/AirtimeInstall.php @@ -143,41 +143,6 @@ class AirtimeInstall return true; } - /* TODO: This function should be moved to the media-monitor - * install script. */ - public static function InstallStorageDirectory() - { - $CC_CONFIG = Config::getConfig(); - echo '* Storage directory setup' . PHP_EOL; - $ini = parse_ini_file(__DIR__ . '/airtime-install.ini'); - $stor_dir = $ini['storage_dir']; - $dirs = [$stor_dir, $stor_dir . '/organize']; - foreach ($dirs as $dir) { - if (!file_exists($dir)) { - if (mkdir($dir, 02775, true)) { - $rp = realpath($dir); - echo "* Directory {$rp} created" . PHP_EOL; - } else { - echo "* Failed creating {$dir}" . PHP_EOL; - - exit(1); - } - } elseif (is_writable($dir)) { - $rp = realpath($dir); - echo "* Skipping directory already exists: {$rp}" . PHP_EOL; - } else { - $rp = realpath($dir); - echo "* Error: Directory already exists, but is not writable: {$rp}" . PHP_EOL; - - exit(1); - } - echo "* Giving Apache permission to access {$rp}" . PHP_EOL; - $success = chown($rp, $CC_CONFIG['webServerUser']); - $success = chgrp($rp, $CC_CONFIG['webServerUser']); - $success = chmod($rp, 0775); - } - } - public static function CreateDatabaseUser() { $CC_CONFIG = Config::getConfig(); @@ -317,7 +282,8 @@ END; public static function DirCheck() { echo 'Legend: "+" means the dir/file exists, "-" means that it does not.' . PHP_EOL; - $dirs = [AirtimeInstall::CONF_DIR_BINARIES, + $dirs = [ + AirtimeInstall::CONF_DIR_BINARIES, AirtimeInstall::CONF_DIR_WWW, AirtimeIni::CONF_FILE_AIRTIME, AirtimeIni::CONF_FILE_LIQUIDSOAP, @@ -326,7 +292,8 @@ END; '/usr/lib/airtime/pypo', '/var/log/airtime', '/var/log/airtime/pypo', - '/var/tmp/airtime/pypo', ]; + '/var/tmp/airtime/pypo', + ]; foreach ($dirs as $f) { if (file_exists($f)) { echo "+ {$f}" . PHP_EOL; diff --git a/legacy/tests/config/airtime.conf b/legacy/tests/config/airtime.conf index 969b4ae21..ce5cf9fd6 100644 --- a/legacy/tests/config/airtime.conf +++ b/legacy/tests/config/airtime.conf @@ -15,7 +15,6 @@ vhost = /airtime_tests [general] dev_env = testing api_key = H2NRICX6CM8F50CU123C -web_server_user = www-data airtime_dir = /usr/share/airtime base_url = localhost base_port = 80