Hello List, I'm working on a central initialization file for SquirrelMail to get rid of the spaghetti we have to deal with now. The process contains multiple stages: 1) replacing all include/require_once calls to include() 2) moving php code outside functions (i.e. global.php and validate.php) to the central init.php file 3) shuffling functions between the files to reduce the amount of include calls 4) creating a dependency array and automate includes (see attached classes.php file from sm2) In order to make it work I started on replacing all include_once and require_once calls to include. Double includes trigger fatal errors so i could remove the require-/include_once call from the related file. Now all files that need to be included for every page load are in init.php. That means every other file that still includes one of the already included files will fail and need to be fixed. Stage 2 is where i'm working on. Some of it is already done, see attached init.php. About sm_include (step 4, this is the last stage because i want to have everything working first with only include calls. Making use of include_once and require_once is the lazy programmer way of dealing with includes. Using include helps us to bring back control over what we are actually doing. If we know what we are doing we can trying to reduce the amount of included code by evaluating the locations of current used functions. The good part about init.php is the fact that we can see what's actually going on and we reduce the amount of expensive require_once and include_once calls. The bad part is that it will break every third party plugin. However, those plugins will be easy to fix. The plugin just need to provide on which files it depends and with an sm_include call we check if the file is already included and if not we do the include. The only thing i didn't decided yet is if i'm going to commit this to 1.5.2 CVS or create a separate branch. Sooner or later the code will be commited to 1.5.2 CVS anyway so at this moment I think i should commit it a.s.a.p. to 1.5.2 because we just released a "stable" 1.5.1 version so it's not a big deal 1.5.2 CVS is less functional due to the reduced amount of working plugins. Regards, Marc Groot Koerkamp.
Sign up for the SourceForge newsletter:No, thanks