Ticket #2447: upgrade.diff
| File upgrade.diff, 4.6 KB (added by , 20 years ago) |
|---|
-
wp-admin/admin.php
4 4 else 5 5 require_once('../wp-config.php'); 6 6 7 if ( get_option('db_version') != $wp_db_version ) 8 die (sprintf(__("Your database is out-of-date. Please <a href='%s'>upgrade</a>."), get_option('siteurl') . '/wp-admin/upgrade.php')); 9 7 if ( get_option('db_version') != $wp_db_version ) { 8 wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php'); 9 die(); 10 } 11 10 12 require_once(ABSPATH . 'wp-admin/admin-functions.php'); 11 13 require_once(ABSPATH . 'wp-admin/admin-db.php'); 12 14 require_once(ABSPATH . WPINC . '/registration-functions.php'); -
wp-admin/upgrade-functions.php
8 8 global $wp_current_db_version, $wp_db_version, $wp_rewrite; 9 9 $wp_current_db_version = __get_option('db_version'); 10 10 11 // Return of true indicates that upgrade took place 12 $return = false; 13 11 14 // We are up-to-date. Nothing to do. 12 15 if ( $wp_db_version == $wp_current_db_version ) 13 return ;16 return false; 14 17 15 18 // If the version is not set in the DB, try to guess the version. 16 19 if ( empty($wp_current_db_version) ) { … … 29 32 upgrade_101(); 30 33 upgrade_110(); 31 34 upgrade_130(); 35 $return = true; 32 36 } 33 37 34 if ( $wp_current_db_version < 3308 ) 38 if ( $wp_current_db_version < 3308 ) { 35 39 upgrade_160(); 40 $return = true; 41 } 36 42 37 if ( $wp_current_db_version < 3582 ) 43 if ( $wp_current_db_version < 3582 ) { 38 44 upgrade_210(); 45 $return = true; 46 } 39 47 40 48 $wp_rewrite->flush_rules(); 41 49 42 50 update_option('db_version', $wp_db_version); 51 52 return $return; 43 53 } 44 54 45 55 function upgrade_100() { … … 731 741 732 742 $alterations = dbDelta($wp_queries); 733 743 echo "<ol>\n"; 734 foreach ($alterations as $alteration) echo "<li>$alteration</li>\n";744 foreach ( (array) $alterations as $alteration) echo "<li>$alteration</li>\n"; 735 745 echo "</ol>\n"; 746 if ( $alterations ) 747 return true; 748 return false; 736 749 } 737 750 738 751 function make_db_current_silent() { 739 752 global $wp_queries; 740 753 741 754 $alterations = dbDelta($wp_queries); 755 if ( $alterations ) 756 return true; 757 return false; 742 758 } 743 759 744 760 function make_site_theme_from_oldschool($theme_name, $template) { -
wp-admin/upgrade.php
5 5 timer_start(); 6 6 require_once(ABSPATH . '/wp-admin/upgrade-functions.php'); 7 7 8 $step = $_GET['step'];9 if (!$step) $step = 0;10 8 header( 'Content-Type: text/html; charset=utf-8' ); 11 9 ?> 12 10 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> … … 63 61 </head> 64 62 <body> 65 63 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1> 64 <h2><?php _e('Upgrading WordPress'); ?></h2> 65 <p><?php _e('WordPress is now attempting to upgrade your data'); ?></p> 66 <ol> 66 67 <?php 67 switch($step) {68 69 case 0:70 68 $goback = wp_specialchars($_SERVER['HTTP_REFERER'], 1); 71 ?> 72 <p><?php _e('This file upgrades you from any previous version of WordPress to the latest. It may take a while though, so be patient.'); ?></p> 73 <h2 class="step"><a href="upgrade.php?step=1&backto=<?php echo $goback; ?>"><?php _e('Upgrade WordPress »'); ?></a></h2> 69 wp_cache_flush(); 70 ?> 71 <li><?php _e('Attempting to sync database...'); ?><ul><li> 72 <?php if ( make_db_current_silent() ) 73 _e('Database sync complete!'); 74 else 75 _e('No database sync was necessary.'); 76 ?></li></ul></li> 77 <li><?php _e('Attempting data upgrade...'); ?><ul><li> 78 <?php if ( upgrade_all() ) 79 _e('Upgrade complete!'); 80 else 81 _e('No upgrade was necessary.'); 82 ?></li></ul></li> 83 </ol> 74 84 <?php 75 break;76 77 case 1:78 85 wp_cache_flush(); 79 make_db_current_silent();80 upgrade_all();81 wp_cache_flush();82 86 83 87 if ( empty( $_GET['backto'] ) ) 84 88 $backto = __get_option('home'); 85 89 else 86 90 $backto = wp_specialchars( $_GET['backto'] , 1 ); 87 91 ?> 88 <h2><?php _e('Step 1'); ?></h2> 89 <p><?php printf(__("There's actually only one step. So if you see this, you're done. <a href='%s'>Have fun</a>!"), $backto); ?></p> 92 <h2><?php _e('Upgrade Complete'); ?></h2> 93 <p><?php printf(__("The upgrade has completed, so you can <a href='%s'>go back to what you were doing</a>!"), $backto); ?></p> 94 <script><!-- 95 setTimeout('window.location=\'<?php echo $backto; ?>\';', 10000); 96 //--> 97 </script> 90 98 91 99 <!-- 92 100 <pre> … … 96 104 </pre> 97 105 --> 98 106 99 <?php100 break;101 }102 ?>103 107 </body> 104 </html> 108 </html> 109 No newline at end of file