Skip to content

Instantly share code, notes, and snippets.

@cballenar
Last active April 8, 2017 14:55
Show Gist options
  • Save cballenar/e7de5b3f08a0e735e4b7d03ec977aa33 to your computer and use it in GitHub Desktop.
Save cballenar/e7de5b3f08a0e735e4b7d03ec977aa33 to your computer and use it in GitHub Desktop.

Safely updating a Craft installation

1. Download correct version

2. Backup database

  • Craft usually backsup the database on update but I've found that if you have a large database, this can cause the update script to timeout.
  • Craft should be set to 'backupDbOnUpdate' => false
  • This means that you'll be responsible for updating previous to updating
create database [databasename];
grant all privileges on [databasename] to 'user'@'localhost';
FLUSH PRIVILEGES;

3. (OPTIONAL) Be proactive and create a second database before everything goes to hell

4. Increase your memory_limit

  • Check ~/etc/php5/php.ini
  • Check ../craft/config/general.php
  • Drop a ../public/info.php file just in case

5. To update we will replace the ../craft/app directory for the new one

  • Move existing one to app.old
  • Copy new one from the tmp directory onto ../craft/

6. Go to the admin panel and go through the update process

7. If everything went well, then you're good to go and you can

  • Lower memory limit back to 512M (check performance)
  • Erase database backup and secondary databases
  • Erase downloaded files
  • Celebrate!

8. Otherwise

  • Turn on dev mode and find out what's going on
  • Worst case scenario restore back to normal removing new app directory and restoring database
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment