upgrade_all

Functions to be called in install and upgrade scripts.

Description

upgrade_all(); 

Contains conditional checks to determine which upgrade scripts to run, based on database version and WP version being updated-to.


Usage

  1. if ( !function_exists( 'upgrade_all' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/upgrade.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = upgrade_all(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/upgrade.php  
  1. function upgrade_all() { 
  2. global $wp_current_db_version, $wp_db_version; 
  3. $wp_current_db_version = __get_option('db_version'); 
  4.  
  5. // We are up-to-date. Nothing to do. 
  6. if ( $wp_db_version == $wp_current_db_version ) 
  7. return; 
  8.  
  9. // If the version is not set in the DB, try to guess the version. 
  10. if ( empty($wp_current_db_version) ) { 
  11. $wp_current_db_version = 0; 
  12.  
  13. // If the template option exists, we have 1.5. 
  14. $template = __get_option('template'); 
  15. if ( !empty($template) ) 
  16. $wp_current_db_version = 2541; 
  17.  
  18. if ( $wp_current_db_version < 6039 ) 
  19.  
  20.  
  21. if ( $wp_current_db_version < 2541 ) { 
  22.  
  23. if ( $wp_current_db_version < 3308 ) 
  24.  
  25. if ( $wp_current_db_version < 4772 ) 
  26.  
  27. if ( $wp_current_db_version < 4351 ) 
  28.  
  29. if ( $wp_current_db_version < 5539 ) 
  30.  
  31. if ( $wp_current_db_version < 6124 ) 
  32.  
  33. if ( $wp_current_db_version < 7499 ) 
  34.  
  35. if ( $wp_current_db_version < 7935 ) 
  36.  
  37. if ( $wp_current_db_version < 8201 ) 
  38.  
  39. if ( $wp_current_db_version < 8989 ) 
  40.  
  41. if ( $wp_current_db_version < 10360 ) 
  42.  
  43. if ( $wp_current_db_version < 11958 ) 
  44.  
  45. if ( $wp_current_db_version < 15260 ) 
  46.  
  47. if ( $wp_current_db_version < 19389 ) 
  48.  
  49. if ( $wp_current_db_version < 20080 ) 
  50.  
  51. if ( $wp_current_db_version < 22422 ) 
  52.  
  53. if ( $wp_current_db_version < 25824 ) 
  54.  
  55. if ( $wp_current_db_version < 26148 ) 
  56.  
  57. if ( $wp_current_db_version < 26691 ) 
  58.  
  59. if ( $wp_current_db_version < 29630 ) 
  60.  
  61. if ( $wp_current_db_version < 33055 ) 
  62.  
  63. if ( $wp_current_db_version < 33056 ) 
  64.  
  65. if ( $wp_current_db_version < 35700 ) 
  66.  
  67. if ( $wp_current_db_version < 36686 ) 
  68.  
  69. if ( $wp_current_db_version < 37965 ) 
  70.  
  71.  
  72.  
  73. update_option( 'db_version', $wp_db_version ); 
  74. update_option( 'db_upgraded', true );