monsterinsights_lite_install_and_upgrade

MonsterInsights Install and Updates.

Description

monsterinsights_lite_install_and_upgrade(); 

This function is used install and upgrade MonsterInsights. This is used for upgrade routines that can be done automatically, behind the scenes without the need for user interaction (for example pagination or user input required), as well as the initial install.


Usage

  1. if ( !function_exists( 'monsterinsights_lite_install_and_upgrade' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/googleanalytics.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = monsterinsights_lite_install_and_upgrade(); 
  7.  

Defined (1)

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

/googleanalytics.php  
  1. function monsterinsights_lite_install_and_upgrade() { 
  2. global $wp_version; 
  3.  
  4. // If the WordPress site doesn't meet the correct WP version requirements, don't activate MonsterInsights 
  5. if ( version_compare( $wp_version, '3.8', '<' ) ) { 
  6. if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { 
  7. return; 
  8.  
  9. // Don't run if MI Pro is installed 
  10. if ( class_exists( 'MonsterInsights' ) ) { 
  11. if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) { 
  12. return; 
  13.  
  14.  
  15. // Load settings and globals (so we can use/set them during the upgrade process) 
  16. MonsterInsights_Lite()->define_globals(); 
  17. MonsterInsights_Lite()->load_settings(); 
  18.  
  19. // Load upgrade file 
  20. require_once MONSTERINSIGHTS_PLUGIN_DIR . 'includes/install.php'; 
  21. require_once MONSTERINSIGHTS_PLUGIN_DIR . 'lite/includes/install.php'; // Lite only install stuff 
  22.  
  23. // Run the MonsterInsights upgrade routines 
  24. $updates = new MonsterInsights_Install(); 
  25. $updates->init();