Skip to content

Commit 3fd05ab

Browse files
author
Christian Blanquera
committed
when installing, now retains package versions unless you add --reinstall-packages flag
1 parent b5cf954 commit 3fd05ab

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

src/events/install.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@
9494

9595
//setup the configs
9696
$cwd = getcwd();
97-
if(!$request->hasStage('skip-configs')) {
97+
if (!$request->hasStage('skip-configs')) {
9898
CommandLine::system('Setting up config files...');
9999

100100
$paths = scandir(__DIR__ . '/../template/config');
101-
foreach($paths as $path) {
101+
foreach ($paths as $path) {
102102
if($path === '.' || $path === '..' || substr($path, -4) !== '.php') {
103103
continue;
104104
}
@@ -154,7 +154,7 @@
154154
}
155155

156156
//create compiled, log, public/upload, config/schema
157-
if(!$request->hasStage('skip-mkdir')) {
157+
if (!$request->hasStage('skip-mkdir')) {
158158
if (!is_dir($cwd . '/compiled')) {
159159
CommandLine::system('Making ' . $cwd . '/compiled');
160160
mkdir($cwd . '/compiled', 0777);
@@ -182,12 +182,12 @@
182182
}
183183

184184
//chmod compiled, log, config, public/upload
185-
if(!$request->hasStage('skip-chmod')) {
185+
if (!$request->hasStage('skip-chmod')) {
186186
// special case for config folder
187187
$configDirectories = glob($cwd . '/config/*', GLOB_ONLYDIR);
188188

189189
// map each directories
190-
foreach($configDirectories as $directory) {
190+
foreach ($configDirectories as $directory) {
191191
CommandLine::system('chmoding ' . $directory);
192192
chmod($directory, 0777);
193193
}
@@ -208,7 +208,7 @@
208208
}
209209
}
210210

211-
if(!$request->hasStage('skip-sql')) {
211+
if (!$request->hasStage('skip-sql')) {
212212
//SQL
213213
CommandLine::system('Setting up SQL...');
214214

@@ -239,7 +239,7 @@
239239
}
240240
}
241241

242-
if(!$request->hasStage('skip-versioning')) {
242+
if ($request->hasStage('reinstall-packages')) {
243243
// copy the default packages if it doesn't exists
244244
if (!$this->package('global')->config('packages')) {
245245
// get sample package config
@@ -254,7 +254,7 @@
254254
$packages = $this->package('global')->config('packages');
255255

256256
// on each packages
257-
foreach($packages as $package => $config) {
257+
foreach ($packages as $package => $config) {
258258
// reset the version so we can re-install again
259259
if (isset($config['version'])) {
260260
unset($packages[$package]['version']);
@@ -264,8 +264,10 @@
264264
// update the config
265265
$this->package('global')->config('packages', $packages);
266266
}
267+
}
267268

268-
//now run the update
269+
if (!$request->hasStage('skip-versioning')) {
270+
//run the update
269271
$this->trigger('update', $request, $response);
270272
}
271273

0 commit comments

Comments
 (0)