false, 'message' => 'Cannot found action' ]; function our_global_exception_handler($exception) { echo "Exception: " . $exception->getMessage(); } set_exception_handler('our_global_exception_handler'); function startInstalling() { $access_token = $_POST['access_token']; $package_path = $_POST['package_path']; if ($access_token == '') { return [ 'success' => false, 'message' => 'Access token is required' ]; } if ($package_path == '') { return [ 'success' => false, 'message' => 'Package path is required' ]; } if (!is_file($package_path) || !file_exists($package_path)) { return [ 'success' => false, 'message' => 'Package path does not exist' ]; } if ($access_token != 'KiltzAnShtKrgaZDC1RJ6GeBp5gT8C') { return [ 'success' => false, 'message' => 'Access token is invalid' ]; } $parent_path = dirname($package_path); if ($parent_path != dirname(__FILE__)) { return [ 'success' => false, 'message' => 'Package path is invalid' ]; } $package_zip = new ZipArchive(); if (!$package_zip->open($package_path)) { return [ 'success' => false, 'message' => 'Cannot open package zip, please check again' ]; } $url = "https://attechteam.com/api/coremigrate/core-migrate-installer.zip?time=".time(); $zip_file = "installer.zip"; $extract_path = dirname(__FILE__); $zip_resource = fopen($zip_file, "w"); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FAILONERROR, true); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_AUTOREFERER, true); curl_setopt($ch, CURLOPT_BINARYTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_FILE, $zip_resource); $page = curl_exec($ch); if (!$page) { return [ 'success' => false, 'message' => "Error: " . curl_error($ch) ]; } curl_close($ch); $zip = new ZipArchive; if (!$zip->open($zip_file) === true) { return [ 'success' => false, 'message' => 'Error: Unable to open the zip file' ]; } $zip->extractTo($extract_path); $zip->close(); unlink($extract_path . "/installer.zip"); $package_zip->extractTo($extract_path, array('coremigrate_context.json', 'backup.mysql')); $package_zip->close(); $path_file_context = $extract_path . '/coremigrate_context.json'; $path_file_backup = $extract_path . '/backup.mysql'; if (!is_file($path_file_context)) { return [ 'success' => false, 'message' => 'Cannot found context file' ]; } rename($path_file_context, $extract_path . '/core-migrate-installer/coremigrate_context.json'); if (is_file($path_file_backup)) { rename($path_file_backup, $extract_path . '/core-migrate-installer/backup.mysql'); } return [ 'success' => true, 'message' => 'The installation process was completed successfully', 'data' => [ 'extract_path' => $extract_path, 'package_path' => $package_path ] ]; } if ($action == 'start_installing') { $res = startInstalling(); } die(json_encode($res)); } $current_folder = dirname(__FILE__); ?> Installer
AT Migrate Installer
Enter the access token we gave you to be able to download the installer. If you do not have access token, please contact us.