************Environment information***************
SQL Server version: 5.1.40-community
Webserver Apache/2.2.4 (Win32) mod_ssl/2.2.4 OpenSSL/0.9.8k PHP/5.3.1
MODx Revo 2.0.8 pl traditional localhost
Chrome browser
Windows XP SP3
**************************************************
I think this "one day" is coming

But for now there is a decision on
http://devtrench.com/posts/first-impressions-of-xpdo-wordpress-to-modx-migration-tool
last github version
http://github.com/devtrench/WordPress-to-MODx
Well. I`m stuck in xPDO things.
ISW devtrench migration code has 2 files:
build.wordpress.php - creates wordpress.mysql.schema.xml file for future parsing of Wordpress database;
wp-migrate.php - creates resources from data in Wordpress database using WP db and MODx db as xPDO objects.
It`s some kind of very rough explanation =))).
I`ve created
wordpress.mysql.schema.xml and made it ready to parse WP db. It`s fine.
But my
wp-migrate.php definitely needs some xPDO expert assistance

Here is edited code:
<?php
/**
* xPDO Wordpress to MODx Migration Code
* Author James Ehly (devtrench.com)
*/
################################################################################
# Configuration
################################################################################
/**
* a flag to turn this script on and off
*/
$can_migrate = true;
/**
* Wordpress Database settings
*
* $wp_database_host string database hostname
* $wp_database_charset string database character set
* $wp_database_name string database name
* $wp_database_prefix string database table prefix
* $wp_database_username string database username
* $wp_database_password string database password
*/
$wp_database_host = 'localhost';
$wp_database_charset = 'utf-8';
$wp_database_name = 'linuxblog';
$wp_database_prefix = 'wp_';
$wp_database_username = 'root';
$wp_database_password = '';
/**
* template ids to use during import
* if you would like to have different templates for posts and pages you can
* specify that below, if not they will default to the default template id
* if the templates don't exist they will be created. The default template id
* must be set.
*/
$default_template_id = 1;
/**
* the name of the template variable that you want to use for your categories.
* If it doesn't exist, it will be created. Leave blank if you don't want to
* import categories
*/
/**
* $empty_tables
* if set to true, the tables that will be updated are emptied first.
*/
$empty_tables = true;
################################################################################
if (!$can_migrate) die('Migration cannot be processed, this script is off.');
if (!is_int($default_template_id)) die('The default template id must be set. Check that $default_template_id is set and is an integer.');
// Include the xpdo and modx classes
include ('../../xpdo/xpdo.class.php');
include ('../../model/modx/modx.class.php');
// Instantiate a new modx object. MODx inherits from xpdo so we can use it
// like an xpdo object, but it has the extra functions needed for saving content.
// Thanks to Shaun McCormick for writing docs on this.
$modx = new modX();
$modx->initialize('web');
// Now instantiate a new xpdo object and add our wordpress package. This gives
// us the ability to make queries on the wordpress database as an xpdo object.
$wp = new xPDO('mysql:host=' . $wp_database_host .
';dbname=' . $wp_database_name .
';charset=' . $wp_database_charset,
$wp_database_username,
$wp_database_password );
$can_migrate_wp = $wp->addPackage('wordpress','../',$wp_database_prefix);
if (!$can_migrate_wp) die('Wordpress Package could not be loaded.');
// get all wordpress posts. Isn't this so easy?
$posts = $wp->getCollection('Posts');
$post_count = 0;
$comment_count = 0;
/**
* post and page migration -----------------------------------------------------
* iterate over each post and create a new modResource object, mapping our post
* fields to our wordpress fields
*/
foreach($posts as $post)
{
$resource = '';
$template_id = '';
$type = $post->get('post_type');
if ($type == 'post')
{
$resource = $modx->newObject('modResource');
$data = array(
'id'=>$post->get('ID'),
'pagetitle'=>$post->get('post_title'),
'alias'=>$post->get('post_name'),
'content'=>$post->get('post_content'),
'context_key'=>'web'
);
$resource->fromArray($data,'',true);
// call the save function which inserts our object record into the database.
$resource->save();
//echo "ID = ".$post->get('ID')."<br> ";
//echo "Post title = ".$post->get('post_title')."<br> ";
//echo "alias".$post->get('post_name')."<br> ";
//echo "Content".$post->get('post_content')."<br> ";
echo $resource;
$post_count++;
$res_id = $post_count;
}
}
/**
* Processing is now finished. Echo the number of posts inserted.
*/
echo $post_count . ' post' . (($post_count == 1) ? '' : 's') . ' added. ' . $comment_count . ' comment' . (($comment_count == 1) ? '' : 's') . " added.\n";
echo "If you are done with migrating posts you should remove this file or set \$can_migrate to false so this page can't be executed in the future.\n";
$modx->cacheManager->delete('');
?>
This code is fully documented by it`s creator. It differs from github version - I`ve deleted all stuff which I don`t need or fully understand. But it`s still not working fine -
saved resources don`t have full context field (just empty or approximately 100 html text symbols) and empty title.
When I`m trying to echo all posts like this:
<?php
//blablabla code
echo "ID = ".$post->get('ID')."<br> ";
echo "Post title = ".$post->get('post_title')."<br> ";
echo "alias".$post->get('post_name')."<br> ";
echo "Content".$post->get('post_content')."<br> ";
//blablabla code
?>
- it`s fine and all post appear in browser which shows that everything is correct till save function. Where is the problem? Can anybody explain? =) Thanks in advance...