← All changes
|
modules/api-backups/classes/class-api-backups-handler.php
+7
-2
5.3
→
trunk
View file →
| @@ -11,8 +11,13 @@ | ||
| 11 | 11 | namespace MainWP\Dashboard\Module\ApiBackups; |
| 12 | 12 | |
| 13 | 13 | use WP_Error; |
| 14 | 14 | |
| 15 | +// Exit if accessed directly. | |
| 16 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 17 | + exit; | |
| 18 | +} | |
| 19 | + | |
| 15 | 20 | /** |
| 16 | 21 | * MainWP API Backups Handler |
| 17 | 22 | */ |
| 18 | 23 | class Api_Backups_Handler { |
| @@ -140,9 +145,9 @@ | ||
| 140 | 145 | $linode_response = $result; |
| 141 | 146 | if ( is_object( $linode_response ) ) { |
| 142 | 147 | // Handle response. |
| 143 | 148 | if ( isset( $linode_response->errors ) ) { |
| 144 | - $error = new WP_Error( '400', __( $linode_response->errors['0']->reason, 'Some information' ) ); | |
| 149 | + $error = new WP_Error( '400', $linode_response->errors['0']->reason, 'Some information' ); | |
| 145 | 150 | static::send_backups_response( false, $error ); |
| 146 | 151 | } else { |
| 147 | 152 | static::send_backups_response(); |
| 148 | 153 | } |
| @@ -154,9 +159,9 @@ | ||
| 154 | 159 | $result = Api_Backups_3rd_Party::gridpane_action_create_backup( $website_id, $return ); |
| 155 | 160 | if ( $die_output ) { |
| 156 | 161 | $backup_status = (array) $result; |
| 157 | 162 | if ( array_key_exists( 'error', $backup_status ) ) { |
| 158 | - $error = new WP_Error( $backup_status['error']->code, __( $backup_status['error']->message, 'mainwp' ) ); | |
| 163 | + $error = new WP_Error( $backup_status['error']->code, $backup_status['error']->message ); | |
| 159 | 164 | if ( is_wp_error( $error ) ) { |
| 160 | 165 | static::send_backups_response( false, $error->get_error_message() ); |
| 161 | 166 | } |
| 162 | 167 | } |