Main: Updated way DB names are generated

Switch from geting folder count in /var/www
to using SiteCount variable stored in /etc/ICTM/sites.count,
installer.sh has static 1, AppendCMS gets the file an increments it by one.
Fallback is build in for systems without sites.count
This commit is contained in:
2022-04-21 15:17:28 +02:00
parent 9222904ab2
commit be98df66a9
5 changed files with 14 additions and 10 deletions

View File

@@ -1,7 +1,6 @@
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="fc_$db_suffix"
db_user="fc_$db_suffix"
db_name="fc_$SiteCount"
db_user="fc_$SiteCount"
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
#Storing DB Credentials

View File

@@ -13,9 +13,8 @@ cp -a /tmp/nextcloud/. /var/www/"$domain"/html
touch /var/www/"$domain"/html/data/nextcloud.log > $OUTPUT 2>&1
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="nextcloud_$db_suffix"
db_user="nextcloud_$db_suffix"
db_name="nextcloud_$SiteCount"
db_user="nextcloud_$SiteCount"
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
mysql -u root -p"$password" -e "CREATE DATABASE "$db_name" DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" > $OUTPUT 2>&1
mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1

View File

@@ -6,9 +6,8 @@ if [ ! -f /usr/local/bin/wp ]; then
fi
#Creating DB
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
db_name="wp_$db_suffix"
db_user="wp_$db_suffix"
db_name="wp_$SiteCount"
db_user="wp_$SiteCount"
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
WPSalts=$(curl --retry 7 --retry-delay 5 -s https://api.wordpress.org/secret-key/1.1/salt/)