问题
I'm trying to convert 100 models + several hundred controllers & views from cakephp 2.6.7 to cakephp 3.0.7.
I've tried the following with the upgrade shell tool:
- download the zip file
- place into project main folder (i.e. same folder that cake 2.6.7 app resides)
- php composer.phar install
- composer upgrade all. This installs all of cakePHP 3.0
Then the docs leave me with lots of questions...
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
bin/cake upgrade locations [path]
bin/cake upgrade namespaces [path]
bin/cake upgrade app_uses [path]
First... I'm already in E:\my-app !
Second... After running a "cake upgrade locations E:\my-app" (the first task command) Nothing is modified and no files are moved. In fact if I run each of the commands listed in the documentation and never use the "all" command, the \src folder is almost empty. It does contain a Templates folder!
The \app folder still has all the Controllers, Views, Models.
There are not Tables, Entities, etc.
I could use a little hint as to what I need to see differently. Any assistance would be greatly appreciated.
回答1:
First things first, the upgrade shell is a standalone application, and you should install it separately, that is, in a separate folder (for example E:\cakephp-upgrade\
), not in your project folder! Also when using the all
command, it should not be necessary to run the individual commands again, it would render the all
command pretty useless if you'd have to do that.
That being said, the problem with the non-moved files stems from two issues
The path passed to the upgrade shell must end with a directory separator, otherwise the shell will use double separators at some point, because a separator is left in the path when the root is being stripped from it (https://github.com/cakephp/upgrade/issues/89).
When not using GIT, and files need to be moved as well as changed, then the files are not being written to the proper target path, but to the source path (https://github.com/cakephp/upgrade/issues/90).
Please report this as an issue over at GitHub.
Unfortuantely the GIT usage seems to be buggy too (https://github.com/cakephp/upgrade/issues/88), but I'm too lazy to trace this down right now. So until this is all fixed, you should be able workaround these issues by running all the commands manually, that way the files are being moved first, which seems to work fine.
So, assuming that the upgrade app is installed in E:\cakephp-upgrade\
, and your project is in E:\my-app
, then you'd do
E:
cd cakephp-upgrade
bin\cake upgrade locations E:\my-app\
bin\cake upgrade namespaces E:\my-app\
bin\cake upgrade app_uses E:\my-app\
bin\cake upgrade rename_classes E:\my-app\
bin\cake upgrade rename_collections E:\my-app\
bin\cake upgrade method_names E:\my-app\
bin\cake upgrade method_signatures E:\my-app\
bin\cake upgrade fixtures E:\my-app\
bin\cake upgrade tests E:\my-app\
bin\cake upgrade i18n E:\my-app\
bin\cake upgrade prefixed_templates E:\my-app\
bin\cake upgrade skeleton E:\my-app\
来源:https://stackoverflow.com/questions/31214440/cakephp-3-0-upgrade-tool-trouble-understanding-docs-install-tool-where-fol