Skip to content

Commit

Permalink
Fix: DO NOT Override configuration files on update and skip default a…
Browse files Browse the repository at this point in the history
…rtwork when installing
  • Loading branch information
Jackysi committed Jan 6, 2025
1 parent b8e9b9d commit 409dfbf
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions panel/lib/API/Updates.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ class Updates extends Base {
*/
protected string $sseName = 'update';

/**
* Files to skip when extracting the release
*
* @var string[]
*/
private array $skipFiles = [
'inc/config/general.php' => true,
'inc/config/channels.php' => true,
'data/images/default.png' => true,
];


/**
* @param $pawtunes
Expand Down Expand Up @@ -156,7 +167,7 @@ function( $total, $now ) use ( &$lastSentPercent ) {


/**
* @throws \splitbrain\PHPArchive\ArchiveIOException
* @return void
*/
private function extractUpdate(): void {

Expand Down Expand Up @@ -188,6 +199,15 @@ private function extractUpdate(): void {
for ( $i = 0; $i < $total; $i++ ) {

$tmp = $zip->getNameIndex( $i );

// Skip specific files
if ( isset( $this->skipFiles[ $tmp ] ) ) {

unset( $this->skipFiles[ $tmp ] );
continue;

}

$zip->extractTo( $this->path, [ $tmp ] );

$file = $i + 1;
Expand All @@ -212,8 +232,6 @@ private function extractUpdate(): void {

public function postUpdate( $path ): void {

$this->sendSSE( "<div>Processing installation...</div>" );

// Trigger post update script
if ( file_exists( $path . '/post-update.php' ) ) {
include $path . '/post-update.php';
Expand Down

0 comments on commit 409dfbf

Please sign in to comment.