1048576 ) { continue; // Skip files larger than 1MB or unreadable. } // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local file read with size check. $contents = file_get_contents( $real, false, null, 0, 1048576 ); if ( $contents ) { $hosting_patterns = array( 'wpengine' => 'WP Engine', 'godaddy' => 'GoDaddy', 'bluehost' => 'Bluehost', 'siteground' => 'SiteGround', 'kinsta' => 'Kinsta', 'flywheel' => 'Flywheel', 'pantheon' => 'Pantheon', 'cloudways' => 'Cloudways', ); foreach ( $hosting_patterns as $pattern => $host ) { if ( stripos( $contents, $pattern ) !== false || stripos( $file, $pattern ) !== false ) { $host_specific[ $file ] = $host; break; } } } } } } $mu_count = count( $mu_plugins ); $host_count = count( $host_specific ); $custom_count = $mu_count - $host_count; $details = array( 'mu_plugins_dir' => $mu_plugins_dir, 'mu_plugins' => $mu_plugins, 'host_specific' => $host_specific, 'total_count' => $mu_count, 'custom_count' => $custom_count, ); if ( 0 === $mu_count ) { return static::pass( __( 'No must-use plugins found. Your migration won\'t need to account for any MU-plugins.', '0-day-analytics' ), $details ); } if ( ! empty( $host_specific ) ) { return static::warning( sprintf( /* translators: 1: number of MU-plugins, 2: hosting provider names */ __( 'Found %1$d must-use plugins, including hosting-specific ones from %2$s. These are typically installed by your host and should NOT be copied to a new server.', '0-day-analytics' ), $mu_count, implode( ', ', array_unique( array_values( $host_specific ) ) ) ), __( 'Only migrate your custom MU-plugins, not the ones provided by your hosting company. The new host may have their own MU-plugins.', '0-day-analytics' ), $details ); } if ( $mu_count > 5 ) { return static::info( sprintf( /* translators: %d: number of MU-plugins */ __( 'Found %d must-use plugins. Remember to manually copy the mu-plugins folder during migration - most automated tools skip this directory.', '0-day-analytics' ), $mu_count ), $details ); } return static::info( sprintf( /* translators: %d: number of MU-plugins */ __( 'Found %d must-use plugin(s). Make sure to manually copy the mu-plugins folder to your new server - automated migration tools often skip this directory.', '0-day-analytics' ), $mu_count ), $details ); } } }