﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
20731	Split wp-settings.php in two	scribu		"In wp-settings.php, we have these lines:

{{{
// Stop most of WordPress from being loaded if we just want the basics.
if ( SHORTINIT )
	return false;
}}}

What I'm suggesting is that we move everything that follows into a separate file.

Use-case: setting up a unit-testing environment without changing the database:

https://github.com/nb/wordpress-tests/pull/19

Here's the gist of how it's currently done:

{{{
// Define the options to be short-circuited
$GLOBALS['wp_tests_options'] = array(
  'active_plugins' => array( 'akismet.php' ),
  'template' => 'twentyeleven'
);

// Load the essential parts of WordPress.
define('SHORTINIT', true);
require_once ABSPATH . '/wp-settings.php';

// Short-circuit the options
function wp_tests_options( $value ) {
	$key = substr( current_filter(), strlen( 'pre_option_' ) );
	return $GLOBALS['wp_tests_options'][$key];
}

foreach ( array_keys( $GLOBALS['wp_tests_options'] ) as $key ) {
	add_filter( 'pre_option_'.$key, 'wp_tests_options' );
}

// Load the rest of wp-settings.php (start from where we left off)
$wp_settings_content = file_get_contents(ABSPATH.'/wp-settings.php');
$offset = strpos($wp_settings_content, '// Load the l18n library.');
eval(substr($wp_settings_content, $offset));
unset($wp_settings_content, $offset);
}}}

As you can see, that last part is really ugly and fragile. It would be awesome if we could just do:

{{{
require(ABSPATH.'/wp-settings-2.php');
}}}
"	enhancement	closed	normal		General		normal	wontfix	dev-feedback	
