• I’ve got a bit of a problem, and the setup is a little complicated, but bear with me — I’m just trying to avoid the usual “why would you want to do that?” questions. I’m currently setting up WordPress to display news content from the Associated Press. Now, the AP does things a little funny. They make all their content available via a news server — as in NNTP, as in Usenet. So here’s how I’m handling it: I’ve written a lengthy PHP script that (to oversimplify things quite a bit), every 10 minutes, opens a connection to the NNTP server, checks for new content, and creates a WordPress post for each article. This script, by the way, runs on top of WordPress, so I’m not writing directly to the database, I’m having WordPress do it for me.

    On the surface, this works great. But there’s a somewhat major problem. The script takes about a minute to run, and during that minute, the website — including the WordPress admin — is completely inaccessible. To an extent, I can fix that with a caching plugin, but that doesn’t affect the admin screens, and having those be unavailable to our editors for one out of every 10 minutes is unacceptable.

    At first, I blamed WordPress for this inefficiency. But a little QA has suggested that WordPress is actually doing an admirable job with all this content crunching. Rather, it seems that it’s latency with the NNTP server that’s causing the issue.

    So here’s my idea. I run my PHP script on a separate server. But the script creates the WordPress posts on the original server. I’m fairly confident that this would take care of everything — the script would be free to hang as much as it wanted, tied up with the NNTP server, because its interaction with the original server would be brief.

    The only issue with this is that Google has been useless in telling me if it’s possible to interact with WordPress from a different server. What I really want is two WordPress installations — one on the new server, one on the old server, with the script running on top of the new installation and writing posts to the old installation. Is there any way at all to do this? I guess I could write the newsgroup data directly to the MySQL database, but yikes, I’d really rather not do that; the WordPress functions are so easy to use and contain a lot of error handling and failover that my script relies on.

    Any ideas? How can I write to one WordPress install from another? (And of course, if you have any alternative suggestions, I’m all ears.)

Viewing 3 replies - 1 through 3 (of 3 total)
  • wpismypuppet

    (@wordpressismypuppet)

    Hmmm, without putting too much thought into it, what if you had two identical installs of WordPress? One that runs local on the server (and can’t be seen by, or accessed by, anyone else in the world) that does that connection to the NNTP server and does all the crunching, then had your live site where it lies. Use a cron job to export the test database and import that data to the live database, updating and writing to the live database only what’s new/changed?

    This way, the test site can take as much time as it needs, and the cron job will do everything behind the scenes… the live site will never see a hinder in performance. Also, since the test site is not accessible by anyone in the world, it won’t interfere with SEO or ranking!

    Thread Starter tiszenkel

    (@tiszenkel)

    That’s an intriguing idea, but I’m wondering whether it would still cause a performance hit, because it’s the same server even though there are two installs. I just had another idea, though, that seems so simple I’m kicking myself for not thinking of it before (but isn’t that how it always works?): Two separate WP installs on two separate servers, but identical wp-config files, each pointing to the original database. I’m going to give that a try next, then maybe I’ll give your idea a go.

    Thanks a lot for the suggestion!

    wpismypuppet

    (@wordpressismypuppet)

    No problem… hope it works out.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Writing from one WordPress install to another’ is closed to new replies.