Skip to content

Commit

Permalink
Coding Standards: Give some variables in WP_Importer a more meaning…
Browse files Browse the repository at this point in the history
…ful name.

See #52627.

git-svn-id: https://develop.svn.wordpress.org/trunk@50658 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Apr 5, 2021
1 parent b0f74b7 commit 868081f
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/wp-admin/includes/class-wp-importer.php
Expand Up @@ -14,10 +14,10 @@ public function __construct() {}
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $importer_name
* @param string $bid
* @param string $blog_id
* @return array
*/
public function get_imported_posts( $importer_name, $bid ) {
public function get_imported_posts( $importer_name, $blog_id ) {
global $wpdb;

$hashtable = array();
Expand All @@ -27,7 +27,7 @@ public function get_imported_posts( $importer_name, $bid ) {

// Grab all posts in chunks.
do {
$meta_key = $importer_name . '_' . $bid . '_permalink';
$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 );

Expand All @@ -54,16 +54,16 @@ public function get_imported_posts( $importer_name, $bid ) {
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $importer_name
* @param string $bid
* @param string $blog_id
* @return int
*/
public function count_imported_posts( $importer_name, $bid ) {
public function count_imported_posts( $importer_name, $blog_id ) {
global $wpdb;

$count = 0;

// Get count of permalinks.
$meta_key = $importer_name . '_' . $bid . '_permalink';
$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 );
Expand All @@ -83,10 +83,10 @@ public function count_imported_posts( $importer_name, $bid ) {
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $bid
* @param string $blog_id
* @return array
*/
public function get_imported_comments( $bid ) {
public function get_imported_comments( $blog_id ) {
global $wpdb;

$hashtable = array();
Expand All @@ -105,11 +105,12 @@ public function get_imported_comments( $bid ) {
if ( ! empty( $results ) ) {
foreach ( $results as $r ) {
// Explode comment_agent key.
list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
$source_comment_id = (int) $source_comment_id;
list ( $comment_agent_blog_id, $source_comment_id ) = explode( '-', $r->comment_agent );

$source_comment_id = (int) $source_comment_id;

// Check if this comment came from this blog.
if ( $bid == $ca_bid ) {
if ( $blog_id == $comment_agent_blog_id ) {
$hashtable[ $source_comment_id ] = (int) $r->comment_ID;
}
}
Expand Down

0 comments on commit 868081f

Please sign in to comment.