Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit e810a2c

Browse files
committed
making sure the config doesn't get written until after migrations run
1 parent 4bc373a commit e810a2c

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

core/lib/PatternLab/Configurer.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ public function getConfig() {
5353
// check to see if the user config exists, if not create it
5454
print "configuring pattern lab...\n";
5555
if (!file_exists($this->userConfigPath)) {
56-
if (!@copy($this->plConfigPath, $this->userConfigPath)) {
57-
print "Please make sure that Pattern Lab can write a new config to config/.\n";
58-
exit;
59-
}
6056
$migrate = true;
6157
} else {
6258
$config = parse_ini_file($this->userConfigPath);
@@ -70,8 +66,15 @@ public function getConfig() {
7066
print "upgrading your version of pattern lab...\n";
7167
print "checking for migrations...\n";
7268
$m = new Migrator;
73-
$m->migrate($diffVersion);
74-
$config = $this->writeNewConfig($config,$defaultConfig);
69+
$m->migrate(true);
70+
if ($migrate) {
71+
if (!@copy($this->plConfigPath, $this->userConfigPath)) {
72+
print "Please make sure that Pattern Lab can write a new config to config/.\n";
73+
exit;
74+
}
75+
} else {
76+
$config = $this->writeNewConfig($config,$defaultConfig);
77+
}
7578
}
7679

7780
return $config;

0 commit comments

Comments
 (0)