mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Run migrations after restore
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
f14a4d3bc7
commit
014a32b050
|
@ -1250,19 +1250,26 @@ class SettingsController extends Controller
|
|||
|
||||
// If it's greater than 300, it probably worked
|
||||
$output = Artisan::output();
|
||||
|
||||
if (strlen($output) > 300) {
|
||||
$find_user = DB::table('users')->where('first_name', $user->first_name)->where('last_name', $user->last_name)->exists();
|
||||
if(!$find_user){
|
||||
|
||||
if (!$find_user){
|
||||
\Log::warning('Attempting to restore user: ' . $user->first_name . ' ' . $user->last_name);
|
||||
$new_user = $user->replicate();
|
||||
$new_user->push();
|
||||
}
|
||||
|
||||
$session_files = glob(storage_path("framework/sessions/*"));
|
||||
foreach ($session_files as $file) {
|
||||
if (is_file($file))
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
\Log::debug('Logging all users out..');
|
||||
Artisan::call('snipeit:global-logout', ['--force' => true]);
|
||||
|
||||
/* run migrations */
|
||||
\Log::debug('Migrating database...');
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
$migrate_output = Artisan::output();
|
||||
\Log::debug($migrate_output);
|
||||
|
||||
DB::table('users')->update(['remember_token' => null]);
|
||||
\Auth::logout();
|
||||
|
||||
|
|
Loading…
Reference in a new issue