Re: Overriding libraries
Bharat Mediratta <[email protected]>
| Newsgroups | gmane.comp.web.gallery.devel |
|---|---|
| Message-ID | <CAESa+_mfSNnqDFb7cR-=6n8Zz25-OBeTQNBJKDphwY6vvhaWng@mail.gmail.com> |
You can't override Input.php in a module because of the way that we start up the system. We specify certain modules that we know we're going to load in application/config/config.php in the $config['modules'] setting. Kohana loads those modules, then does its bootstrapping which loads Input - at that time it looks for overrides across all modules. Later on, we look in the db to see which modules you have activated and load those up as well. Net of all this is that your module is loaded too late to overload that particular class. :-/ As the system is currently, you can't have two MY_xxx overrides. It'll find one and use it. We could wire up a second level of overrides without too much difficulty but we'd have to decide on a nomenclature that makes sense and it'd be an API change (backwards compatible, but older versions wouldn't be able to use it). You could try overriding xss_clean in MY_Input.php and have it get a module var to see whether or not it should do the cleaning - then you can set that module var elsewhere... On Sun, Apr 15, 2012 at 8:53 PM, Dave Moore <[email protected]> wrote: > I'm trying to write a module that will loosen some of the restrictions > from the kohana library Input.php > gallery3/system/libraries/Input.php > I see the gallery module overrides Input.php with: > gallery3/modules/libraries/MY_Input.php > > In troubleshooting I have added a > echo("test"); > to the function in gallery3/modules/libraries/MY_Input.php and that works. > So I know that function is overriding the > gallery3/system/libraries/Input.php So far so good. > > I remove gallery3/modules/libraries/MY_Input.php and place it in my > modules libraries directory and and activate my module and it does not > work. > gallery3/modules/floridave/libraries/MY_Input.php > Why does this not work in the floridave module but does in the gallery > module? > Is there additional code required other than extending the class and > renaming the file with MY_ prefix? > > Next question is can there be 2 MY_Input.php files that are read and > used by the cascading kohana magic? > > Cheers! > Dave > > > ------------------------------------------------------------------------------ > For Developers, A Lot Can Happen In A Second. > Boundary is the first to Know...and Tell You. > Monitor Your Applications in Ultra-Fine Resolution. Try it FREE! > http://p.sf.net/sfu/Boundary-d2dvs2 > __[ g a l l e r y - d e v e l ]_________________________ > > [ list info/archive --> http://gallery.sf.net/lists.php ] > [ gallery info/FAQ/download --> http://gallery.sf.net ] > > ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev __[ g a l l e r y - d e v e l ]_________________________ [ list info/archive --> http://gallery.sf.net/lists.php ] [ gallery info/FAQ/download --> http://gallery.sf.net ]