Make WordPress Core

Ticket #10293: 10293.2.diff

File 10293.2.diff, 2.7 KB (added by dd32, 15 years ago)
  • wp-includes/wp-db.php

     
    296296        var $real_escape = false;
    297297
    298298        /**
     299         * Database Username
     300         *
     301         * @since 2.9.0
     302         * @access private
     303         * @var string
     304         */
     305        var $dbuser;
     306
     307        /**
    299308         * Connects to the database server and selects a database
    300309         *
    301310         * PHP4 compatibility layer for calling the PHP5 constructor.
     
    338347                if ( defined('DB_COLLATE') )
    339348                        $this->collate = DB_COLLATE;
    340349
     350                $this->dbuser = $dbuser;
     351
    341352                $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
    342353                if (!$this->dbh) {
    343354                        $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
     
    349360        <li>Are you sure that the database server is running?</li>
    350361</ul>
    351362<p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
    352 "/*/WP_I18N_DB_CONN_ERROR*/, $dbhost));
     363"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail');
    353364                        return;
    354365                }
    355366
     
    436447<li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
    437448<li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
    438449</ul>
    439 <p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER));
     450<p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser), 'db_select_fail');
    440451                        return;
    441452                }
    442453        }
     
    9961007         *
    9971008         * @since 1.5.0
    9981009         *
    999          * @param string $message
     1010         * @param string $message The Error message
     1011         * @param string $error_code (optional) A Computer readable string to identify the error.
    10001012         * @return false|void
    10011013         */
    1002         function bail($message) {
     1014        function bail($message, $error_code = '500') {
    10031015                if ( !$this->show_errors ) {
    10041016                        if ( class_exists('WP_Error') )
    1005                                 $this->error = new WP_Error('500', $message);
     1017                                $this->error = new WP_Error($error_code, $message);
    10061018                        else
    10071019                                $this->error = $message;
    10081020                        return false;
     
    10351047         *
    10361048         * @return bool True if collation is supported, false if version does not
    10371049         */
    1038         function supports_collation()
    1039         {
     1050        function supports_collation() {
    10401051                return $this->has_cap( 'collation' );
    10411052        }
    10421053