update_profiles

Upgrade profiles if changes have been made.

Description

update_profiles(); 

Usage

  1. if ( !function_exists( 'update_profiles' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-doc-embedder/libs/lib-setup.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = update_profiles(); 
  7.  

Defined (1)

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

/libs/lib-setup.php  
  1. function update_profiles() { 
  2. $prodata = gde_get_profiles(); 
  3. $defpros = gde_defaults('profiles'); 
  4. $default = $defpros['default']; 
  5.  
  6. foreach ( $prodata as $profile ) { 
  7. $updated = false; 
  8.  
  9. $id = $profile['profile_id']; 
  10. if ( $data = @unserialize( $profile['profile_data'] ) ) { 
  11. foreach ( $default as $k => $v ) { 
  12. if ( $k !== "desc" && ! array_key_exists( $k, $data ) ) { 
  13. $data[$k] = $default[$k]; 
  14.  
  15. $updated = true; 
  16.  
  17. if ( $updated ) { 
  18. // write updated profile 
  19. $data = serialize( $data ); 
  20. $newpro = array( $profile['profile_name'], $profile['profile_desc'], $data ); 
  21. if ( gde_write_profile( $newpro, $id, true ) < 1 ) { 
  22. gde_dx_log("Failed to update profile '" . $profile['profile_name'] . "'");