MC4WP_DB_Upgrader

The MailChimp for WordPress Lite MC4WP DB Upgrader class.

Defined (1)

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

/includes/admin/class-db-upgrader.php  
  1. class MC4WP_DB_Upgrader { 
  2.  
  3. /** 
  4. * @var int 
  5. */ 
  6. protected $database_version = 0; 
  7.  
  8. /** 
  9. * @var 
  10. */ 
  11. protected $code_version = 0; 
  12.  
  13. /** 
  14. * @param string $code_version The version we're upgrading to 
  15. * @param string $database_version The version the current database data is at 
  16. */ 
  17. public function __construct( $code_version, $database_version ) { 
  18. $this->database_version = $database_version; 
  19. $this->code_version = $code_version; 
  20. $this->installing = ( $database_version === 0 ); 
  21.  
  22. /** 
  23. * Run the various upgrade routines, all the way up to the latest version 
  24. */ 
  25. public function run() { 
  26. define( 'MC4WP_DOING_UPGRADE', true ); 
  27.  
  28. // upgrade to 2.3 
  29. if( ! $this->installing && version_compare( $this->database_version, '2.3', '<' ) ) { 
  30. $this->change_success_message_key(); 
  31.  
  32. // update code version 
  33. update_option( 'mc4wp_lite_version', MC4WP_LITE_VERSION ); 
  34.  
  35. protected function change_success_message_key() { 
  36. $options = get_option( 'mc4wp_lite_form' ); 
  37. if( isset( $options['text_success'] ) ) { 
  38. $options['text_subscribed'] = $options['text_success']; 
  39. unset( $options['text_success'] ); 
  40.  
  41. update_option( 'mc4wp_lite_form', $options ); 
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.