Index: branches/5.2.x/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r16415 -r16417 --- branches/5.2.x/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 16415) +++ branches/5.2.x/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 16417) @@ -1,6 +1,6 @@ Application->SetConfigValue($variable_name, $object->GetDBField('VariableValue'), true); + + $sorting_prefix = $this->getSortingPrefix($variable_name); + + if ( $sorting_prefix ) { + $sql = 'DELETE FROM ' . TABLE_PREFIX . 'UserPersistentSessionData + WHERE VariableName LIKE "' . $sorting_prefix . '%Sortings.%"'; + $this->Conn->Query($sql); + } } if ( $variable_name == 'Require_AdminSSL' || $variable_name == 'AdminSSL_URL' ) { @@ -323,6 +331,35 @@ } /** + * Returns prefix, related to given sorting system setting + * + * @param string $system_setting System setting. + * + * @return boolean|string + */ + protected function getSortingPrefix($system_setting) + { + foreach ( $this->Application->ModuleInfo as $module_info ) { + if ( $module_info['Name'] == 'In-Portal' ) { + continue; + } + + $prefix = ($module_info['Var'] == 'adm') ? 'c' : $module_info['Var']; + $config_mapping = $this->Application->getUnitOption($prefix, 'ConfigMapping'); + + if ( (isset($config_mapping['DefaultSorting1Field']) + && $system_setting == $config_mapping['DefaultSorting1Field']) + || (isset($config_mapping['DefaultSorting2Field']) + && $system_setting == $config_mapping['DefaultSorting2Field']) + ) { + return $prefix; + } + } + + return false; + } + + /** * Updates kDBItem * * @param kEvent $event