Make WordPress Core

Changeset 11902


Ignore:
Timestamp:
09/06/2009 06:46:27 PM (15 years ago)
Author:
ryan
Message:

is_blog_installed() improvements and repair.php. see #10728

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r11883 r11902  
    17721772    wp_cache_set( 'is_blog_installed', $installed );
    17731773
    1774     return $installed;
     1774    if ( $installed )
     1775        return true;
     1776
     1777    $suppress = $wpdb->suppress_errors();
     1778    $tables = $wpdb->get_col('SHOW TABLES');
     1779    $wpdb->suppress_errors( $suppress );
     1780
     1781    // Loop over the WP tables.  If none exist, then scratch install is allowed.
     1782    // If one or more exist, suggest table repair since we got here because the options
     1783    // table could not be accessed.
     1784    foreach ($wpdb->tables as $table) {
     1785        // If one of the WP tables exist, then we are in an insane state.
     1786        if ( in_array($wpdb->prefix . $table, $tables) ) {
     1787            // If visiting repair.php, return true and let it take over.
     1788            if ( defined('WP_REPAIRING') )
     1789                return true;
     1790            // Die with a DB error.
     1791            $wpdb->error = __('One or more database tables are unavailable.  The database may need to be <a href="maint/repair.php?referrer=is_blog_installed">repaired</a>.');
     1792            dead_db();
     1793        }
     1794    }
     1795
     1796    wp_cache_set( 'is_blog_installed', false );
     1797
     1798    return false;
    17751799}
    17761800
  • trunk/wp-includes/wp-db.php

    r11865 r11902  
    255255            'postmeta', 'terms', 'term_taxonomy', 'term_relationships');
    256256
     257    /**
     258     * List of deprecated WordPress tables
     259     *
     260     * @since 2.9.0
     261     * @access private
     262     * @var array
     263     */
     264    var $old_tables = array('categories', 'post2cat', 'link2cat');
     265
     266   
    257267    /**
    258268     * Format specifiers for DB columns. Columns not listed here default to %s.  Initialized in wp-settings.php.
Note: See TracChangeset for help on using the changeset viewer.