Index: branches/unlabeled/unlabeled-1.115.2/core/kernel/application.php =================================================================== diff -u -r4217 -r4278 --- branches/unlabeled/unlabeled-1.115.2/core/kernel/application.php (.../application.php) (revision 4217) +++ branches/unlabeled/unlabeled-1.115.2/core/kernel/application.php (.../application.php) (revision 4278) @@ -186,8 +186,8 @@ $this->DB = new kDBConnection(SQL_TYPE, Array(&$this,'handleSQLError') ); $this->DB->Connect(SQL_SERVER, SQL_USER, SQL_PASS, SQL_DB); $this->DB->debugMode = $this->isDebugMode(); - - $this->ModuleInfo = $this->DB->Query('SELECT * FROM '.TABLE_PREFIX.'Modules ORDER BY LoadOrder', 'Name'); + + $this->refreshModuleInfo(); $this->ConfigHash = $this->DB->GetCol('SELECT VariableValue, VariableName FROM '.TABLE_PREFIX.'ConfigurationValues', 'VariableName'); $rewrite_on = $this->ConfigValue('UseModRewrite'); @@ -239,6 +239,11 @@ return true; } + function refreshModuleInfo() + { + $this->ModuleInfo = $this->DB->Query('SELECT * FROM '.TABLE_PREFIX.'Modules ORDER BY LoadOrder', 'Name'); + } + /** * Checks if passed language id if valid and sets it to primary otherwise * Index: branches/unlabeled/unlabeled-1.3.2/kernel/units/general/helpers/multilanguage.php =================================================================== diff -u -r4030 -r4278 --- branches/unlabeled/unlabeled-1.3.2/kernel/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 4030) +++ branches/unlabeled/unlabeled-1.3.2/kernel/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 4278) @@ -43,6 +43,10 @@ { $table_name = $this->Application->getUnitOption('lang', 'TableName'); $languages_count = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$table_name); + if (!$languages_count) { + // during installation we have not languages, but we need to created custom field columns + $languages_count = 1; + } return $languages_count + 5 - ( $languages_count % 5 ? ($languages_count % 5) : 5 ); } Index: branches/unlabeled/unlabeled-1.43.2/core/kernel/db/db_event_handler.php =================================================================== diff -u -r4230 -r4278 --- branches/unlabeled/unlabeled-1.43.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4230) +++ branches/unlabeled/unlabeled-1.43.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4278) @@ -1580,15 +1580,20 @@ function OnCreateCustomFields(&$event) { $main_prefix = $this->Application->getUnitOption($event->Prefix, 'ParentPrefix'); + $item_type = $this->Application->getUnitOption($main_prefix, 'ItemType'); + if (!$item_type) { + // no main config of such type + return false; + } // 1. get custom field information - $item_type = $this->Application->getUnitOption($main_prefix, 'ItemType'); $sql = 'SELECT FieldName, CustomFieldId FROM '.TABLE_PREFIX.'CustomField WHERE Type = '.$item_type.' ORDER BY CustomFieldId'; $custom_fields = $this->Conn->GetCol($sql, 'CustomFieldId'); if (!$custom_fields) { + // config doesn't have custom fields return false; } Index: branches/unlabeled/unlabeled-1.3.2/core/units/general/helpers/multilanguage.php =================================================================== diff -u -r4030 -r4278 --- branches/unlabeled/unlabeled-1.3.2/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 4030) +++ branches/unlabeled/unlabeled-1.3.2/core/units/general/helpers/multilanguage.php (.../multilanguage.php) (revision 4278) @@ -43,6 +43,10 @@ { $table_name = $this->Application->getUnitOption('lang', 'TableName'); $languages_count = $this->Conn->GetOne('SELECT COUNT(*) FROM '.$table_name); + if (!$languages_count) { + // during installation we have not languages, but we need to created custom field columns + $languages_count = 1; + } return $languages_count + 5 - ( $languages_count % 5 ? ($languages_count % 5) : 5 ); }