从 Cake 1.3 迁移到 2.0 及更高版本 - 迁移现有的,还是仅用于新的? [英] Migrating from Cake 1.3 to 2.0 and beyond - migrate existing, or only use for new?

查看:31
本文介绍了从 Cake 1.3 迁移到 2.0 及更高版本 - 迁移现有的,还是仅用于新的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一个 CakePHP 驱动的网站即将完成,刚刚看到他们已经在开发 CakePHP 2.0(还不是稳定版本).

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).

我的问题:

  • 迁移到新版本的 CakePHP(当它成为稳定"版本时)会非常耗时吗?我知道他们有迁移指南,但是 - 我以前从未使用过框架,所以我从来不需要迁移任何东西.

  • Is it incredibly time consuming to move to a new version of CakePHP (when it becomes the "stable" release that is)? I know they have migration guides, but - I've never used a framework before, so I've never had to migrate anything.

您是为现有项目迁移代码,还是保持原样并仅将新的稳定版本用于未来的项目?

Do you migrate your code for existing projects, or leave it as is and use the new stable version for future projects only?

在哪里可以找到我目前安装的 CakePHP 版本?我查看了 LICENSE 和 VERSION 文件,但找不到其中列出的已安装/当前版本.

Where can I find what version of CakePHP I currently have installed? I've looked at the LICENCE and VERSION files, but cannot find the installed/current version listed in them.

这些看似简单的问题,但我非常感谢任何想法/建议 - 在 Google 上搜索此内容只会显示如何迁移页面,而不是优点/缺点......等等.

These seem like simple questions, but I greatly appreciate any thoughts/advice - searching this on Google just brings up how-to-migrate pages, not pros/cons...etc.

推荐答案

我已经将一些网站从 CakePHP 1.2 迁移到 1.3.根据我的经验,在有 5-10 个控制器且没有自定义插件等的网站上需要 2-3 个小时.我发现我通常只需要更改少数函数调用的语法,当我弄清楚哪些函数调用时,这只是在整个站点上进行查找/替换的问题.当然,从 1.3 到 2.0 可能会成为一个更大的问题,但我不认为这将是一个特别剧烈的 API 更改.

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.

更新:我现在正在迁移到 CakePHP 2.0 测试版,并认为我应该更新它,因为我发现更新比我之前更广泛和深远我写这篇文章时假设的.此处的迁移指南:https://github.com/cakephp/docs/blob/master/en/appendices/2-0-migration-guide.rst

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

另一个更新:由于人们似乎发现这很有用,我只是想指出,Cake 现在提供了一个升级外壳,可以为您完成一些工作.请注意,尽管文档说它将完成大部分"工作,但我发现仍有相当多的函数调用等需要手动更新(请参阅迁移指南).http://book2.cakephp.org/en/console-and-shells/upgrade-shell.html

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

正如 dhofstet 所说,这完全取决于您网站的规模和复杂程度.

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

您是否升级通常是一个判断电话,但有时您必须这样做(例如,如果您的主机升级到 PHP 5.3,Cake 1.2 有一些代码会中断).您当然不会遇到旧的 WordPress、Drupal 等安装会遇到的那种安全问题.我已经看到随着 Cake 升级的一些明显的速度提升,所以根据具体情况,仅仅为此付出一些麻烦是值得的(Cake 2.0 最终放弃了 PHP 4 支持).查看发行说明,看看新版本中是否有吸引您的地方.

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.

要查看您的版本,请在 cake/VERSION.txt 文件中查看最后一行.这很容易错过,但它应该只是一个数字,例如1.3.8.

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.

这篇关于从 Cake 1.3 迁移到 2.0 及更高版本 - 迁移现有的,还是仅用于新的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