Server : Apache System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 User : andertr9 ( 1047) PHP Version : 8.2.18 Disable Function : NONE Directory : /opt/eig_wp/ |
Upload File : |
#!/bin/bash +x export TERM=dumb export WP_CLI_CONFIG_PATH=/opt/eig_wp/wp-cli.yml _src_plugin='/opt/wp/drop-in/object-cache.php' cd ${HOME} if [[ ! -d ${HOME}/.ecp_conf ]]; then mkdir ${HOME}/.ecp_conf/ 2>/dev/null fi object_cache_add() { if [[ -f ${HOME}/.ecp_conf/object_cache_disabled ]] ; then echo "WP Object Cache disabled. If you want to continue with the install, delete ${HOME}/.ecp_conf/object_cache_disabled" exit fi if [[ -f ${HOME}/.ecp_conf/object_cache_installed_on ]] ; then install_time=$(expr $(date +%s) - $(date +%s -r ${HOME}/.ecp_conf/object_cache_installed_on)) if [ $install_time -lt 259200 ] ; then echo "WP Object Cache has recently been installed. If you really want to continue. Please delete ${HOME}/.ecp_conf/object_cache_installed_on" exit; fi fi _wp_command='/opt/cpanel/ea-php74/root/usr/bin/php /usr/local/bin/wp' _wp_configs=$(ls wp-config.php public_html/wp-config.php public_html/*/wp-config.php 2>/dev/null) _wp_a=$(echo ${_wp_configs} | tr ";" "\n") for _wp_config in ${_wp_a}; do _dir=$(dirname "${_wp_config}") if [[ -d "${_dir}/wp-content" ]]; then if [[ ! -f "${_dir}/wp-content/object-cache.php" ]]; then if cp ${_src_plugin} "${_dir}/wp-content" 2> /dev/null; then echo "[COMPLETE] WP Object Cache installed on ${_dir}" echo ${_dir} >> "${HOME}/.ecp_conf/object_cache_installed_on" else echo "[ERROR] cp ${_src_plugin} ${_dir}/wp-content failed" fi else echo "[ERROR] ${_dir}/wp-content/object-cache.php already exists" fi else echo "[ERROR] ${_dir}/wp-content missing" fi done touch ${HOME}/.ecp_conf/object_cache_installed_on } object_cache_remove() { if [[ -f ${HOME}/.ecp_conf/object_cache_installed_on ]] ; then for _dir in $(cat ${HOME}/.ecp_conf/object_cache_installed_on); do if [[ -f "${_dir}/wp-content/object-cache.php" ]]; then if rm -f "${_dir}/wp-content/object-cache.php"; then echo "[COMPLETE] WP Object Cache removed from ${_dir}" else echo "[ERROR] failed removing ${_dir}/wp-content/object-cache.php" fi else echo "[ERROR] ${_dir}/wp-content/object-cache.php doesn't exist" fi done rm -f ${HOME}/.ecp_conf/object_cache_installed_on else echo "[ERROR] ${HOME}/.ecp_conf/object_cache_installed_on doesn't exist" fi } $1