Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../proc/self/root/opt/maint/bin
File: update_ads.sh
#!/bin/bash
[0] Fix | Delete
[1] Fix | Delete
FORCE=$(echo "$@" | grep -oP -- "--force")
[2] Fix | Delete
do_log() {
[3] Fix | Delete
echo "[$(date)] $@" | tee -a /var/log/update_shared_ads.log;
[4] Fix | Delete
}
[5] Fix | Delete
[6] Fix | Delete
INCLUDE_FILE="imh_include.html.tt"
[7] Fix | Delete
LOCAL_ADS_VERSION_FILE="/etc/shared_ads"
[8] Fix | Delete
LOCAL_TEMPLATE_FILE="/usr/local/cpanel/base/frontend/jupiter/_assets/${INCLUDE_FILE}"
[9] Fix | Delete
[10] Fix | Delete
# if development, use development URL
[11] Fix | Delete
if hostname | grep -q dev; then
[12] Fix | Delete
REMOTE_ADS_URL="https://dedbackups.iad1.imhcloud.net/int-shared-ads/development"
[13] Fix | Delete
else
[14] Fix | Delete
REMOTE_ADS_URL="https://dedbackups.iad1.imhcloud.net/int-shared-ads/production"
[15] Fix | Delete
fi
[16] Fix | Delete
[17] Fix | Delete
if ! test -f $LOCAL_ADS_VERSION_FILE; then
[18] Fix | Delete
LOCAL_ADS_VERSION=0;
[19] Fix | Delete
else
[20] Fix | Delete
LOCAL_ADS_VERSION=$(cat $LOCAL_ADS_VERSION_FILE);
[21] Fix | Delete
fi
[22] Fix | Delete
[23] Fix | Delete
REMOTE_ADS_VERSION=$(curl -s "${REMOTE_ADS_URL}/version.txt")
[24] Fix | Delete
if [[ ! -z "${REMOTE_ADS_VERSION}" ]]; then
[25] Fix | Delete
if [[ $REMOTE_ADS_VERSION -gt $LOCAL_ADS_VERSION || "${FORCE}" == "--force" ]]; then
[26] Fix | Delete
if [[ "${FORCE}" == "--force" ]]; then
[27] Fix | Delete
do_log "Updating IMH cPanel Ads release from ${LOCAL_ADS_VERSION} to ${REMOTE_ADS_VERSION} (force=True)";
[28] Fix | Delete
else
[29] Fix | Delete
do_log "Updating IMH cPanel Ads release from ${LOCAL_ADS_VERSION} to ${REMOTE_ADS_VERSION} (force=False)";
[30] Fix | Delete
fi
[31] Fix | Delete
wget -q -O "${LOCAL_TEMPLATE_FILE}" "${REMOTE_ADS_URL}/${INCLUDE_FILE}";
[32] Fix | Delete
echo "${REMOTE_ADS_VERSION}" > $LOCAL_ADS_VERSION_FILE;
[33] Fix | Delete
fi
[34] Fix | Delete
else
[35] Fix | Delete
do_log "We failed to retrieve version information from int-shared-ads";
[36] Fix | Delete
fi
[37] Fix | Delete
[38] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function