Coding Standards: Give some variables in WP_Importer a more meaningful name.

See .

git-svn-id: https://develop.svn.wordpress.org/trunk@50658 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2021-04-05 10:48:11 +00:00
parent b0f74b74a5
commit 868081ff3a

@ -14,10 +14,10 @@ class WP_Importer {
* @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();
@ -27,7 +27,7 @@ class WP_Importer {
// 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 );
@ -54,16 +54,16 @@ class WP_Importer {
* @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 );
@ -83,10 +83,10 @@ class WP_Importer {
*
* @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();
@ -105,11 +105,12 @@ class WP_Importer {
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;
}
}