Import/Export posts #24

Closed
charliegroll opened this Issue Feb 5, 2012 · 31 comments

Comments

Projects
None yet

The ability to import and export posts (perhaps just XML) would be very useful.

Contributor

idiot commented Feb 5, 2012

Sure would! This'd take some planning, though.

I agree. I'm going to take a look at the db and everything to see if I can rig something together (after the Super Bowl and in between classes/work)

Owner

rwarasaurus commented Feb 7, 2012

what would you import from and export to? applications wise? import from an rss feed?

I was thinking about importing/exporting all (or selective) posts for another anchor instance or a fork of anchor, if one should come about.

Owner

rwarasaurus commented Feb 8, 2012

would you not just use a mysqldump? or are you thinking about migrating to different versions?

could, but i figured it would be more user-friendly to do it for them. i'm always thinking from a UX point of view, and the normal user wont' know how to mysqldump

Contributor

idiot commented Feb 8, 2012

Also, I've been getting a bunch of people wanting to import their WordPress posts, so it might be useful for that, too.

@ghost ghost assigned rwarasaurus Feb 8, 2012

A friend of mine today was just noting how he is returning to WordPress from Tumblr and how WordPress can import from Tumblr — sounds helpful, as well.

Has any progress been made on this front? I'd love to switch from Wordpress but if I can't transfer my posts it's difficult to justify.

Bumping an old issue here, but why don't we ask and include this in the main repo? Or better integrated into the installer

Owner

daviddarnes commented Feb 15, 2013

Because its not necessary for everyone? Its true that it can be very useful, however most people are starting a fresh when using this. An export button would be nice though, simple xml export.

Why not at installation have
Create a new site or Import from WordPress

If you have it on the installer it's still asking for an interaction and as david said it's not necessary for everyone.

It would make more sense to keep the installer as simple as possible and just have an import option on the back-end posts page.

"Create a new post" "Import posts"

Owner

daviddarnes commented Feb 15, 2013

I agree with @simonclavey, however it would be best to have a simple xml import and export buttons in the metadata section. Understandably its awesome that we can now convert data from WordPress to Anchor, however Anchor needs to stay fresh and different. Having a WordPress import button will take it a step closer to "Another WordPress clone".

Sorry to harp on.

Good idea. I think it should be integrated in there. Should I start work on a pull request to import WordPress sites using that script referenced above?

To be clearer, in the Extend section, next to Metadata. I think it fits under 'extend'

Really, this should be split into two separate issues.
For exporting I'd say JSON output is more friendly and lightweight. For those reasons I think it fits anchors mould better than any other format.

How about adding post from markdown.md files? Super convenient when we are offline and want to write an article and a big + is that you can use any editor you want on any device.

That would be awesome. It already supports drag/drop CSS and JS, why not drag/drop MD?

Owner

rwarasaurus commented Mar 8, 2013

@oefterdal @joshvickerson Drag and drop .md files is a great idea.

Owner

daviddarnes commented Mar 8, 2013

Myself @studioromeo said exactly the same, you beat us to it @joshvickerson!

Cool, Thank you for the support.

Owner

daviddarnes commented Mar 10, 2013

Would it be a step too far to be able to do this with html files too? Maybe some creative front end developers would benefit from being able to drag html, css & js into their articles?

Contributor

idiot commented Mar 24, 2013

Original issue: importing works, thanks to http://samhellawell.info/index.php/posts/wp2anchor; exporting can be a plugin. Sorted.

@idiot idiot closed this Mar 24, 2013

I've used wp2anchor to import my blog data from Wordpress. The import is done, but it seems that the text encoding is not the right one.

In the original .xml file, text is with Spanish characters, like in "sueños". But for some reason it seems that after that import characters look like this: "sueños".

If I write a new post, characters are OK.

Would you know how to fix this?

tlongren commented Nov 6, 2013

Probably due to the import not setting default charset to utf8 when importing into MySQL. I haven't looked at the code though, so I could be wrong. Just throwing out ideas. --default-character-set=utf8 would take care of it.

Well, unfortunately my PHP skills don't allow me to understand the code and try to help others fixing it.

I've tried changing the database character set to UTF8, and importing all again, with the same results.

tlongren commented Nov 7, 2013

@javiercuello, in wp2anchor's import.php file, try adding this around line 187:

$mysql->set_charset("utf8");

Add that directly after this line (line 186):

wp2anchor_log("Connected to the database: " . $mysqlInfo["database"]);

That may or may not fix your unicode import issues. I haven't tested that, so no promises. :)

Thanks Tyler.

I've kind of solved this directly replacing characters in my database. It would be great for someone to fix this wp2anchor for others having my same issues.

I've found other problems as well, concerning other things: importing from wordpress keeps some tags like the ones for < blockquotes >, < ul > and < em >. Ideally, it would be great to have some importing tool that convert this tags to the corresponding markdown.

So, I'm checking & fixing post by post, just to be sure all is OK.

Also, this import file uses almost the same information needed when installing Anchor CMS; so it would be useful to have an "import" field directly when installing anchor.

I'm just thinking out loud, but I think it's better to say this somewhere, and not keeping it for myself.

A way to import from Wordpress, be it directly from a Wordpress database dump, by connecting to the Wordpress database or by be able to import a XML file would be great.

I have tried to get wp2anchor to work but it falls a bit short.

With larger XML files (20+ megabytes) the import fails. In my case, PHP is configured to handle up to 512MB files and the tmp-storage directory is defined with proper access rights. The result of this is a bit hairy:

The import fails with this message:

"Connected to the database: xxxxxxxxxxx
Cleared tables: anchor_categories, anchor_comments, anchor_page_meta, anchor_post_meta, anchor_posts
Set site meta [sitename] to []
Set site meta [description] to []

All existing posts and categories are wiped and none are created."

Smaller XML (5-6MB) files work, but the import script deletes any data already present in the database rather than add to existing data in the database which makes it impossible to import a huge Wordpress site step by step.

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