/** * Clears the application cache * * Since this script is being executed via web requests and standalone from the Mautic application, we don't have access to Symfony's * CLI suite. So we'll go with Option B in this instance and just nuke the entire production cache and let Symfony rebuild it on the next * application cycle. * * @param array $status * * @return array */ function clear_mautic_cache(array $status) { if (!recursive_remove_directory(MAUTIC_CACHE_DIR)) { process_error_log(array('Could not remove the application cache. You will need to manually delete ' . MAUTIC_CACHE_DIR . '.')); } // Build the cache for migrations build_cache(); // Apply critical migrations apply_critical_migrations(); $status['complete'] = true; $status['stepStatus'] = 'Success'; $status['nextStep'] = 'Processing Database Updates'; $status['nextStepStatus'] = 'In Progress'; $status['updateState']['cacheComplete'] = true; return $status; }
$status = move_mautic_core($status); $status = move_mautic_vendors($status, -1); if (empty($status['complete'])) { echo "failed. Review udpate errors log for details."; exit; } unset($status['complete']); echo "done!\n"; echo "Clearing the cache..."; if (!clear_mautic_cache()) { echo "failed. Review udpate errors log for details."; exit; } echo "done!\n"; echo "Rebuilding the cache..."; 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()) {
$data['impressions'][$log->user_id][] = $log; break; case 'conversion': $log->id = get_conversion_id(); if (!isset($data['conversions'][$log->user_id])) { $data['conversions'][$log->user_id] = array(); } $data['conversions'][$log->user_id][] = $log; break; } if (!isset($data['logs'][$log->user_id])) { $data['logs'][$log->user_id] = array(); } $data['logs'][$log->user_id][] = $log; } unset($log_array); foreach ($data['conversions'] as $uc_key => $uc_val) { usort($data['conversions'][$uc_key], 'sort_log_by_time'); } foreach ($data['impressions'] as $ui_key => $ui_val) { usort($data['impressions'][$ui_key], 'sort_log_by_time'); } $users = json_decode(file_get_contents($data_users_file)); foreach ($users as $u => $user) { $user->logs = array('impressions' => $data['impressions'][$user->id], 'conversions' => $data['conversions'][$user->id]); $data['users'][$u] = $users; } file_put_contents($data_dir . 'all.json', json_encode($data)); } build_cache();