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

Commit

Permalink
Fixes for APIController to update correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanlesage committed Sep 17, 2016
1 parent d07cb0f commit 94f83eb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/Http/Controllers/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
use App\Http\Requests;

use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Artisan;

// Composer dependencies to run from PHP
use Composer\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;

use ZipArchive;

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

$ch = curl_init();
Expand Down Expand Up @@ -118,7 +123,7 @@ public function moveUpdate()

// Remove old files
foreach($diff['remove'] as $file) {
File::delete(base_path() . $file, File::get(base_path() . '/storage/app/update_files/' . $file));
File::delete(base_path() . $file);
}

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

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

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

0 comments on commit 94f83eb

Please sign in to comment.