Skip to content

Commit d1f7224

Browse files
authored
Refactor file path and filename exclusions
Refactored the path and filename exclusion logic to improve maintainability and flexibility. Removed unnecessary file from filename exclusions. Updated the 'upgrade exclude' log to include additional excluded filenames.
1 parent 429d649 commit d1f7224

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Updater.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function __construct(string $username, string $repository, string $token,
8686
$this->exclude = ['source' => $sourceExclusions, 'release' => $releaseExclusions];
8787
$this->clear = $clear;
8888

89-
if($dir != ""){
89+
if ($dir != "") {
9090
$this->dir = $dir;
9191
} else {
9292
$this->dir = getcwd();
@@ -378,11 +378,11 @@ private function Upgrade()
378378
sleep(10);
379379

380380
$source_exclude = [];
381-
$source_exclude['path'] = [$this->dir . '/.git', $this->dir . '/update', $this->dir . '/update.lock', $this->dir . '/vendor', $this->dir . '/composer.phar'];
381+
$source_exclude['path'] = [$this->dir . '/.git', $this->dir . '/update', $this->dir . '/update.lock', $this->dir . '/vendor'];
382382
$source_exclude['path'] = array_merge($source_exclude['path'], $this->exclude['source']['path']);
383383
$source_exclude['path'] = array_unique($source_exclude['path']);
384384

385-
$source_exclude['filename'] = ['.gitignore'];
385+
$source_exclude['filename'] = [];
386386
$source_exclude['filename'] = array_merge($source_exclude['filename'], $this->exclude['source']['filename']);
387387
$source_exclude['filename'] = array_unique($source_exclude['filename']);
388388

@@ -398,7 +398,7 @@ private function Upgrade()
398398
$release_exclude = [];
399399
$release_exclude['path'] = $this->exclude['release']['path'];
400400

401-
$release_exclude['filename'] = ['.gitignore'];
401+
$release_exclude['filename'] = ['composer.phar', '.gitignore', '.gitkeep'];
402402
$release_exclude['filename'] = array_merge($release_exclude['filename'], $this->exclude['release']['filename']);
403403
$release_exclude['filename'] = array_unique($release_exclude['filename']);
404404
$this->log[] = [date("Y-m-d H:i:s"), "Upgrade exclude:\n" . json_encode($release_exclude, JSON_PRETTY_PRINT)];

0 commit comments

Comments
 (0)