Extending the session library (3.0.6) |
I believe your problem might be because Session is now a driver http://www.codeigniter.com/user_guide/li...on-drivers. In order to extend a driver you create another "driver" file for it based on the SessionHandlerInterface.php http://www.codeigniter.com/user_guide/li...om-drivers. If this is a old session library and you feel it's better than the new session drivers you will need to add the missing methods (the one's you didn't extend) from the old session library. Add the new 3.x session methods. rename it (like spjonez_session) and then load it like a regular library instead of the driver but, call it session (third param $object_name) http://www.codeigniter.com/user_guide/li...r::library.
(04-10-2016, 05:50 PM)dmyers Wrote: I believe your problem might be because Session is now a driver http://www.codeigniter.com/user_guide/li...on-drivers. In order to extend a driver you create another "driver" file for it based on the SessionHandlerInterface.php http://www.codeigniter.com/user_guide/li...om-drivers. If this is a old session library and you feel it's better than the new session drivers you will need to add the missing methods (the one's you didn't extend) from the old session library. Add the new 3.x session methods. rename it (like spjonez_session) and then load it like a regular library instead of the driver but, call it session (third param $object_name) http://www.codeigniter.com/user_guide/li...r::library. No, it is NOT a "driver"!
Sorry the only reason I thought it was a driver is because it's called a driver multiple times in the documentation
http://www.codeigniter.com/user_guide/li...om-drivers it says: "Custom Drivers" "You may also create your own, custom session drivers." "when creating a session driver for CodeIgniter" "Put your driver’s file under application/libraries/Session/drivers/" "For example, if you were to create a ‘dummy’ driver, you would have a Session_dummy_driver" "Extend the CI_Session_driver class." "So, based on our ‘dummy’ driver example above"
These quotes refer to creating session drivers, in the sense of what the term "driver" means.
They are not calling the session library itself a "driver", and certainly not in the sense of it using CI_Driver_Library (which you've linked to), because that's not the case. And either way, that's not why the OP is unable to extend it.
The OP's problem was just a guess for which I was trying to help with.
While I know your very busy with CodeIgniter and all unfortunately "No, it is NOT a "driver"!" isn't very descriptive. Thank you for your clarification, had you responded with that originally you would have saved yourself from having to add another post and therefore take even more time. (04-12-2016, 10:26 AM)dmyers Wrote: The OP's problem was just a guess for which I was trying to help with. I couldn't possibly reply with that originally, simply because I didn't know why you were calling it a "driver".
I am autoloading as a 'library', yes it was a driver back in the 3-dev branch but it's been a library since release.
Back to the original question, how can this be done?
The extension file must match the location of the stock CI file (relative to application/ and system/ respectively, of course).
Or in your case, it has to be under application/libraries/Session/. On another note, I saw you wrote "3.06" in another thread title ... That is not the same thing as 3.0.6, please don't omit the dot.
Oh my what a silly mistake. Thanks!
I'll update both of my posts to include the correct version number. |
Welcome Guest, Not a member yet? Register Sign In |