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

Commit 94f83eb

Browse files
committed
Fixes for APIController to update correctly
1 parent d07cb0f commit 94f83eb

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

app/Http/Controllers/APIController.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
use App\Http\Requests;
88

99
use Illuminate\Support\Facades\File;
10+
use Illuminate\Support\Facades\Artisan;
11+
12+
// Composer dependencies to run from PHP
13+
use Composer\Console\Application;
14+
use Symfony\Component\Console\Input\ArrayInput;
1015

1116
use ZipArchive;
1217

@@ -25,7 +30,7 @@ public function downloadUpdate($version)
2530
{
2631
// This function gets the ZIP and extracts its contents to the correct dirs
2732
$archive = 'https://github.com/Zettlr/wiki/archive/' . $version . '.zip';
28-
$dest = 'tmp.zip';
33+
$dest = base_path() . '/storage/app/tmp.zip';
2934
$foldername = false;
3035

3136
$ch = curl_init();
@@ -118,7 +123,7 @@ public function moveUpdate()
118123

119124
// Remove old files
120125
foreach($diff['remove'] as $file) {
121-
File::delete(base_path() . $file, File::get(base_path() . '/storage/app/update_files/' . $file));
126+
File::delete(base_path() . $file);
122127
}
123128

124129
// Now the pure folder structure of this installation resembles the
@@ -135,7 +140,7 @@ public function migrateDatabase()
135140
// new tables, alterations and the like.
136141

137142
// We need to --force artisan to prevent security questions.
138-
Artisan::call('migrate --force');
143+
Artisan::call('migrate', ['--force' => true]);
139144

140145
return response()->json(['Database migration successful!', 200]);
141146
}

0 commit comments

Comments
 (0)