It appears that extending WordPressBlogEntry, as described in https://drupal.org/node/1593370 does not work. In wordpress_migrate.migrate.inc (line ~674), WordPressBlogEntry is automatically registered as the class to handle imports of Wordpress blog entries.
$this->addMigration('BlogPost', 'WordPressBlogEntry', $arguments);
This creates a db entry in the migrate_status table.

Possible idea for solutions.
$this->addMigration('BlogPost', variable_get('wordpress_migrate_blog_entry_class', 'WordPressBlogEntry'), $arguments);

I'm happy to provide a patch, but I'd rather hear the authors desired route prior to my submission. Thanks!

Comments

dafeder’s picture

Agreed, been struggling with this and definitely doesn't seem to be working...

dafeder’s picture

I'm also getting a number of error messages on most page loads now. They look something like:

Notice: Undefined index: post_type in WordPressBlogEntry->__construct() (line 805 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).
Notice: Undefined index: text_format in WordPressItemMigration->__construct() (line 168 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).
Notice: Undefined index: path_action in WordPressItemMigration->__construct() (line 179 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).
Notice: Undefined index: tag_vocabulary in WordPressItemMigration->__construct() (line 226 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).
Notice: Undefined index: category_vocabulary in WordPressItemMigration->__construct() (line 227 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).
Notice: Undefined index: podcast_field in WordPressItemMigration->__construct() (line 242 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).
Notice: Undefined index: attachment_field in WordPressItemMigration->__construct() (line 249 of [XXX]/sites/all/modules/contrib/wordpress_migrate/wordpress_item.inc).

Debugging the __construct() function for my class, these are the arguments its receiving that throw an error, as they don't include a number of arguments needed for WordPressBlogEntry:

Array
(
    [filename] => wordpress://[XXX].xml
    [group_name] => default
    [machine_name] => [XXX]BlogEntry
)

  • mikeryan committed 86cceb0 on 7.x-2.x
    Issue #2088129 by mikeryan: Make custom migration classes work with the...
mikeryan’s picture

Issue summary: View changes
Status: Active » Fixed

Fix committed - overriding classes will now work as documented at https://www.drupal.org/node/1593478 when using the new wizard.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

neuquen’s picture

I am still getting the same exact error message as you guys even though I'm using the latest version. I followed the instructions which were linked above (https://www.drupal.org/node/1593478) almost exactly:

I extended the blog entry class in includes/CustomWordPressBlogEntry.inc and includes/CustomWordPressPage.inc:

class CustomWordPressBlogEntry extends WordPressBlogEntry { ... }
class CustomWordPressPage extends WordPressPage { ... }

I extended the WordPressBlog class in my .module file:

class CustomBlog extends WordPressBlog {
  public function migrationClasses() {
    $classes = parent::migrationClasses();
    $classes['WordPressBlogEntry'] = 'CustomWordPressBlogEntry';
    $classes['WordPressPage'] = 'CustomWordPressPage';
    return $classes;
  }
}

And I assigned the following variable:

variable_set('wordpress_migrate_blog_class', 'CustomBlog');

But I still see the following errors:

Notice: Undefined index: post_type in WordPressBlogEntry->__construct() (line 878 of C:\...\sites\all\modules\contrib\wordpress_migrate\wordpress_item.inc).
Notice: Undefined index: filename in WordPressMigration->__construct() (line 40 of C:\...\sites\all\modules\contrib\wordpress_migrate\wordpress.inc).
Warning: XMLReader::open(): Empty string supplied as input in WordPressBlog->__construct() (line 200 of C:\...\sites\all\modules\contrib\wordpress_migrate\wordpress.inc).
Migration CustomBlogPost could not be constructed.
Could not open XML file

UPDATE:

I figured out what the issue was in my case. When I defined the constructor within my classes, I did not pass in $arguments. After passing in $arguments everything worked. For example:

class CustomWordPressBlogEntry extends WordPressBlogEntry {

  public function __construct(array $arguments) {
    parent::__construct($arguments);

  ...

}