Skip to content

Existing uddeIM configuration is reset to defaults during update/reinstall #129

Description

@JKoelman

Description

While testing uddeIM 5.6.3 on Joomla 6, I noticed that existing global uddeIM configuration values can be reset to the packaged defaults when the component is updated/reinstalled through Joomla.

This is potentially quite disruptive because an administrator can lose previously configured settings without explicitly resetting them.

This may not be Joomla 6 specific; that is simply the environment where I reproduced it.

Environment

  • Joomla 6.1.2
  • uddeIM 5.6.3
  • PHP 8.x
  • Playwright

Reproduction

I first noticed this with e-mail notifications.

Before reinstall/update:

allowemailnotify = 1

After reinstalling the component: allowemailnotify = 0

The recipient-specific notification preference was still present, so the problem appeared to be the global uddeIM configuration.

I then repeated the test with several independent configuration values.

Before update/reinstall:

allowemailnotify = 1
emailtrafficenabled = 1
enableattachment = 1
maxlength = 2350
perpage = 13
showonline = 0
allowurltext = 1

After update/reinstall they had returned to the packaged defaults:

allowemailnotify = 0
emailtrafficenabled = 0
enableattachment = 0
maxlength = 2500
perpage = 8
showonline = 1
allowurltext = 0

Actual result

Existing administrator configuration is replaced by the default values from the installed package.

Expected result

An uddeIM update/reinstall should preserve the administrator's existing configuration values.
New configuration options introduced by a newer version should of course still receive their new package defaults.

Cause

In com_uddeim_j50/script50.php, the current configuration is backed up during preflight('update'):

rename(
    JPATH_SITE . '/administrator/components/com_uddeim/config.class.php',
    JPATH_SITE . '/administrator/components/com_uddeim/config.class_bak.php'
);

The package then installs its config.class.php.

In postflight() the backup is reported, but its existing configuration values are not restored or merged into the newly installed configuration.

So the backup exists, but the active configuration continues using the package defaults.

Possible solution

After the new configuration file has been installed, values from config.class_bak.php could be merged into the new configuration.

A safe approach would be:

  • restore only properties that exist in both the old and new configuration;
  • keep package defaults for newly introduced properties;
  • do not overwrite the new configuration schema/version value;
  • do not restore temporary runtime properties;
  • keep config.class_bak.php as a recovery copy.

This would preserve existing administrator settings while still allowing future uddeIM versions to introduce new configuration options safely.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions