Plugin Directory

Changeset 741344


Ignore:
Timestamp:
07/15/2013 10:42:05 PM (13 years ago)
Author:
ReadyMadeWeb
Message:

0.6.9

  • Update post GUIDs post import to reflect currently set domain name, not example.org
  • Correct URL of plugin on wordpress.org
  • Fix issues with escaped file names as attachments
Location:
readymade-wordpress-importer-061/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • readymade-wordpress-importer-061/trunk/readme.txt

    r740762 r741344  
    55Requires at least: 3.0
    66Tested up to: 3.5
    7 Stable tag: 0.6.8
     7Stable tag: 0.6.9
    88
    99Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
     
    3232
    3333== Changelog ==
     34
     35= 0.6.9 =
     36* Update post GUIDs post import to reflect currently set domain name, not example.org
     37* Correct URL of plugin on wordpress.org
     38* Fix issues with escaped file names as attachments
    3439
    3540= 0.6.8 =
  • readymade-wordpress-importer-061/trunk/wordpress-importer.php

    r740762 r741344  
    22/*
    33Plugin Name: ReadyMade WordPress Importer
    4 Plugin URI: http://wordpress.org/extend/plugins/wordpress-importer/
     4Plugin URI: https://wordpress.org/plugins/readymade-wordpress-importer-061/
    55Description: Import posts, pages, comments, custom fields, categories, tags and more from a WordPress export file.
    66Author: wordpressdotorg, snyderp@gmail.com
    77Author URI: http://readymadeweb.com
    8 Version: 0.6.8
     8Version: 0.6.9
    99Text Domain: wordpress-importer
    1010License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    121121        $this->backfill_attachment_urls();
    122122        $this->remap_featured_images();
     123        $this->update_guids();
    123124        $this->import_end();
    124125    }
     
    920921
    921922            // get placeholder file in the upload dir with a unique, sanitized filename
    922             $upload = wp_upload_bits( $file_name, 0, '', $post['upload_date'] );
     923            $unescaped_file_name = urldecode( $file_name );
     924            $upload = wp_upload_bits( $unescaped_file_name, 0, '', $post['upload_date'] );
    923925        }
    924926
     
    10581060
    10591061    /**
     1062     * Update all post guids so that they match the current domain, not the
     1063     * example.org domain that the importer uses in the WXR file.
     1064     */
     1065    function update_guids() {
     1066
     1067        global $wpdb;
     1068
     1069        // If the current site domain ends in a "/", we can just strip it off
     1070        // here so we only have to do slightly less work when updating the
     1071        // GUIDs in the posts table
     1072        $current_site_root = trim( get_option( 'siteurl', 'http://example.org/' ) );
     1073        if ( substr( $current_site_root, -1 ) === '/' ) {
     1074            $current_site_root = substr( $current_site_root, 0, -1 );
     1075        }
     1076
     1077        $query = "
     1078            UPDATE
     1079                {$wpdb->posts}
     1080            SET
     1081                guid = REPLACE(guid, %s, %s)
     1082        ";
     1083
     1084        $wpdb->query( $wpdb->prepare( $query, 'http://example.org', $current_site_root ) );
     1085    }
     1086
     1087    /**
    10601088     * Parse a WXR file
    10611089     *
Note: See TracChangeset for help on using the changeset viewer.