Opened 15 years ago
Closed 13 years ago
#16455 closed defect (bug) (invalid)
if MULTISITE constant not defined error message "One or more database tables are unavailable" or "Error establishing a database connection" appears
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.0.4 |
| Component: | General | Keywords: | needs-testing dev-feedback |
| Focuses: | Cc: |
Description
I updated a wordpress installation (no multisite) from 3.0.1 to 3.0.4. After the update the back-end displayed the error message "One or more database tables are unavailable" and the front-end "Error establishing a database connection".
I figured out that this only happened if the constant MULTISITE in wp-config.php was not defined at all.
If you set it to false
define( 'MULTISITE', false );
or true
define( 'MULTISITE', true );
everything seams to be fine.
I tested it with the default 'Twenty Ten 1.1 by the WordPress team' theme and no plugins activated.
This might have to do with this:
if (MULTISITE) {echo "is true";}
else {echo "is false";}
is evaluated to 'true' if you didn't defined the constant while it is evaluated to 'false'
define("MULTISITE", false );
if (MULTISITE) {echo "is true";}
else {echo "is false";}
if you define it to be false.
Attachments (2)
Change History (11)
#2
@
15 years ago
If is_multisite() returns true, we assume that, if MULTISITE is defined, it is defined to true. This occurs in a few locations, notably wp-db.php, which allows us to identify whether we're on a 3.0 network, or a network updated from MU.
#3
@
15 years ago
- Keywords reporter-feedback added
Other note: If you are running a MU network -- such that you have VHOST or SUNRISE defined -- and you define('MULTISITE', false);, the sky will fall on your head.
I don't even have a theory for what's going on here. Something very odd and I think it's your setup.
#4
@
15 years ago
Thanks for your quick reply. I tracked the problem down. It's not critical for normal users but if you have
define( 'SUBDOMAIN_INSTALL', false );
in your wp-config.php and don't have
define( 'MULTISITE', false );
in your wp-config.php then
/**
* Whether Multisite support is enabled
*
* @since 3.0.0
*
* @return bool True if multisite is enabled, false otherwise.
*/
function is_multisite() {
if ( defined( 'MULTISITE' ) )
return MULTISITE;
if ( defined( 'SUBDOMAIN_INSTALL' ) || defined( 'VHOST' ) || defined( 'SUNRISE' ) )
return true;
return false;
}
( line 499 in wp-includes/load.php ) returns true.
#5
@
14 years ago
- Keywords has-patch needs-testing added
The is-subdomain_install() function does part of this query so why not make use of that?
Patch attached, needs testing
#6
@
14 years ago
Scratch that - it won't call that function is no MS. The attached should be better by on my testing is multisite is not defined but subdomain_install is then WordPress bails. I therefore cannot reproduce.
#8
@
13 years ago
- Keywords close dev-feedback added; has-patch removed
This looks like it was simply just a single installation mis-configuration, and if not, there's not enough information here to figure out how this happened, but this situation doesn't happen currently, assuming instructions for multisite installation are followed correctly.
Proposing close.
WordPress should never be treating MULTISITE as a boolean without testing first to see if it is defined.
Additionally, in the case of a non-multisite install, we define it to be false.
// Initialize multisite if enabled. if ( is_multisite() ) { require( ABSPATH . WPINC . '/ms-blogs.php' ); require( ABSPATH . WPINC . '/ms-settings.php' ); } elseif ( ! defined( 'MULTISITE' ) ) { define( 'MULTISITE', false ); }Going to need more information here. Literally millions of people are running 3.0.4 with no MULTISITE constant defined at all. Something else must be going on.