phpgroupware-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Phpgroupware-developers] Discussion: include/require stateme nts


From: Dave Hall
Subject: RE: [Phpgroupware-developers] Discussion: include/require stateme nts
Date: Tue, 10 May 2005 21:45:53 +1000

On Tue, 2005-05-10 at 12:57 +0200, Kai Hofmann wrote: 
> > > When making API calls this is surely the best way. But at 
> > the same time
> > > createObject/ExecMethod create the biggest overhead we have 
> > as I know from
> > > performance analyses.
> > 
> > Where is the data to support the claim?
> 
> Its in a non-GPL closed source tool called Zend Studio - but I can make
> a Screenshot if you like.

Post it somewhere for everyone to look at.

> 
> > createObject sits on top of this.  It deals with some of the issues
> > created by php.  Import in Java and C# (2 languages I have experience
> > with) are path aware.  If we want to go down this road within phpgw I
> > would suggest that the header.inc.php does a ini_set for include_path.
> > Then you can also have problems where a user wants the API 
> > class an gets
> > the app file with the same name of vise versa
> 
> When you are using this only within a "closed" module like an application
> or the api itself, this is no problem.

I don't understand what you mean here.  To me it sounds like you are
contradicting yourself.

> 
> > > 2. You can easily see the dependencies of a source file 
> > very quickly, when
> > > the
> > >    require statements are placed near the head of the file.
> > > 3. Each source file itself knows which dependencies it has, 
> > so only required
> > >    files will be loaded at runtime.
> > >    (This is important, because at the moment we load often 
> > a lot of things
> > > that
> > >    are not required - which costs performance)
> > > 
> > 
> > Examples?
> 
> The already known example is the data load of translations that
> will not be used. After this has been fixed better performance analysis
> could be done to find out the other bottlenecks.

Yes the performance hit from translations is something that needs to be
fixed.  Are you offering to fix it?

> 
> > As I mentioned in my previous post Not true - require triggers a fatal
> > error http://php.net/phpdevel-errors#internal.e-error
> > 
> > It dies at that point
> 
> And that is exacly what should happen, when the installation
> is incomplete. When including modules etc. you run a
> "module scanner" first, so that you know which files are there
> before including them. - So no errors

That is what we have the setup app for.  Again you have cut the relevant
part of the post out.  The point is to run some basic checks using
include_once in the header and setup to make sure the install is setup
properly.  If it isn't then we present a clear error to the user, no
something like

Which is more useful for a user

<quote src="require_once">
Warning: main('deleted-file.php'): failed to open stream: No such file
or directory in /path/to/script.php on line X

Fatal error: main(): Failed opening required
'deleted-file.php' (include_path='.:/usr/share/php:/usr/share/pear')
in /path/to/script.php on line X
</quote>

<quote src="modified_example">
your install is fux0r, contact your sysadmin
<!-- of course the real version would be nicer -->
</quote>

I don't think an end user you ever be presented with a raw php error.

Cheers

Dave






reply via email to

[Prev in Thread] Current Thread [Next in Thread]