cykoder / wp2anchor

OLD, UNSUPPORTED - Imports Wordpress data into Anchor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Import fails with large XML files

joacimmelin opened this issue · comments

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.

Smaller XML files work, but the import script seems to overwrite data already 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.

Been Trying some more and I'd really appreciate some feedback on this.

The import fails with this message:

Connected to the database: macproanchor
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.

When trying to load the Anchor front page this error message is presented:

Uncaught Exception

Undefined variable: categories

Origin

anchor/libraries/anchor.php on line 82

Trace

#0 /home/joacim/web/z80.org/anchor/libraries/anchor.php(82): System\Error::native(8, 'Undefined varia...', '/home/joacim/we...', 82, Array)
#1 /home/joacim/web/z80.org/anchor/libraries/anchor.php(28): Anchor::register()
#2 /home/joacim/web/z80.org/anchor/run.php(37): Anchor::setup()
#3 /home/joacim/web/z80.org/system/start.php(21): require('/home/joacim/we...')
#4 /home/joacim/web/z80.org/index.php(33): require('/home/joacim/we...')
#5 {main}

After creating my categories, the site works again but there are still no posts available.

Hi @joacimmelin, I had the same issue: in my case the xml file was not well formed because of a problem with the wordpress environment. Having some xml tag without closing will make the simple_xml parser to fail without noticing. I did a fork of the project (already filled a pull request) solves this (I hope). Check my new commits as they should solve two different problems with the xml file: having errors while trying to parse and removing the xml namespaces, and maybe this issue could be closed with them.

Another idea for this issue (or other people with similar problems): with large xml files the php process could be killed because it uses too much memory.

I had to edit my php.ini file and change the maximum upload file size, as my wordpress export file was > 20MB. After that, I changed the memory_limit for the php-cgi processes from the original 128MB, and then it worked.

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 256M

Don't think it's your case, as you get to receive a response from the server.