remove nested dirname and use level parameter for better readability (#1025)

This commit is contained in:
Dennis Dudek
2022-04-13 10:14:03 +02:00
committed by GitHub
parent 3fbf23cb47
commit 7a13e4a421
7 changed files with 19 additions and 19 deletions

View File

@@ -83,7 +83,7 @@ class FroxlorInstall
*/ */
public function __construct() public function __construct()
{ {
$this->_basepath = dirname(dirname(dirname(__FILE__))); $this->_basepath = dirname(__FILE__, 3);
$this->_data = array(); $this->_data = array();
} }
@@ -394,7 +394,7 @@ class FroxlorInstall
// test if we can store the userdata.inc.php in ../lib // test if we can store the userdata.inc.php in ../lib
$umask = @umask(077); $umask = @umask(077);
$userdata_file = dirname(dirname(dirname(__FILE__))) . '/lib/userdata.inc.php'; $userdata_file = dirname(__FILE__, 3) . '/lib/userdata.inc.php';
if (@touch($userdata_file) && @is_writable($userdata_file)) { if (@touch($userdata_file) && @is_writable($userdata_file)) {
$fp = @fopen($userdata_file, 'w'); $fp = @fopen($userdata_file, 'w');
@fputs($fp, $userdata, strlen($userdata)); @fputs($fp, $userdata, strlen($userdata));
@@ -609,7 +609,7 @@ class FroxlorInstall
} }
$this->_updateSetting($upd_stmt, $this->_data['activate_newsfeed'], 'admin', 'show_news_feed'); $this->_updateSetting($upd_stmt, $this->_data['activate_newsfeed'], 'admin', 'show_news_feed');
$this->_updateSetting($upd_stmt, dirname(dirname(dirname(__FILE__))), 'system', 'letsencryptchallengepath'); $this->_updateSetting($upd_stmt, dirname(__FILE__, 3), 'system', 'letsencryptchallengepath');
// insert the lastcronrun to be the installation date // insert the lastcronrun to be the installation date
$this->_updateSetting($upd_stmt, time(), 'system', 'lastcronrun'); $this->_updateSetting($upd_stmt, time(), 'system', 'lastcronrun');
@@ -687,7 +687,7 @@ class FroxlorInstall
'title' => $this->_lng['install']['importing_data'], 'title' => $this->_lng['install']['importing_data'],
'result' => 0 'result' => 0
]; ];
$db_schema = dirname(dirname(__FILE__)) . '/froxlor.sql'; $db_schema = dirname(__FILE__, 2) . '/froxlor.sql';
$sql_query = @file_get_contents($db_schema); $sql_query = @file_get_contents($db_schema);
$sql_query = $this->_remove_remarks($sql_query); $sql_query = $this->_remove_remarks($sql_query);
$sql_query = $this->_split_sql_file($sql_query, ';'); $sql_query = $this->_split_sql_file($sql_query, ';');

View File

@@ -93,8 +93,8 @@ $lng['install']['changing_data'] = 'Adjusting settings...';
$lng['install']['creating_entries'] = 'Inserting new values...'; $lng['install']['creating_entries'] = 'Inserting new values...';
$lng['install']['adding_admin_user'] = 'Creating admin-account...'; $lng['install']['adding_admin_user'] = 'Creating admin-account...';
$lng['install']['creating_configfile'] = 'Creating configfile...'; $lng['install']['creating_configfile'] = 'Creating configfile...';
$lng['install']['creating_configfile_temp'] = 'File was saved in %s, please move to ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php'; $lng['install']['creating_configfile_temp'] = 'File was saved in %s, please move to ' . dirname(__DIR__, 2) . '/lib/userdata.inc.php';
$lng['install']['creating_configfile_failed'] = 'Could not create ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php, please create it manually with the following content:'; $lng['install']['creating_configfile_failed'] = 'Could not create ' . dirname(__DIR__, 2) . '/lib/userdata.inc.php, please create it manually with the following content:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor was installed successfully.';
$lng['install']['failed'] = 'failed'; $lng['install']['failed'] = 'failed';

View File

