/**
  * Does the traditional work of setting up the plugin's database and adding default data.
  * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade.
  * NOTE: if we're in maintenance mode (which would be the case if we detect there are data
  * migration scripts that need to be run and a version change happens), enqueues core for database initialization,
  * so that it will be done when migrations are finished
  *
  * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too;
  * @param boolean $verify_schema if true will re-check the database tables have the correct schema.
  *                               This is a resource-intensive job
  * so we prefer to only do it when necessary
  * @return void
  */
 public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true)
 {
     $request_type = $this->detect_req_type();
     //only initialize system if we're not in maintenance mode.
     if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
         update_option('ee_flush_rewrite_rules', TRUE);
         if ($verify_schema) {
             EEH_Activation::initialize_db_and_folders();
         }
         EEH_Activation::initialize_db_content();
         EEH_Activation::system_initialization();
         if ($initialize_addons_too) {
             $this->initialize_addons();
         }
     } else {
         EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
     }
     if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
         add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
     }
 }
Esempio n. 2
0
 /**
  * Does the traditional work of setting up the plugin's database and adding default data.
  * If migration script/process did not exist, this is what would happen on every activation/reactivation/upgrade.
  * NOTE: does nothing if we're in maintenance mode (which would be the case if we detect there are data
  * migration scripts that need to be run)
  * @return void
  */
 public function initialize_db_if_no_migrations_required()
 {
     $request_type = $this->detect_req_type();
     //only initialize system if we're not in maintenance mode.
     if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
         // set flag for flushing rewrite rules
         update_option('ee_flush_rewrite_rules', TRUE);
         EEH_Activation::system_initialization();
         EEH_Activation::initialize_db_and_folders();
         EEH_Activation::initialize_db_content();
         //foreach registered addon, make sure its db is up-to-date too
         foreach (EE_Registry::instance()->addons as $addon) {
             $addon->initialize_db_if_no_migrations_required();
         }
     }
     if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
         add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
     }
 }