$task = getVar('task'); // Build the base status array // TODO - Find a way to translate the step status $status = array('complete' => false, 'error' => false, 'updateState' => $state, 'stepStatus' => 'In Progress'); switch ($task) { case 'moveBundles': $status = move_mautic_bundles($status); break; case 'moveCore': $status = move_mautic_core($status); break; case 'moveVendors': $status = move_mautic_vendors($status); break; case 'clearCache': $status = clear_mautic_cache($status); break; default: $status['error'] = true; $status['message'] = 'Invalid task'; $status['stepStatus'] = 'Failed'; break; } // A way to keep the upgrade from failing if the session is lost after // the cache is cleared by upgrade.php $isSSL = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'; $cookie_path = isset($localParameters['cookie_path']) ? $localParameters['cookie_path'] : '/'; $cookie_domain = isset($localParameters['cookie_domain']) ? $localParameters['cookie_domain'] : ''; $cookie_secure = isset($localParameters['cookie_secure']) ? $localParameters['cookie_secure'] : $isSSL; $cookie_httponly = isset($localParameters['cookie_httponly']) ? $localParameters['cookie_httponly'] : false; setcookie('mautic_update', $task, time() + 300, $cookie_path, $cookie_domain, $cookie_secure, $cookie_httponly);
if (!build_cache()) { echo "failed. Review udpate errors log for details."; exit; } echo "done!\n"; echo "Applying migrations..."; if (!apply_migrations()) { echo "failed. Review udpate errors log for details."; exit; } echo "done!\n"; echo "Cleaning up..."; if (!recursive_remove_directory(MAUTIC_UPGRADE_ROOT)) { echo "failed. Manually delete the upgrade folder.\n"; } if (!clear_mautic_cache()) { echo "failed. Manually delete app/cache/prod."; } echo "done!\n"; echo "\nSuccess!"; } /** * Get local parameters * * @return mixed */ function get_local_config() { static $parameters; if (null === $parameters) { // Used in paths.php