[isf-wifidog] CVS Commit report

Rob Janes janes.rob at gmail.com
Mer 4 Jan 11:12:11 EST 2006


apropo, I added some functions to common.php to help navigation. 
common.phpis supposed to be standalone (no dependencies but for
config.php), and common.php needs to find it's bootstrap files.  So, any
navigation aids need to be in common.php itself.  Rather than making them
private (prepending underscore) since I thought they might be more generally
useful, I prepended "cmn" to their names so they could be used outside of
common.php without namespace collision.

I replaced the require_once(xxx config.php) at the top of common.php with
cmnRequireConfig(), which goes up through the parent directories looking for
config.php, and when it finds it, it require_onces it.

cmnHomeDir() - returns what used to be the BASEPATH.

cmnSearchParentDirectories($dirname, $searchfor), as in
cmnSearchParentDirectories(dirname(__FILE__), 'config.php')
- finds config.php at or above the current running file.

cmnSearchParentDirectories(dirname(__FILE__), 'include/common.php')
- finds common.php

cmnRequirePackage($rel_path, $private=false) - require_once on a file name.
cmnIncludePackage($rel_path, $private=false) - include_once on a file name.
Not sure how useful these are now that the base directory is prepended to
the system path list (thanks max!).

-rob

On 1/4/06, Max Horváth <max.horvath at maxspot.de> wrote:
>
> >> It's not broken,
> >> See in config.php, SYSTEM_PATH is the new name.
> >> Then in common.php there is a set_include_path() that adds the
> >> SYSTEM_PATH
> >>
> >> thus, it does exactly the same as before, but without needing to
> >> prepend BASEPATH on the require lines ....
>
> SYSTEM_PATH did always exist ...
>
> > Ok, I stand corrected, my apologies.  I misunderstood what Max was
> > trying to
> > do.  I tought he was trying to complete the removal of SYSTEM_PATH
> > from the
> > config file.  To prove that I am a good sport I checked in the
> > change to
> > complete autodetection of paths.  There is now one less configuration
> > directive to worry about.
>
> Nice feature.
>
> But I hope that those new functions won't cost us much speed. When
> profiling WiFiDog code I saw that including alll of our files costs a
> quite huge amount of time. Now with all those array functions I hope
> we won't more speed (PHPs array functions are quite slow) ...
>
> > As the BASEPATH change itself, we now we have confusing pearls like:
> > require_once('../include/common.php');
> > require_once('include/common_interface.php');
> > (Taken from portal/index.php).  Yep, you were supposed to figure
> > out that
> > common.php and common_interface.php are actually in the SAME
> > directory.
>
> Well - it makes sense ...
>
> The first require_once is used to include common.php which defines
> the base path of our WiFiDog installation.
>
> After that no script has to think about where the rest of the files
> are located ... so you don't have to use anything like '../include/
> common_interface.php' anymore.
>
> Take a look at the source. You'll see that only /include/common.php
> and admin/admin_common.php get included like this.
>
> And it's just the way that one file has to be called like this - and
> it shouldn't be confusing, because no other files have to be called
> like this.
>
> Cheers, Max!
>
>
>
> _______________________________________________
> WiFiDog mailing list
> WiFiDog at listes.ilesansfil.org
> http://listes.ilesansfil.org/cgi-bin/mailman/listinfo/wifidog
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listes.ilesansfil.org/pipermail/wifidog/attachments/20060104/58c99fe0/attachment.htm


More information about the WiFiDog mailing list