• Resolved Loggy

    (@loggy)


    As we all know, updating and testing on a production site is a bad idea!

    One of the problems with WordPress (among almost all other packages) is that you have to keep a development copy up to date for testing, which is messy and wasteful. Updates to plugins and themes sometimes cause problems but in principle they can be deactivated or edited if you know what you are doing.

    My platform is hardened Ubuntu 10.04 LTS with WordPress 3.2.1. All permissions are correct – files are 0660, directories are 2771, ownership is by user:web-data and ftp is also a member of web-data.

    So I thought it a good idea to clone the site so that it can be tested as it is and then any modifications repeated on the production site (or the site re-copied back). The cloned site can then be deleted to avoid confusion or regularly cloned as a complete backup possibly to another server in case of network outage.

    So I wrote a script to do this by

    a) copying all the tables,
    b) copying the complete tree,
    c) updating the virtual host and
    d) restarting the web server.

    The first of these is done in PHP, which writes out a shell script which can be executed by root to carry out the other operations.

    Obviously some changes are needed:

    1) The tree is copied with $table_prefix changed in wp-config.php (or optionally the database can be changed instead).
    2) All tables are copied with references to the URL changed (that means unserializing the arrays where necessary),
    3) The few entries in XXX_usermeta and XXX_options have their names (metakey and option_name) changed to reflect the altered prefix.

    On trying the cloned site, I get an error establishing database connection. There is nothing wrong with the mysql user, privileges etc and the error occurs whether I use a the same database (different prefix) or a different database completely.

    So I try /wp-admin which tells me that the database may need repairing. I insert the appropriate definition in wp-config.php and WP tells me that they are all OK. I have even tried repairing all tables from phpmyadmin. I have tried different browsers on different computers. All the contents of the tables are there as I can see from phpmyadmin!

    But the problem is still there. So it seems as if there is something else that is giving the database error.

    My question is What?

    Are there are any other fields that need changing or resetting in the tables to enable the cloned site to work. Or whether there is something else in the setup that needs deleting or modifying.

    TIA

    (BTW this process shows that get_settings is still used in wp-includes/functions.php on line 3382 despite it being deprecated since version 2.1 in favouir of get_options!).

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Loggy

    (@loggy)

    PS The error comes from wp-includes/functions.php (there is no supporting text) about line 3296. I guess this means that something before that coding is called in wp-settings.php at line 70 is not being set but I haven’t tracked the logic yet.

    PPS Needless to say I have tried setting WP_DEBUG{_DISPLAY|_LOG|} as well as trawled the apache logs to no avail ….! All I get is the deprecated messagee mentioned before. So debugging only starts once the program is well and truly loaded…..:((( I tried putting wp_debug_mode() before the require(‘functions.php’) call to no avail.

    Thread Starter Loggy

    (@loggy)

    OK I’ve got this now – the siteurl and other simple cases in XX_options were not translated properly. It was in the test script ….

    Except when I try to login I get a “You do not have sufficient permissions to access this page” message. Even though I seem to be half logged in as when I go back to the front of the site, the ribbon is visible at the top with my login name and dashboard but nothing else. And I can ‘logout’ even if I could never do anything while logged in!!!

    Any clues would be welcome.

    Thread Starter Loggy

    (@loggy)

    Got it I think – the update of the usermeta table barked. It all seems to work smoothly now so I can try-before-I-buy!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cloning a WP site – problem in cloned site’ is closed to new replies.