upgrade_210

Execute changes made in WordPress 2.1.

Description

upgrade_210(); 

Usage

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

Defined (1)

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

/wp-admin/includes/upgrade.php  
  1. function upgrade_210() { 
  2. global $wpdb, $wp_current_db_version; 
  3.  
  4. if ( $wp_current_db_version < 3506 ) { 
  5. // Update status and type. 
  6. $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); 
  7.  
  8. if ( ! empty($posts) ) foreach ($posts as $post) { 
  9. $status = $post->post_status; 
  10. $type = 'post'; 
  11.  
  12. if ( 'static' == $status ) { 
  13. $status = 'publish'; 
  14. $type = 'page'; 
  15. } elseif ( 'attachment' == $status ) { 
  16. $status = 'inherit'; 
  17. $type = 'attachment'; 
  18.  
  19. $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) ); 
  20.  
  21. if ( $wp_current_db_version < 3845 ) { 
  22.  
  23. if ( $wp_current_db_version < 3531 ) { 
  24. // Give future posts a post_status of future. 
  25. $now = gmdate('Y-m-d H:i:59'); 
  26. $wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'"); 
  27.  
  28. $posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'"); 
  29. if ( !empty($posts) ) 
  30. foreach ( $posts as $post ) 
  31. wp_schedule_single_event(mysql2date('U', $post->post_date, false), 'publish_future_post', array($post->ID));