Index: trunk/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r8052 -r8104 --- trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8052) +++ trunk/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 8104) @@ -354,13 +354,10 @@ $this->ValidateConfig($prefix); } } - function ValidateConfig($prefix) { global $debugger; - $config =& $this->configData[$prefix]; - $tablename = $config['TableName']; $float_types = Array ('float', 'double', 'numeric'); $conn =& $this->Application->GetADODBConnection(); @@ -372,10 +369,8 @@ 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']); - $error_messages = Array ( 'field_not_found' => 'Field %s exists in the database, but is not defined in config', 'default_missing' => 'Default value for field %s not set in config', @@ -385,10 +380,9 @@ 'invalid_default' => 'Default value for field %s%s not sync. to db (in config = %s, in db = %s)', 'type_missing' => 'Type definition for field %s missing in config', ); - $config_errors = Array (); $tablename = preg_replace('/^'.preg_quote(TABLE_PREFIX, '/').'(.*)/', '\\1', $tablename); // remove table prefix - + foreach ($res as $field) { $f_name = $field['Field']; @@ -397,7 +391,6 @@ // skip multilingual fields continue; } - if (!array_key_exists ($f_name, $config['Fields'])) { $config_errors[] = sprintf($error_messages['field_not_found'], $f_name); } @@ -412,7 +405,6 @@ $config_errors[] = sprintf($error_messages['default_missing'], $f_name); $default_missing = true; } - if ($field['Null'] != 'YES') { // field is NOT NULL in database (MySQL5 for null returns "NO", but MySQL4 returns "") if ( $f_name != $config['IDField'] && !isset($options['not_null']) && !isset($options['required']) ) { @@ -427,11 +419,9 @@ $config_errors[] = sprintf($error_messages['not_null_error3'], $f_name); } } - if (!array_key_exists('type', $options)) { $config_errors[] = sprintf($error_messages['type_missing'], $f_name); } - if (!$default_missing) { if ($f_name == $config['IDField'] && $options['type'] != 'string' && $options['default'] !== 0) { $config_errors[] = sprintf($error_messages['invalid_default'], 'IDField ', $f_name, $this->varDump($options['default']), $this->varDump($field['Default'])); @@ -443,21 +433,20 @@ } } } - if ($config_errors) { $error_prefix = 'Config Error'.(count($config_errors) > 1 ? 's' : '').': for prefix '.$config_link.' ('.$tablename.') in unit config:
'; $config_errors = $error_prefix.'   '.implode('
   ', $config_errors); - $debugger->appendHTML($config_errors); - safeDefine('DBG_RAISE_ON_WARNINGS', 1); - } + safeDefine('DBG_RAISE_ON_WARNINGS', 1); + } } function varDump($value) { return ''.var_export($value, true).' of '.gettype($value); + } - + function ProcessDependencies($prefix) { $config =& $this->configData[$prefix];