[wp-trac] Re: [WordPress Trac] #9444: Allow to read wp-config.php without loading WP

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 4 21:14:19 GMT 2009


#9444: Allow to read wp-config.php without loading WP
--------------------------+-------------------------------------------------
 Reporter:  hakre         |       Owner:  anonymous                    
     Type:  defect (bug)  |      Status:  new                          
 Priority:  normal        |   Milestone:  2.8                          
Component:  General       |     Version:  2.7.1                        
 Severity:  normal        |    Keywords:  has-patch tested dev-feedback
--------------------------+-------------------------------------------------

Comment(by hakre):

 Replying to [comment:6 Denis-de-Bernardy]:
 > Use as follows:
 >
 >
 > {{{
 > define('WP_CONFIG_ONLY', true);
 > include '/path/to/wp-config.php';
 > // do stuff
 > }}}

 simple and snatch - love that patch!

 tests went out very well!. maybe adding a comment there and giving an
 <example> on how to use?

 one thing that comes into my mind is, that while in this request, wp-
 config.php will not loaded any longer. so degrading to a global variable
 might be more flexible then using a constant.

 {{{
 /**
  * wp-settings.php is auto-loaded when the wp-config.php
  * is included.
  * defining WP_CONFIG_ONLY prevents that.
  */
 if ( defined('WP_CONFIG_ONLY') ) return;
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/9444#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list