more code

This commit is contained in:
Ste Vaidis 2023-11-15 15:20:31 +02:00
parent aa160e1771
commit 66acaa1cf8
11 changed files with 101 additions and 69 deletions

View File

@ -31,7 +31,7 @@ echo
echo -ne " 🍄 Copy files from $SRC to $DST" echo -ne " 🍄 Copy files from $SRC to $DST"
cp -rp $SRC $DST cp -rp $SRC $DST
cp $SRC.copy.log $DST.copy.log [ -f "$SRC.copy.log" ] && cp $SRC.copy.log $DST.copy.log
echo >> $DST.copy.log echo >> $DST.copy.log
echo "`date +'%d/%m/%Y %H:%M:%S'` Copy from $SRC to $DST" >> $DST.copy.log echo "`date +'%d/%m/%Y %H:%M:%S'` Copy from $SRC to $DST" >> $DST.copy.log
echo $NOTE >> $DST.copy.log echo $NOTE >> $DST.copy.log
@ -57,7 +57,13 @@ if [ $? = 0 ]; then ok; else fail; fi
echo -ne " 🍒 Drupal settings.php" echo -ne " 🍒 Drupal settings.php"
cd $DST cd $DST
sed -i "s/$SRC/$DST/g" sites/default/settings.php if [ -f "sites/default/settings.php" ]
then
CONFIG="sites/default/settings.php"
else
CONFIG="web/sites/default/settings.php"
fi
sed -i "s/$SRC/$DST/g" $CONFIG
if [ $? = 0 ]; then ok; else fail; fi if [ $? = 0 ]; then ok; else fail; fi
# echo -ne " 🍒 link html to $DST" # echo -ne " 🍒 link html to $DST"
@ -66,6 +72,6 @@ if [ $? = 0 ]; then ok; else fail; fi
# if [ $? = 0 ]; then ok; else fail; fi # if [ $? = 0 ]; then ok; else fail; fi
echo echo
ls -l --color=auto /var/www/site[1234] ls -l --color=auto /var/www/site[0123456789]
echo echo

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
df -h
rm -rf $1 rm -rf $1
rm -r $1.sql rm -r $1.sql
rm -r $1.copy.log rm -r $1.copy.log
@ -8,3 +10,4 @@ rm -r $1.composer.log
./db -du $1 ./db -du $1
./db -dd $1 ./db -dd $1
df -h

View File

@ -1,82 +1,76 @@
#!/bin/bash #!/bin/bash
RED="\e[0;31m"
GRN="\e[0;32m"
BLU="\e[0;34m"
WHT="\e[0;97m"
BRED="\e[1;31m"
BGRN="\e[1;32m"
BBLU="\e[1;34m"
BWHT="\e[1;97m"
END="\e[00m"
cd $1 cd $1
cd modules # cd web/modules
COUNT=$(ls -d */ 2> /dev/null | grep -v custom | grep -v contrib | wc -l) # COUNT=$(ls -d */ 2> /dev/null | grep -v custom | grep -v contrib | wc -l)
echo # echo
echo -e " 📦 ${BGRN}/modules: ${BWHT}${COUNT}${END}" # echo -e " 📦 ${BGRN}/modules: ${BWHT}${COUNT}${END}"
echo # echo
ls -d */ | grep -v custom | grep -v contrib 2> /dev/null # ls -d */ | grep -v custom | grep -v contrib 2> /dev/null
cd .. # cd ../..
cd modules/contrib # cd web/modules/contrib
COUNT=$(ls -1 | wc -l 2> /dev/null) # COUNT=$(ls -1 | wc -l 2> /dev/null)
echo # echo
echo -e " 📦 ${BGRN}/modules/contrib: ${BWHT}${COUNT}${END}" # echo -e " 📦 ${BGRN}/modules/contrib: ${BWHT}${COUNT}${END}"
echo # echo
ls -d */ # ls -d */
cd ../../ # cd ../../../
cd modules/custom # cd web/modules/custom
COUNT=$(ls -1 | wc -l 2> /dev/null) # COUNT=$(ls -1 | wc -l 2> /dev/null)
echo # echo
echo -e " 📦 ${BGRN}/modules/custom: ${BWHT}${COUNT}${END}" # echo -e " 📦 ${BGRN}/modules/custom: ${BWHT}${COUNT}${END}"
echo # echo
ls -d */ # ls -d */
cd ../../ # cd ../../../
#
# if [[ -f ./libraries ]]; then
# cd libraries
# COUNT=$(ls -1 | sed 's/js//g' | sed 's/min//g' | sed 's/[\.-]//g' | sort | uniq | wc -l)
# echo
# echo -e "📦 /libraries: ${COUNT}"
# echo
# ls -1
# cd ../..
# fi
echo "<html><head></head><body><pre style='font: monospace'>"
if [[ -f ./libraries ]]; then COUNT=$(vendor/drush/drush/drush route | grep "/api/" | wc -l)
cd libraries echo
COUNT=$(ls -1 | sed 's/js//g' | sed 's/min//g' | sed 's/[\.-]//g' | sort | uniq | wc -l) echo -e "🌐 GET endpoints from Views: ${COUNT}"
echo
vendor/drush/drush/drush route | grep "/api/" | awk {'print $2'} | sed "s/'//g"
if [[ -f ./web/modules/custom ]]; then
cd ./web/modules/custom
COUNT=$(grep -e "path:" -e "methods" * -Rh | awk -F: {'print $2'} | tr -d "'" | tr -d '\n' | tr -d '\[' | sed 's/\]/\n/g' | awk {'print $2 " \t "$1'} | wc -l)
echo echo
echo -e " 📦 ${BGRN}/libraries: ${BWHT}${COUNT}${END}" echo -e "🌐 GET endpoints from custom modules: ${COUNT}"
echo
grep -e path -e methods * -Rh | awk -F: {'print $2'} | tr -d "'" | tr -d '\n' | tr -d '\[' | sed 's/\]/\n/g' | awk {'print $2 " \t "$1'}
else
echo
echo -e "🌐 GET endpoints from custom modules: 0"
echo echo
ls -1
cd ..
fi fi
COUNT=$(grep -e "path:" -e "methods" modules/custom* -Rh | awk -F: {'print $2'} | tr -d "'" | tr -d '\n' | tr -d '\[' | sed 's/\]/\n/g' | awk {'print $2 " \t "$1'} | wc -l)
echo
echo -e " 🍓 ${BGRN}Custom endpoints: ${BWHT}${COUNT}${END}"
echo
grep -e path -e methods modules/custom* -Rh | awk -F: {'print $2'} | tr -d "'" | tr -d '\n' | tr -d '\[' | sed 's/\]/\n/g' | awk {'print $2 " \t "$1'}
#diff -qr $1/modules/custom $2/modules/custom
#echo
#echo "Themes"
#diff -qr $1/themes/ $2/themes
#echo
#echo "Users"
#cd $1 && drush uls
#cd ..
#cd $2 && drush uls
#cd ..
#echo
#echo "Views"
COUNT=$(mysql -uroot -p1234 $1 -Nse "SELECT name from $1.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq | wc -l) COUNT=$(mysql -uroot -p1234 $1 -Nse "SELECT name from $1.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq | wc -l)
echo echo
echo -e " 🍓 ${BGRN}Content types: ${BWHT}${COUNT}${END}" echo -e "🍓 Content types: ${COUNT}"
echo echo
mysql -uroot -p1234 $1 -Nse "SELECT name from $1.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq mysql -uroot -p1234 $1 -Nse "SELECT name from $1.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq
echo echo
echo -e " ☢️ ${BGRN}Core version${END}" echo -e "🎃 Available users"
echo echo
drush st 2> /dev/null | grep "Drupal version" vendor/drush/drush/drush uinf $(vendor/drush/drush/drush sqlq "SELECT GROUP_CONCAT(name) FROM users_field_data")
echo echo
echo -e "☢️ Core version"
echo
./vendor/drush/drush/drush st 2> /dev/null | grep "Drupal version"
echo
echo "</pre></body></html>"

