开发者

How to handle the deployment and updates of multiple installations of one CakePHP web-app?

I ma开发者_StackOverflow中文版de a simple CMS with CakePHP to handle a small (but growing) number of websites. The CMS is constantly evolving as I regularly add features to a development version on my own machine.

I use SVN to trace the evolution of this development version, and that's pretty much it. To make a new website, I basically copy/paste the dev folder and modify the necessary files before uploading the new website by FTP.

One problem is in the end, every website installation is independent and if I want to add some new features to existing websites, I have to copy files by hand.

Another problem is that some websites have modified versions of the CMS because of specific needs: some controller classes have specific methods not present on the local version.

To sum it up:

  • I have one base CakePHP app regularly evolving
  • There are multiple versions (=websites) of this app already installed on different servers
  • Some websites have custom code included not present in the base version
  • I want to be able to easily update all the present and future websites when I improve the base app, without breaking some possible specific parts

Knowing it's a CakePHP app, what would you do? How should I change my code to manage at the same time the core and the specific code?

Thanks in advance!


... some controller classes have specific methods not present on the local version.

You might also consider the option of setting up additional class paths within each of your website applications. You can tell CakePHP to check other directories entirely for files missing from the current application. For example, you could have the following directory structure:

/app1 - a standard client's website application
/app2
/app3 - a custom client's website application (with custom controller)
/core - the core CMS application
/cake

By adding the following to your /appN/config/bootstrap.php files, you are telling CakePHP to look for controllers in /core/controllers if it can't find one it's looking for in the current application.

App::build(array(
    'controllers' => array(ROOT . DS . 'core' . DS . 'controllers' . DS),
));

This would, for example, allow you to put all your CMS controllers in /core/controllers and delete all your /appN/controllers directories. Only where a client needed a controller customized (ie. /app3 above) would you create a controllers directory, copy the specific controller across and make modifications (adding methods and such).

(This is the approach the developer of Wildflower CMS took - note the /wildflower directory.)


Using version control software (like SVN) would probably do the trick for you. Each website you work on could be a branch that follows the main branch of development. Every time you make a change that you want to apply to every site, you'd update the main branch and then have every sub branch import the changes from the main branch.

Mind you, I'm more used to how Git works, so this scenario might work better in Git than in SVN, ymmv.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