1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Reminder to check database name in config.php before upgrade

Discussion in 'Installation, Upgrade, and Import Support' started by xmlxp, Dec 4, 2010.

  1. xmlxp

    xmlxp Active Member

    actually this happen to me today when upgrading from test beta3 to test beta4 and it happend to me in the past when upgrading vB forums and am sure it keeps happening to alot of forums admins.

    for new installation there is no problem but since upgrading xenforo require you upload the new folders and files over the exisiting one in the xen root folder someone might forget to change the database name in the config.php to the name of new test database which would result upgrading the production database by mistake and God help if you didnt make a backup.

    so i suggest in the upgrade script start page there should be an input box to edit if needed the name of databse in config.php which you want to be upgraded or at least a red color text reminder to check database name in config.php before running the upgrade, that way no one will forget if his database name need to be changed or not
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Are you saying you had to manually edit the config.php file to complete the upgrade?

    Make sure you check the upgrade package for an existing installation.

  3. xmlxp

    xmlxp Active Member

    No Borgan.

    when i do upgrade i stay a way from the live databse.
    i just make a new databse with restored copy of the live database and run the upgrade on the new database.
    on my case i forgot to change the database name in the config.php from the live DB to the new DB so the upgrade ran on the live DB. if somthing goes wrong i will loose my live DB
  4. Brogan

    Brogan XenForo Moderator Staff Member

    So if I'm to understand correctly, you upload the new files onto your live server directory but then manually edit the config.php file to run the upgrade on a test database?

    Surely overwriting the live server files also has risk attached to it?
    What happens if you have to backout? You will have to upload all the old files to your server.

    Why not just have a completely separate environment for your test and live installations?
    Both directories and databases?
  5. xmlxp

    xmlxp Active Member

    the upgrade instruction said:
    To upgrade an existing XenForo installation, you will need to extract the zip and upload all files within the upload directory to your existing XenForo Directory, overwriting all files.

    so to simulate the instruction i copied all folders and files of a currunt comunity xen3 including config.php to a newly ctreated folder of name xen4 then i uploaded the all files of the upgrade package to xen4 overwriting all exisiting files

    i did that becouse i am not sure if the upgarde package include all files OR only the changed files from beta3 to beta4

    now i will run the upgarde process on xen4 folder

    BUT inside xen4 folder there is:
    1. config.php of live DB details copied from xen3
    2. confing.php.default with no details copied from the upgrade package

    when i run the upgrade script on xen4 folder, the script will see config.php which contains the details of the live DB and then run the upgrade on it.

    i was planing to edit config.php to direct the upgrade to the test DB not the live DB , but i forgot :)
  6. Brogan

    Brogan XenForo Moderator Staff Member

    The upgrade instructions relate to any installation, be that your live, test or local installation.

    The config.php.default file is included with both the full and upgrade packages.

    What you did was essentially correct, all you omitted was the step to edit the config.php file in your new test/xen4 directory to point to your test database.

    If you now leave that test folder in place, there will be no need to do anything next time.
    The details in the config.php file will in future point to your test database.

    Apart from avatars and attachments, all data is stored in the database so there is no need to copy the live directory to the test directory in future as all the files will be identical as they are now both at Beta 4.

    If you want to make your test database/directory completely reflect your live site for the next upgrade, just copy the data and internal_data directories and import the live database to your test DB.
    Then you can run the upgrade on your test installation and if it works, repeat the process on your live installation.
  7. xmlxp

    xmlxp Active Member

    that clarify the upgrade instructions.

    thanks Borgan
  8. Brogan

    Brogan XenForo Moderator Staff Member

    No problem but just be aware you don't really need to copy the data and internal_data directories.
    You can just copy the live DB to your test DB, just attachments and avatars will be missing.
  9. Floris

    Floris Guest

    Yea, but it does not say: copy the db and do a live test upgrade first ..

    The upgrade instructions adapt to your personal situation obviously ..

Share This Page