| Server IP : 80.74.154.100 / Your IP : 216.73.217.0 Web Server : Apache System : Linux marissa.metanet.ch 4.18.0-553.141.2.lve.el7h.x86_64 #1 SMP Wed Jul 8 17:20:31 UTC 2026 x86_64 User : onlineadmin ( 10487) PHP Version : 8.5.7 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/httpd/vhosts/comeonline.ch/mybin/ |
Upload File : |
#!/bin/bash
PS4=':${LINENO} + '
#set -x
# Script to patch Drupal for use on Drupion's servers. 2014.08.06 Frederick Henderson
# Updated 2015.03.18 to allow specifying the path to run in on the command line.
# See http://drupion.com/resources/downloads/drupal for more info.
# A symptoms is that no images show on the site.
# Drupion says on that page:
# Please note these are simply patched versions obtained by searching with
# find . | xargs fgrep -nH FollowSymLinks
# and replacing all +FollowSymLinks with +SymLinksIfOwnerMatch.
# I used the following to fix all links:
# find . -exec sed -i 's@FollowSymLinks@SymLinksIfOwnerMatch@g' "{}" \; -print
yes=0
function usage()
{
echo "Usage ${0##*/} -y -h <path>"
echo "Where:"
echo "-y answers yes to questions. For use in scripts."
echo "-h displays this help info."
echo "<path> of the drupal root to operate on."
echo ""
}
while getopts yh option
do
case "${option}" in
h)
usage
exit 2
;;
y)
yes=1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
# get rid of our flag options and arguments
shift $((OPTIND-1))
# Save path if given on command lines
drupalrootpath=$1
red='\e[1;31m'
NC='\e[0m' # No Color
pwd=$(pwd)
switchdirctoryifgiven(){
if [ ! -z $drupalrootpath ] ; then
cd $drupalrootpath
else
directoryrunfrom=$(cd -P -- "$(dirname -- "$0")" && pwd -P)
drupalrootpath=$directoryrunfrom
cd $drupalrootpath
fi
}
pause(){
read -p "$*"
}
informuser(){
echo "This script should be run from a Drupal webroot, but the"
echo "directory to run from can be specified on the command line."
echo "To see help use the -h switch."
echo "This script will be run in $drupalrootpath"
echo "This script will patch this Drupal installation to use"
echo " +SymLinksIfOwnerMatch instead +FollowSymLinks"
echo "This is need on servers running Virtualmin."
echo " "
}
areweinadrupalwebroot(){
if [ ! -f index.php ] ; then
grep -q [Dd]rupal index.php
if [ $? -ne 0 ]; then
echo -e "Exiting, I did not find the ${red}Drupal index.php${NC} file."
informuser
echo "Nothing more to do, exiting. Bye!"
exit
fi
fi
}
notwhatyouwanted(){
echo -e "If this is not what you want hit ${red}Ctrl + C${NC} to abort this script or press any key to continue."
pause
echo " "
}
patchdrupionyesno(){
echo -e -n "Patch this Drupal installation for use on Drupion by replacing all ${red}+FollowSymLinks${NC} with ${red}+SymLinksIfOwnerMatch${NC} ? [y/N] "
read -r response
response=${response,,} # tolower
}
patchdrupion(){
if [[ $response =~ ^(yes|y)$ || $yes = 1 ]]; then
find . -exec sed -i 's@FollowSymLinks@SymLinksIfOwnerMatch@g' "{}" \; -print
else
exit
fi
}
finished(){
echo "All done patching this Drupal installation"
}
### MAIN PROGRAMM ###
if [ $yes = 1 ]; then
switchdirctoryifgiven
areweinadrupalwebroot
patchdrupion
else
switchdirctoryifgiven
areweinadrupalwebroot
informuser
notwhatyouwanted
patchdrupionyesno
patchdrupion
finished
fi