diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php
index a21b0bc325..cd87548876 100644
--- a/app/Http/Controllers/System/InstallController.php
+++ b/app/Http/Controllers/System/InstallController.php
@@ -29,7 +29,6 @@ use FireflyIII\Http\Controllers\Controller;
use Laravel\Passport\Passport;
use Log;
use phpseclib\Crypt\RSA;
-use Symfony\Component\Console\Output\BufferedOutput;
/**
* Class InstallController
@@ -47,15 +46,16 @@ class InstallController extends Controller
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
- public function migrate()
+ public function index()
{
- Log::debug('Am now calling migrate routine...');
- $output = new BufferedOutput();
- Artisan::call('migrate', ['--seed' => true, '--force' => true]);
- $result = $output->fetch();
- Log::debug($result);
- Log::debug(Artisan::output());
+ return view('install.index');
+ }
+ /**
+ * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
+ */
+ public function keys()
+ {
// create keys manually because for some reason the passport namespace
// does not exist
$rsa = new RSA();
@@ -67,13 +67,37 @@ class InstallController extends Controller
];
if ((file_exists($publicKey) || file_exists($privateKey))) {
- return redirect(route('index'));
+ return response()->json(['OK']);
}
file_put_contents($publicKey, array_get($keys, 'publickey'));
file_put_contents($privateKey, array_get($keys, 'privatekey'));
- return redirect(route('index'));
+ return response()->json(['OK']);
+ }
+
+ /**
+ * @return \Illuminate\Http\JsonResponse
+ */
+ public function migrate()
+ {
+ Log::debug('Am now calling migrate routine...');
+ Artisan::call('migrate', ['--seed' => true, '--force' => true]);
+ Log::debug(Artisan::output());
+
+ return response()->json(['OK']);
+ }
+
+ /**
+ * @return \Illuminate\Http\JsonResponse
+ */
+ public function upgrade()
+ {
+ Log::debug('Am now calling upgrade database routine...');
+ Artisan::call('firefly:upgrade-database');
+ Log::debug(Artisan::output());
+
+ return response()->json(['OK']);
}
}
\ No newline at end of file
diff --git a/app/Http/Middleware/Installer.php b/app/Http/Middleware/Installer.php
index 43e38ba37c..d707f6872a 100644
--- a/app/Http/Middleware/Installer.php
+++ b/app/Http/Middleware/Installer.php
@@ -50,7 +50,7 @@ class Installer
// redirect to UpdateController
Log::warning('There are no Firefly III tables present. Redirect to migrate routine.');
- return response()->redirectTo(route('installer.migrate'));
+ return response()->redirectTo(route('installer.index'));
}
throw new FireflyException(sprintf('Could not access the database: %s', $message));
}
@@ -64,7 +64,7 @@ class Installer
));
// redirect to migrate routine:
- return response()->redirectTo(route('installer.migrate'));
+ return response()->redirectTo(route('installer.index'));
}
return $next($request);
}
diff --git a/public/js/ff/install/index.js b/public/js/ff/install/index.js
new file mode 100644
index 0000000000..22b8575918
--- /dev/null
+++ b/public/js/ff/install/index.js
@@ -0,0 +1,70 @@
+/*
+ * index.js
+ * Copyright (c) 2018 thegrumpydictator@gmail.com
+ *
+ * This file is part of Firefly III.
+ *
+ * Firefly III is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Firefly III is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Firefly III. If not, see
Please wait...