Coding Standards: Remove a one-time $sql variable in WP_Importer methods.
Some checks failed
Cleanup Pull Requests / Clean up pull requests (push) Has been cancelled
Coding Standards / PHP coding standards (push) Has been cancelled
Coding Standards / JavaScript coding standards (push) Has been cancelled
Coding Standards / Slack Notifications (push) Has been cancelled
Coding Standards / Failed workflow tasks (push) Has been cancelled
End-to-end Tests / Test with SCRIPT_DEBUG disabled (push) Has been cancelled
End-to-end Tests / Test with SCRIPT_DEBUG enabled (push) Has been cancelled
End-to-end Tests / Slack Notifications (push) Has been cancelled
End-to-end Tests / Failed workflow tasks (push) Has been cancelled
JavaScript Tests / QUnit Tests (push) Has been cancelled
JavaScript Tests / Slack Notifications (push) Has been cancelled
JavaScript Tests / Failed workflow tasks (push) Has been cancelled
Performance Tests / Determine Matrix (push) Has been cancelled
Performance Tests / ${{ matrix.multisite && 'Multisite' || 'Single Site' }} ${{ matrix.memcached && 'Memcached' || 'Default' }} (push) Has been cancelled
Performance Tests / Compare (push) Has been cancelled
Performance Tests / Slack Notifications (push) Has been cancelled
Performance Tests / Failed workflow tasks (push) Has been cancelled
PHP Compatibility / Check PHP compatibility (push) Has been cancelled
PHP Compatibility / Slack Notifications (push) Has been cancelled
PHP Compatibility / Failed workflow tasks (push) Has been cancelled
PHPUnit Tests / PHP 7.2 (push) Has been cancelled
PHPUnit Tests / PHP 7.3 (push) Has been cancelled
PHPUnit Tests / PHP 7.4 (push) Has been cancelled
PHPUnit Tests / PHP 8.0 (push) Has been cancelled
PHPUnit Tests / PHP 8.1 (push) Has been cancelled
PHPUnit Tests / PHP 8.2 (push) Has been cancelled
PHPUnit Tests / PHP 8.3 (push) Has been cancelled
PHPUnit Tests / PHP 8.4 (push) Has been cancelled
PHPUnit Tests / html-api-html5lib-tests (push) Has been cancelled
PHPUnit Tests / Slack Notifications (push) Has been cancelled
PHPUnit Tests / Failed workflow tasks (push) Has been cancelled
Test Build Processes / Core running from build (push) Has been cancelled
Test Build Processes / Core running from src (push) Has been cancelled
Test Build Processes / Gutenberg running from build (push) Has been cancelled
Test Build Processes / Gutenberg running from src (push) Has been cancelled
Test Build Processes / Slack Notifications (push) Has been cancelled
Test Build Processes / Failed workflow tasks (push) Has been cancelled
Upgrade Develop Version Tests / Build (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 4.9 (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 6.5 (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 6.7 (push) Has been cancelled
Upgrade Develop Version Tests / Upgrade from 6.8 (push) Has been cancelled
Upgrade Develop Version Tests / Slack Notifications (push) Has been cancelled
Upgrade Develop Version Tests / Failed workflow tasks (push) Has been cancelled
Upgrade Tests / 6.7 to latest (push) Has been cancelled
Upgrade Tests / 6.8 to latest (push) Has been cancelled
Upgrade Tests / 6.0 to latest (push) Has been cancelled
Upgrade Tests / 6.1 to latest (push) Has been cancelled
Upgrade Tests / 6.2 to latest (push) Has been cancelled
Upgrade Tests / 6.3 to latest (push) Has been cancelled
Upgrade Tests / 6.4 to latest (push) Has been cancelled
Upgrade Tests / 6.5 to latest (push) Has been cancelled
Upgrade Tests / 6.6 to latest (push) Has been cancelled
Upgrade Tests / 5.0 to latest (push) Has been cancelled
Upgrade Tests / 5.1 to latest (push) Has been cancelled
Upgrade Tests / 5.3 to latest (push) Has been cancelled
Upgrade Tests / 5.4 to latest (push) Has been cancelled
Upgrade Tests / 5.5 to latest (push) Has been cancelled
Upgrade Tests / 5.6 to latest (push) Has been cancelled
Upgrade Tests / 5.9 to latest (push) Has been cancelled
Upgrade Tests / 4.1 to latest (push) Has been cancelled
Upgrade Tests / 4.2 to latest (push) Has been cancelled
Upgrade Tests / 4.3 to latest (push) Has been cancelled
Upgrade Tests / 4.4 to latest (push) Has been cancelled
Upgrade Tests / 4.5 to latest (push) Has been cancelled
Upgrade Tests / 4.6 to latest (push) Has been cancelled
Upgrade Tests / 4.7 to latest (push) Has been cancelled
Upgrade Tests / Slack Notifications (push) Has been cancelled
Upgrade Tests / Failed workflow tasks (push) Has been cancelled
Lint GitHub Actions workflow files / Lint GitHub Action files (push) Has been cancelled
Lint GitHub Actions workflow files / Slack Notifications (push) Has been cancelled
Lint GitHub Actions workflow files / Failed workflow tasks (push) Has been cancelled
Code Coverage Report / Single site report (push) Has been cancelled
Code Coverage Report / Multisite report (push) Has been cancelled
Code Coverage Report / Slack Notifications (push) Has been cancelled
Code Coverage Report / Failed workflow tasks (push) Has been cancelled
Installation Tests / Build Test Matrix (push) Has been cancelled
Local Docker Environment / Build Test Matrix (push) Has been cancelled
Test Default Themes & Create ZIPs / twentyeleven empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentyfifteen empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentyfourteen empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentynineteen empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentyseventeen empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentysixteen empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentyten empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentythirteen empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwelve empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwenty empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwentyfive empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwentyfour empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwentyone empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwentythree empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / twentytwentytwo empty file check (push) Has been cancelled
Test Default Themes & Create ZIPs / Test twentynineteen build script (push) Has been cancelled
Test Default Themes & Create ZIPs / Test twentytwenty build script (push) Has been cancelled
Test Default Themes & Create ZIPs / Test twentytwentyone build script (push) Has been cancelled
Test old branches / coding-standards.yml for 4.1 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.1 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.1 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.1 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.2 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.2 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.2 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.2 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.3 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.3 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.3 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.3 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.4 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.4 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.4 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.4 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.5 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.5 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.5 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.5 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.6 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.6 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.6 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.6 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.7 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.7 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.7 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.7 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.8 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.8 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.8 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.8 (push) Has been cancelled
Test old branches / coding-standards.yml for 4.9 (push) Has been cancelled
Test old branches / javascript-tests.yml for 4.9 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 4.9 (push) Has been cancelled
Test old branches / test-build-processes.yml for 4.9 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.0 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.0 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.0 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.0 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.1 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.1 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.1 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.1 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.2 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.2 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.2 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.2 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.3 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.3 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.3 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.3 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.4 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.4 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.4 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.4 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.5 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.5 (push) Has been cancelled
Test old branches / php-compatibility.yml for 5.5 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.5 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.5 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.6 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.6 (push) Has been cancelled
Test old branches / php-compatibility.yml for 5.6 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.6 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.6 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.7 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.7 (push) Has been cancelled
Test old branches / php-compatibility.yml for 5.7 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.7 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.7 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.8 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 5.8 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.8 (push) Has been cancelled
Test old branches / php-compatibility.yml for 5.8 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.8 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.8 (push) Has been cancelled
Test old branches / coding-standards.yml for 5.9 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 5.9 (push) Has been cancelled
Test old branches / javascript-tests.yml for 5.9 (push) Has been cancelled
Test old branches / php-compatibility.yml for 5.9 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 5.9 (push) Has been cancelled
Test old branches / test-build-processes.yml for 5.9 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.0 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.0 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.0 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.0 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.0 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.0 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.1 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.1 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.1 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.1 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.1 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.1 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.2 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.2 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.2 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.2 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.2 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.2 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.3 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.3 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.3 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.3 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.3 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.3 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.4 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.4 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.4 (push) Has been cancelled
Test old branches / performance.yml for 6.4 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.4 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.4 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.4 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.5 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.5 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.5 (push) Has been cancelled
Test old branches / performance.yml for 6.5 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.5 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.5 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.5 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.6 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.6 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.6 (push) Has been cancelled
Test old branches / performance.yml for 6.6 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.6 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.6 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.6 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.7 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.7 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.7 (push) Has been cancelled
Test old branches / performance.yml for 6.7 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.7 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.7 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.7 (push) Has been cancelled
Test old branches / coding-standards.yml for 6.8 (push) Has been cancelled
Test old branches / end-to-end-tests.yml for 6.8 (push) Has been cancelled
Test old branches / javascript-tests.yml for 6.8 (push) Has been cancelled
Test old branches / performance.yml for 6.8 (push) Has been cancelled
Test old branches / php-compatibility.yml for 6.8 (push) Has been cancelled
Test old branches / phpunit-tests.yml for 6.8 (push) Has been cancelled
Test old branches / test-build-processes.yml for 6.8 (push) Has been cancelled
Installation Tests / WP ${{ inputs.wp-version || 'nightly' }} / PHP ${{ matrix.php }} / ${{ 'mariadb' == matrix.db-type && 'MariaDB' || 'MySQL' }} ${{ matrix.db-version }}${{ matrix.multisite && ' multisite' || '' }} (push) Has been cancelled
Installation Tests / Slack Notifications (push) Has been cancelled
Installation Tests / Failed workflow tasks (push) Has been cancelled
Local Docker Environment / PHP ${{ matrix.php }} (push) Has been cancelled
Local Docker Environment / Slack Notifications (push) Has been cancelled
Local Docker Environment / Failed workflow tasks (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentyeleven ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentyfifteen ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentyfourteen ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentynineteen ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentyseventeen ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentysixteen ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentyten ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentythirteen ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwelve ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwenty ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwentyfive ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwentyfour ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwentyone ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwentythree ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Create twentytwentytwo ZIP file (push) Has been cancelled
Test Default Themes & Create ZIPs / Slack Notifications (push) Has been cancelled
Test Default Themes & Create ZIPs / Failed workflow tasks (push) Has been cancelled
Test old branches / Slack Notifications (push) Has been cancelled

This allows the `$wpdb::prepare()` calls to be picked up correctly by PHPCS.

Follow-up to [14760].

Props aristath, poena, afercia, SergeyBiryukov.
See #63168.

git-svn-id: https://develop.svn.wordpress.org/trunk@60094 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2025-03-25 18:34:48 +00:00
parent b943118a5b
commit 50bb23e860

View File

@ -29,8 +29,14 @@ class WP_Importer {
// Grab all posts in chunks.
do {
$meta_key = $importer_name . '_' . $blog_id . '_permalink';
$sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s LIMIT %d,%d", $meta_key, $offset, $limit );
$results = $wpdb->get_results( $sql );
$results = $wpdb->get_results(
$wpdb->prepare(
"SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = %s LIMIT %d,%d",
$meta_key,
$offset,
$limit
)
);
// Increment offset.
$offset = ( $limit + $offset );
@ -62,9 +68,12 @@ class WP_Importer {
// Get count of permalinks.
$meta_key = $importer_name . '_' . $blog_id . '_permalink';
$sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key );
$result = $wpdb->get_results( $sql );
$result = $wpdb->get_results(
$wpdb->prepare(
"SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = %s",
$meta_key
)
);
if ( ! empty( $result ) ) {
$count = (int) $result[0]->cnt;
@ -91,8 +100,13 @@ class WP_Importer {
// Grab all comments in chunks.
do {
$sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit );
$results = $wpdb->get_results( $sql );
$results = $wpdb->get_results(
$wpdb->prepare(
"SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d",
$offset,
$limit
)
);
// Increment offset.
$offset = ( $limit + $offset );