Sunday, March 3, 2013

cakephp 1.3 migration to 2.3.1

I decided to migrate one of my apps (one of the easiest) from cakephp 1.3 to 2.3.1

Although the cakaphp upgrade shell is magnificent upgrading my code, it doesn't to all (obviously).

Problems I encountered:


  • upgrading plugins
    • I was lucky I think all my plugins had a 2.x branch
  • One to manually upgrade webroot/index.php file
  • One has to manually merge Config/core.php file with your old one
  • Im 1.3 I used $this->view = 'MyView'  in app_controller to use my own view class. This changed to $this->viewClass
  • I also had to update my legacy code.
    • That is to change some things from 1.2 style to 1.3 style... which was already compatble with 2.3.1 !
      • that included basically changing
        • $this->Javascript->link to $this->Html->script
        • $this->Javascript->codeBlock to $this->Html->scriptBlock
        • $this->Javascript->object to $this->JsBaseEngine->object
        • this was easily done with find && sed:
find . -type f -exec sed -i -e "s/Javascript->link/Html->script/g" {} \;
find . -type f -exec sed -i -e "s/Javascript->codeBlock/Html->scriptBlock/g" {} \;
find . -type f -exec sed -i -e "s/Javascript->link/Html->script/g" {} \;

No comments:

Post a Comment

cancel script completely on ctrl-c

I found this question interesting: basically how to cancel completely a script and all child processes : You do this by creating a subro...