3

I have been doing some changes these days on a localhost version of a joomla 2.5 website. Those changes consist of creating new files or editing previous ones, adding tables in the database and changing others.

But all these days a friend of mine was creating articles online causing changes to the database and the file system. Now I am in position of thinking, how to synchronize the online database + files with the localhost version of them. Is there a tool? or I need to eyeball the changes done in the database and the file structure of the joomla application and sync them by hand? What is the common practice for this issue?

thank you

themhz
  • 8,335
  • 21
  • 84
  • 109

1 Answers1

2

You have two issues here: database and files sync.

The first thing you should do is set up a code versioning system, be it svn or git doesn't really matter, as long as you keep your data safe. Dump both dbs to the svn too just in case.

If you didn't touch the database, then you can just update the files. Please note that extension installation will also make changes to the database.

If you created minor changes to the database, you'd better recreate them manually.

If you have created major changes, you'll be better off inserting the content, assets, categories tables from your live site into your dev site database, add any images that were added along with the articles. You can selectively output database dumps excluding specified tables, i.e.

mysqldump -u username -p database --ignore-table=database.jos_session 
    --ignore-table=database.jos_content  --ignore-table=database.jos_menu 
    > database_config.sql

!This is just the syntax, you will need to determine the table names by yourself!!!

You can achieve the same with phpmyadmin or the like.

Now to code. If no files (other than images) were created on the production site, you can safely move your development files over to the server.

Otherwise put your development site under code versioning, commit or push, then copy the production files over them and use the svn / git features to examine code differences and to publish to the live server once everything is ok.

If you can read Italian I have published an article that sums up a few of these concepts in a nicer format: http://www.fasterjoomla.com/it/soluzioni-joomla/svn-per-joomla

Riccardo Zorn
  • 5,590
  • 1
  • 20
  • 36
  • I should ignore #__content? are those comments? where are articles stored? – themhz Apr 29 '13 at 06:16
  • #__content is the way you tell Joomla that it should insert the database prefix into a table, and is used only within queries, so it will be translated to something like jos_content (note, double underscore after the #, single underscore after the db prefix). The articles are stored in #__content + each has an asset assigned in #__asset + there may be new categories and most likely images on the filesystem – Riccardo Zorn Apr 29 '13 at 11:40