Skip to content

Preserve customized images during automatic updates while adding new ones - #160

Merged
itshypax merged 4 commits into
mainfrom
copilot/fix-automatic-updater-image-override
Nov 14, 2025
Merged

Preserve customized images during automatic updates while adding new ones#160
itshypax merged 4 commits into
mainfrom
copilot/fix-automatic-updater-image-override

Conversation

Copilot AI commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

The automatic updater overwrites customized images (logos, badges, wallpapers) in assets/img/ during updates, forcing users to manually restore customizations after each update.

Changes

src/Utils/SystemUpdater.php

  • Implemented intelligent image preservation in downloadAndApplyUpdate()
  • Added $preserveDirs parameter to copyUpdateFiles() method
  • Images in assets/img/ are only copied if they don't already exist
// Before
$excludeDirs = ['vendor', 'storage', 'system/updates'];
$this->copyUpdateFiles($sourceDir, $appRoot, $excludeDirs, $excludeFiles);

// After  
$excludeDirs = ['vendor', 'storage', 'system/updates'];
$preserveDirs = ['assets/img'];
$this->copyUpdateFiles($sourceDir, $appRoot, $excludeDirs, $excludeFiles, $preserveDirs);

The copyUpdateFiles() method now checks file_exists() for files in preserve directories:

  • If file exists → skip copying (preserve customization)
  • If file doesn't exist → copy from update (add new image)

system/updates/README.md

  • Documented intelligent image protection system
  • Explained that existing images are preserved while new ones are added
  • Listed specific customizable images: logos, badges, wallpapers, organization graphics

Impact

  • ✅ Preserves user customizations in assets/img/ (existing files not overwritten)
  • ✅ Automatically adds new images from updates (new files are copied)
  • ✅ Makes SYSTEM_LOGO config option functional (custom files no longer overwritten)
  • ✅ Best of both worlds: safety for customizations + benefits from update improvements

<issue_title>Automatischer Updater überschreibt Bilddateien</issue_title>

Beschreibe den Fehler

Wenn man den automatischen Updater verwendet, werden getauschte Bilddateien (z. B. Logos etc.) ausgetauscht.

Erwartetes Verhalten

Bilder sollten beim Updaten nicht überschrieben werden, oder bestenfalls im System austauschbar sein. Zum Beispiel in dem gewisse Bilddateien sich in der Administration per Upload tauschen lassen.

Original prompt

This section details on the original issue you should resolve

<issue_title>Automatischer Updater überschreibt Bilddateien</issue_title>
<issue_description>## Reproduzierbar?
Konntest du den Fehler selbst erneut provozieren?

  • Ja
  • Nein

Wo tritt der Fehler auf?

  • Computer (Browser)
  • Handy (Browser)
  • Ingame (intraTab)

Welche Version wird verwendet?

//

Beschreibe den Fehler

Wenn man den automatischen Updater verwendet, werden getauschte Bilddateien (z. B. Logos etc.) ausgetauscht.

Erwartetes Verhalten

Bilder sollten beim Updaten nicht überschrieben werden, oder bestenfalls im System austauschbar sein. Zum Beispiel in dem gewisse Bilddateien sich in der Administration per Upload tauschen lassen.

Zusätzlicher Kontext / Bilder

//
</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…ions

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix automatic updater overwriting image files Preserve customized images during automatic updates Nov 12, 2025
Copilot AI requested a review from itshypax November 12, 2025 16:14
@itshypax

Copy link
Copy Markdown
Collaborator

@copilot Und was passiert, wenn jemals neue Bilder hinzukommen sollten? Werden diese dann auch eingefügt?

…ates

Co-authored-by: itshypax <33388336+itshypax@users.noreply.github.com>

Copilot AI commented Nov 13, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Und was passiert, wenn jemals neue Bilder hinzukommen sollten? Werden diese dann auch eingefügt?

Gute Frage! Die ursprüngliche Lösung hätte neue Bilder blockiert. Ich habe das jetzt verbessert:

Neues Verhalten (Commit 98460d4):

  • ✅ Existierende Bilder bleiben erhalten (keine Überschreibung)
  • ✅ Neue Bilder aus Updates werden automatisch hinzugefügt

Das System prüft jetzt bei Dateien in assets/img/ mit file_exists() - wenn die Datei schon existiert, wird sie übersprungen. Neue Dateien werden normal kopiert.

Beispiel:

  • assets/img/defaultLogo.png (existiert) → bleibt erhalten
  • assets/img/new-badge-2025.png (neu im Update) → wird hinzugefügt

Copilot AI changed the title Preserve customized images during automatic updates Preserve customized images during automatic updates while adding new ones Nov 13, 2025
@itshypax
itshypax marked this pull request as ready for review November 14, 2025 16:24
@itshypax
itshypax merged commit a5a6484 into main Nov 14, 2025
1 check passed
@itshypax
itshypax deleted the copilot/fix-automatic-updater-image-override branch November 14, 2025 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automatischer Updater überschreibt Bilddateien

2 participants