Ticket #6747: upgrade.diff

File upgrade.diff, 2.0 kB (added by solsen230, 5 months ago)

wp-admin/include/upgrade.php

  • wp-admin/includes/upgrade.php

    old new  
    44        require (WP_CONTENT_DIR . '/install.php'); 
    55require_once(ABSPATH . 'wp-admin/includes/admin.php'); 
    66require_once(ABSPATH . 'wp-admin/includes/schema.php'); 
     7require_once(ABSPATH . 'wp-admin/install-helper.php'); 
    78 
    89if ( !function_exists('wp_install') ) : 
    910function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='') { 
     
    745746// The functions we use to actually do stuff 
    746747 
    747748// General 
    748 function maybe_create_table($table_name, $create_ddl) { 
    749         global $wpdb; 
    750         foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 
    751                 if ($table == $table_name) { 
    752                         return true; 
    753                 } 
    754         } 
    755         //didn't find it try to create it. 
    756         $q = $wpdb->query($create_ddl); 
    757         // we cannot directly tell that whether this succeeded! 
    758         foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) { 
    759                 if ($table == $table_name) { 
    760                         return true; 
    761                 } 
    762         } 
    763         return false; 
    764 } 
    765749 
    766750function drop_index($table, $index) { 
    767751        global $wpdb; 
     
    782766        return true; 
    783767} 
    784768 
    785 /** 
    786  ** maybe_add_column() 
    787  ** Add column to db table if it doesn't exist. 
    788  ** Returns:  true if already exists or on successful completion 
    789  **           false on error 
    790  */ 
    791 function maybe_add_column($table_name, $column_name, $create_ddl) { 
    792         global $wpdb, $debug; 
    793         foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { 
    794                 if ($debug) echo("checking $column == $column_name<br />"); 
    795                 if ($column == $column_name) { 
    796                         return true; 
    797                 } 
    798         } 
    799         //didn't find it try to create it. 
    800         $q = $wpdb->query($create_ddl); 
    801         // we cannot directly tell that whether this succeeded! 
    802         foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) { 
    803                 if ($column == $column_name) { 
    804                         return true; 
    805                 } 
    806         } 
    807         return false; 
    808 } 
    809  
    810  
    811769// get_alloptions as it was for 1.2. 
    812770function get_alloptions_110() { 
    813771        global $wpdb;