Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a debug helper coverage logger module. #42620

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed the INSERT statement generation.
  • Loading branch information
zinigor committed Mar 21, 2025
commit e1b4a4fe409d5d88a6508c47738499a5aaeaaba3
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,15 @@ public function log_coverage_results() {

$coverage_data = xdebug_get_code_coverage();

$sql = $wpdb->prepare( 'INSERT INTO %s (path, line) VALUES ', self::DATABASE_NAME );
$sql = sprintf( 'INSERT INTO `%s` (path, line) VALUES ', $wpdb->prefix . self::DATABASE_NAME );

foreach ( $coverage_data as $file => $lines ) {
$path = substr( $file, strlen( ABSPATH ) );

if ( ! str_starts_with( $path, 'wp-content/plugins/jetpack' ) ) {
continue;
}

foreach ( $lines as $line => $count ) {
for ( $i = 0; $i < $count; $i++ ) {
$sql .= $wpdb->prepare( '( %s, %d ),', $path, $line );
Expand Down