M_verify_tables

The Membership 2 M verify tables function.

Description

M_verify_tables(); 

Usage

  1. if ( !function_exists( 'M_verify_tables' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/classes/upgrade.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = M_verify_tables(); 
  7.  

Defined (1)

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

/app_old/membershipincludes/classes/upgrade.php  
  1. function M_verify_tables() { 
  2.  
  3. global $wpdb; 
  4.  
  5.  
  6. foreach( $tables as $name => $fields ) { 
  7.  
  8. echo "<p>" . __('Checking table : ', 'membership') . $name . " - "; 
  9.  
  10. $sql = "SHOW TABLES LIKE '{$name}';"; 
  11. $t = $wpdb->get_var( $sql ); 
  12.  
  13. if($t == $name) { 
  14. echo "<span style='color: green;'>" . __('Ok', 'membership') . "</span>"; 
  15. echo "</p>"; 
  16.  
  17. echo "<p>" . __('Checking fields in table : ', 'membership') . $name . " - "; 
  18.  
  19. $sql = "SHOW COLUMNS FROM {$name};"; 
  20. $t = $wpdb->get_results( $sql ); 
  21.  
  22. foreach( $fields as $fieldname => $type ) { 
  23. $found = false; 
  24. echo "<br/>" . $fieldname . " - "; 
  25. foreach($t as $dbf) { 
  26. if($dbf->Field == $fieldname && $dbf->Type == $type) { 
  27. $found = true; 
  28. break; 
  29. if($found) { 
  30. echo "<span style='color: green;'>" . __('Ok', 'membership') . "</span>"; 
  31. } else { 
  32. echo "<span style='color: red;'>" . __('Missing or Incorrect', 'membership') . "</span>"; 
  33.  
  34. echo "</p>"; 
  35.  
  36. } else { 
  37. echo "<span style='color: red;'>" . __('Missing', 'membership') . "</span>"; 
  38. echo "</p>"; 
  39.  
  40.