Просмотр исходного кода

White label for file manager (#4681)

* White label for file manager

* Add the $HESTIA variable to the path

* Add app name after update filemanager

* Update format

---------

Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
Maxi Zamorano 1 год назад
Родитель
Сommit
aaec5d97d2
3 измененных файлов с 28 добавлено и 0 удалено
  1. 7 0
      bin/v-add-sys-filemanager
  2. 13 0
      bin/v-change-sys-config-value
  3. 8 0
      func/upgrade.sh

+ 7 - 0
bin/v-add-sys-filemanager

@@ -102,6 +102,13 @@ fi
 # Add configuration file
 cp -f $HESTIA_INSTALL_DIR/filemanager/filegator/configuration.php $HESTIA/web/fm/configuration.php
 
+# Path to the file manager configuration file where the change will be made.
+config_file="$HESTIA/web/fm/configuration.php"
+app_name="File Manager - $APP_NAME"
+
+# Sed replaces only the value after "File Manager -"
+sed -i "s|\(\$dist_config\[\"frontend_config\"\]\[\"app_name\"\] = \"File Manager - \).*\";|\1${APP_NAME}\";|" "$config_file"
+
 echo "$fm_v" > "${FM_INSTALL_DIR}/version"
 # Set permissions
 chown root: -R "${FM_INSTALL_DIR}"

+ 13 - 0
bin/v-change-sys-config-value

@@ -45,6 +45,19 @@ mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.bak
 mv /tmp/updconf $HESTIA/conf/hestia.conf
 rm -f $HESTIA/conf/hestia.conf.bak
 
+# Check if the variable "$key" has the value "APP_NAME"
+if [ "$key" == "APP_NAME" ]; then
+	# Path to the file manager configuration file where the change will be made.
+	config_file="$HESTIA/web/fm/configuration.php"
+	new_app_name="File Manager - $value"
+
+	# Verify if configuration.php exists and is writable
+	if [ -f "$config_file" ] && [ -w "$config_file" ]; then
+		# Sed replaces only the value after "File Manager -"
+		sed -i "s|\(\$dist_config\[\"frontend_config\"\]\[\"app_name\"\] = \"File Manager - \).*\";|\1${value}\";|" "$config_file"
+	fi
+fi
+
 #----------------------------------------------------------#
 #                       Hestia                             #
 #----------------------------------------------------------#

+ 8 - 0
func/upgrade.sh

@@ -687,6 +687,14 @@ upgrade_filemanager() {
 					echo "[ ! ] Updating File Manager configuration..."
 					# Update configuration.php
 					cp -f $HESTIA_INSTALL_DIR/filemanager/filegator/configuration.php $HESTIA/web/fm/configuration.php
+
+					# Path to the file manager configuration file where the change will be made.
+					config_file="$HESTIA/web/fm/configuration.php"
+					app_name="File Manager - $APP_NAME"
+
+					# Sed replaces only the value after "File Manager -"
+					sed -i "s|\(\$dist_config\[\"frontend_config\"\]\[\"app_name\"\] = \"File Manager - \).*\";|\1${APP_NAME}\";|" "$config_file"
+
 					# Set environment variable for interface
 					$BIN/v-change-sys-config-value 'FILE_MANAGER' 'true'
 				fi