gmb_trigger_upgrades

Triggers all upgrade functions.

Description

gmb_trigger_upgrades(); 

This function is usually triggered via AJAX


Usage

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

Defined (2)

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

/includes/admin/upgrades/upgrade-functions.php  
  1. function gmb_trigger_upgrades() { 
  2.  
  3. if ( ! current_user_can( 'activate_plugins' ) ) { 
  4. wp_die( __( 'You do not have permission to do plugin upgrades', 'gmb' ), __( 'Error', 'gmb' ), array( 'response' => 403 ) ); 
  5.  
  6. $gmb_version = get_option( 'gmb_version' ); 
  7.  
  8. //Is the option above in the db? 
  9. if ( ! $gmb_version ) { 
  10. // 2.0 is the first version to use this option so we must add it 
  11. $gmb_version = '2.0'; 
  12. add_option( 'gmb_version', $gmb_version ); 
  13.  
  14. if ( version_compare( GMB_VERSION, $gmb_version, '>=' ) && ! get_option( 'gmb_refid_upgraded' ) ) { 
  15.  
  16. update_option( 'gmb_version', $gmb_version ); 
  17.  
  18. if ( DOING_AJAX ) { 
  19. die( 'complete' ); 
  20. } // Let AJAX know that the upgrade is complete 
/vendor/wordimpress/maps-builder-core/includes/admin/upgrades/upgrade-functions.php  
  1. function gmb_trigger_upgrades() { 
  2.  
  3. if ( ! current_user_can( 'activate_plugins' ) ) { 
  4. wp_die( __( 'You do not have permission to do plugin upgrades', 'google-maps-builder' ), __( 'Error', 'google-maps-builder' ), array( 'response' => 403 ) ); 
  5.  
  6. $gmb_version = get_option( 'gmb_version' ); 
  7.  
  8. //Is the option above in the db? 
  9. if ( ! $gmb_version ) { 
  10. // 2.0 is the first version to use this option so we must add it. 
  11. $gmb_version = '2.0'; 
  12. add_option( 'gmb_version', $gmb_version ); 
  13. //Version 2.0 upgrades 
  14. if ( version_compare( GMB_VERSION, '2.0', '>=' ) && ! get_option( 'gmb_refid_upgraded' ) ) { 
  15.  
  16. //Version 2.1 upgrades 
  17. if ( version_compare( GMB_VERSION, '2.1', '>=' ) ) { 
  18. if ( ! gmb_has_upgrade_completed( 'gmb_markers_upgraded' ) ) { 
  19.  
  20. if ( ! gmb_has_upgrade_completed( 'gmb_api_keys_upgraded' ) ) { 
  21.  
  22. update_option( 'gmb_version', $gmb_version ); 
  23.  
  24. if ( DOING_AJAX ) { 
  25. die( 'complete' ); 
  26. } // Let AJAX know that the upgrade is complete