Updating to latest version of Yii

I have several Yii sites built on version 1.1.6. It is worth the effort to update those sites to the latest version of Yii? If so, what is the best way to do so?

Thanks!

In my humble opinion the best way of switching between Yii versions is through serving the framework from a symlinked directory. This way you simply change the symlink to point to another source folder and immediately all websites are using updated framework version. In case you observe some issues, you simply change the symlink back to previous source.

In case you run into any issues, you should also look into the UPGRADE file, which has information about changes between versions.

I updated yii on my app to the latest because there was a new method added to a class I wanted to use. I probably wouldn’t have done so if I didn’t want to use the new function. I followed a guide for installing multiple Yii versions on the same site so you can easily switch between the two. I highly recommend doing this.

I can’t find the guide, but you basically create a folder called /yii which contains your different Yii versions. You end up with something like:

mysite.com/yii/1.1.11/

You drop the framework folder into the version number.

Then you change the Yii bootstrap index.php page to point to the core you want:

mysite.com/index.php


$yii=dirname(__FILE__).'/../yii/1.1.11/framework/yii.php';

Then, whenever you install a new Yii version to /yii/, you only need to change the index.php file to point to the new version. This is helpful if a new version breaks your site and you need to revert back, or you want to test.

You could also use yii as a git submodule and check it out at the wanted tag. This way you could also verify your app against the latest changed on master.

Thanks for all of your replies.

If my all sites run well as they are, is there a benefit to updating?

And Just so I’m sure I understand, in the most basic terms all I have to do to update is replace the framework folder with the new one?

Thanks again.

I think that upgrading is necessary to provide security. Like you install upgrades in windows/linux/etc you should also do with programming libraries and frameworks.

New versions not only extend and provide new functionalities but also tighten security, remove holes, etc. Mature maintenance procedures should involve periodical upgrades. Of course this means lots of regression tests every time but I think it is worth it…