Index: branches/unlabeled/unlabeled-1.65.2/core/kernel/utility/unit_config_reader.php
===================================================================
diff -u -r7853 -r7874
--- branches/unlabeled/unlabeled-1.65.2/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7853)
+++ branches/unlabeled/unlabeled-1.65.2/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 7874)
@@ -350,79 +350,38 @@
$this->Application->ReplacementTemplates = array_merge_recursive2($this->Application->ReplacementTemplates, $config['ReplacementTemplates']);
}
- if ( $this->Application->isDebugMode(false) && constOn('DBG_VALIDATE_CONFIGS') && isset($config['TableName']) ) {
- $this->ValidateConfig($prefix);
- }
- }
-
- function ValidateConfig($prefix)
+ if ( $this->Application->isDebugMode() && constOn('DBG_VALIDATE_CONFIGS') && isset($config['TableName']) )
{
global $debugger;
-
- $config =& $this->configData[$prefix];
-
$tablename = $config['TableName'];
- $float_types = Array ('float', 'double', 'numeric');
+
$conn =& $this->Application->GetADODBConnection();
-
- $table_found = $conn->Query('SHOW TABLES LIKE "'.$tablename.'"');
- if (!$table_found) {
- // config present, but table missing, strange
- $debugger->appendHTML("Config Warning: Table $tablename missing, but prefix ".$config['Prefix']." requires it!");
- safeDefine('DBG_RAISE_ON_WARNINGS', 1);
- return ;
- }
-
$res = $conn->Query("DESCRIBE $tablename");
- $config_link = $debugger->getFileLink(FULL_PATH.$this->prefixFiles[$config['Prefix']], 1, $config['Prefix']);
-
foreach ($res as $field) {
$f_name = $field['Field'];
if (getArrayValue($config, 'Fields')) {
- if (preg_match('/l[\d]+_[\w]/', $f_name)) {
- // skip multilingual fields
- continue;
- }
-
if (!array_key_exists ($f_name, $config['Fields'])) {
- $debugger->appendHTML("Config Warning: Field $f_name exists in the database, but is not defined in config file for prefix ".$config_link." !");
+ $debugger->appendHTML("Config Warning: Field $f_name exists in the database, but is not defined in config file for prefix ".$config['Prefix']."!");
safeDefine('DBG_RAISE_ON_WARNINGS', 1);
}
else {
$options = $config['Fields'][$f_name];
- if ($field['Null'] != 'YES') {
- // MySQL5 for null returns "NO", but MySQL4 returns ""
+ if ($field['Null'] == '') {
if ( $f_name != $config['IDField'] && !isset($options['not_null']) && !isset($options['required']) ) {
- $debugger->appendHTML("Config Error: Field $f_name in config for prefix ".$config_link." is NOT NULL in the database, but is not configured as not_null or required !");
+ $debugger->appendHTML("Config Error: Field $f_name in config for prefix ".$config['Prefix']." is NOT NULL in the database, but is not configured as not_null or required!");
safeDefine('DBG_RAISE_ON_WARNINGS', 1);
}
if ( isset($options['not_null']) && !isset($options['default']) ) {
- $debugger->appendHTML("Config Error: Field $f_name in config for prefix ".$config_link." is described as NOT NULL, but does not have DEFAULT value !");
+ $debugger->appendHTML("Config Error: Field $f_name in config for prefix ".$config['Prefix']." is described as NOT NULL, but does not have DEFAULT value!");
safeDefine('DBG_RAISE_ON_WARNINGS', 1);
}
-
- if (!isset($options['default'])) {
- $debugger->appendHTML("Config Error: Default value for field $f_name in config for prefix ".$config_link." not set !");
- safeDefine('DBG_RAISE_ON_WARNINGS', 1);
}
- elseif ($f_name == $config['IDField'] && $options['default'] !== 0) {
- $debugger->appendHTML("Config Error: Default value for field IDField $f_name (".var_export($options['default'], true).") in config for prefix ".$config_link." differs from default value from field in database (".var_export($field['Default'], true).") !");
- safeDefine('DBG_RAISE_ON_WARNINGS', 1);
- }
- else if ($options['default'] != '#NOW#' && $field['Default'] !== (string)$options['default'] && !in_array($options['type'], $float_types)) {
- $debugger->appendHTML("Config Error: Default value for field $f_name (".var_export($options['default'], true).") in config for prefix ".$config_link." differs from default value from field in database (".var_export($field['Default'], true).") !");
-// $debugger->dumpVars($field['Default'], $options['default'], 'STRICT');
- safeDefine('DBG_RAISE_ON_WARNINGS', 1);
- }
-
- // check that all idfields have default values & are not_null!!!
- }
+ }
}
}
}
-
}
function ProcessDependencies($prefix)