upgrade yii from 2.0.4 to 2.0.6

How to upgrade Yii2 to the latest version? read on…

$ wget https://github.com/yiisoft/yii2/releases/download/2.0.6/yii-advanced-app-2.0.6.tgz
$ tar xvfz yii-advanced-app-2.0.6.tgz
$ mv advanced advanced.2.0.6
# we cd to the ‘advanced’ directory and do rsync later with . instead of advanced/* as * wont expand to include hidden file like .gitignore etc.
$ cd advanced.2.0.6
$ rsync -av –dry-run . /opt/php/html/
#and look at the dry-run output to estimate any risk etc.

$ rsync -av . /opt/php/html/
$ cd /opt/php/html/
$ git status

# check for any changes we want to merge back, e.g. .gitignore updates
# we want to reserve changes we made before for frontend/web/.gitignore
[root@dev html]# git diff frontend/web/.gitignore
diff –git a/frontend/web/.gitignore b/frontend/web/.gitignore
index 8d89329..25c74e6 100644
— a/frontend/web/.gitignore
+++ b/frontend/web/.gitignore
@@ -1,4 +1,2 @@
/index.php
/index-test.php
-/p_images

# we changed powered by and company info, we want to merge back related changes
$ git log -g –grep=”powered”
$ git show f4e9310b53e0345774f8ff43ae6fc40edf51aa90
# or we can change ‘vendor/yiisoft/yii2/BaseYii.php’ to override the Yii::Powered function too

# check for untracked changes and add them
$ git add common

#if there are other changes we dont want to check in yet (e.g. integration folder), add yii upgrade related only
$ git add tests init frontend environments console composer.lock composer.json backend README.md

$ git commit -m ‘Yii 2 upgrade from 2.0.4 to 2.0.6’
$ git push
$ git pull –rebase

$ chown nobody.nobody /opt/php/html/frontend/web/assets
$ chown nobody.nobody /opt/php/html/backend/web/assets

#change yii for the following line
#!/usr/bin/env php
to
#!/usr/bin/env myphp

######################################
# log to upgrade to 2.0.4 from 2.0.3 #
######################################
$ wget https://github.com/yiisoft/yii2/releases/download/2.0.4/yii-advanced-app-2.0.4.tgz
$ tar xvfz yii-advanced-app-2.0.4.tgz
# we cd to the ‘advanced’ directory and do rsync later with . instead of advanced/* as * wont expand to include hidden file like .gitignore etc.
$ cd advanced
$ rsync -av –dry-run . /opt/php/html/
$ cd /opt/php/html/
$ git status

# check for any changes we want to merge back, e.g. .gitignore updates
# we want to reserve changes we made before for frontend/web/.gitignore

$ git commit -a
$ git push
$ git pull –rebase

$ chown nobody.nobody /opt/php/html/frontend/web/assets
$ chown nobody.nobody /opt/php/html/backend/web/assets

#change yii for the following line
#!/usr/bin/env php
to
#!/usr/bin/env myphp

Leave a Reply

Your email address will not be published. Required fields are marked *

4 × 2 =