'
);
}
else {
$correct_fields = false;
$field_system = $fields_system[$name_field];
$diff = array_diff($field_test, $field_system);
if (!empty($diff)) {
foreach ($diff as $config_field => $value) {
switch ($config_field) {
case 'type':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the type with %s.',
$name_field, $table, $value));
ui_print_info_message(
__('You can execute this SQL query for to fix.') . " " .
'
'
);
break;
case 'null':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the null values with %s.',
$name_field, $table, $value));
if ($value == "no") {
ui_print_info_message(
__('You can execute this SQL query for to fix.') . " " .
'
'
);
}
break;
case 'key':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the key as defined in the SQL file.',
$name_field, $table));
ui_print_info_message(
__('Please check the SQL file for to know the kind of key needed.'));
break;
case 'default':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted the default value as %s.',
$name_field, $table, $value));
ui_print_info_message(
__('Please check the SQL file for to know the kind of default value needed.'));
break;
case 'extra':
ui_print_error_message(
__('Unsuccessful the field %s in the table %s must be setted as defined in the SQL file.',
$name_field, $table));
ui_print_info_message(
__('Please check the SQL file for to know the kind of extra config needed.'));
break;
}
}
}
}
}
}
if ($correct_fields) {
ui_print_success_message(
__('Successful all the tables have the correct fields')
);
}
}
function extension_db_status_execute_sql_file($url, $connection) {
if (file_exists($url)) {
$file_content = file($url);
$query = "";
foreach ($file_content as $sql_line) {
if (trim($sql_line) != "" && strpos($sql_line, "--") === false) {
$query .= $sql_line;
if (preg_match("/;[\040]*\$/", $sql_line)) {
if (!$result = mysql_query($query, $connection)) {
echo mysql_error(); //Uncomment for debug
echo " $query ";
return 0;
}
$query = "";
}
}
}
return 1;
}
else
return 0;
}
extensions_add_godmode_function('extension_db_status');
extensions_add_godmode_menu_option(__('DB Status'), 'DM', 'gextensions', null, "v1r1", 'gdbman');
?>