[drupal-devel] [bug] Do not execute functions in include files

adrian drupal-devel at drupal.org
Sun Mar 27 06:56:00 UTC 2005


Issue status update for http://drupal.org/node/18213

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  killes at www.drop.org
 Updated by:   adrian
 Status:       active

It's definately not a simple problem.
For instance.. the db connection needs to be started during bootstrap,
and during normal execution.
I think the better idea is to include a DRUPAL_INIT constant we can
check before executing the function. (or a DRUPAL_NO_INIT .. i'm not
picky).


adrian



Previous comments:
------------------------------------------------------------------------

March 2, 2005 - 00:09 : killes at www.drop.org

Drupal currently executes functions in include files. This is very
annoying if you want to include files from external scripts such as
update scripts or other scripts that want to use Drupal as a framework.
Offending files are:
database.inc:
db_set_active();
session.inc:
session_set_save_handler("sess_open", "sess_close", "sess_read",
"sess_write", "sess_destroy", "sess_gc");
session_start();
common.inc:
A bunch of stuff at the bottom.
All this should be moved into a start.inc file.


------------------------------------------------------------------------

March 27, 2005 - 08:44 : adrian

I haven't done this recently, but back in 4.4 era I attempted something
similar to this for the install api.
A _lot_ of modifications were required to be able to use (for instance)
the theme api without needing to have a database connection active.





More information about the drupal-devel mailing list