We are a team of many developers working on a website that uses both Joomla and custom PHP scripts. The problem is that there are multiple developers working on various features which need to update information in Joomla (adding modules, changing existing ones or changing settings) and when one developer changes something, he usually makes the change locally first and then does the same thing (hopefully) on the production server. Not only that this is very error-prone, but the developers often forget to tell other developers about the changes. The custom PHP scripts are easily sha开发者_开发百科red between developers, but the changes in Joomla are often forgotten and they lead to serious conflicts when a developer tries to replicate his local changes in production.
I have thought about placing Joomla in a Mercurial repository, but how could we distribute the changes in the database between the development, the testing and the production machines?
We run all of our Joomla sites over subversion, checking them out as required. We just branch whenever we need to make major amends to a project.
In general, we run a single test database which is shared amongst everyone to ensure we have consistent data but you could easily run local DB's as well.
We use SVN for all our customers with separate databases. When installing a new extension the database changes. With a diff of the databasedump before and the databasedump after installation of the extension we know what the differences are.
Database synchronization is tricky, as you would want to maintain the content that is stored in the live site, whilst updating other tables from your dev/staging sites.
if it were just your developers creating the database changes (and not 3rd party extensions adding unknown additional tables) then you could look at something like DBV https://github.com/victorstanciu/dbv.
I've had reasonable success with using database tools such as Navicat to set up scheduled database syncs. That would be my suggestion as it provides the most flexibility in defining which tables are synced where and when.
Another option might be to look at mySql replication, but last time I looked that was difficult to set up when there was no obvious master/slave relationship between the databases to be sync'd
If you build everything as extensions (modules, components, and plugins), they should include any database changes required. I would set it up so each developer is working off their own local database. If you need test data loaded, I would just create MySQL scripts that can be run after you install all the extensions. Since all of this can be checked into a repo, you should be good on everyone sharing code.
Using PHP, you should be able to write up a quick script that will start with an empty server, install Joomla!, install all your extensions, and then dump in any test data. Having this will also be good for developers to get back to a "clean" state. I would encourage developers to reset back to the golden state before they start any new work.
Another idea would be to use mysqldump to dump all of your tables. If a user makes a database change on their local machine, they also need to dump out the change and check it in.
We use SVN on our server to manage these types of issues. If you are going to do any productive development with a team of people you have to use a revision control system. There are a number out there, have a google for svn, cvs, git, those are some of the most commonly accepted version control systems. It might take some time to setup initially but you will reap the rewards from it!
Hope that helps! Cheers
精彩评论