Skip to content

Upgrade to blog 2.x compatibility#21

Open
camfindlay wants to merge 13 commits into
masterfrom
blog2
Open

Upgrade to blog 2.x compatibility#21
camfindlay wants to merge 13 commits into
masterfrom
blog2

Conversation

@camfindlay
Copy link
Copy Markdown
Owner

Work in progress on a better WP importer.

@nglasl
Copy link
Copy Markdown

nglasl commented Feb 9, 2016

I've given this a good test, and it's looking pretty good at the moment. There are just a few things..

1. I noticed the import getting stuck in an infinite loop when attempting to import assets, as I didn't actually have them available to copy across. At the least, I think the $importAssets needs to be changed so we can configure it from YAML, either similar to the maximum execution time or by using an injector property. Switching this to false is what solved my issue.

2. A lot of the custom wordpress fields are contained in the XML export, however are not brought across during the import (mainly custom metadata). I think we need a way of just storing everything for a blog post in something such as a serialised DB field, so they can just be parsed and displayed through the CMS (or wherever else they may be needed).

3. There were no comments imported, however I believe this is because the extension that does so isn't applied correctly. I'm sure this one is simple to solve, I just haven't spent the time looking into it yet :)

It's looking great so far, and I like that the tagging and categorisation is actually pulled across into the relevant data objects for blog 2.x :)

@camfindlay
Copy link
Copy Markdown
Owner Author

thanks @nglasl yip I had noticed the loop issue. Hopefully will find more time to work on it. Happy to accept PRs onto this PR too!

At the moment I am in transition between the old version and this new version (hence the extra files that arn't actually used). Will be cleaning these out once I have everything in a working start. This will eventually become a new major version release of this module.

There are also a number of issues/features we can address going forward too.

@camfindlay
Copy link
Copy Markdown
Owner Author

@micmania1 you might be interested in this ;)

**/
public function parse($file) {
if(file_exists($file)) {
$this->simpleXml = simplexml_load_file($file) or die('Cannot open file.');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or die() :D - Maybe this should throw some sort of Exception?

@wildflower
Copy link
Copy Markdown

wildflower commented Jul 12, 2016

Hi,
How do I get your Pull request code onto my machine?
Do you need to merge it first?
I'd like to run it against a v2.0 blog please

I think I figured it out ;)
git clone https://github.com/camfindlay/silverstripe-wordpressimport.git
git checkout origin/blog2
git status

I had to change the line 55 on WordpressImportField to the correct path to find the js - and then it worked :)
Requirements::javascript("silverstripe-wordpressimport/js/WordpressImportField.js");

@camfindlay
Copy link
Copy Markdown
Owner Author

cheers @wildflower - hopefully will have some time to wrap this work up.

@wildflower
Copy link
Copy Markdown

I've had a crack at this and got it working on my export file, (it uses wordpress' taxonomy rather than wp_tags and wp_categories). - this means the ImportBlogTag and ImportBlogCategory methods don't do anything in my case

I've used SS_DataLists instead of an array to keep track of what's being/has been stored.
I've found where/how to put PublishDate in so the post goes straight to live as well.

I'd like to use the CMS popout Notice thing for status updates, but haven't figured that out yet.

Can I do a pull request on top of a pull request?

@camfindlay
Copy link
Copy Markdown
Owner Author

@wildflower absolutely! Just fork, work on your forked branch then pull request against my blog2 branch. Happy to merge in. Would be great to get some tests going also - maybe a mock WP xml file to test the importer? Have you dealt with images also?

@wildflower
Copy link
Copy Markdown

(Is there a gitter.im room for this?)
I'm looking at images/attachments now, there isn't a direct link/reference in the export.xml I have.

There's a thumbnail_id in one of the wp:postmeta tags and they don't have an attachment_url value.

I'll have to curl/wget domain.com?p=thumbnail_id
and then save the that is in the middle of the page as the $source and $url for the importAssets method.

quite convoluted

@camfindlay
Copy link
Copy Markdown
Owner Author

@wildflower no gitter (as yet) feel free to continue dialogue here in the issue (or start your pull request of my pull request and we can keep these specific image related chats there?) - I know WP has some way of pulling images from one install to another unsure if they use curl or wget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants