PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
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 5.2 5.2.1 All 155 releases
← All changes | pages/page-mainwp-server-information-handler.php +192 -14 6.1.8 → 6.2.2 View file →
@@ -1070,9 +1070,11 @@
1070 1070 'kb_url' => ( isset( $self_connect['code'] ) && 'unexpected_body' === $self_connect['code'] ) ? '' : 'https://docs.mainwp.com/troubleshooting/potential-issues/',
1071 1071 );
1072 1072 }
1073 1073
1074 - return $issues;
1074 + $db_issues = MainWP_Database_Schema_Checker::get_detected_db_issues();
1075 +
1076 + return array_merge( $issues, is_array( $db_issues ) ? $db_issues : array() );
1075 1077 }
1076 1078
1077 1079 /**
1078 1080 * Add English export labels to localized report rows.
@@ -1377,9 +1379,9 @@
1377 1379 if ( ! in_array( $frequency_auto_update, array( 'daily', 'weekly', 'monthly' ), true ) ) {
1378 1380 $frequency_auto_update = 'daily';
1379 1381 }
1380 1382
1381 - $show_widgets = get_user_option( 'mainwp_settings_show_widgets', array() );
1383 + $show_widgets = get_user_option( 'mainwp_settings_show_widgets' );
1382 1384 if ( ! is_array( $show_widgets ) ) {
1383 1385 $show_widgets = array();
1384 1386 }
1385 1387
@@ -2138,9 +2140,9 @@
2138 2140 *
2139 2141 * @return array<int,array<string,mixed>>
2140 2142 */
2141 2143 public static function get_conflict_signal_report_rows() {
2142 - $caching_plugins = static::get_active_plugins_by_keyword_group(
2144 + $caching_plugins = static::get_active_plugins_by_keyword_group(
2143 2145 array(
2144 2146 'cache',
2145 2147 'rocket',
2146 2148 'litespeed',
@@ -2153,9 +2155,9 @@
2153 2155 'nitropack',
2154 2156 'hummingbird',
2155 2157 )
2156 2158 );
2157 - $security_plugins = static::get_active_plugins_by_keyword_group(
2159 + $security_plugins = static::get_active_plugins_by_keyword_group(
2158 2160 array(
2159 2161 'wordfence',
2160 2162 'sucuri',
2161 2163 'solid security',
@@ -2168,19 +2170,12 @@
2168 2170 'cloudflare',
2169 2171 'limit login',
2170 2172 )
2171 2173 );
2172 - $maintenance_plugins = static::get_active_plugins_by_keyword_group(
2173 - array(
2174 - 'maintenance',
2175 - 'coming soon',
2176 - 'seedprod',
2177 - 'lightstart',
2178 - )
2179 - );
2180 - $maintenance_mode = static::get_maintenance_mode_indicators();
2181 - $dropins = static::get_dropin_conflict_indicators();
2182 2174
2175 + $maintenance_mode = static::get_maintenance_mode_indicators();
2176 + $dropins = static::get_dropin_conflict_indicators();
2177 +
2183 2178 return self::add_export_labels_to_rows(
2184 2179 array(
2185 2180 array(
2186 2181 'label' => esc_html__( 'Caching / performance plugins', 'mainwp' ),
@@ -2207,8 +2202,191 @@
2207 2202 'Drop-ins / object cache',
2208 2203 )
2209 2204 );
2210 2205 }
2206 +
2207 +
2208 + /**
2209 + * Get database rows.
2210 + *
2211 + * @return array<int,array<string,mixed>>
2212 + */
2213 + public static function get_database_report_rows() { // phpcs:ignore -- NOSONAR - complex function.
2214 +
2215 + $db_info = MainWP_Database_Schema_Checker::get_database_info();
2216 +
2217 + $database_size = isset( $db_info['database_size'] ) ? $db_info['database_size'] : array();
2218 +
2219 + $data_size = isset( $database_size['data'] ) ? $database_size['data'] : 0;
2220 + $index_size = isset( $database_size['index'] ) ? $database_size['index'] : 0;
2221 +
2222 + $db_privileges_info = MainWP_Database_Schema_Checker::get_database_privileges();
2223 +
2224 + $db_privileges = ! empty( $db_privileges_info['database_grants'] ) && is_array( $db_privileges_info['database_grants'] ) ? implode( ', ', $db_privileges_info['database_grants'] ) . '.' : '';
2225 +
2226 + $db_privileges_status = 'pass';
2227 + if ( ! empty( $db_privileges_info['database_missing_privileges'] ) && is_array( $db_privileges_info['database_missing_privileges'] ) ) {
2228 + $db_privileges .= ' ' . esc_html__( 'Missing database privileges:', 'mainwp' ) . ' ' . implode( ', ', $db_privileges_info['database_missing_privileges'] );
2229 + $db_privileges_status = 'error';
2230 + }
2231 +
2232 + $db_rows_info = array(
2233 + array(
2234 + 'label' => esc_html__( 'MainWP database version', 'mainwp' ),
2235 + 'value' => $db_info['mainwp_database_version'],
2236 + ),
2237 + array(
2238 + 'label' => esc_html__( 'Database prefix', 'mainwp' ),
2239 + 'value' => $db_info['database_prefix'],
2240 + ),
2241 + array(
2242 + 'label' => esc_html__( 'Total Database Size', 'mainwp' ),
2243 + 'value' => esc_html( sprintf( __( '%sMB', 'mainwp' ), $data_size + $index_size ) ),
2244 + ),
2245 + array(
2246 + 'label' => esc_html__( 'Database Data Size', 'mainwp' ),
2247 + 'value' => esc_html( sprintf( __( '%sMB', 'mainwp' ), $data_size ) ),
2248 + ),
2249 + array(
2250 + 'label' => esc_html__( 'Database Index Size', 'mainwp' ),
2251 + 'value' => esc_html( sprintf( __( '%sMB', 'mainwp' ), $index_size ) ),
2252 + ),
2253 + array(
2254 + 'status' => $db_privileges_status,
2255 + 'label' => esc_html__( 'Database privileges', 'mainwp' ),
2256 + 'value' => $db_privileges,
2257 + ),
2258 + );
2259 +
2260 + $db_rows = array();
2261 + $db_rows_missing = array();
2262 +
2263 + if ( isset( $db_info['database_tables'] ) && is_array( $db_info['database_tables'] ) ) {
2264 +
2265 + $missing_db_tables = MainWP_Database_Schema_Checker::detect_missing_tables( $db_info['database_tables'] );
2266 +
2267 + if ( is_array( $missing_db_tables ) ) {
2268 + foreach ( array( 'core', 'extensions' ) as $type ) {
2269 + $miss_tables = isset( $missing_db_tables[ $type ] ) ? $missing_db_tables[ $type ] : array();
2270 + if ( ! empty( $miss_tables ) && is_array( $miss_tables ) ) {
2271 + if ( 'core' === $type ) {
2272 + foreach ( $miss_tables as $tb_name ) {
2273 + $db_rows_missing[] = array(
2274 + 'label' => $tb_name,
2275 + 'value' => esc_html__( 'Missing core table', 'mainwp' ),
2276 + 'status' => 'error',
2277 + );
2278 + }
2279 + } else {
2280 + foreach ( $miss_tables as $ext_slug => $miss_ext_tables ) {
2281 + $title = MainWP_Database_Schema_Checker::get_loaded_extension_title( $ext_slug );
2282 + foreach ( $miss_ext_tables as $tb_name ) {
2283 + $db_rows_missing[] = array(
2284 + 'label' => $tb_name,
2285 + 'value' => sprintf( esc_html__( 'Missing extension table: %1s', 'mainwp' ), $title ),
2286 + 'status' => 'error',
2287 + );
2288 + }
2289 + }
2290 + }
2291 + }
2292 + }
2293 + }
2294 +
2295 + foreach ( array( 'core', 'other' ) as $type ) {
2296 + $type_tables = isset( $db_info['database_tables'][ $type ] ) ? $db_info['database_tables'][ $type ] : array();
2297 + if ( is_array( $type_tables ) ) {
2298 + foreach ( $type_tables as $tb_name => $info ) {
2299 +
2300 + if ( empty( $info ) ) {
2301 + continue; // Missing table, so skip column detection.
2302 + }
2303 +
2304 + $status = 'pass';
2305 +
2306 + $detect_cols_issues = array();
2307 +
2308 + /**
2309 + * Filter to disable detection of missing table columns. Useful for slow hosts.
2310 + *
2311 + * @since 6.1.3.
2312 + */
2313 + if ( apply_filters( 'mainwp_detect_table_column_issues', true ) ) {
2314 + $detect_cols_issues = MainWP_Database_Schema_Checker::detect_table_columns_issues( $tb_name, $type );
2315 + }
2316 +
2317 + $missing_cols = is_array( $detect_cols_issues ) && isset( $detect_cols_issues['missing_columns'] ) ? $detect_cols_issues['missing_columns'] : array();
2318 + $invalid_cols = is_array( $detect_cols_issues ) && isset( $detect_cols_issues['invalid_columns'] ) ? $detect_cols_issues['invalid_columns'] : array();
2319 +
2320 + $issues_cols_info = array();
2321 +
2322 + if ( ! empty( $missing_cols ) && is_array( $missing_cols ) ) {
2323 + $issues_cols_info[] = sprintf( esc_html__( 'Missing columns: %1s;', 'mainwp' ), implode( ', ', $missing_cols ) );
2324 + $status = 'error';
2325 + }
2326 +
2327 + if ( ! empty( $invalid_cols ) && is_array( $invalid_cols ) && isset( $invalid_cols[0]['column'] ) ) {
2328 +
2329 + $issues_string = implode(
2330 + '; ',
2331 + array_map(
2332 + static function ( $issue ) {
2333 + return sprintf(
2334 + 'column: "%s" - expected: "%s" - actual: "%s"',
2335 + $issue['column'],
2336 + $issue['expected'],
2337 + $issue['actual']
2338 + );
2339 + },
2340 + $invalid_cols
2341 + )
2342 + );
2343 +
2344 + $issues_cols_info[] = sprintf(
2345 + esc_html__( 'Incorrect column definitions found: %s;', 'mainwp' ),
2346 + $issues_string
2347 + );
2348 +
2349 + if ( 'pass' === $status ) {
2350 + $status = 'error'; // warning - incorrect column definition.
2351 + }
2352 + }
2353 +
2354 + $tbl_info = '';
2355 + if ( is_array( $info ) && isset( $info['data'] ) ) {
2356 + $tbl_info = sprintf( __( 'Data: %sMB + Index: %sMB + Engine %s', 'mainwp' ), $info['data'], $info['index'], $info['engine'] );
2357 + }
2358 +
2359 + $db_rows[] = array(
2360 + 'label' => esc_html( $tb_name ),
2361 + 'value' => esc_html(
2362 + $tbl_info . ( ! empty( $issues_cols_info ) ? ' (' . implode( '; ', $issues_cols_info ) . ') ' : '' ),
2363 + ),
2364 + 'status' => $status,
2365 + );
2366 +
2367 + }
2368 + }
2369 + }
2370 +
2371 + MainWP_Database_Schema_Checker::prepare_db_and_tables_issues( $missing_db_tables );
2372 + }
2373 +
2374 + return self::add_export_labels_to_rows(
2375 + array_merge( $db_rows_info, $db_rows_missing, $db_rows ),
2376 + array(
2377 + 'Database',
2378 + 'Database privileges',
2379 + 'MainWP database version',
2380 + 'Database prefix',
2381 + 'Total Database Size',
2382 + 'Database Data Size',
2383 + 'Database Index Size',
2384 + 'Missing core table',
2385 + )
2386 + );
2387 + }
2388 +
2211 2389
2212 2390 /**
2213 2391 * Format boolean label.
2214 2392 *