Help adding CI3 compatibility to Flexi Auth |
Hi there,
I am trying to update flexi auth so it's compatible with CI3 https://github.com/haseydesign/flexi-auth I've gone through the process of upgrading as per the user guide (http://www.codeigniter.com/userguide3/in...ading.html) But I have run into the following error that I cannot fix the following error. Can anyone give me any ideas on how to fix this error. Guessing it's pretty simple, but since this is my first attempt at updating to 3.0 I am not sure. PHP Code: Severity: Error I'm pretty sure the original developer has moved on from CI, but I'd like to be able to upgrade an existing project using flexi auth to take advantage of some features in CI3. Any help greatly appreciated.
This appears to happen when the the 'Library Flexi_auth' tries to load another library 'Flexi_auth_lite' in order to extend it:
load_class('Flexi_auth_lite', 'libraries', FALSE); class Flexi_auth extends Flexi_auth_lite Many thanks, Tom
I couldn't tell from your reply if you had solved your issue. The only problem I've had with CI3 class loading compatibility is the class name and file name upper/lower casing.
Sorry -- No I have not solved the problem. I'm at a bit of a loss for the problem, everything else I've upgraded no problem.
I am not sure why the error is trying to load ‘CI_Flexi_auth_lite’ when the call is: load_class('Flexi_auth_lite', 'libraries', FALSE); Calling library is: File: Flexi_auth.php Code: load_class('Flexi_auth_lite', 'libraries', FALSE); class Flexi_auth extends Flexi_auth_lite{...} The file and class name for the file it should be loading are: File: Flexi_auth_lite.php Class: class Flexi_auth_lite(){...} Both are in the /application/libraries folder. Many thanks, Tom
Ok I found a fix, was how the library was being called, just needed to change
load_class('Flexi_auth_lite', 'libraries', FALSE); to $CI =& get_instance(); $CI->load->library('Flexi_auth_lite’); Unless anyone is aghast at the idea of doing that?
That is a normal way to do things.
If you use $CI a lot in your Library, then use PHP Code: $this->CI->load->library('Flexi_auth_lite’); and use the same pattern for all the other calls. Obviously the $CI variable must be a class variable to use $this. (11-14-2014, 08:52 AM)Chroma Wrote: That is a normal way to do things. Yes -- I am not sure why it was not like this to start - presumably it was a workaround for something in CI2.0
Are you going to fork this project with your changes, or have you already done so?
(11-16-2014, 09:57 PM)bclinton Wrote: Are you going to fork this project with your changes, or have you already done so? Sorry for the slow response. I actually have a slightly modified version for my project, but I just forked the standard project and will apply the fix to it there. Post the link once i'm done. Cheers, Tom (12-07-2014, 11:27 PM)mrtomtom Wrote:(11-16-2014, 09:57 PM)bclinton Wrote: Are you going to fork this project with your changes, or have you already done so? hi there any chance of getting the link to download this ? thanks |
Welcome Guest, Not a member yet? Register Sign In |