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:
@@ -30,6 +30,11 @@ fi
|
|||||||
rm /tmp/pkg.list > $OUTPUT 2>&1
|
rm /tmp/pkg.list > $OUTPUT 2>&1
|
||||||
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
source <(curl --retry 7 --retry-delay 5 -s "$repo"/raw/"$branchtype"/"$branch"/ModulesMenu.list)
|
||||||
|
|
||||||
|
#SiteCount
|
||||||
|
if [ ! -f "/etc/ICTM/sites.count" ]; then SiteCount=`expr $(ls -l /var/www | grep -c ^d) - 1` ; else source /etc/ICTM/sites.count; fi
|
||||||
|
if [ -z ${SiteCount+x} ] ; then SiteCount=`expr $(ls -l /var/www | grep -c ^d) - 1` ; fi
|
||||||
|
SiteCount=$(($SiteCount+1))
|
||||||
|
|
||||||
#Setting Menulist to webserver
|
#Setting Menulist to webserver
|
||||||
declare -n CMSL="$webserv"CMSL
|
declare -n CMSL="$webserv"CMSL
|
||||||
declare -n options="$webserv"Options
|
declare -n options="$webserv"Options
|
||||||
@@ -174,6 +179,7 @@ CMS="${CMS//:}" && CMS="${CMS,,}"
|
|||||||
##-----------------##
|
##-----------------##
|
||||||
|
|
||||||
touch /etc/ICTM/sites/"$sitename"
|
touch /etc/ICTM/sites/"$sitename"
|
||||||
|
echo "SiteCount=$SiteCount" > /etc/ICTM/sites.count
|
||||||
|
|
||||||
|
|
||||||
##-----------##
|
##-----------##
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#Creating DB
|
#Creating DB
|
||||||
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
|
db_name="fc_$SiteCount"
|
||||||
db_name="fc_$db_suffix"
|
db_user="fc_$SiteCount"
|
||||||
db_user="fc_$db_suffix"
|
|
||||||
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
|
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
|
||||||
|
|
||||||
#Storing DB Credentials
|
#Storing DB Credentials
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ cp -a /tmp/nextcloud/. /var/www/"$domain"/html
|
|||||||
touch /var/www/"$domain"/html/data/nextcloud.log > $OUTPUT 2>&1
|
touch /var/www/"$domain"/html/data/nextcloud.log > $OUTPUT 2>&1
|
||||||
|
|
||||||
#Creating DB
|
#Creating DB
|
||||||
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
|
db_name="nextcloud_$SiteCount"
|
||||||
db_name="nextcloud_$db_suffix"
|
db_user="nextcloud_$SiteCount"
|
||||||
db_user="nextcloud_$db_suffix"
|
|
||||||
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
|
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 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
|
mysql -u root -p"$password" -e "CREATE USER '"$db_user"'@'localhost' IDENTIFIED BY '"$db_pass"';" > $OUTPUT 2>&1
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ if [ ! -f /usr/local/bin/wp ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#Creating DB
|
#Creating DB
|
||||||
db_suffix=`expr $(ls -l /var/www | grep -c ^d) - 1`
|
db_name="wp_$SiteCount"
|
||||||
db_name="wp_$db_suffix"
|
db_user="wp_$SiteCount"
|
||||||
db_user="wp_$db_suffix"
|
|
||||||
db_pass=$(tr -dc 'A-Za-z0-9!#%()*+,-.:;<=>?@[]^_{|}~' </dev/urandom | head -c 30 ; echo)
|
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/)
|
WPSalts=$(curl --retry 7 --retry-delay 5 -s https://api.wordpress.org/secret-key/1.1/salt/)
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ CompatVer=2
|
|||||||
phpver=7.4
|
phpver=7.4
|
||||||
PHPMyadmin=1 #Overwriten by cms's without php
|
PHPMyadmin=1 #Overwriten by cms's without php
|
||||||
sqlver=8.0
|
sqlver=8.0
|
||||||
|
SiteCount=1
|
||||||
TestMode=0
|
TestMode=0
|
||||||
#PackageManager-config
|
#PackageManager-config
|
||||||
|
|
||||||
@@ -386,8 +387,8 @@ for storeme in PKGM PKGI PKGUC PKGUP PKGLIST OUTPUT IMODE shortdist repo branch
|
|||||||
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list
|
declare -p $storeme | cut -d ' ' -f 3- >> /etc/ICTM/mainvar.list
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
touch /etc/ICTM/sites/"$sitename"
|
touch /etc/ICTM/sites/"$sitename"
|
||||||
|
echo "SiteCount=$SiteCount" > /etc/ICTM/sites.count
|
||||||
|
|
||||||
##----------##
|
##----------##
|
||||||
# Addons #
|
# Addons #
|
||||||
|
|||||||
Reference in New Issue
Block a user