I'd like to document the process to customise import processes further, using WordPress Migrate as a base.

For example, the importer currently throws wp_postmeta data into the import rows, then handles those special properties in eg WordPressItemMigration::prepare().

When migrating a site which has custom postmeta data; does WP Migrate permit use of a custom WordPressItemMigration class which extends WordPressItemMigration?

Comments

xurizaemon’s picture

Expanding with more concrete example -

We have WP Posts with site-specific custom metadata, eg "report_abundance", "report_latitude", "report_foliage" (these posts are pest sightings). There are also "regular" posts. For those posts with custom metadata X, we want to (1) alter the imported Drupal node type from "article" to "sighting", and (2) assign the custom metadata to matching fields in Drupal.

mikeryan’s picture

Category: bug » task

Yes, I should document the technique fully at http://drupal.org/node/1593478. Quick overview:

1. Extend whatever WordPressFoo migration classes you need to modify.
2. Extend the WordPressBlog class, and override migrationClasses() to point to your custom classes:

class BlogImportBlog extends WordPressBlog {
  public function migrationClasses() {
    $classes = parent::migrationClasses();
    $classes['WordPressBlogEntry'] = 'BlogImportBlogEntry';
    $classes['WordPressPage'] = 'BlogImportPage';
    return $classes;
  }
}

3. Set the wordpress_migrate_blog_class variable to point to your WordPressBlog extension, E.g., in your settings.php

$conf['wordpress_migrate_blog_class'] = 'BlogImportBlog';

I'll include a full scrubbed version of this from my last WordPress project in the documentation when I have a chance.

mikeryan’s picture

Status: Active » Fixed

It could use a concrete example, but there's enough there now for a competent programmer to make use of it.

Status: Fixed » Closed (fixed)

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

karlshea’s picture

Category: Task » Bug report
Issue summary: View changes
Status: Closed (fixed) » Active

This doesn't seem to be working anymore in the current dev version.

migrationClasses() only gets called from migrations() (and machineName(), but that's only called in migrations()), but migrations() only gets called from drush_wordpress_migrate_import().

mikeryan’s picture

Category: Bug report » Task
Status: Active » Closed (fixed)

Restoring the issue status - a bug in functionality is an entirely different issue from the documentation of that functionality.

michelle’s picture

@mikeryan - Just wondering if you've had a chance to make an example in the 2 years since comment #3? :) I'm feeling a bit overwhelmed and examples are always lovely.