#!/usr/bin/env bash ### # Devportal Cleanup tasks script ## # This script can be ran if the Devportal upgrade script fails during the "Running cleanup tasks..." # with the error: "Query failed." # # This script runs the final cleanup tasks that are run at the end of the Devportal upgrade script. # # Instructions: # 1) place this script in your webroot, which is /var/www/html by default # 2) run: "bash devportal-upgrade-cleanup-tasks.sh" # 3) delete this script after completion echo "Running cleanup tasks..." drush_exe=$( which drush 2>/dev/null ) ${drush_exe} sql-query --db-prefix "TRUNCATE TABLE {cache_bootstrap}" # Clean up old views handlers from the registry. ${drush_exe} sql-query --db-prefix "DELETE FROM {registry} WHERE name LIKE 'dda_handler%' OR name LIKE 'du_handler%'" ${drush_exe} sql-query --db-prefix "DELETE FROM {registry_file} WHERE filename LIKE '%dda_handler%' OR filename LIKE '%du_handler%'" # If apigee_checklist was enabled, disable it, so we don't get spurious # drush warnings on cron. ${drush_exe} sql-query --db-prefix "UPDATE {system} SET status = 0 WHERE name = 'apigee_checklist'" ${drush_exe} rr echo "Running database updates..." ${drush_exe} updb -y echo "Enabling Update module if it was not already enabled..." ${drush_exe} en -y update echo "Clearing caches and running cron..." ${drush_exe} cc all ${drush_exe} cron echo "--------------------------------------------------------------------------------" echo "Dev Portal cleanup tasks Complete" echo "--------------------------------------------------------------------------------"