mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 23:54:12 -08:00
Merge remote-tracking branch 'origin/develop'
This commit is contained in:
commit
a0183ff56f
2
.github/workflows/codacy-analysis.yml
vendored
2
.github/workflows/codacy-analysis.yml
vendored
|
@ -36,7 +36,7 @@ jobs:
|
|||
|
||||
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||
- name: Run Codacy Analysis CLI
|
||||
uses: codacy/codacy-analysis-cli-action@1.1.0
|
||||
uses: codacy/codacy-analysis-cli-action@v4.1.0
|
||||
with:
|
||||
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||
# You can also omit the token and run the tools that support default configurations
|
||||
|
|
|
@ -1278,34 +1278,30 @@ 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();
|
||||
/* Run migrations */
|
||||
\Log::debug('Migrating database...');
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
$migrate_output = Artisan::output();
|
||||
\Log::debug($migrate_output);
|
||||
|
||||
if (!$find_user){
|
||||
\Log::warning('Attempting to restore user: ' . $user->first_name . ' ' . $user->last_name);
|
||||
$new_user = $user->replicate();
|
||||
$new_user->push();
|
||||
}
|
||||
|
||||
|
||||
\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();
|
||||
|
||||
return redirect()->route('login')->with('success', 'Your system has been restored. Please login again.');
|
||||
$find_user = DB::table('users')->where('username', $user->username)->exists();
|
||||
|
||||
if (!$find_user){
|
||||
\Log::warning('Attempting to restore user: ' . $user->username);
|
||||
$new_user = $user->replicate();
|
||||
$new_user->push();
|
||||
} else {
|
||||
return redirect()->route('settings.backups.index')->with('error', $output);
|
||||
|
||||
\Log::debug('User: ' . $user->username .' already exists.');
|
||||
}
|
||||
|
||||
\Log::debug('Logging all users out..');
|
||||
Artisan::call('snipeit:global-logout', ['--force' => true]);
|
||||
|
||||
DB::table('users')->update(['remember_token' => null]);
|
||||
\Auth::logout();
|
||||
|
||||
return redirect()->route('login')->with('success', 'Your system has been restored. Please login again.');
|
||||
|
||||
} else {
|
||||
return redirect()->route('settings.backups.index')->with('error', trans('admin/settings/message.backup.file_not_found'));
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@ class AddEulaToCheckoutAcceptance extends Migration
|
|||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('checkout_acceptances', function (Blueprint $table) {
|
||||
$table->text('stored_eula')->nullable()->default(null);
|
||||
$table->string('stored_eula_file')->nullable()->default(null);
|
||||
});
|
||||
if (!Schema::hasColumn('checkout_acceptances', 'stored_eula')) {
|
||||
Schema::table('checkout_acceptances', function (Blueprint $table) {
|
||||
$table->text('stored_eula')->nullable()->default(null);
|
||||
$table->string('stored_eula_file')->nullable()->default(null);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,13 +28,15 @@ class AddEulaToCheckoutAcceptance extends Migration
|
|||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('checkout_acceptances', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) {
|
||||
$table->dropColumn('stored_eula');
|
||||
}
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula_file')) {
|
||||
$table->dropColumn('stored_eula_file');
|
||||
}
|
||||
});
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) {
|
||||
Schema::table('checkout_acceptances', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) {
|
||||
$table->dropColumn('stored_eula');
|
||||
}
|
||||
if (Schema::hasColumn('checkout_acceptances', 'stored_eula_file')) {
|
||||
$table->dropColumn('stored_eula_file');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue