Make WordPress Core

Changeset 19690


Ignore:
Timestamp:
01/05/2012 09:21:51 PM (14 years ago)
Author:
nacin
Message:

Update some old upgrade functions to use untrailingslashit().

File:
1 edited

Legend:

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

    r19687 r19690  
    13631363function get_alloptions_110() {
    13641364    global $wpdb;
    1365     if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
    1366         foreach ($options as $option) {
    1367             // "When trying to design a foolproof system,
    1368             //  never underestimate the ingenuity of the fools :)" -- Dougal
    1369             if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    1370             if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    1371             if ('category_base' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
    1372             $all_options->{$option->option_name} = stripslashes($option->option_value);
     1365    $all_options = new stdClass;
     1366    if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
     1367        foreach ( $options as $option ) {
     1368            if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name )
     1369                $option->option_value = untrailingslashit( $option->option_value );
     1370            $all_options->{$option->option_name} = stripslashes( $option->option_value );
    13731371        }
    13741372    }
     
    13881386    global $wpdb;
    13891387
    1390     if ( $setting == 'home' && defined( 'WP_HOME' ) ) {
    1391         return preg_replace( '|/+$|', '', WP_HOME );
    1392     }
    1393 
    1394     if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) ) {
    1395         return preg_replace( '|/+$|', '', WP_SITEURL );
    1396     }
    1397 
    1398     $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) );
     1388    if ( $setting == 'home' && defined( 'WP_HOME' ) )
     1389        return untrailingslashit( WP_HOME );
     1390
     1391    if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) )
     1392        return untrailingslashit( WP_SITEURL );
     1393
     1394    $option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );
    13991395
    14001396    if ( 'home' == $setting && '' == $option )
    1401         return __get_option('siteurl');
    1402 
    1403     if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting )
    1404         $option = preg_replace('|/+$|', '', $option);
    1405 
    1406     @ $kellogs = unserialize($option);
    1407     if ($kellogs !== false)
     1397        return __get_option( 'siteurl' );
     1398
     1399    if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting || 'tag_base' == $setting )
     1400        $option = untrailingslashit( $option );
     1401
     1402    @ $kellogs = unserialize( $option );
     1403    if ( $kellogs !== false )
    14081404        return $kellogs;
    14091405    else
Note: See TracChangeset for help on using the changeset viewer.