@@ -78,8 +78,8 @@ $lng['install']['changing_data'] = 'Ajustement des paramètres...';
$lng['install']['creating_entries'] = 'Insertion des nouvelles valeurs...'; $lng['install']['creating_entries'] = 'Insertion des nouvelles valeurs...';
$lng['install']['adding_admin_user'] = 'Création du compte administrateur...'; $lng['install']['adding_admin_user'] = 'Création du compte administrateur...';
$lng['install']['creating_configfile'] = 'Création du fichier de configuration...'; $lng['install']['creating_configfile'] = 'Création du fichier de configuration...';
$lng['install']['creating_configfile_temp'] = 'Le fichier a été enregistré dans %s, merci de le déplacer dans ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php'; $lng['install']['creating_configfile_temp'] = 'Le fichier a été enregistré dans %s, merci de le déplacer dans ' . dirname(__DIR__, 2) . '/lib/userdata.inc.php';
$lng['install']['creating_configfile_failed'] = 'Impossible de créer ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php, merci de le créer manuellement avec le contenu suivant:'; $lng['install']['creating_configfile_failed'] = 'Impossible de créer ' . dirname(__DIR__, 2) . '/lib/userdata.inc.php, merci de le créer manuellement avec le contenu suivant:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor a été installé avec succès.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor a été installé avec succès.';
$lng['click_here_to_refresh'] = 'Cliquez ici pour vérifier à nouveau'; $lng['click_here_to_refresh'] = 'Cliquez ici pour vérifier à nouveau';

View File

@@ -93,8 +93,8 @@ $lng['install']['changing_data'] = 'Einstellungen anpassen...';
$lng['install']['creating_entries'] = 'Trage neue Werte ein...'; $lng['install']['creating_entries'] = 'Trage neue Werte ein...';
$lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...'; $lng['install']['adding_admin_user'] = 'Erstelle Admin-Benutzer...';
$lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...'; $lng['install']['creating_configfile'] = 'Erstelle Konfigurationsdatei...';
$lng['install']['creating_configfile_temp'] = 'Datei wurde in %s gespeichert, bitte nach ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php verschieben.'; $lng['install']['creating_configfile_temp'] = 'Datei wurde in %s gespeichert, bitte nach ' . dirname(__DIR__, 2) . '/lib/userdata.inc.php verschieben.';
$lng['install']['creating_configfile_failed'] = 'Konnte ' . dirname(dirname(__DIR__)) . '/lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:'; $lng['install']['creating_configfile_failed'] = 'Konnte ' . dirname(__DIR__, 2) . '/lib/userdata.inc.php nicht erstellen, bitte manuell mit folgendem Inhalt anlegen:';
$lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.'; $lng['install']['froxlor_succ_installed'] = 'Froxlor wurde erfolgreich installiert.';
$lng['install']['failed'] = 'fehlgeschlagen'; $lng['install']['failed'] = 'fehlgeschlagen';

View File

@@ -95,7 +95,7 @@ class LighttpdFcgi extends Lighttpd
public function createOwnVhostStarter() public function createOwnVhostStarter()
{ {
if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') { if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') {
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown $mypath = \Froxlor\FileDir::makeCorrectDir(dirname(__FILE__, 3)); // /var/www/froxlor, needed for chown
$user = Settings::Get('phpfpm.vhost_httpuser'); $user = Settings::Get('phpfpm.vhost_httpuser');
$group = Settings::Get('phpfpm.vhost_httpgroup'); $group = Settings::Get('phpfpm.vhost_httpgroup');

View File

@@ -64,7 +64,7 @@ class NginxFcgi extends Nginx
public function createOwnVhostStarter() public function createOwnVhostStarter()
{ {
if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') { if (Settings::Get('phpfpm.enabled') == '1' && Settings::Get('phpfpm.enabled_ownvhost') == '1') {
$mypath = \Froxlor\FileDir::makeCorrectDir(dirname(dirname(dirname(__FILE__)))); // /var/www/froxlor, needed for chown $mypath = \Froxlor\FileDir::makeCorrectDir(dirname(__FILE__, 3)); // /var/www/froxlor, needed for chown
$user = Settings::Get('phpfpm.vhost_httpuser'); $user = Settings::Get('phpfpm.vhost_httpuser');
$group = Settings::Get('phpfpm.vhost_httpgroup'); $group = Settings::Get('phpfpm.vhost_httpgroup');

View File

@@ -23,7 +23,7 @@ final class Froxlor
*/ */
public static function getInstallDir() public static function getInstallDir()
{ {
return dirname(dirname(__DIR__)) . '/'; return dirname(__DIR__, 2) . '/';
} }
/** /**