Upgrading from 1.2

I recently inherited a web-based app build with CakePHP 1.2. The first thing I’m trying to do with it is get it up-to-date with all the most recent versions of CakePHP, PHP, MySQL, etc. In my test environment, I’ve now got it running (apparently) fine with PHP 5.6 and MySQL 5.6.

So far, what I’ve learned about upgrading CakePHP is that it needs to go first from 1.2 to 1.3, then 2.x and 3.x successively.

I have found and read (numerous times) the “Migrating from CakePHP 1.2 to 1.3” guide, and am nothing but confused. What I gather from that is, the process involves replacing only 3 files (webroot/index.php, (webroot?)/config/core.php, and webroot/test.php), then re-writing app code that makes calls to deprecated functions? Am I getting this right, or is there another, more universal and comprehensive upgrade guide that includes a little more context to this procedure that I haven’t found yet?

I tried replacing the 3 files, and ended up with a firestorm of errors from files in …/cake/libs and other that were not replaced, complaining about deprecated usages.

Um… help? :scream:

Re-write in Cake3. We recently upgraded our app from 2x to 3x. 3x is a new architecture altogether… Bye bye arrays and welcome objects :slight_smile: combine with hhvm or php7… which makes it ridiculously faster!!!

Upgrading our 8k LOC code took nearly 50 hours combined (all devs) but was it worth? Absolutely YES!

Bottomline: Learn the Cake3 stuff and then upgrade - one controller at a time.

I use Sublime Text 3, which made my work twice as fast (as compared to my colleague who uses Netbeans)…

Happy upgrading :slight_smile:

1 Like

I agree with @karmicdice. Upgrading form 1.2 to 3 by “step by step way” would be too much effort, even more than rewrite it from scratch. And rewrite means review, so you will end up with something much more better.

I have a medium size project (an online accounting system) born at 1.2. I updated to 2 when it came out, and I am working on upgrading to 3 now. In my case I have unit tests which are great help in this situation. Still there are a lot of change in 3, so it is a work.

1 Like

Yes, I would also be very surprised if there was a simple way to upgrade CakePHP apps. Real-world apps are usually far too “dirty” to be upgraded with a mere migration script or guideline; There’s ultimately little difference between an upgrade and a rewrite.

So I think it’s important to realize that a big upgrade is equal to a complete rewrite and consider if it’s worth the effort.

All I can say is that after using CakePHP 3 for a few months, I believe it’s MUCH better than v2 in practically every way. However, if 1.2 was enough and the website as it currently is works just fine, there’s no real reason to upgrade. CakePHP is a framework and not a CMS, so if some particular feature is lacking you can always just write it yourself…

It’s not really some particular feature that makes Cake3 better than the previous versions, but rather the new overall architecture. This of course also means that if you’re comfortable with the < 2 versions, it’ll take time to get used to 3.