abstract class WordPressItemMigration in WordPress Migrate 7
Same name and namespace in other branches
- 7.2 wordpress_item.inc \WordPressItemMigration
Intermediate Migration class, implementing behavior common across different types (post_type) of items.
Hierarchy
- class \MigrationBase
- class \Migration
- class \DynamicMigration
- class \WordPressMigration
- class \WordPressItemMigration
- class \WordPressMigration
- class \DynamicMigration
- class \Migration
Expanded class hierarchy of WordPressItemMigration
File
- ./
wordpress_item.inc, line 144 - Support for migrating posts and pages from a WordPress blog into Drupal.
View source
abstract class WordPressItemMigration extends WordPressMigration {
/**
* Indicates to the complete() method that the nid of this item needs to be
* saved in linksToFix for later processing.
*
* @var boolean
*/
protected $linksNeedFixing = FALSE;
/**
* List of nids which have links needing fixing.
*
* @var array
*/
protected static $linksToFix = array();
/**
* Set it up
*/
public function __construct(array $arguments = array()) {
parent::__construct($arguments);
$this->dependencies = array(
$this
->generateMachineName('WordPressCategory'),
$this
->generateMachineName('WordPressTag'),
);
// WordPress post type
$post_type = $arguments['post_type'];
// Drupal content type (bundle)
$bundle = $arguments['bundle'];
// post_id is the unique ID of items in WordPress
$this->map = new MigrateSQLMap($this->machineName, array(
'post_id' => array(
'type' => 'int',
'not null' => TRUE,
'unsigned' => TRUE,
'description' => 'WordPress post ID',
),
), MigrateDestinationNode::getKeySchema());
// Construct the source objects.
$this->source = new WordPressItemSource($this->wxrFile, $post_type);
$this->destination = new MigrateDestinationNode($bundle);
// Default mappings, applying to most or all migrations
$this
->addFieldMapping('title', 'title');
$this
->addFieldMapping('created', 'post_date')
->description('Empty dates handled in prepare()');
$this
->addFieldMapping('changed', 'post_date')
->description('Empty dates handled in prepare()');
$this
->addFieldMapping('uid', 'creator')
->description('Use matching username if any, otherwise current user');
$text_format = variable_get('wordpress_migrate_text_format', 'filtered_html');
$arguments = array(
'source_field' => 'excerpt',
'format' => $text_format,
);
$this
->addFieldMapping('body', 'content')
->arguments($arguments);
$this
->addFieldMapping(NULL, 'excerpt');
$this
->addFieldMapping('comment', 'comment_status')
->description('WP "open" mapped to Drupal COMMENT_NODE_OPEN');
$this
->addFieldMapping('status', 'status')
->description('Set Drupal status to 1 iff wp:status=publish');
$this
->addFieldMapping(NULL, 'post_parent')
->description('For attachments, indicates item attached to')
->issueGroup(t('Open issues'))
->issuePriority(MigrateFieldMapping::ISSUE_PRIORITY_MEDIUM);
$this
->addFieldMapping('sticky', 'is_sticky');
if (module_exists('path')) {
$this
->addFieldMapping('path', 'link')
->description(t('If no ? in the link, strip the domain for the path'));
if (module_exists('pathauto')) {
$this
->addFieldMapping('pathauto_perform_alias')
->defaultValue(0)
->description('Disable pathauto, we set the alias from the WP link');
}
}
// Map the source fields to the configured vocabularies
$vocabs = array(
'tag' => variable_get('wordpress_migrate_tag_vocabulary', ''),
'category' => variable_get('wordpress_migrate_category_vocabulary', ''),
);
// Look through this content type's fields for term references
foreach ($this->destination
->fields() as $machine_name => $description) {
if (preg_match('/\\(taxonomy_term_reference\\)$/', $description)) {
$field_info = field_info_field($machine_name);
// Check this field against each of the configured vocabularies - if
// a match is found, make the mapping
foreach ($vocabs as $source_field => $vocab_name) {
if ($vocab_name == $field_info['settings']['allowed_values'][0]['vocabulary']) {
if ($source_field == 'tag') {
$sourceMigration = $this
->generateMachineName('WordPressTag');
}
else {
$sourceMigration = $this
->generateMachineName('WordPressCategory');
}
$this
->addFieldMapping($machine_name, $source_field)
->arguments(array(
'source_type' => 'tid',
))
->sourceMigration($sourceMigration);
unset($vocabs[$source_field]);
}
}
}
}
// If we didn't map one or both of the tag/category fields, indicate so with
// a DNM mapping.
foreach ($vocabs as $source_field => $vocab_name) {
if ($vocab_name) {
$message = t('!vocab_name vocabulary is not assigned to node type !bundle', array(
'!vocab_name' => $vocab_name,
'!bundle' => $bundle,
));
}
else {
$message = t('No vocabulary assigned for this field');
}
$this
->addFieldMapping(NULL, $source_field)
->description($message)
->issueGroup(t('DNM'));
}
// Unmapped destination fields
$this
->addFieldMapping('is_new')
->issueGroup(t('DNM'));
$this
->addFieldMapping('revision')
->issueGroup(t('DNM'));
$this
->addFieldMapping('language')
->issueGroup(t('DNM'));
$this
->addFieldMapping('promote')
->issueGroup(t('DNM'));
$this
->addFieldMapping('revision_uid')
->issueGroup(t('DNM'));
// Unmapped source fields
$this
->addFieldMapping(NULL, 'guid')
->description('same as link, plus isPermaLink attribute?')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'description')
->description('Always empty?')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'post_id')
->description(t('Primary key of source'))
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'pubDate')
->description('Use post_date')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'post_date_gmt')
->description('Use post_date')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'ping_status')
->description('What does this mean?')
->issueGroup(t('Open issues'))
->issuePriority(MigrateFieldMapping::ISSUE_PRIORITY_MEDIUM);
$this
->addFieldMapping(NULL, 'post_name')
->description('Looks like last component of path')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'menu_order')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'post_type')
->issueGroup(t('DNM'));
$this
->addFieldMapping(NULL, 'post_password')
->description('???')
->issueGroup(t('DNM'));
}
/**
* Data manipulations to be performed before the migrate module applies mappings.
*
* @param stdClass $row
* @return string
*/
public function prepareRow($row) {
// Only publish those with wp:status == 'publish'
if (isset($row->status) && $row->status == 'publish') {
$row->status = NODE_PUBLISHED;
}
else {
$row->status = NODE_NOT_PUBLISHED;
}
// If incoming date is zero (indicates unpublished content), use the current time
if ($row->post_date == '0000-00-00 00:00:00') {
$row->post_date = time();
}
// If the link has a query string, don't produce a path
if (strpos($row->link, '?')) {
unset($row->link);
}
else {
// Otherwise, strip the domain portion of the URL
$matches = array();
if (preg_match('|http://[^/]+/(.*)|', $row->link, $matches)) {
$row->link = $matches[1];
// Strip the last slash off of the URL (the Path module can't handle this)
$row->link = rtrim($row->link, '/');
}
else {
unset($row->link);
}
}
// Translate WordPress comment_status to Drupal values
if ($row->comment_status == 'open') {
$row->comment_status = COMMENT_NODE_OPEN;
}
else {
$row->comment_status = COMMENT_NODE_CLOSED;
}
// Interpret the [caption] tags
$row->content = preg_replace_callback('|(\\[caption.*?\\])(.*?)(\\[/caption\\])|i', array(
$this,
'replaceCaptions',
), $row->content);
// Rewrite embedded video references to media tags (TODO: YouTube only for now)
if (module_exists('media_youtube')) {
$row->content = preg_replace_callback('|<object [^>]*>.*?(<embed [^>]*>).*?</object>|i', array(
$this,
'replaceEmbeds',
), $row->content);
}
// Rewrite (or remember to rewrite) links of the form
// http://example.wordpress.com/?p=19 to local links of the form /node/35
$row->content = $this
->fixLocalLinks($row->content);
return TRUE;
}
/**
* Rewrite [caption] tags into HTML representing a caption.
* [caption] itself ($matches[1]) will become an opening <div>,
* the content within the tag ($matches[2]) will be passed through unchanged,
* and the closing [/caption] ($matches[3]) will become a <p> containing the
* caption followed by a closing </div>.
*
* @param array $matches
*/
protected function replaceCaptions(array $matches) {
$caption_open = $matches[1];
$content = $matches[2];
$caption_close = $matches[3];
preg_match('|width="(.*?)"|i', $caption_open, $matches);
$width = (int) $matches[1] + 10;
$style = "width: {$width}px;";
preg_match('|align="(.*?)"|i', $caption_open, $matches);
$align = $matches[1];
switch ($align) {
case 'aligncenter':
$style .= "display:block;margin:0 auto;";
break;
case 'alignleft':
$style .= "float:left;";
break;
case 'alignright':
$style .= "float:right;";
break;
default:
break;
}
preg_match('|caption="(.*?)"|i', $caption_open, $matches);
$caption = $matches[1];
$result = '<div style="' . $style . '">';
$result .= $content;
$result .= "<p>{$caption}</p></div>";
return $result;
}
/**
* If we have a YouTube reference, replace it with media tags.
*
* @param array $matches
*/
protected function replaceEmbeds(array $matches) {
$embed_matches = array();
// Default to the original <object> tag
$result = $matches[0];
// If an <embed> tag is present, parse it
if ($matches[1]) {
if (preg_match('|src=[\'"](.*?)[\'"]|i', $matches[1], $src_matches)) {
$src = $src_matches[1];
}
else {
return $result;
}
// We support YouTube only
if (preg_match('|^https?://www.youtube.com/|', $src)) {
$src = preg_replace('|^https?://www.youtube.com/|', 'youtube://', $src);
}
else {
return $result;
}
if (preg_match('|width=[\'"](.*?)[\'"]|i', $matches[1], $width_matches)) {
$width = $width_matches[1];
}
else {
return $result;
}
if (preg_match('|height=[\'"](.*?)[\'"]|i', $matches[1], $height_matches)) {
$height = $height_matches[1];
}
else {
return $result;
}
// OK, at this point we have all the info we need - construct a file_managed table
// entry (if one doesn't already exist)
$fid = db_select('file_managed', 'f')
->fields('f', array(
'fid',
))
->condition('uri', $src)
->execute()
->fetchField();
if (!$fid) {
global $user;
$file = new stdClass();
$file->uri = $src;
$file->filename = basename($src);
$file->filemime = 'video/youtube';
$file->type = 'video';
$file->uid = $user->uid;
$file->status = 1;
file_save($file);
if (module_exists('media')) {
media_save($file);
}
$fid = $file->fid;
}
// Build the media tag
$video_info = array(
'type' => 'media',
'view_mode' => 'media_large',
'fid' => $fid,
'attributes' => array(
'class' => 'media-image',
'typeof' => 'foaf:Image',
'height' => $height,
'width' => $width,
'style' => '',
),
);
$result = '[[' . drupal_json_encode($video_info) . ']]';
}
return $result;
}
/**
* Replace any hrefs to links of the form http://example.wordpress.com/?=23
* to local links to a node.
*
* @param string $body
*/
protected function fixLocalLinks($body) {
$this->linksNeedFixing = FALSE;
$site_url = reset($this->source
->getXml()
->xpath('//channel/link'));
$pattern = '|href="' . $site_url . '/\\?p=([0-9]+)"|i';
$body = preg_replace_callback($pattern, array(
$this,
'replaceLinks',
), $body);
return $body;
}
/**
* If we have a local link of the form ?p=34, translate the WordPress ID into
* a Drupal nid, and rewrite the link.
*
* @param array $matches
*/
protected function replaceLinks(array $matches) {
// Default to the existing string
$return = $matches[0];
$wordpress_id = (int) $matches[1];
// Check the blog entry and page maps to see if we can map this to a nid
static $maps = array();
if (empty($maps)) {
$machines = array(
$this
->generateMachineName('WordPressBlogEntry'),
$this
->generateMachineName('WordPressPage'),
);
foreach ($machines as $machine) {
$maps[] = MigrationBase::getInstance($machine)
->getMap();
}
}
foreach ($maps as $map) {
$destination_id = $map
->lookupDestinationID(array(
$wordpress_id,
), $this);
if (!empty($destination_id)) {
// Got a hit! Stop looking...
$destination_id = reset($destination_id);
break;
}
}
// Remember if we didn't get a hit, complete() will set up for later review
if (empty($destination_id)) {
$this->linksNeedFixing = TRUE;
}
else {
$return = 'href="/node/' . $destination_id . '"';
}
return $return;
}
/**
* Prepare node - called just before node_save().
*
* @param stdClass $node
* @param stdClass $row
*/
public function prepare(stdClass $node, stdClass $row) {
// Match creator username to Drupal username if possible; otherwise, use
// the user that initiated the import
static $drupal_static_fast;
if (!isset($drupal_static_fast)) {
$drupal_static_fast['user_map'] =& drupal_static(__FUNCTION__);
$drupal_static_fast['default_user'] =& drupal_static(__FUNCTION__ . 'DefaultUser');
}
$user_map =& $drupal_static_fast['user_map'];
if (!isset($user_map[$row->creator])) {
$user_map[$row->creator] = db_select('users', 'u')
->fields('u', array(
'uid',
))
->condition('name', $row->creator)
->execute()
->fetchField();
if (!$user_map[$row->creator]) {
$default_user =& $drupal_static_fast['default_user'];
if (!isset($default_user)) {
$default_user = db_select('wordpress_migrate', 'wpm')
->fields('wpm', array(
'uid',
))
->condition('filename', $this->wxrFile)
->execute()
->fetchField();
}
$user_map[$row->creator] = $default_user;
}
}
$node->uid = $user_map[$row->creator];
}
/**
* Complete node - called just after node_save().
*
* @param stdClass $node
* @param stdClass $row
*/
public function complete(stdClass $node, stdClass $row) {
// Remember the nid of any node where we weren't able to resolve ?p=23
// links yet - by the time the page migration's postImport() is called, we
// should have resolved all references.
if ($this->linksNeedFixing) {
self::$linksToFix[] = $node->nid;
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DynamicMigration:: |
static | property | ||
DynamicMigration:: |
public static | function |
Overrides default of FALSE Overrides MigrationBase:: |
|
Migration:: |
protected | property | All field mappings, with those retrieved from the database overriding those defined in code. | |
Migration:: |
protected | property | Field mappings retrieved from storage. | |
Migration:: |
protected | property | An array of counts. Initially used for cache hit/miss tracking. | |
Migration:: |
protected | property | The default rollback action for this migration. Can be overridden on a per-row basis by setting $row->rollbackAction in prepareRow(). | |
Migration:: |
protected | property | Destination object for the migration, derived from MigrateDestination. | |
Migration:: |
protected | property | The object currently being constructed | |
Migration:: |
protected | property | If present, an array with keys name and alias (optional). Name refers to the source columns used for tracking highwater marks. alias is an optional table alias. | |
Migration:: |
protected | property | Map object tracking relationships between source and destination data | |
Migration:: |
public | property | Specify value of needs_update for current map row. Usually set by MigrateFieldHandler implementations. | |
Migration:: |
protected | property | Queue up messages that can't be safely saved (in particular, if they're generated in prepareRow(). | |
Migration:: |
public | property | The rollback action to be saved for the current row. | |
Migration:: |
protected | property | When performing a bulkRollback(), the maximum number of items to pass in a single call. Can be overridden in derived class constructor. | |
Migration:: |
protected | property | Source object for the migration, derived from MigrateSource. | |
Migration:: |
protected | property | The current data row retrieved from the source. | |
Migration:: |
protected | property | Field mappings defined in code. | |
Migration:: |
protected | property | ||
Migration:: |
protected | property | ||
Migration:: |
protected | property | ||
Migration:: |
public | function | Add a mapping for a destination field, specifying a source field and/or a default value. | 1 |
Migration:: |
public | function | Shortcut for adding several fields which have the same name on both source and destination sides. | |
Migration:: |
public | function | Shortcut for adding several destination fields which are to be explicitly not migrated. | |
Migration:: |
public | function | Shortcut for adding several source fields which are to be explicitly not migrated. | |
Migration:: |
public | function | Perform an analysis operation - report on field values in the source. | |
Migration:: |
protected | function | Apply field mappings to a data row received from the source, returning a populated destination object. | 1 |
Migration:: |
protected | function |
Override MigrationBase::beginProcess, to make sure the map/message tables
are present. Overrides MigrationBase:: |
|
Migration:: |
protected | function | Standard top-of-loop stuff, common between rollback and import - check for exceptional conditions, and display feedback. | |
Migration:: |
protected | function | If stub creation is enabled, try to create a stub and save the mapping. | |
Migration:: |
protected | function | Fetch the key array for the current source record. | |
Migration:: |
public static | function |
Deregister a migration - remove all traces of it from the database (without
touching any content which was created by this migration). Overrides MigrationBase:: |
|
Migration:: |
constant | |||
Migration:: |
public | function |
Override MigrationBase::endProcess, to call post hooks. Note that it must
be public to be callable as the shutdown function. Overrides MigrationBase:: |
|
Migration:: |
public | function | Get the number of source records which failed to import. TODO: Doesn't yet account for informationals, or multiple errors for a source record. | |
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
protected | function | For fields which require uniqueness, assign a new unique value if necessary. | |
Migration:: |
protected | function | Look up a value migrated in another migration. | |
Migration:: |
protected | function | Perform an import operation - migrate items from source to destination. | |
Migration:: |
public | function | Get the number of records successfully imported. | |
Migration:: |
public | function |
Reports whether this migration process is complete (i.e., all available
source rows have been processed). Overrides MigrationBase:: |
|
Migration:: |
protected | function | Test whether we've exceeded the designated item limit. | |
Migration:: |
public | function | Load any stored field mappings from the database. | |
Migration:: |
public | function | Get the number of messages associated with this migration | |
Migration:: |
protected | function | React when migration didn't failed but destination ids are empty. | |
Migration:: |
protected | function | React when there is an exception | |
Migration:: |
protected | function | React when there is a migrate exception | |
Migration:: |
protected | function | React when the migration has been successful. | |
Migration:: |
protected | function | ||
Migration:: |
protected | function | ||
Migration:: |
protected | function | Default implementations of pre/post import/rollback methods. These call the destination methods (if they exist) - when overriding, always call parent::preImport() etc. | |
Migration:: |
public | function | Default implementation of prepareKey. This method is called from the source plugin immediately after retrieving the raw data from the source - by default, it simply assigns the key values based on the field names passed to MigrateSQLMap(). Override… | |
Migration:: |
public | function | Prepares this migration to run as an update - that is, in addition to unmigrated content (source records not in the map table) being imported, previously-migrated content will also be updated in place. | |
Migration:: |
protected | function | ||
Migration:: |
public | function | Get the number of source records processed. | |
Migration:: |
protected | function | Outputs a progress message, reflecting the current status of a migration process. | |
Migration:: |
public | function | Queue messages to be later saved through the map class. | |
Migration:: |
public static | function |
Register a new migration process in the migrate_status table. This will
generally be used in two contexts - by the class detection code for
static (one instance per class) migrations, and by the module implementing
dynamic (parameterized class)… Overrides MigrationBase:: |
|
Migration:: |
public | function | Remove any existing coded mappings for a given destination or source field. | |
Migration:: |
protected | function | Perform a rollback operation - remove migrated items from the destination. | |
Migration:: |
public static | function | Record an array of field mappings to the database. | |
Migration:: |
public | function |
Pass messages through to the map class. Overrides MigrationBase:: |
|
Migration:: |
public | function | Save any messages we've queued up to the message table. | |
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | ||
Migration:: |
public | function | Set the specified row to be updated, if it exists. | |
Migration:: |
constant | Indicate whether the primary system of record for this migration is the source, or the destination (Drupal). In the source case, migration of an existing object will completely replace the Drupal object with data from the source side. In the… | ||
Migration:: |
public | function | Convenience function to return count of total source records | |
Migration:: |
public | function | Get the number of records marked as needing update. | |
MigrationBase:: |
protected | property | Arguments configuring a migration. | |
MigrationBase:: |
protected | property | A time limit in seconds appropriate to be used in a batch import. Defaults to 240. | |
MigrationBase:: |
protected static | property | Track the migration currently running, so handlers can easily determine it without having to pass a Migration object everywhere. | |
MigrationBase:: |
protected | property | List of other Migration classes which should be imported before this one. E.g., a comment migration class would typically have node and user migrations as dependencies. | |
MigrationBase:: |
protected | property | Detailed information describing the migration. | |
MigrationBase:: |
protected | property | Any module hooks which should be disabled during migration processes. | |
MigrationBase:: |
protected static | property | Name of a function for displaying feedback. It must take the message to display as its first argument, and a (string) message type as its second argument (see drush_log()). | |
MigrationBase:: |
protected static | property | ||
MigrationBase:: |
protected | property | Disabling a migration prevents it from running with --all, or individually without --force | |
MigrationBase:: |
protected | property | A migration group object, used to collect related migrations. | |
MigrationBase:: |
protected static | property | Have we already warned about obsolete constructor argumentss on this request? | |
MigrationBase:: |
protected | property | If provided, an URL for an issue tracking system containing :id where the issue number will go (e.g., 'http://example.com/project/ticket/:id'). | |
MigrationBase:: |
protected | property | Whether to maintain a history of migration processes in migrate_log | |
MigrationBase:: |
protected | property | Primary key of the current history record (inserted at the beginning of a process, to be updated at the end) | |
MigrationBase:: |
protected | property | The machine name of this Migration object, derived by removing the 'Migration' suffix from the class name. Used to construct default map/message table names, displayed in drush migrate-status, key to migrate_status table... | |
MigrationBase:: |
protected | property | An array to track 'mail_system' variable if disabled. | |
MigrationBase:: |
protected | property | The PHP memory_limit expressed in bytes. | |
MigrationBase:: |
protected | property | The fraction of the memory limit at which an operation will be interrupted. Can be overridden by a Migration subclass if one would like to push the envelope. Defaults to 85%. | |
MigrationBase:: |
protected | property | Save options passed to current operation | |
MigrationBase:: |
protected | property | If we set an error handler (during import), remember the previous one so it can be restored. | |
MigrationBase:: |
protected | property | Indicates that we are processing a rollback or import - used to avoid excess writes in endProcess() | |
MigrationBase:: |
protected static | property | Track whether or not we've already displayed an encryption warning | |
MigrationBase:: |
protected | property | When the current operation started. | |
MigrationBase:: |
protected | property | Are we importing, rolling back, or doing nothing? | |
MigrationBase:: |
protected | property | MigrateTeamMember objects representing people involved with this migration. | |
MigrationBase:: |
protected | property | The PHP max_execution_time. | |
MigrationBase:: |
protected | property | The fraction of the time limit at which an operation will be interrupted. Can be overridden by a Migration subclass if one would like to push the envelope. Defaults to 90%. | |
MigrationBase:: |
protected | property | Number of "items" processed in the current migration process (whatever that means for the type of process) | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public static | function | ||
MigrationBase:: |
public static | function | Decrypt an incoming value. | |
MigrationBase:: |
public static | function | Make sure any arguments we want to be decrypted get decrypted. | |
MigrationBase:: |
protected | function | Reports whether all (hard) dependencies have completed migration | |
MigrationBase:: |
public | function | Disables mail system to prevent emails from being sent during migrations. | |
MigrationBase:: |
public static | function | Output the given message appropriately (drush_print/drupal_set_message/etc.) | |
MigrationBase:: |
public static | function | Encrypt an incoming value. Detects for existence of the Drupal 'Encrypt' module. | |
MigrationBase:: |
public static | function | Make sure any arguments we want to be encrypted get encrypted. | |
MigrationBase:: |
public | function | Custom PHP error handler. TODO: Redundant with hook_watchdog? | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Fetch the current highwater mark for updated content. | |
MigrationBase:: |
public static | function | Return the single instance of the given migration. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Retrieve the last time an import operation completed successfully. | |
MigrationBase:: |
public | function | Retrieve the last throughput for current Migration (items / minute). | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Get human readable name for a message constant. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Check the current status of a migration. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Takes an Exception object and both saves and displays it, pulling additional information on the location triggering the exception. | |
MigrationBase:: |
public | function | Returns an array of the migration's dependencies that are incomplete. | |
MigrationBase:: |
protected static | function | Given only a class name, derive a machine name (the class name with the "Migration" suffix, if any, removed). | |
MigrationBase:: |
protected | function | Test whether we've exceeded the desired memory threshold. If so, output a message. | |
MigrationBase:: |
constant | Message types to be passed to saveMessage() and saved in message tables. MESSAGE_INFORMATIONAL represents a condition that did not prevent the operation from succeeding - all others represent different severities of conditions resulting in a source… | ||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
public | function | Perform an operation during the import phase | |
MigrationBase:: |
public | function | Perform an operation during the rollback phase. | |
MigrationBase:: |
public | function | Reset the status of the migration to IDLE (to be used when the status gets stuck, e.g. if a process core-dumped) | |
MigrationBase:: |
public | function | Restores the original saved mail system for migrations that require it. | |
MigrationBase:: |
constant | Codes representing the result of a rollback or import process. | ||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
protected | function | Save the highwater mark for this migration (but not when using an idlist). | |
MigrationBase:: |
public | function | Saves the current mail system, or set a system default if there is none. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | Set the PHP time limit. This method may be called from batch callbacks before calling the processImport method. | |
MigrationBase:: |
public | function | ||
MigrationBase:: |
public static | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public | function | ||
MigrationBase:: |
public static | function | Initialize static members, before any class instances are created. | |
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | Codes representing the current status of a migration, and stored in the migrate_status table. | ||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
constant | |||
MigrationBase:: |
public | function | Signal that any current import or rollback process should end itself at the earliest opportunity | |
MigrationBase:: |
protected | function | Test whether we're approaching the PHP time limit. | |
MigrationBase:: |
protected | function | Test whether we've exceeded the designated time limit. | |
MigrationBase:: |
public static | function | Convert an incoming string (which may be a UNIX timestamp, or an arbitrarily-formatted date/time string) to a UNIX timestamp. | |
WordPressItemMigration:: |
protected | property | Indicates to the complete() method that the nid of this item needs to be saved in linksToFix for later processing. | |
WordPressItemMigration:: |
protected static | property | List of nids which have links needing fixing. | |
WordPressItemMigration:: |
public | function | Complete node - called just after node_save(). | |
WordPressItemMigration:: |
protected | function | Replace any hrefs to links of the form http://example.wordpress.com/?=23 to local links to a node. | |
WordPressItemMigration:: |
public | function | Prepare node - called just before node_save(). | |
WordPressItemMigration:: |
public | function |
Data manipulations to be performed before the migrate module applies mappings. Overrides Migration:: |
|
WordPressItemMigration:: |
protected | function | Rewrite [caption] tags into HTML representing a caption. [caption] itself ($matches[1]) will become an opening <div>, the content within the tag ($matches[2]) will be passed through unchanged, and the closing [/caption] ($matches[3]) will become… | |
WordPressItemMigration:: |
protected | function | If we have a YouTube reference, replace it with media tags. | |
WordPressItemMigration:: |
protected | function | If we have a local link of the form ?p=34, translate the WordPress ID into a Drupal nid, and rewrite the link. | |
WordPressItemMigration:: |
public | function |
Set it up Overrides WordPressMigration:: |
2 |
WordPressMigration:: |
protected | property | ||
WordPressMigration:: |
protected | property | The filespec of the WXR file this migration is based on. | |
WordPressMigration:: |
protected | function |
Construct the machine name from the blog title Overrides MigrationBase:: |
|
WordPressMigration:: |
public | function | Suppress normal migrate module output in the browser. In drush, use drush_print instead of drush_log to capture output (non-informational) for email. |