Gallery2:How To Backup and Sync the DB - Gallery Codex
Personal tools

Gallery2:How To Backup and Sync the DB

From Gallery Codex

Revision as of 12:49, 2 November 2005 by Pbearne (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

So have created your production gallery site with a few custom bits but wish to test the cvs version as well

This is what I have done

wrote this PHP page ( havn't worked how to display the shell output onto screen the print isn't working )


<?php $output = shell_exec( 'sh' ); print($output); ?>

which runs this Shell script --------------------------------
  1. update code

cvs update -P gallery2

  1. copy the images to dev folder If you have space to product production

cp -ru /path to /albums /path to /g2data_dev/

  1. back db done this so I get a db backup

mysqldump --add-drop-table -u ProductionDBname username password > g2.sql

  1. write the data back into dev db

mysql -u DevDBname username password < g2.sql

Both file need to be in the root of the dev web site

So all I have to is run the php and I get backup of the DB called G2.sql and a fresh copy of the code

I have set my dev site up as a third level site ie

You will need to change the path and username password in the shell to make it work

I am sure this can be inproved on and that is have the reson I have posted it here