PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.3
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.3
6.3 6.2.3 6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 All 157 releases
← All changes | class/class-mainwp-error-helper.php +54 -0 6.2.1 → 6.3 View file →
@@ -37,8 +37,10 @@
37 37 if ( $pException->getMessage() === 'HTTPERROR' ) {
38 38 $error = 'HTTP error' . ( ! empty( $pException->get_message_extra() ) ? ' - ' . $pException->get_message_extra() : '' );
39 39 } elseif ( $pException->getMessage() === 'NOMAINWP' ) {
40 40 $error = static::get_error_not_detected_connect();
41 + } elseif ( 'TIMEOUT' === $pException->getMessage() ) {
42 + $error = static::get_timeout_error_message( $pException->get_message_error_code() );
41 43 }
42 44
43 45 if ( $escape_msg ) {
44 46 return esc_html( wp_strip_all_tags( $error ) );
@@ -62,8 +64,10 @@
62 64 if ( $pException->getMessage() === 'HTTPERROR' ) {
63 65 $error = 'HTTP error' . ( ! empty( $pException->get_message_extra() ) ? ' - ' . $pException->get_message_extra() : '' );
64 66 } elseif ( $pException->getMessage() === 'NOMAINWP' ) {
65 67 $error = static::get_error_not_detected_connect();
68 + } elseif ( 'TIMEOUT' === $pException->getMessage() ) {
69 + $error = static::get_timeout_error_message( $pException->get_message_error_code() );
66 70 } elseif ( $pException->getMessage() !== 'WPERROR' && ! empty( $pException->get_message_extra() ) ) {
67 71 $error .= ' - ' . $pException->get_message_extra();
68 72 }
69 73
@@ -77,6 +81,56 @@
77 81 */
78 82 public static function get_error_not_detected_connect() {
79 83 /* translators: 1: Opening anchor tag, 2: Closing anchor tag */
80 84 return sprintf( esc_html__( 'MainWP Child plugin not detected or could not be reached! Ensure the MainWP Child plugin is installed and activated on the child site, and there are no security rules blocking requests. If you continue experiencing this issue, check the %1$sMainWP Community%2$s for help.', 'mainwp' ), '<a href="https://community.mainwp.com/c/community-support/5" target="_blank">', '</a>' );
85 + }
86 +
87 + /**
88 + * Connect/sync failure message with IP labels, User-Agent, and readable response.
89 + *
90 + * On 403 / Cloudflare / WAF, Cloudflare and User-Agent allow steps come first.
91 + *
92 + * @param MainWP_Exception $exception Exception.
93 + * @param array $output Fetch output.
94 + *
95 + * @return string
96 + */
97 + public static function get_connect_failure_message( $exception, $output = array() ) {
98 + $details = MainWP_Connect_Failure_Ux::from_exception( $exception, $output );
99 + $ux = MainWP_Connect_Failure_Ux::render_html( $details );
100 +
101 + if ( ! empty( $details['waf_likely'] ) ) {
102 + return $ux;
103 + }
104 +
105 + $base = '';
106 + if ( $exception instanceof MainWP_Exception ) {
107 + $base = MainWP_Connect_Failure_Ux::sanitize_diagnostic_text( static::get_error_message( $exception ) );
108 + }
109 +
110 + if ( '' === $base ) {
111 + return $ux;
112 + }
113 +
114 + return $base . $ux;
115 + }
116 +
117 + /**
118 + * Fixed copy for a child request timeout.
119 + *
120 + * Gateway and connect timeouts do not mention the Advanced Settings total.
121 + * The extra on the exception stays empty; this method does not append it.
122 + *
123 + * @param string $kind operation, connect, or gateway.
124 + *
125 + * @return string
126 + */
127 + public static function get_timeout_error_message( $kind = 'operation' ) {
128 + if ( 'gateway' === $kind ) {
129 + return esc_html__( 'The child site request timed out at a gateway or proxy. This is not a missing MainWP Child plugin. Changing the Child request timeout does not fix this response.', 'mainwp' );
130 + }
131 + if ( 'connect' === $kind ) {
132 + return esc_html__( 'The connection to the child site timed out before it opened. Use Test Connection to check whether the site is reachable. This is not a missing MainWP Child plugin.', 'mainwp' );
133 + }
134 + return esc_html__( 'The child site request timed out. You can raise the Child request timeout in Settings → Advanced Settings. This is not a missing MainWP Child plugin.', 'mainwp' );
81 135 }
82 136 }