Project

General

Profile

Bug #6991

user settings appended, not overwritten

Added by Anonymous almost 8 years ago. Updated almost 8 years ago.

Status:
Bug resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
25/02/2014
Due date:
% Done:

0%

Estimated time:
Complexity:
Normal

Description

when the user settings are changes (My Account > User Settings), the settings are not overwritten in the database, but appended (see screenshot). In practice, this means that only the last occuring set of settings will be loaded (see common/libraries/php/shared/configuration/local_setting.class.php, load_local_settings), and it appears to be working correctly.

This is a problem for three reasons:
- incorrect semantics of updating the database [i.e. incorrect]
- redundant storage and longer load times [i.e. inefficient]
- prevents other modules from changing user settings in a straightforward way (as per default, only the first occuring set of settings will be overwritten, which prevents them from being selected when loaded (see above) [i.e. inextensible]


Files

History

#1

Updated by Anonymous almost 8 years ago

  • Subject changed from use settings appended, not overwritten to user settings appended, not overwritten
#2

Updated by Anonymous almost 8 years ago

  • Status changed from New to Bug resolved
  • Assignee set to Anonymous

bugfix created

two files affected:
core/admin/php/lib/configuration_form.class.php line 475
common/extensions/video_conferencing_manager/php/lib/form/settings.class.php line 412

note: the settings tables in your local database should be cleaned up (remove the duplicates); saving the settings with highest ID (of all duplicates) is sufficient to retain stability.

pull request pending

#3

Updated by Anonymous almost 8 years ago

the following SQL cleans up duplicates from the user settings (took about 6 minutes on our testing servers)

DELETE user_setting FROM user_setting LEFT OUTER JOIN (
    SELECT MAX(id) AS id, user_id, setting_id, value
    FROM user_setting
    GROUP BY user_id, setting_id
) AS keep_setting ON user_setting.id = keep_setting.id
WHERE keep_setting.id IS NULL

Also available in: Atom PDF