Make WordPress Core

Changeset 13209


Ignore:
Timestamp:
02/19/2010 01:03:58 AM (14 years ago)
Author:
nacin
Message:

Assume WP_DEBUG is defined in wpdb. Remove unnecessary constant() calls. Ensure DB_COLLATE defined as empty string doesn't override default Multisite collation. fixes #12041, see #11644

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/ms.php

    r13106 r13209  
    7676        }
    7777        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->blogs WHERE blog_id = %d", $blog_id) );
    78         $dir = apply_filters( 'wpmu_delete_blog_upload_dir', constant( "WP_CONTENT_DIR" ) . "/blogs.dir/{$blog_id}/files/", $blog_id );
     78        $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR . "/blogs.dir/{$blog_id}/files/", $blog_id );
    7979        $dir = rtrim($dir, DIRECTORY_SEPARATOR);
    8080        $top_dir = $dir;
  • trunk/wp-admin/includes/upgrade.php

    r13134 r13209  
    12601260
    12611261    if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
    1262         return preg_replace( '|/+$|', '', constant( 'WP_HOME' ) );
     1262        return preg_replace( '|/+$|', '', WP_HOME );
    12631263    }
    12641264
    12651265    if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
    1266         return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
     1266        return preg_replace( '|/+$|', '', WP_SITEURL );
    12671267    }
    12681268
  • trunk/wp-admin/revision.php

    r12859 r13209  
    3030        break;
    3131
    32     if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
     32    if ( ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
    3333        break;
    3434
     
    6969        break; // Don't diff two unrelated revisions
    7070
    71     if ( !constant('WP_POST_REVISIONS') ) { // Revisions disabled
     71    if ( ! WP_POST_REVISIONS ) { // Revisions disabled
    7272        if (
    7373            // we're not looking at an autosave
     
    107107        break;
    108108
    109     if ( !constant('WP_POST_REVISIONS') && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
     109    if ( ! WP_POST_REVISIONS && !wp_is_post_autosave( $revision ) ) // Revisions disabled and we're not looking at an autosave
    110110        break;
    111111
     
    208208
    209209$args = array( 'format' => 'form-table', 'parent' => true, 'right' => $right, 'left' => $left );
    210 if ( !constant( 'WP_POST_REVISIONS' ) )
     210if ( ! WP_POST_REVISIONS )
    211211    $args['type'] = 'autosave';
    212212
  • trunk/wp-includes/ms-functions.php

    r13125 r13209  
    12751275function maybe_redirect_404() {
    12761276    global $current_site;
    1277     if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && constant( 'NOBLOGREDIRECT' ) != '' ) {
    1278         $destination = constant( 'NOBLOGREDIRECT' );
     1277    if ( is_main_site() && is_404() && defined( 'NOBLOGREDIRECT' ) && ( $destination = NOBLOGREDIRECT ) ) {
    12791278        if ( $destination == '%siteurl%' )
    12801279            $destination = $current_site->domain . $current_site->path;
  • trunk/wp-includes/ms-load.php

    r13066 r13209  
    9999    global $wpdb, $current_site, $domain, $path, $sites, $cookie_domain;
    100100    if ( defined( 'DOMAIN_CURRENT_SITE' ) && defined( 'PATH_CURRENT_SITE' ) ) {
    101         $current_site->id = (defined( 'SITE_ID_CURRENT_SITE' ) ? constant('SITE_ID_CURRENT_SITE') : 1);
     101        $current_site->id = defined( 'SITE_ID_CURRENT_SITE' ) ? SITE_ID_CURRENT_SITE : 1;
    102102        $current_site->domain = DOMAIN_CURRENT_SITE;
    103103        $current_site->path   = $path = PATH_CURRENT_SITE;
  • trunk/wp-includes/post.php

    r13199 r13209  
    41704170
    41714171    // WP_POST_REVISIONS = 0, false
    4172     if ( !constant('WP_POST_REVISIONS') )
     4172    if ( ! WP_POST_REVISIONS )
    41734173        return;
    41744174
     
    44494449 */
    44504450function wp_get_post_revisions( $post_id = 0, $args = null ) {
    4451     if ( !constant('WP_POST_REVISIONS') )
     4451    if ( ! WP_POST_REVISIONS )
    44524452        return array();
    44534453    if ( ( !$post = get_post( $post_id ) ) || empty( $post->ID ) )
  • trunk/wp-includes/template-loader.php

    r7754 r13209  
    44 * @package WordPress
    55 */
    6 if ( defined('WP_USE_THEMES') && constant('WP_USE_THEMES') ) {
     6if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) {
    77    do_action('template_redirect');
    88    if ( is_robots() ) {
  • trunk/wp-includes/wp-db.php

    r13174 r13209  
    346346     */
    347347    function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
    348         if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true )
     348        if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
    349349            $this->db_connect();
    350350        return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
     
    368368        register_shutdown_function(array(&$this, "__destruct"));
    369369
    370         if ( defined( 'WP_DEBUG' ) && WP_DEBUG )
     370        if ( WP_DEBUG )
    371371            $this->show_errors();
    372372
    373373        if ( is_multisite() ) {
    374374            $this->charset = 'utf8';
    375             if ( defined( 'DB_COLLATE' ) && constant( 'DB_COLLATE' ) != '' )
    376                 $this->collate = constant( 'DB_COLLATE' );
     375            if ( defined( 'DB_COLLATE' ) && DB_COLLATE )
     376                $this->collate = DB_COLLATE;
    377377            else
    378378                $this->collate = 'utf8_general_ci';
     379        } elseif ( defined( 'DB_COLLATE' ) ) {
     380            $this->collate = DB_COLLATE;
    379381        }
    380382
    381383        if ( defined('DB_CHARSET') )
    382384            $this->charset = DB_CHARSET;
    383 
    384         if ( defined('DB_COLLATE') )
    385             $this->collate = DB_COLLATE;
    386385
    387386        $this->dbuser = $dbuser;
     
    667666            $msg = "WordPress database error: [$str]\n{$this->last_query}\n";
    668667            if ( defined( 'ERRORLOGFILE' ) )
    669                 error_log( $msg, 3, CONSTANT( 'ERRORLOGFILE' ) );
     668                error_log( $msg, 3, ERRORLOGFILE );
    670669            if ( defined( 'DIEONDBERROR' ) )
    671670                die( $msg );
     
    808807        // use $this->dbhglobal for gloal table ops
    809808        unset( $dbh );
    810         if( defined( "WP_USE_MULTIPLE_DB" ) && CONSTANT( "WP_USE_MULTIPLE_DB" ) == true ) {
     809        if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB ) {
    811810            if( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
    812811                if( false == isset( $this->dbhglobal ) ) {
Note: See TracChangeset for help on using the changeset viewer.