CodeIgniter Forums

Full Version: Can I replace the system/database directory of version 3.1 into version 2.2?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
One of my projects is using CI 2.2.
And I want to use the PDO driver.
But I don't want to upgrade to 3.1.
If I only replace the system/database directory using 3.1, can it work well?

Thanks.

ps: replace the whole system/database directory
Sorry, but that won't work. There are too many other differences in the database driver structure between CI2 and CI3.
(09-20-2016, 07:57 AM)ciadmin Wrote: [ -> ]Sorry, but that won't work. There are too many other differences in the database driver structure between CI2 and CI3.

I tried it.
It seems work. 
mysqli and pdo both works.

Huh Exclamation

I think I should check the source codes in system/database carefully.
Hmm - that is unexpected. The database drivers could be more decoupled from the other CI3 components than I thought!
The most significant changes to the database library were internal or in the form of additions to the API, so most things will probably work. The big issue is that it's an untested combination, and you'll probably find that any issues you do have will be difficult to troubleshoot, hard to track down, and definitely unsupported. You'll also still have most of the security issues in CI2 to worry about.

It's actually pretty amazing how many of the CI3 components can be swapped into CI2 with very few issues, but it requires a lot more attention to detail than just upgrading the whole thing at once.
(09-26-2016, 01:14 PM)mwhitney Wrote: [ -> ]The most significant changes to the database library were internal or in the form of additions to the API, so most things will probably work. The big issue is that it's an untested combination, and you'll probably find that any issues you do have will be difficult to troubleshoot, hard to track down, and definitely unsupported. You'll also still have most of the security issues in CI2 to worry about.

It's actually pretty amazing how many of the CI3 components can be swapped into CI2 with very few issues, but it requires a lot more attention to detail than just upgrading the whole thing at once.

Thanks for your reply.
Here's a question: Why?
You are a cowboy! Smile
(09-27-2016, 12:21 AM)Narf Wrote: [ -> ]Here's a question: Why?

When I was running 2.x, it was helpful to use pieces of 3.x to patch the system, since a lot of things weren't back-ported. However, that was when 2.x was still somewhat supported.

Now, I'd say it's good if the intention is to move the site to 3.x. However, if it's just to pull some features from 3.x, it's definitely a bad idea. This long after end of life, anyone working on a 2.x site should be spending most of their development time on that site moving it to 3.x.