Upgrading cakephp 2.x to 3.x - cakephp

I'm trying to upgrade several of our cakephp 2 apps to cakephp 3 using the upgrade tool but I'm a little lost. On this blog, in one of the comments it says that my application will need a copy of cakephp 3 for the upgrade. Do I install it in the root directory of my app or where exactly?
Should the commands be run like this
bin/cake upgrade all /root_directory/
or
bin/cake upgrade all /root_directory/app/
Any help is appreciated.

Related

Upgrading CakePHP from 2.8.0 to 2.10.20

Currently, I have a live project in CakePHP 2.8.0 where PHP Version is 5.6.40.
I need to upgrade my CakePHP to the latest version. Can you suggest any new version that I should upgrade to without having many changes? Should I upgrade to 2.10.20 which is the 2019 release? Also, I don't want to change the PHP version which is 5.6.40 now.
Upgrades to CakePHP need to be done iteratively, ie. you'd need to cover everthing in the 2.9 migration guide before going through the 2.10 migration guide.
I'd suggest taking a copy of your code and installing the most recent version of CakePHP 2.10 for it and going through the CakePHP 2.9 Migration guide and then the CakePHP 2.10 Migration guide
Both 2.9 and 2.10 are compatible with PHP 5.6
After doing this, you can consider upgrading to CakePHP 3 which is a much bigger upgrade

Migrations in CakePHP 4 not working correctly?

I'm running a fresh install of CakePHP 4 and I'm trying to create an initial migration for the database. The migration itself is build correctly but the command fails to mark the migrations as done:
~/code$ bin/cake bake migration_snapshot Initial
Creating file /home/vagrant/code/config/Migrations/20200125204245_Initial.php
Wrote `/home/vagrant/code/config/Migrations/20200125204245_Initial.php`
Marking the migration 20200125204245_Initial as migrated...
Exception: Shell class for "Migrations" could not be found. If you are trying to use a plugin shell, that was loaded via $this->addPlugin(), you may need to update bin/cake.php to match https://github.com/cakephp/app/tree/master/bin/cake.php
In [/home/vagrant/code/vendor/cakephp/cakephp/src/Console/ShellDispatcher.php, line 332]
Since the migration is created successfully I'm pretty sure the plugin is installed correctly but somehow Bake can't access it?
The installed versions are:
CakePHP 4.0.2
CakePHP/Bake 2.0.4
CakePHP/Migrations 3.0.0-beta2
Apparently it's a bug and an issue has been created:
https://github.com/cakephp/bake/issues/638

ugprade cakephp 3 to latest version

i have cakephp3.3 windows and i need to upgrade to cakephp3.6. Checking the docs i see there is no tool available. Checking the migration guides i am not seeing any issues with my code in cake3.3 with newer versions.
Do i simply create a new instance of cake3.6 and create models,controllers again using bake and then copy over code to see if this works? what is an efficient way
The docs in cakephp are not clear on this process. do i upgrade to 3.4 then 3.5,3.6?
https://book.cakephp.org/3.0/en/appendices/3-x-migration-guide.html
Use composer.
For Windows, you can download it from here. After installation, locate composer.json file in your CakePHP application directory, and look for "require" part, and update line regarding CakePHP as follows:
"require": {
"php": ">=5.6",
"cakephp/cakephp": "3.6.*",
....
}
Then, in command line, navigate to your CakePHP installation directory and fire composer update. After a while you should have your CakePHP upgraded.
More info about updating to new version can be found in docs:
Keeping up to date with latest CakePHP changes
Another solution was given which was to install a new instance of cakephp and just copy over scr folder and other relevant code in the new instance. This is more work but the conversion from 3.3 to 3.6 isnt very clean with a composer update

upgrade cakephp from 2.3 to 2.5

I have a problem with some code and I found out that I have an older version of cakephp installed on the server I am using which is ver 2.3. I want to upgrade this version from 2.3 to cakephp ver 2.5 .I need to:
1) place new version in the lib/cake folder (overwrite?)
2) check migration guide for any function differences.
The advice given here was to simply refer to the migration guide but this guide says nothing about installing and mentions only upgrading from 2.4 which I don't even have?
I don't want a potential headache moving from 2.3 to 2.5.
http://book.cakephp.org/2.0/en/appendices/2-5-migration-guide.html

CakePHP question: How can i upgrade a cakephp project from cakephp-1.3.10 to cakephp-1.3.11?

I have developed a project with cakephp-1.3.10 .
Now I want to upgrade it to cakephp-1.3.11.
What's the easiest process to upgrade from cakephp-1.3.10 to cakephp-1.3.11 ?
download the cake zip, unpack, delete the app folder, put your app folder in.
I'm sure you can't use composer! And there's a high cost in upgrading by a large jump between versions, meaning that you will end up with a lot of deprecated code.
I would go like:
complete backup
upload your app to a Github repository
tag your code
create a new branch
upload your new code
debug
merge branch
since you were just upgrading from 1.3.10 to 1.3.11 the simplest way would have been to download latest cakephp and then simply copy lib/ folder from the downloaded folder and replacing it with your existing cakephp/lib/ folder. I would prefer to download latest version from cakephp's official website https://cakephp.org/
Note- If you have to upgrade from 1.x to 3.x then you have to move from 1.x to 2.x and then 2.x to 3.x, direct migration from 1.x to 3.x is not possible

Resources