💦 FULL SET: Changeset/ - Uncensored 2025

Changeset 2636772


Ignore:
Timestamp:
11/29/2021 11:09:47 AM (4 years ago)
Author:
wpseahorse
Message:

3.0.20

  • Added SNS Alert if Remote Connection Fails
Location:
wp-migrate-2-aws/trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • wp-migrate-2-aws/trunk/admin/classes/apiGlobal.class.php

    r2626222 r2636772  
    23052305            )
    23062306        );
    2307         // return $response;
     2307
     2308        $isError = is_wp_error($response);
     2309        if ($isError === true) {
     2310            // Alert Error
     2311            $adminFunctions = new WPM2AWS_AdminFunctions();
     2312            $errorMessage = $response->get_error_message();
     2313            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'getRemoteConsoleData');
     2314            return array('error' => 'An Error Has Occurred (data)<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>', 'code' => 'error');
     2315        }
     2316
    23082317        $responseCode = wp_remote_retrieve_response_code($response);
    2309         // wp_die(print_r($response));
     2318
    23102319        if ('200' !== $responseCode && 200 !== $responseCode) {
    23112320            $errorMessage = json_decode($response['body'], true);
     
    23132322                return array('error' => 'Unauthorised Access<br>' . $errorMessage, 'code' => $responseCode);
    23142323            } else {
     2324                // Alert Bad Connection
     2325                if ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     2326                    $adminFunctions = new WPM2AWS_AdminFunctions();
     2327                    $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'getRemoteConsoleData');
     2328                }
     2329
    23152330                return array('error' => 'An Error Has Occurred (data)<br>' . $errorMessage, 'code' => $responseCode);
    23162331            }
     
    23992414            )
    24002415        );
    2401         // return $response;
     2416
     2417
     2418        $isError = is_wp_error($response);
     2419        if ($isError === true) {
     2420            // Alert Error
     2421            $adminFunctions = new WPM2AWS_AdminFunctions();
     2422            $errorMessage = $response->get_error_message();
     2423            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'remoteAddNewMetricAlarm');
     2424            return array('error' => 'An Error Has Occurred (data)<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>', 'code' => 'error');
     2425        }
     2426
    24022427        $responseCode = wp_remote_retrieve_response_code($response);
    2403         // wp_die(print_r($response));
     2428
    24042429        if ('200' !== $responseCode && 200 !== $responseCode) {
    24052430            $errorMessage = json_decode($response['body'], true);
     
    24072432                return array('error' => 'Unauthorised Access<br>' . $errorMessage, 'code' => $responseCode);
    24082433            } else {
     2434                // Alert Bad Connection
     2435                if ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     2436                    $adminFunctions = new WPM2AWS_AdminFunctions();
     2437                    $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'remoteAddNewMetricAlarm');
     2438                }
    24092439                return array('error' => 'An Error Has Occurred<br>' . $errorMessage, 'code' => $responseCode);
    24102440            }
     
    24902520            )
    24912521        );
    2492         // return $response;
     2522
     2523        $isError = is_wp_error($response);
     2524        if ($isError === true) {
     2525            // Alert Error
     2526            $adminFunctions = new WPM2AWS_AdminFunctions();
     2527            $errorMessage = $response->get_error_message();
     2528            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'remoteRebootInstance');
     2529            throw new \Exception('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     2530        }
     2531
    24932532        $responseCode = wp_remote_retrieve_response_code($response);
    2494         // wp_die(print_r($response));
     2533
    24952534        if ('200' !== $responseCode && 200 !== $responseCode) {
    24962535            $errorMessage = json_decode($response['body'], true);
     
    25002539                return array('error' => 'Unauthorised Access<br>' . $errorMessage, 'code' => $responseCode);
    25012540            } else {
    2502                 // wp_die(print_r($errorMessage));
     2541                // Alert Bad Connection
     2542                if ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     2543                    $adminFunctions = new WPM2AWS_AdminFunctions();
     2544                    $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'remoteRebootInstance');
     2545                }
     2546
    25032547                throw new Exception('Unauthorised Access<br>' . $errorMessage);
    25042548                return array('error' => 'An Error Has Occurred<br>' . $errorMessage, 'code' => $responseCode);
     
    25912635            )
    25922636        );
    2593         // return $response;
     2637
     2638        $isError = is_wp_error($response);
     2639        if ($isError === true) {
     2640            // Alert Error
     2641            $adminFunctions = new WPM2AWS_AdminFunctions();
     2642            $errorMessage = $response->get_error_message();
     2643            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'remoteCreateManualSnapshot');
     2644            throw new \Exception('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     2645        }
     2646
    25942647        $responseCode = wp_remote_retrieve_response_code($response);
    2595         // wp_die(print_r($response));
     2648
    25962649        if ('200' !== $responseCode && 200 !== $responseCode) {
    25972650            $errorMessage = json_decode($response['body'], true);
     
    26012654                return array('error' => 'Unauthorised Access<br>' . $errorMessage, 'code' => $responseCode);
    26022655            } else {
    2603                 // wp_die(print_r($errorMessage));
     2656                // Alert Bad Connection
     2657                if ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     2658                    $adminFunctions = new WPM2AWS_AdminFunctions();
     2659                    $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'remoteCreateManualSnapshot');
     2660                }
     2661
    26042662                throw new Exception('Unauthorised Access<br>' . $errorMessage);
    26052663                return array('error' => 'An Error Has Occurred<br>' . $errorMessage, 'code' => $responseCode);
     
    26992757        );
    27002758
     2759        $isError = is_wp_error($response);
     2760        if ($isError === true) {
     2761            // Alert Error
     2762            $adminFunctions = new WPM2AWS_AdminFunctions();
     2763            $errorMessage = $response->get_error_message();
     2764            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'remoteChangeInstancePlan');
     2765            throw new \Exception('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     2766        }
     2767
    27012768        $responseCode = wp_remote_retrieve_response_code($response);
    2702         // wp_die(print_r($response));
     2769
    27032770        if ('200' !== $responseCode && 200 !== $responseCode) {
    27042771            $errorMessage = json_decode($response['body'], true);
     
    27082775                return array('error' => 'Unauthorised Access<br>' . $errorMessage, 'code' => $responseCode);
    27092776            } else {
    2710                 // wp_die(print_r($errorMessage));
     2777                // Alert Bad Connection
     2778                if ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     2779                    $adminFunctions = new WPM2AWS_AdminFunctions();
     2780                    $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'remoteChangeInstancePlan');
     2781                }
     2782
    27112783                throw new Exception('Unauthorised Access<br>' . $errorMessage);
    27122784                return array('error' => 'An Error Has Occurred<br>' . $errorMessage, 'code' => $responseCode);
  • wp-migrate-2-aws/trunk/admin/classes/apiRemote.class.php

    r2626222 r2636772  
    9494            )
    9595        );
    96         // die(print_r($response));
     96
     97        $isError = is_wp_error($response);
     98        if ($isError === true) {
     99            // Alert Error
     100            $adminFunctions = new WPM2AWS_AdminFunctions();
     101            $errorMessage = $response->get_error_message();
     102            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'createLightsailFromZip');
     103            throw new \Exception('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     104        }
     105
    97106        $responseCode = wp_remote_retrieve_response_code($response);
    98         // wp_die(print_r(json_decode($response['body'], true)));
     107
    99108
    100109        if ('200' !== $responseCode && 200 !== $responseCode) {
     
    104113                throw new \Exception('Error! This Action Can Not Be Completed. Unauthorised Access<br>' . $errorMessage);
    105114            } elseif ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     115                // Alert Bad Connection
     116                $adminFunctions = new WPM2AWS_AdminFunctions();
     117                $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'createLightsailFromZip');
     118
    106119                throw new \Exception('Error! This Action Can Not Be Completed. Internal Server Error<br>' . $errorMessage);
    107120            } else {
  • wp-migrate-2-aws/trunk/admin/classes/apiRemoteIam.class.php

    r2626222 r2636772  
    5959        );
    6060
     61        $isError = is_wp_error($response);
     62        if ($isError === true) {
     63            // Alert Error
     64            $adminFunctions = new WPM2AWS_AdminFunctions();
     65            $errorMessage = $response->get_error_message();
     66            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'getIamUser');
     67            $this->abortWithErrorMessage('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     68        }
     69
    6170        $responseCode = wp_remote_retrieve_response_code($response);
    6271
     
    6776                $this->abortWithErrorMessage('Error! This Action Can Not Be Completed. Unauthorised Access<br>' . $errorMessage);
    6877            } elseif ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     78                // Alert Bad Connection
     79                $adminFunctions = new WPM2AWS_AdminFunctions();
     80                $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'getIamUser');
     81
    6982                $this->abortWithErrorMessage('Error! This Action Can Not Be Completed. Internal Server Error.<br>' . $errorMessage);
    7083            } else {
  • wp-migrate-2-aws/trunk/admin/classes/apiRemoteS3.class.php

    r2626222 r2636772  
    5757        );
    5858
     59        $isError = is_wp_error($response);
     60        if ($isError === true) {
     61            // Alert Error
     62            $adminFunctions = new WPM2AWS_AdminFunctions();
     63            $errorMessage = $response->get_error_message();
     64            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'checkBucketExists');
     65            throw new \Exception('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     66        }
     67
    5968        $responseCode = wp_remote_retrieve_response_code($response);
    6069
     
    6574                throw new \Exception('Error! This Action Can Not Be Completed. Unauthorised Access<br>' . $errorMessage);
    6675            } elseif ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     76                // Alert Bad Connection
     77                $adminFunctions = new WPM2AWS_AdminFunctions();
     78                $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'checkBucketExists');
     79
    6780                throw new \Exception('Error! This Action Can Not Be Completed. Internal Server Error<br>' . $errorMessage);
    6881            } else {
     
    97110        );
    98111
     112        $isError = is_wp_error($response);
     113        if ($isError === true) {
     114            // Alert Error
     115            $adminFunctions = new WPM2AWS_AdminFunctions();
     116            $errorMessage = $response->get_error_message();
     117            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'getBucketList');
     118            $this->abortWithErrorMessage('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     119        }
     120
    99121        $responseCode = wp_remote_retrieve_response_code($response);
    100122
     
    105127                $this->abortWithErrorMessage('Error! This Action Can Not Be Completed. Unauthorised Access<br>' . $errorMessage);
    106128            } elseif ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     129                // Alert Bad Connection
     130                $adminFunctions = new WPM2AWS_AdminFunctions();
     131                $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'getBucketList');
     132
    107133                $this->abortWithErrorMessage('Error! This Action Can Not Be Completed. Internal Server Error.<br>' . $errorMessage);
    108134            } else {
     
    146172        );
    147173
     174        $isError = is_wp_error($response);
     175        if ($isError === true) {
     176            // Alert Error
     177            $adminFunctions = new WPM2AWS_AdminFunctions();
     178            $errorMessage = $response->get_error_message();
     179            $adminFunctions->wpm2awsAlertBadRemoteConnection('n/a', $errorMessage, 'createBucket');
     180            $this->abortWithErrorMessage('An error has occurred.<br>Please contact <a href="https://www.seahorse-data.com/wp-on-aws-support-portal/" target="_blank">Seahorse Support</a>');
     181        }
     182
    148183        $responseCode = wp_remote_retrieve_response_code($response);
    149184
     
    160195                $this->abortWithErrorMessage('Error! This Action Can Not Be Completed. Unauthorised Access<br>' . $errorMessage);
    161196            } elseif ((int)$responseCode >= 500 && (int)$responseCode < 600) {
     197                // Alert Bad Connection
     198                $adminFunctions = new WPM2AWS_AdminFunctions();
     199                $adminFunctions->wpm2awsAlertBadRemoteConnection($responseCode, $errorMessage, 'createBucket');
     200
    162201                $this->abortWithErrorMessage('Error! This Action Can Not Be Completed. Internal Server Error.<br>' . $errorMessage);
    163202            } else {
  • wp-migrate-2-aws/trunk/admin/includes/adminFunctions.php

    r2626222 r2636772  
    688688            wpm2awsAddUpdateOptions('wpm2aws_valid_licence_dyck', $responseData['dyck']);
    689689        }