Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save techpulsetoday/b138b94295d19115d7afffc10abeba8e to your computer and use it in GitHub Desktop.
Save techpulsetoday/b138b94295d19115d7afffc10abeba8e to your computer and use it in GitHub Desktop.
#!/bin/bash
# Author: Vijayan Jayaraman
# Publisher: https://techpulsetoday.com/
# Text Reset
RESET='\e[0m'
BLINK='\e[5m'
# Regular Colors
BLACK='\e[0;30m'
RED='\e[0;31m'
BRED='\e[1;31m'
GREEN='\e[0;32m'
BGREEN='\e[1;32m'
YELLOW='\e[0;33m'
BYELLOW='\e[1;33m'
BLUE='\e[0;34m'
BBLUE='\e[1;34m'
PURPLE='\e[0;35m'
CYAN='\e[0;36m'
BCYAN='\e[1;36m'
WHITE='\e[0;37m'
clear
echo -e "${CYAN}=================================================================${RESET}"
echo -e "${GREEN} Upgrade phpMyAdmin!! ${RESET}"
echo -e "${CYAN}=================================================================${RESET}"
# Backup phpMyAdmin
echo -e "${BCYAN}Backing Up phpMyAdmin${RESET}"
CURRENTDATE=`date +%Y_%m_%d_%H_%M_%S`
echo -e "${PURPLE}sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin_bak_${CURRENTDATE}${RESET}"
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin_bak_${CURRENTDATE}
echo -e "${BGREEN}Success: ${RESET}Done."
echo
# Download Latest phpMyAdmin
echo -e "${BCYAN}Downloading Latest phpMyAdmin${RESET}"
rm -rf /tmp/phpMyAdmin-*-all-languages.zip
wget --no-check-certificate --content-disposition https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -P /tmp
echo -e "${BGREEN}Success: ${RESET}Done."
echo
# Unzip the file
echo -e "${BCYAN}Unzipping zip file${RESET}"
unzip -qq /tmp/phpMyAdmin-*-all-languages.zip -d /tmp
echo -e "${BGREEN}Success: ${RESET}Done."
echo
# Move phpMyAdmin folder
echo -e "${BCYAN}Move phpMyAdmin folder${RESET}"
sudo mv /tmp/phpMyAdmin-*-all-languages /usr/share/phpmyadmin
rm -rf /tmp/phpMyAdmin-*-all-languages.zip
echo -e "${BGREEN}Success: ${RESET}Done."
echo
# Update Configuration
echo -e "${BCYAN}Updating Configuration${RESET}"
sed -i "s+'TEMP_DIR', ROOT_PATH . 'tmp/'+'TEMP_DIR', '/var/lib/phpmyadmin/tmp/'+g" /usr/share/phpmyadmin/libraries/vendor_config.php
sed -i "s+'CONFIG_DIR', ROOT_PATH+'CONFIG_DIR', '/etc/phpmyadmin/'+g" /usr/share/phpmyadmin/libraries/vendor_config.php
echo -e "${BGREEN}Success: ${RESET}Done."
echo
echo -e "${BBLUE}${BLINK}Access the phpMyAdmin in a web browser.${RESET}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment