Copying WordPress installations with phpmyadmin

So this should be fairly easy according to various guides, but it is not.

The goal is to create a test installation of WordPress on the server, so we can play around with it before moving any changes to the live server.

First step, backup everything!

It is very easy to fuck something up, so you always want to backup stuff. Just in case. To do this, open the FTP and copy all the files. Make sure it was done correctly. One idea is to do it twice and examine the folders. They should be identical (assuming no activity on the site in the meanwhile).

Next you go to the myphpadmin login site. I am using Unoeuro (great host, recommended), so mine is e.g. here: mysql29.unoeuro.com

Go to the database (you can only have one on Unoeuro, it is named after the domain). Then click export, and quick settings.

OBG0

Copying and fixing the database

WordPress runs of the mySQL database, and two WP installations need their own. To do this, go to the main overview of tables (structure-tab). Then mark the tables WP uses.

OBG1

Then scroll to the bottom and choose “copy with prefix” in the drop-down menu. Then add the prefix of the tables and the desired prefix of the copies.

OBG2

You now have a duplicate table set. But wait! In my case, the tables are not copied correctly. The encoding “collation” and type for some reason change to some other stuff. You need to change¬† them back. To do this, go into each table and choose Opernations-tab. Then change the values so they match the tables from the original WP installation. In my case, to utf8_general_ci and MyISAM.

OBG4

Do this for each table (there were 11 for me).

Now, we are done? Nope! Next you need to edit the table to tell WP on which domain it is located (for use in relative links presumably). These settings are under wp_options. For some reason there are two identical ones “siteurl” and “home”. These both need to be change to the new URL. In my case openpsych.net/test/OBG from openpsych.net/OBG.

No edit rights?

However, it wasn’t possible for me to edit them. The error was that no column was set as the uniquely identifying one. To resolve this, go to the SQL-tab and type:

OBG5

ALTER TABLE `test_journal_OBG_wp_options` ADD UNIQUE (`option_id`)

This sets column “option_id” as the unique column in table “test_journal_OBG_wp_options”. Switch these values with yours. You need to do this for the unique column in every table you want to edit. WP did not make it simple because the unique ID column does not have the same name for each table either, but they are easy to identity.

And then you need to edit the two lines in wp_options.

You do not have sufficient permissions to access this page

Aaaand then, you are not done. When I tried to login, I got an error “You do not have sufficient permissions to access this page.”. Some googling around (1, 2) did not solve the problem for me, but it did suggest the solution to me. The trouble is that within the tables, WP cross-refers to other tables. But these cross-references have not had the prefix added! So you need to find all of them and add it. You need to do that under wp_usermeta and wp_options. I did not find an automatic search and replace, but there are only a few places it needs to be done. Unless you have a lot of users, since you need to do it a few times for every user. Hope you find the research&replace command!

Uploading the copied WordPress

Next step is making a copy of the WordPress folder you want to copy. Then you go to the wp-config.php file and find the line “$table_prefix¬† = ‘test_journal_OBG_wp_';”. Change this line to the prefix you have chosen and save.

Then upload the WP folder into the correct subfolder on the FTP server and login.

I did not do things in the order above, but it seems the most effective. I may have also forgotten some things I tried. This is just to serve as a reference for those who have similar problems.

Re: “How To Get Rid Of Unwanted Redirects In Google Search Results”

Link to article.

Ever been annoyed by the overly long links one gets when one tries to copy a link from Google? Here is an example:

www.google.com/url?sa=t&source=web&cd=2&ved=0CCoQFjAB&url=http%3A%2F%2Fwww.stat.gl%2FLinkClick.aspx%3Flink%3DAlkohol%252Fpublika%2B2010%2Balko.pdf%26tabid%3D109%26mid%3D494%26language%3Den-US&rct=j&q=alkoholindtag+pr+land+gr%C3%B8nland&ei=2ffcTZThBIaF-wblnOHJDw&usg=AFQjCNG-ZRltkvhL1RYHjT4uSEJWmmXxVQ&cad=rja

These are very annoying and their function is just to allow Google to track and see which link you actually clicked. Fortunately, there is a way to get rid of them (at least if one is using Firefox which is my favorite browser).

So, after installing GreaseMoney and a suitable script (I tried one first that didn’t work), here is what happens when I copypasta the link again:

www.stat.gl/LinkClick.aspx?link=Alkohol%2Fpublika+2010+alko.pdf&tabid=109&mid=494&language=en-US

Two ideas for torrent clients

Automatic addition of trackers

With the probable closure of The Pirate Bay (TPB) in the near future the torrent scene will be more decentralized. Especially if the TPB tracker goes down. Luckily there are new upcoming trackers to take its place. The problem is that they are not in many of the torrent files. Besides adding the trackers manually there are some ways to fix it. One way is to re-upload all torrents with more trackers. That doesn’t seem like a plausible method. Another way is the have an indexer site (like TPB, Mininova or BTjunkie) update all the torrents with more trackers. This doesn’t seem like a bad idea.

Another idea, and this is my idea for the client, is to have an option in the client to automatically add more trackers to all torrents loaded. That would be very useful for torrents that do not include any new public tracker such as Openbittorrent (OBT)1 or Publicbittorrent (PBT)2. There could be an editable list of trackers to be automatically added, or there could be function that shares all public trackers for all torrents though I’m unsure of what the consequences will be of that. Even more, one could have peers share public trackers. In that way any new public tracker would quickly spread. There is reason to be cautious, however, a third party, say RIAA, may set up such a public tracker just to sniff IPs.

Automatic force-seeding of torrents with no seeds

The goal is to keep rarer torrents alive easier. Currently I have to manually look through my torrent client for torrents that currently have no seeds and then force seed them so that the peers can finish their download.3 It should probably force seed for a set time. If it forced-seeded only until there were at least two seeds, then complications arise. Imagine that there are two people who are the only seeds and both their torrent clients have this feature. Both their clients would then force seed the torrent until they spot another seed, but then they can see each other and so they will keep bouncing on and off force seeding while the peers would not get much data. A mix of these two ideas may be a good idea.

Footnotes

3We’re presuming here for simplicity that if there is no seed, then there is not a complete file in the swarm. This is false in some cases.