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

@@ -30,6 +30,11 @@ fi
rm /tmp/pkg.list > $OUTPUT 2>&1
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
declare -n CMSL="$webserv"CMSL
declare -n options="$webserv"Options
@@ -174,6 +179,7 @@ CMS="${CMS//:}" && CMS="${CMS,,}"
##-----------------##
touch /etc/ICTM/sites/"$sitename"
echo "SiteCount=$SiteCount" > /etc/ICTM/sites.count
##-----------##