Migrating from Cake 1.3 to 2.0 and beyond - migrate existing, or only use for new?

前端 未结 3 1078
执念已碎
执念已碎 2021-02-13 21:34

I\'m nearling completion of my first CakePHP-driven website and just saw they\'re already working on CakePHP 2.0 (not the stable release yet).

My questions:

相关标签:
3条回答
  • 2021-02-13 22:19

    I've migrated a few sites from CakePHP 1.2 to 1.3. In my experience, it takes 2-3 hours on sites that have 5-10 controllers and no custom plugins, etc. I find I typically only have to change the syntax on a handful of function calls, and when I figure out which ones, it is just a matter of doing a find / replace across the site. Of course it could be more of an issue going from 1.3 to 2.0, but I don't get the sense that it will be an especially drastic API change.

    UPDATE: I'm now in the process of migrating to CakePHP 2.0 beta, and thought I should update this, as I'm finding the updates are more extensive and far-reaching than I had assumed when I wrote this. Migration guide here: https://github.com/cakephp/docs/blob/master/en/appendices/2-0-migration-guide.rst

    ANOTHER UPDATE: Since people seem to be finding this useful, I just thought I'd point out that Cake now helpfully provides an upgrade shell that does some of the work for you. Note that although the documentation says it will do "most" of the work, I have found there are still quite a few function calls, etc. that will need to be updated manually (see migration guide). http://book2.cakephp.org/en/console-and-shells/upgrade-shell.html

    As dhofstet said, it will all depend on the size and complexity of your site.

    Whether you upgrade at all is usually a judgment call, but sometimes you have to (e.g. Cake 1.2 has some code that will break if your host upgrades to PHP 5.3). You certainly wouldn't have the kind of security issues that an old WordPress, Drupal, etc install would have. I have seen some noticeable speed increases with Cake upgrades, so depending on the situation it could be worth the trouble just for that (Cake 2.0 finally drops PHP 4 suppport). Look at the release notes and see if there are things that appeal to you in the new version.

    To see your version, in the cake/VERSION.txt file, look at the very last line. It's easy to miss, but it should just be a number, e.g. 1.3.8.

    0 讨论(0)
  • 2021-02-13 22:28
    1. This question is difficult to answer as it depends on the size and complexity of your project(s). The "big" releases (from 1.1 -> 1.2, 1.2 -> 1.3, 1.3 -> 2.0) usually break stuff and so you have to budget some migration work. The migration between "smaller" releases (for example from 1.3.9 to 1.3.10), on the other hand, is usually easy, often it just means to replace the cake folder. In both cases it is useful to have tests.
    2. I migrate the projects which are actively maintained.
    3. You can find the CakePHP version in cake/config/config.php
    0 讨论(0)
  • 2021-02-13 22:28

    I'm migrating an app 1.3»2.0rc1 right now and I got no big trouble.

    1. I had to change names of folder/files, eg. app_controller.php » Controller/AppController.php
    2. Follow the migration link (tmp link) http://book2.cakephp.org/en/appendices/2-0-migration-guide.html
    3. plugins/components/.. from various source won't work (at minus, for point 1)
    4. To update the code (which in my case wasn't needed as the app worked well) I've shell-baked a dummy table and looked at differences in code.. It's a good starting point
    5. Authentication/Authorization changed in some config, but requires few changes.
    6. Trees still working
    7. Acl don't. But I'm quite sure it's my fault.

    For now it's all, good work!

    0 讨论(0)
提交回复
热议问题