General bash functions for use in jooma scripts
#!/bin/sh | |
# jfunctions - general bash functions for use in Joomla bash scripts | |
# Supports Joomla versions 2.5 - 3.x | |
# | |
# Copyright 2014 - 2016 Rene Kreijveld - r.kreijveld@dsd.nu | |
# | |
# This program is free software; you may redistribute it and/or modify it. | |
# | |
# Version history | |
# 3.0 Initial version | |
# 3.1 Code rewrite | |
# 3.2 Modification of all echo -e statements and remove backticks | |
# 3.3 Update to support Joomla 3.5 | |
# 3.4 Dropped support for Joomla versions lower than 2.5 | |
# Define general variables | |
version=3.4 | |
# Check if configuration.php exists. | |
if [ ! -e ./configuration.php ] | |
then | |
echo "" | |
echo "File configuration.php not found. Are you at the root of the site?" | |
echo "" | |
exit 1 | |
fi | |
# Find MySQL Socket | |
if [ -S /var/lib/mysql/mysql.sock ]; then | |
mysock=/var/lib/mysql/mysql.sock | |
elif [ -S /var/run/mysqld/mysqld.sock ]; then | |
mysock=/var/run/mysqld/mysqld.sock | |
elif [ -S /Applications/MAMP/tmp/mysql/mysql.sock ]; then | |
mysock=/Applications/MAMP/tmp/mysql/mysql.sock | |
elif [ -S /tmp/mysql.sock ]; then | |
mysock=/tmp/mysql.sock | |
fi | |
# Grab information from Joomla 2.5/3.x configuration. | |
sitename=$(grep '$sitename =' ./configuration.php | cut -d \' -f 2 | sed 's/ /_/g') | |
sitenameclean=$(grep '$sitename =' ./configuration.php | cut -d \' -f 2) | |
database=$(grep '$db =' ./configuration.php | cut -d \' -f 2) | |
dbuser=$(grep '$user =' ./configuration.php | cut -d \' -f 2) | |
password=$(grep '$password =' ./configuration.php | cut -d \' -f 2) | |
host=$(grep '$host =' ./configuration.php | cut -d \' -f 2) | |
prefix=$(grep '$dbprefix =' ./configuration.php | cut -d \' -f 2) | |
versr=$(grep 'RELEASE =' ./libraries/cms/version/version.php | cut -d \' -f 2) | |
versd=$(grep 'DEV_LEVEL =' ./libraries/cms/version/version.php | cut -d \' -f 2) | |
verss=$(grep 'DEV_STATUS =' ./libraries/cms/version/version.php | cut -d \' -f 2) |
This comment has been minimized.
This comment has been minimized.
Can you upp with 3.4 and 3.5 and 3.5.1 ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Thanks for the great script. I´ve did a quick test with 3.4 which worked well.
if echo "$release" | grep -q "3.4" ; then
had to been added.