gde_dx_log_create

Create/update database table to store dx log.

Description

gde_dx_log_create(); 

Usage

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

Defined (1)

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

/functions.php  
  1. function gde_dx_log_create() { 
  2. global $wpdb, $gde_db_ver; 
  3.  
  4. $table = $wpdb->base_prefix . 'gde_dx_log'; 
  5. $db_ver_installed = get_site_option( 'gde_db_version', 0 ); 
  6.  
  7. $sql = "CREATE TABLE " . $table . " ( 
  8. id mediumint(9) UNSIGNED NOT NULL AUTO_INCREMENT,  
  9. blogid smallint(5) UNSIGNED NOT NULL,  
  10. data longtext NOT NULL,  
  11. UNIQUE KEY (id) 
  12. ) ENGINE=MyISAM DEFAULT CHARSET=utf8; "; 
  13.  
  14. if ( version_compare( $gde_db_ver, $db_ver_installed, ">" ) ) { 
  15. // upgrade table if needed 
  16. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 
  17. dbDelta( $sql ); 
  18. } elseif ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) == $table ) { 
  19. // table's OK 
  20. return true; 
  21. } else { 
  22. // table doesn't exist, try to create 
  23. require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); 
  24. dbDelta( $sql ); 
  25.  
  26. if ( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) == $table ) { 
  27. // table's OK 
  28. return true; 
  29. } else { 
  30. // can't create 
  31. return false;