Upgrade tools for CakePHP meant to facilitate migrating from one version of the framework to another
PHP Other
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 83 commits ahead, 40 commits behind cakephp:master.
Latest commit f6342e5 Jun 15, 2018
Permalink
Failed to load latest commit information.
bin Docs. Dec 11, 2017
config Upgrade to 3.6. May 3, 2018
docs Add TableToEntity. Dec 12, 2017
src/Shell Fix CS. May 3, 2018
tests Fix test. Feb 14, 2018
.editorconfig Upgrade to Cake 3.4 Feb 6, 2017
.gitattributes Add test and make sure gitattributes are set. Sep 24, 2014
.gitignore gitignore Feb 18, 2017
.travis.yml Update .travis.yml Dec 10, 2017
LICENSE Rename LICENSE.md to LICENSE May 3, 2018
README.md add rector info Jun 14, 2018
composer.json Update lock. Jun 14, 2018
composer.lock Update lock. Jun 14, 2018
phpunit.xml.dist Upgrade to 3.6. May 3, 2018

README.md

CakePHP Upgrade tool

Build Status Software License

Upgrade tool as standalone application for CakePHP meant to facilitate migrating from CakePHP 2.x to 3.x.

It also supports the minor upgrades in 3.x - up until currently 3.6+.

Warning This tool is still under development and doesn't handle all aspects of migrating.


Info Please look into this article for Upgrading applications for 3.6+. The new tool rector seems to be very promising.


Note: When migrating from 1.x to 2.x you might want to look in the old cakephp-upgrade plugin instead.

Installation

This plugin is standalone. Do not try to mix this with your existing app. Instead, put it somewhere completely separate from it. Best to clone it (git clone ....).

After downloading/cloning the upgrade tool, you need to install dependencies with composer

php composer.phar install

Once dependencies are installed you can start using the upgrade shell.

IMPORTANT NOTICE

This tool is a split-off off the original CakePHP upgrade tool and provides additional fixers:

  • Templates
  • Url
  • Locale (fixing locale files)
  • Model to Table (making the model files to Table class files)
  • FixtureLoading
  • Custom (tons of custom fixes)

Feel free to manually port those things back into the core one.

Usage

The upgrade tool provides a standalone application that can be used to upgrade other applications or cakephp plugins. Each of the subcommands accepts a path that points to the application you want to upgrade.

cd /path/to/upgrade
bin/cake upgrade all /home/mark/Sites/my-app
bin/cake upgrade skeleton /home/mark/Sites/my-app

The first command would run all the tasks at once on /home/mark/Sites/my-app, which is probably the way most people will want to use it. Additionally the second command would run the skeleton task on /home/mark/Sites/my-app. This command is not included in all as it is only necessary for apps. Plugins don't need it.

For plugins, point it to the root and use the -p plugin syntax:

// Upgrading 2.x /home/mark/Sites/my-app/Plugin/MyPlugin/ 
bin/cake upgrade all -p MyPlugin /home/mark/Sites/my-app

It is recommended that you keep your application in version control, and keep backups of before using the upgrade tool.

Order matters

Several of the commands have dependencies on each other and should be run in a specific order. It is recommended that you run the following commands first before using other commands:

bin/cake upgrade locations [path]
bin/cake upgrade namespaces [path]
bin/cake upgrade app_uses [path]

Once these three commands have been run, you can use the other commands in any order. The all command already used the right order by default.

Tasks Available

For detailed task descriptions and usage see docs.

Also note the wiki with more recent tips.

Using Tagged Releases

For simplicity the tool uses the latest dev-master branches of framework and app repos (or you can get there using composer update). If you want to use the stable releases instead, just switch those in the composer.json and then run composer update again.