dev/toolbox/info.sh
2024-01-16 10:01:46 +02:00

77 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
cd $1
NAME=$(echo $1 | tr -d '^\./')
# cd web/modules
# COUNT=$(ls -d */ 2> /dev/null | grep -v custom | grep -v contrib | wc -l)
# echo
# echo -e " 📦 ${BGRN}/modules: ${BWHT}${COUNT}${END}"
# echo
# ls -d */ | grep -v custom | grep -v contrib 2> /dev/null
# cd ../..
# cd web/modules/contrib
# COUNT=$(ls -1 | wc -l 2> /dev/null)
# echo
# echo -e " 📦 ${BGRN}/modules/contrib: ${BWHT}${COUNT}${END}"
# echo
# ls -d */
# cd ../../../
# cd web/modules/custom
# COUNT=$(ls -1 | wc -l 2> /dev/null)
# echo
# echo -e " 📦 ${BGRN}/modules/custom: ${BWHT}${COUNT}${END}"
# echo
# ls -d */
# 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'>"
COUNT=$(vendor/drush/drush/drush route | grep "/api/" | wc -l)
echo
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 -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
fi
COUNT=$(mysql -uroot -p1234 ${NAME} -Nse "SELECT name from ${NAME}.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq | wc -l)
echo
echo -e "🍓 Content types: ${COUNT}"
echo
mysql -uroot -p1234 ${NAME} -Nse "SELECT name from ${NAME}.config WHERE name LIKE 'node.type%'" | sed 's/node.type.//g' | sort | uniq
echo
echo -e "🎃 Available users"
echo
vendor/drush/drush/drush uinf $(vendor/drush/drush/drush sqlq "SELECT GROUP_CONCAT(name) FROM users_field_data")
echo
echo -e "☢️ Core version"
echo
./vendor/drush/drush/drush st 2> /dev/null | grep "Drupal version"
echo
echo "</pre></body></html>"