Skip to content

Instantly share code, notes, and snippets.

@renekreijveld
Last active February 22, 2018 00:48
Embed
What would you like to do?
Bash script to find all Joomla extension updates in all Joomla instances on a DirectAdmin based server
#!/bin/sh
# listupdates -- Find Joomla instances and show all extension updates
#
# Copyright 2016 Rene Kreijveld - r.kreijveld@dsd.nu
#
# This program is free software; you may redistribute it and/or modify it.
#
# Version history
# 1.0 Initial version
# This script uses two other scripts to function properly.
# 1. The jfunctions script to get information about the found Joomla instances.
# Get jfunctions here: https://gist.github.com/renekreijveld/773ce744080f6dbb58d8a4b91b984414
# 2. The listupdates.php script to get all extension updates for a Joomla instance.
# Get listupdates.php here: https://gist.github.com/renekreijveld/978523c79183b615917c03130505aad1
# define variables
version=1.0
startdir=/home
# Determine path of script
mypath=$(cd $(dirname ${0}); pwd -P)
# display usage information
usage() {
echo ""
echo "${myname} version ${version}, written by Rene Kreijveld."
echo ""
exit 0
}
for dir in $(find ${startdir} -maxdepth 4 -type d -name "public_html"); do
if [ -f ${dir}/configuration.php ]; then
# possible joomla found
cd ${dir}
# gather joomla information
if [ ! -e ${mypath}/jfunctions ]
then
echo ""
echo "Script jfunctions not found. Get it here: https://gist.github.com/renekreijveld/773ce744080f6dbb58d8a4b91b984414"
echo ""
else
. ${mypath}/jfunctions
echo "Sitename:" $sitenameclean
echo "Version:" $versr.$versd $verss
# Show updates
cd cli
if [ ! -e ./listupdates.php ]
then
echo ""
echo "File listupdates.php not found. Get it here: https://gist.github.com/renekreijveld/978523c79183b615917c03130505aad1"
echo ""
else
/usr/local/bin/php listupdates.php
fi
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment