Index: branches/5.2.x/core/kernel/session/session_storage.php =================================================================== diff -u -N -r14735 -r14811 --- branches/5.2.x/core/kernel/session/session_storage.php (.../session_storage.php) (revision 14735) +++ branches/5.2.x/core/kernel/session/session_storage.php (.../session_storage.php) (revision 14811) @@ -1,7 +1,7 @@ Application->TableFound($this->TableName) ) { + if ( defined('IS_INSTALL') && IS_INSTALL && $to_database && !$this->Application->TableFound($this->TableName, true) ) { return; } Index: branches/5.2.x/core/units/custom_data/custom_data_event_handler.php =================================================================== diff -u -N -r14628 -r14811 --- branches/5.2.x/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 14628) +++ branches/5.2.x/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 14811) @@ -1,6 +1,6 @@ Application->TableFound('CustomField')) { + if (defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('CustomField', true)) { return false; } @@ -141,7 +141,7 @@ $fields['cust_' . $custom_id] = $field_options; $fields['cust_' . $custom_id]['force_primary'] = !$custom_params['MultiLingual']; } - + $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); } Index: branches/5.2.x/core/install/upgrades.php =================================================================== diff -u -N -r14714 -r14811 --- branches/5.2.x/core/install/upgrades.php (.../upgrades.php) (revision 14714) +++ branches/5.2.x/core/install/upgrades.php (.../upgrades.php) (revision 14811) @@ -1,6 +1,6 @@ Conn->TableFound('PageContent')) { + if ($this->Conn->TableFound('PageContent', true)) { // 1. replaces "/kernel/user_files/" references in content blocks $ml_helper =& $this->Application->recallObject('kMultiLanguageHelper'); /* @var $ml_helper kMultiLanguageHelper */ @@ -993,7 +993,7 @@ } // 2. process "PageContent" table - if ($this->Conn->TableFound(TABLE_PREFIX . 'PageContent')) { + if ($this->Conn->TableFound(TABLE_PREFIX . 'PageContent', true)) { $structure = $this->Conn->Query('DESCRIBE ' . TABLE_PREFIX . 'PageContent', 'Field'); if (!array_key_exists('l1_Translated', $structure)) { $sql = "ALTER TABLE " . TABLE_PREFIX . "PageContent @@ -1007,7 +1007,7 @@ } // 3. process "FormFields" table - if ($this->Conn->TableFound(TABLE_PREFIX . 'FormFields')) { + if ($this->Conn->TableFound(TABLE_PREFIX . 'FormFields', true)) { $structure = $this->Conn->Query('DESCRIBE ' . TABLE_PREFIX . 'FormFields', 'Field'); if (!$structure['FormId']['Key']) { $sql = "ALTER TABLE " . TABLE_PREFIX . "FormFields @@ -1027,7 +1027,7 @@ } // 4. process "FormSubmissions" table - if ($this->Conn->TableFound(TABLE_PREFIX . 'FormSubmissions')) { + if ($this->Conn->TableFound(TABLE_PREFIX . 'FormSubmissions', true)) { $structure = $this->Conn->Query('DESCRIBE ' . TABLE_PREFIX . 'FormSubmissions', 'Field'); if (!$structure['SubmissionTime']['Key']) { $sql = "ALTER TABLE " . TABLE_PREFIX . "FormSubmissions @@ -1444,7 +1444,7 @@ $ml_helper->createFields('emailevents'); $languages = $ml_helper->getLanguages(); - if ($this->Conn->TableFound(TABLE_PREFIX . 'EmailMessage')) { + if ($this->Conn->TableFound(TABLE_PREFIX . 'EmailMessage', true)) { $email_message_helper =& $this->Application->recallObject('EmailMessageHelper'); /* @var $email_message_helper EmailMessageHelper */ Index: branches/5.2.x/core/kernel/managers/cache_manager.php =================================================================== diff -u -N -r14787 -r14811 --- branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14787) +++ branches/5.2.x/core/kernel/managers/cache_manager.php (.../cache_manager.php) (revision 14811) @@ -1,6 +1,6 @@ configVariables[$name]; } - if ( defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('ConfigurationValues') ) { + if ( defined('IS_INSTALL') && IS_INSTALL && !$this->Application->TableFound('ConfigurationValues', true) ) { return false; } Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -N -r14803 -r14811 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14803) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14811) @@ -1,6 +1,6 @@ TableFound('Modules')) { + if (defined('IS_INSTALL') && IS_INSTALL && !$this->TableFound('Modules', true)) { $this->registerModuleConstants(); return ; } @@ -2630,11 +2630,12 @@ * Allows to detect table's presense in database * * @param string $table_name + * @param bool $force * @return bool */ - function TableFound($table_name) + function TableFound($table_name, $force = false) { - return $this->Conn->TableFound($table_name); + return $this->Conn->TableFound($table_name, $force); } /** Index: branches/5.2.x/core/kernel/db/db_connection.php =================================================================== diff -u -N -r14609 -r14811 --- branches/5.2.x/core/kernel/db/db_connection.php (.../db_connection.php) (revision 14609) +++ branches/5.2.x/core/kernel/db/db_connection.php (.../db_connection.php) (revision 14811) @@ -1,6 +1,6 @@ GetCol('SHOW TABLES')); } - if (!isset($table_found[$table_name])) { - $table_found[$table_name] = $this->Query('SHOW TABLES LIKE "'.$table_name.'"'); + if ( !preg_match('/^' . preg_quote(TABLE_PREFIX, '/') . '(.*)/', $table_name) ) { + $table_name = TABLE_PREFIX . $table_name; } - return $table_found[$table_name]; + if ( $force ) { + if ( $this->Query('SHOW TABLES LIKE ' . $this->qstr($table_name)) ) { + $table_found[$table_name] = 1; + } + else { + unset($table_found[$table_name]); + } + } + + return isset($table_found[$table_name]); } /** Index: branches/5.2.x/core/units/helpers/multilanguage_helper.php =================================================================== diff -u -N -r14628 -r14811 --- branches/5.2.x/core/units/helpers/multilanguage_helper.php (.../multilanguage_helper.php) (revision 14628) +++ branches/5.2.x/core/units/helpers/multilanguage_helper.php (.../multilanguage_helper.php) (revision 14811) @@ -1,6 +1,6 @@ Application->getUnitOption($prefix, 'TableName'); $this->curFields = $this->Application->getUnitOption($prefix, 'Fields'); - if ( !($table_name && $this->curFields) || ($table_name && !$this->Conn->TableFound($table_name)) ) { + if ( !($table_name && $this->curFields) || ($table_name && !$this->Conn->TableFound($table_name, kUtil::constOn('IS_INSTALL'))) ) { // invalid config found or prefix not found return ; } @@ -245,7 +245,7 @@ $table_name = $this->Application->getUnitOption($prefix, 'TableName'); $this->curFields = $this->Application->getUnitOption($prefix, 'Fields'); - if ( !($table_name && $this->curFields) || ($table_name && !$this->Conn->TableFound($table_name)) ) { + if ( !($table_name && $this->curFields) || ($table_name && !$this->Conn->TableFound($table_name, kUtil::constOn('IS_INSTALL'))) ) { // invalid config found or prefix not found return ; }