A PHP Error was encountered
Severity: 8192
Message: Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4698
Backtrace:
File: /home/things/domains/anna.fyi/public_html/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler
File: /home/things/domains/anna.fyi/public_html/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string
File: /home/things/domains/anna.fyi/public_html/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list
File: /home/things/domains/anna.fyi/public_html/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group
File: /home/things/domains/anna.fyi/public_html/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache
File: /home/things/domains/anna.fyi/public_html/application/libraries/Process.php
Line: 45
Function: parse_code
File: /home/things/domains/anna.fyi/public_html/application/models/Pastes.php
Line: 517
Function: syntax
File: /home/things/domains/anna.fyi/public_html/application/controllers/Main.php
Line: 624
Function: getPaste
File: /home/things/domains/anna.fyi/public_html/index.php
Line: 315
Function: require_once
#!/bin/bash
#title :cpwpinstall.sh
#description :Script to install WordPress on cPanel servers
#author :Anna Schoolfield and Sean Hicks
#date :20180617
#version :0.1
#usage :./cpwpinstall.sh
#notes :Probably shouldn't use if the server is old and/or weird
#============================================================================
# Copyright (c) 2018 Anna Schoolfield, Sean Hicks
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#============================================================================
echo "!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!"
echo " This script does not have enough logic to be idiot proof."
echo " Pay attention to what you're doing and don't be careless."
echo " USE ABSOLUTE PATH IF SPECIFYING LOCATION!"
echo "!!!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!!!!"
echo " "
# Prompt for the cPanel username
read -p 'What is the cPanel username to install under? ' CPANEL
PRT=$(whmapi1 accountsummary user=$CPANEL | grep 'partition: ' | awk -F': ' '{print $2}')
# Prompt for the ticket number
read -p 'What is the ticket number? (Or some unique value to generate db name & username) ' TICKET
# Confirm installation directory
echo -n "Hit y to install the WP site in the default public_html; Otherwise hit n to enter a custom dir: "
# While loop and switch case use to structure an options selection loop.
while (( !DIROPTDONE )); do
read DIROPT
case "$DIROPT" in
y)
DESTDIR="/$PRT/$CPANEL/public_html"
DIROPTDONE=1
;;
n)
read -p "Please specify the directory path to install to: " DESTDIR
# This little bit strips the ending forward slash if present, and nothing if not
DESTDIR=$(echo $DESTDIR | sed '$s%/$%%g')
DIROPTDONE=1
;;
*)
echo "Please choose a valid option (y or n)!"
echo -n "Hit y to install the WP site in the default public_html; Otherwise hit n to enter a custom dir: "
;;
esac
done
############################################
# Gathering variables
PREFIX=$(uapi --user=$CPANEL Mysql get_restrictions | grep prefix | awk '{ print $2 }')
MYSQL=$PREFIX'wp'
MYSQL+=$TICKET
############################################
# Messy solution to find domain
############################################
DOMAIN=""
DOMLIST=$(ls -1 /var/cpanel/userdata/$CPANEL/* | grep -v '_SSL$\|.yaml$\|.json$\|cache$\|main$')
CNT=4
SUBDIR=$(echo "$DESTDIR" | sed 's%^/'"$PRT"'/'"$CPANEL"'/%%')
BUFFER=/$PRT/$CPANEL/
while (( !domfind_done )); do
BUFFER="${BUFFER}$(echo "$DESTDIR" | cut -d'/' -f$CNT)"
SUBDIR=$(echo "$SUBDIR" | sed -E 's%^[^/]+/%%')
DOMLIST=$(echo "$DOMLIST" | xargs grep -l "$BUFFER")
BUFFER="${BUFFER}/"
DOMCNT=$(echo "$DOMLIST" | wc -l)
if [[ "$DOMCNT" -eq 1 ]]; then
DOMAIN=$(echo "$DOMLIST" | rev | cut -d'/' -f1 | rev)
domfind_done=1
fi
if [[ "$DOMCNT" -eq 0 ]]; then
echo "Domain not found! Continuing without..."
DOMAIN="!!!ERROR!!!"
domfind_done=1
fi
((CNT++))
done
############################################
echo "****************************"
echo "****Confirm installation****"
echo "****************************"
echo "Target cPanel Account:" $CPANEL
echo "Target Domain: "$DOMAIN / $SUBDIR
echo "MySQL database and username:" $MYSQL
echo "Destination directory:" $DESTDIR
echo "Current contents of the destination directory (empty if nothing listed):"
ls -1 $DESTDIR
echo " "
read -p "Would you like to proceed with the WP installation? [y/n] " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
echo " "
# Generate a random pw for the MySQL db user
MYSQLUSERPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
# Create MySQL db & user
echo "Creating MySQL user......................"
uapi --user=$CPANEL Mysql create_user name=$MYSQL password=$MYSQLUSERPASS
if [ "$?" -ne 0 ]; then
echo "Error creating MySQL user!"
exit 1
fi
echo "Creating MySQL database......................"
uapi --user=$CPANEL Mysql create_database name=$MYSQL
if [ "$?" -ne 0 ]; then
echo "Error creating MySQL database!"
exit 1
fi
echo "Setting privileges on database......................"
uapi --user=$CPANEL Mysql set_privileges_on_database user=$MYSQL database=$MYSQL privileges=ALL
if [ "$?" -ne 0 ]; then
echo "Error setting MySQL privileges!"
exit 1
fi
# Download and extract the WP tarball, clean it up afterwards
wget -qO- https://wordpress.org/latest.tar.gz | tar --strip-components=1 -xz -C $DESTDIR
rm -f $DESTDIR/latest.tar.gz
# Set up the initial wp-config file
mv $DESTDIR/wp-config-sample.php $DESTDIR/wp-config.php
# Set up the default WP .htaccess file
cat >> $DESTDIR/.htaccess << "EOF"
# BEGIN WordPress