BIP KB:
How to Update CodeIgniter 2.x to 3.x

Article By bruno01


img

Update CodeIgniter VPS

Update CodeIgniter..

CodeIgniter is a powerful PHP framework with a very small footprint, built for developers who need a simple and elegant toolkit to create full-featured web applications.

1: Overwrite SDK files

You need the updated CodeIgniter files from the system/ directory. To do so, you can't simply copy/paste the folder. You will need to remove it (it would be a good idea to first do a backup just in case) and then copy the new one to the same destination.

2: Update Classes Names

For this step all you have to do is to rename the CodeIgniter files inside the application/libraries, application/controllers and application/models so they are Ucfirst. This is easy. All you have to do make the first letter capital for each word or each first letter after an underscore. Let's see some examples so you understand it better:

- application/libraries/library ~> application/libraries/Library - application/controllers/Email_controller ~> application/libraries/Email_Controller So you see this is quite easy, let's follow to the next step.

3: Replace config/mimes.php

This is self-explaining, just remove the older one and copy the new one from your 3.x folder to your old 2.x CI project folder.

4: $autoload['core'] Deprecated

Find and change any reference to $autoload['core'] to $autoload['libraries']. This is deprecated from several versions ago.

5: Logs are now in Core

If you have any log extensions you will have to move them from the libraries to the core in order for it to work. Just put them in the application/core folder and it should be fine.

6: Update Session Library Usage

This step is a little more tedious but still needed, so let's get this done. There's a list of tweaks you should make. - If you weren't using $config['sess_use_database'] in which case the value should be 'database' set the $config['sess_driver'] to the default 'files'. - Set a $config['sess_save_path'] value. - Only if you're using the 'database' driver you need to update your ci_sessions table as well and the changes are as following:

- session_id field renamed to id
- user_agent field dropped
- user_data renamed to data and under MySQL is now of type BLOB
- last_activity field is now named timestamp

- All of this is accompanied by these slight changes in the table indexes as well:

- Remove $config['sess_match_useragent']
- Remove $config['sess_encrypt_cookie']
- Remove $config['sess_expire_on_close']

- Finally move any session extensions to the application/libraries/Session folder

7: Update DB Config

Inside the config/database.php rename $active_record to $query_builder.

Conclusion

Well, apart from the things detailed above you will have to learn about the changes made in the API. So there are some functions that work a little bit different right now and you should learn about them in the CI web page. That's it!, It's not that hard after all. Kind regards, I hope this tutorial was just what you were waiting for. Check out all the other great tutorials at the CLC Community Learning Center.




Tags: , , , , , , , , ,

Spin up a VPS server in no time flat

Simple setup. Full root access. Straightforward pricing.

DEPLOY VPS SERVER

Leave a Reply



Feedbacks