create_summary_websites.sh: support newer versions of MediWiki. Support newer versions of Drupal.

This commit is contained in:
Christoph 2020-08-21 14:54:53 +02:00
parent 2e790b5bf4
commit a6f007d937

View File

@ -527,13 +527,26 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
_found=true
fi
if [[ -f "${_documentroot}/includes/DefaultSettings.php" ]]; then
_found_mediawiki_version=false
if [[ -f "${_documentroot}/includes/Defines.php" ]]; then
version_search_string="define\(\\s*'MW_VERSION'"
cms_version="$(grep -i -E "^\s*$version_search_string" ${_documentroot}/includes/Defines.php 2> /dev/null \
| awk -F ',' '{print$2}' \
| awk -F ')' '{print$1}' \
| tail -1 )"
[[ -n "$cms_version" ]] && _found_mediawiki_version=true
fi
if ! $_found_mediawiki_version && [[ -f "${_documentroot}/includes/DefaultSettings.php" ]]; then
version_search_string='\$wgVersion\s+='
cms_version="$(grep -i -E "^\s*$version_search_string" "${_documentroot}/includes/DefaultSettings.php" 2> /dev/null \
| awk -F '=' '{print$2}' \
| awk -F ';' '{print$1}'\
| tail -1)"
[[ -n "$cms_version" ]] && _found_mediawiki_version=true
fi
if $_found_mediawiki_version ; then
# - Remove leading whitespace characters
cms_version="${cms_version#"${cms_version%%[![:space:]]*}"}"
# - Remove trailing whitespace characters
@ -551,7 +564,7 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
elif [[ -r "$file_to_check_wordpress" ]] && [[ ! -d "$file_to_check_wordpress" ]] ; then
db_search_string="define\('DB_NAME'"
db_search_string="define\(\\s*'DB_NAME'"
_found=false
if grep -i -q -E "^\s*$db_search_string" $file_to_check_wordpress > /dev/null 2>&1 ; then
@ -621,21 +634,36 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
fi
if [[ -f "${_documentroot}/includes/bootstrap.inc" ]] ; then
version_search_string="define\('VERSION'"
_found_drupal_version=false
if [[ -f "${_documentroot}/modules/system/system.module" ]] ; then
version_search_string="define\\s*\(\\s*'VERSION'"
cms_version="$(grep -i -E "^\s*$version_search_string" ${_documentroot}/modules/system/system.module 2> /dev/null \
| awk -F ',' '{print$2}' \
| awk -F ')' '{print$1}' \
| tail -1 )"
[[ -n "$cms_version" ]] && _found_drupal_version=true
fi
if ! $_found_drupal_version && [[ -f "${_documentroot}/includes/bootstrap.inc" ]] ; then
version_search_string="define\\s*\(\\s*'VERSION'"
cms_version="$(grep -i -E "^\s*$version_search_string" ${_documentroot}/includes/bootstrap.inc 2> /dev/null \
| awk -F ',' '{print$2}' \
| awk -F ')' '{print$1}' \
| tail -1 )"
elif [[ -f "${_documentroot}/core/lib/Drupal.php" ]] ; then
[[ -n "$cms_version" ]] && _found_drupal_version=true
fi
if ! $_found_drupal_version && [[ -f "${_documentroot}/core/lib/Drupal.php" ]] ; then
version_search_string="const\\s+VERSION\\s+="
cms_version="$(grep -i -E "^\s*$version_search_string" "${_documentroot}/core/lib/Drupal.php" 2> /dev/null \
| awk -F ' ' '{print$4}' \
| tail -1 )"
[[ -n "$cms_version" ]] && _found_drupal_version=true
fi
if [[ -n "$cms_version" ]] ; then
if $_found_drupal_version ; then
# - Remove leading whitespace characters
cms_version="${cms_version#"${cms_version%%[![:space:]]*}"}"
# - Remove trailing whitespace characters
@ -835,8 +863,8 @@ for _vhost_file in ${_all_vhost_files_arr[@]} ; do
if ! $_found ; then
file_to_check="${_documentroot}/includes/config.inc.php"
if [[ -f "$file_to_check" ]]; then
if grep -i -q -E "^\s*define\('DB_DATABASE'" $file_to_check > /dev/null 2>&1 ; then
database="$(grep -i -m 1 -E "^\s*define\('DB_DATABASE'" $file_to_check 2> /dev/null \
if grep -i -q -E "^\s*define\s*\(\s*'DB_DATABASE'" $file_to_check > /dev/null 2>&1 ; then
database="$(grep -i -m 1 -E "^\s*define\s*\(\s*'DB_DATABASE'" $file_to_check 2> /dev/null \
| awk -F ',' '{print$2}' \
| awk -F ')' '{print$1}' \
| tail -1 )"