View File

@ -32,7 +32,9 @@ function fail() {
echo echo
echo -ne " 💧 Create new drupal in dir ${WHT}$NAME${END} ..." echo -ne " 💧 Create new drupal in dir ${WHT}$NAME${END} ..."
composer --no-interaction create-project drupal/recommended-project:9.5.10 $NAME > /dev/null 2>&1 composer --no-interaction create-project drupal/recommended-project $NAME
# composer --no-interaction create-project drupal/recommended-project:9.5.10 $NAME > /dev/null 2>&1
#
#CMD="composer --no-interaction create-project drupal/recommended-project:9 $NAME > /dev/null 2>&1" #CMD="composer --no-interaction create-project drupal/recommended-project:9 $NAME > /dev/null 2>&1"
#CMD="composer create-project drupal/recommended-project:9 $NAME" #CMD="composer create-project drupal/recommended-project:9 $NAME"
#sudo su -l apache -s /bin/bash -c "cd $PWD; $CMD" #sudo su -l apache -s /bin/bash -c "cd $PWD; $CMD"

View File

@ -50,15 +50,24 @@ echo -ne " 🐬 Restart mysql "
systemctl restart mysql systemctl restart mysql
log $? log $?
echo -ne " 🐬 Drupal clear cache " echo -ne " 🐬 Drush clear cache "
cd $BASE_PATH/sites/$1 cd $BASE_PATH/sites/$1
scl enable php82 bash
if [ -f ./vendor/drush/drush/drush ] if [ -f ./vendor/drush/drush/drush ]
then then
./vendor/drush/drush/drush cr &> /dev/null echo "found local drush"
./vendor/drush/drush/drush cr
log $?
echo
else else
echo "using global drush"
drush cr &> /dev/null drush cr &> /dev/null
log $?
echo
fi fi
log $? echo
cd ..
echo echo
cd .. cd ..

3
toolbox/site0.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/root/Dev-Enviroment/toolbox/site.sh $1 0

3
toolbox/site5.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/root/Dev-Enviroment/toolbox/site.sh $1 5

3
toolbox/site6.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/root/Dev-Enviroment/toolbox/site.sh $1 6

3
toolbox/site7.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/root/Dev-Enviroment/toolbox/site.sh $1 7

3
toolbox/site8.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/root/Dev-Enviroment/toolbox/site.sh $1 8

3
toolbox/site9.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
/root/Dev-Enviroment/toolbox/site.sh $1 9