#!/bin/bash #################################################################################################### #### author: SlickStack ############################################################################ #### link: https://slickstack.io ################################################################### #### mirror: https://mirrors.slickstack.io/bash/ss-install-prestashop-core.txt ##################### #### path: /var/www/ss-install-prestashop-core ##################################################### #### destination: n/a (not a boilerplate) ########################################################## #### purpose: Reinstalls the PrestaShop module (CMS) package and non-config files (idempotent) ##### #### module version: PrestaShop 1.7.x.x ############################################################ #### sourced by: ss-install ######################################################################## #### bash aliases: ss install prestashop core ###################################################### #################################################################################################### ## SS-CONFIG MUST BE PROPERLY CONFIGURED AND ON CURRENT BUILD BEFORE RUNNING SS-INSTALL ## ## ENSURE YOUR SS-CONFIG BUILD REMAINS CURRENT BY RUNNING SS-UPDATE OCCASIONALLY ## ## source ss-config ## source /var/www/ss-config ## source ss-functions ## source /var/www/ss-functions ## BELOW THIS RELIES ON SS-CONFIG AND SS-FUNCTIONS #################################################################################################### #### TABLE OF CONTENTS (SS-Install-PrestaShop-Core) ################################################ #################################################################################################### ## this is a brief summary of the different code snippets you will find in this script ## ## each section should be commented so you understand what is being accomplished ## ## A. Touch Timestamp File ## B. Message (Begin Script) #################################################################################################### #### A. SS-Install-PrestaShop-Core: Touch Timestamp File ########################################### #################################################################################################### ## this is a dummy timestamp file that will remember the last time this script was run ## ## it can be useful for developer reference and is sometimes used by SlickStack ## ## script timestamp ## ss_touch "${TIMESTAMP_SS_INSTALL_PRESTASHOP_CORE}" #################################################################################################### #### B. SS-Install-PrestaShop-Core: Message (Begin Script) ######################################### #################################################################################################### ## this is a simple message that announces to the shell the purpose of this bash script ## ## it will only be noticed by sudo users who manually call ss core bash scripts ## ## echo message ## ss_echo "${COLOR_INFO}Running ss-install-prestashop-core... ${COLOR_RESET}" #################################################################################################### #### SS-Install-PrestaShop-Core: Install Ubuntu Utils ############################################## #################################################################################################### ## after trial and error we have realized that installing Ubuntu utils first is good ## ## this is because sometimes zip or other utilities are missing or so forth ## ## run ss-install-ubuntu-utils ## source "$PATH_SS_INSTALL_UBUNTU_UTILS" #################################################################################################### #### SS-Install-PrestaShop-Core: Install Latest Stable (Minor) PrestaShop Version ################## #################################################################################################### if [[ "$SS_APP" == "prestashop" ]]; then ## cleanup files ## rm /tmp/prestashop.zip* rm /var/www/html/prestashop* rm /var/www/html/staging/prestashop* ## make dirs ## mkdir /var/www/html mkdir /var/www/html/staging ## brief permissions reset ## chown -R $SFTP_USER:slickstack /var/www/html chown -R $SFTP_USER:slickstack /var/www/html/staging chmod 6775 /var/www/html chmod 6775 /var/www/html/staging ## download latest (patched) WordPress version ## ss_wget "${TMP_PRESTASHOP_ZIP}" "${MIRROR_PRESTASHOP_ZIP}" ## install WordPress to web directory ## cp "$TMP_PRESTASHOP_ZIP" /var/www/html unzip /var/www/html/prestashop.zip -d /var/www/html chown -R www-data:slickstack /var/www/html/prestashop chmod 775 /var/www/html/prestashop ss_rsync /var/www/html/prestashop/* /var/www/html ## install WordPress to staging subdirectory ## cp "$TMP_PRESTASHOP_ZIP" /var/www/html/staging unzip /var/www/html/staging/prestashop.zip -d /var/www/html/staging chown -R www-data:slickstack /var/www/html/staging/prestashop chmod 775 /var/www/html/staging/prestashop ss_rsync /var/www/html/staging/prestashop/* /var/www/html/staging ## cleanup files ## rm "$TMP_PRESTASHOP_ZIP" rm /var/www/html/prestashop* rm /var/www/html/staging/prestashop* else echo -e "${PURPLE}Exiting ss-install-prestashop-core: It appears your SlickStack is configured to use a CMS other than Prestashop... ${NOCOLOR}" fi #################################################################################################### #### SS-Install-WordPress-Core: Modify Database Options For WordPress ############################## #################################################################################################### ## here we manually fix certain fields in the MySQL database to ensure proper settings ## ## ensure home + siteurl options are correct in the wp_options table ## # mysql --execute="UPDATE ${DB_PREFIX}options SET option_value='https://$SITE_DOMAIN' WHERE option_name='home'"; # mysql --execute="UPDATE ${DB_PREFIX}options SET option_value='https://$SITE_DOMAIN' WHERE option_name='siteurl'"; #################################################################################################### #### SS-Install-PrestaShop-Core: Reset Permissions (PrestaShop Core) ############################### #################################################################################################### ## run ss-perms-prestashop-core ## source "$PATH_SS_PERMS_PRESTASHOP_CORE" #################################################################################################### #### SS-Install-PrestaShop-Core: Cleanup Temporary Files ########################################### #################################################################################################### ## delete tmp files ## # n/a #################################################################################################### #### PLACEHOLDER: Reset Permissions (SlickStack Scripts) ########################################### #################################################################################################### ## we include this permissions reset in all cron jobs and bash scripts for redundancy ## ## chmod 0700 means only the root/sudo users can execute any SlickStack scripts ## ## THIS SNIPPET DOES NOT RELY ON SS-CONFIG OR SS-FUNCTIONS ## SNIPPET: ss bash scripts, ss cron jobs ## UPDATED: 02JUL2022 chown root:root /var/www/ss* ## must be root:root chown root:root /var/www/crons/*cron* ## must be root:root chown root:root /var/www/crons/custom/*cron* ## must be root:root chmod 0700 /var/www/ss* ## 0700 means only root/sudo can execute chmod 0700 /var/www/crons/*cron* ## 0700 means only root/sudo can execute chmod 0700 /var/www/crons/custom/*cron* ## 0700 means only root/sudo can execute #################################################################################################### #### SlickStack: External References Used To Improve This Script (Thanks, Interwebz) ############### #################################################################################################### ## Ref: https://stackoverflow.com/questions/24987542/is-there-a-link-to-github-for-downloading-a-file-in-the-latest-release-of-a-repo ## SS_EOF