dead_db example

// One or more tables exist. This is not good.
        wp_load_translations_early();

        // Die with a DB error.         $wpdb->error = sprintf(
            /* translators: %s: Database repair URL. */
            __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ),
            'maint/repair.php?referrer=is_blog_installed'
        );

        dead_db();
    }

    $wpdb->suppress_errors( $suppress );

    wp_cache_set( 'is_blog_installed', false );

    return false;
}

/** * Retrieves URL with nonce added to URL query. * * @since 2.0.4 * * @param string $actionurl URL to add nonce action. * @param int|string $action Optional. Nonce action name. Default -1. * @param string $name Optional. Nonce name. Default '_wpnonce'. * @return string Escaped URL with nonce action added. */

function ms_not_installed( $domain$path ) {
    global $wpdb;

    if ( ! is_admin() ) {
        dead_db();
    }

    wp_load_translations_early();

    $title = __( 'Error establishing a database connection' );

    $msg   = '<h1>' . $title . '</h1>';
    $msg  .= '<p>' . __( 'If your site does not display, please contact the owner of this network.' ) . '';
    $msg  .= ' ' . __( 'If you are the owner of this network please check that your host&#8217;s database server is running properly and all tables are error free.' ) . '</p>';
    $query = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) );
    if ( ! $wpdb->get_var( $query ) ) {
        

function wp_set_wpdb_vars() {
    global $wpdb$table_prefix;

    if ( ! empty( $wpdb->error ) ) {
        dead_db();
    }

    $wpdb->field_types = array(
        'post_author'      => '%d',
        'post_parent'      => '%d',
        'menu_order'       => '%d',
        'term_id'          => '%d',
        'term_group'       => '%d',
        'term_taxonomy_id' => '%d',
        'parent'           => '%d',
        'count'            => '%d',
        
__( 'If you are unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href="%s">WordPress support forums</a>.' ),
            __( 'https://wordpress.org/support/forums/' )
        ) . "</p>\n";

        // We weren't able to reconnect, so we better bail.         $this->bail( $message, 'db_connect_fail' );

        /* * Call dead_db() if bail didn't die, because this database is no more. * It has ceased to be (at least temporarily). */
        dead_db();
    }

    /** * Performs a database query, using current database connection. * * More information can be found on the documentation page. * * @since 0.71 * * @link https://developer.wordpress.org/reference/classes/wpdb/ * * @param string $query Database query. * @return int|bool Boolean true for CREATE, ALTER, TRUNCATE and DROP queries. Number of rows * affected/selected for all other queries. Boolean false on error. */
Home | Imprint | This part of the site doesn't use cookies.