Welcome Guest, Not a member yet? Register   Sign In
Extending the session library (3.0.6)
#1

(This post was last modified: 04-14-2016, 12:16 PM by spjonez.)

The usual method of creating a MY_Session.php file doesn't work. Can this be done and if so what is the preferred method?
Reply
#2

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.
Reply
#3

(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"!
Reply
#4

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"
Reply
#5

(This post was last modified: 04-11-2016, 10:45 PM by Narf.)

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.
Reply
#6

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.
Reply
#7

(04-12-2016, 10:26 AM)dmyers Wrote: 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.

I couldn't possibly reply with that originally, simply because I didn't know why you were calling it a "driver".
Reply
#8

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?
Reply
#9

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. Smile
Reply
#10

Oh my what a silly mistake. Thanks!

I'll update both of my posts to include the correct version number.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB