1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 22:22:32 +01:00

Delete migration directory after Import

This commit is contained in:
David Bomba 2021-04-25 21:04:48 +10:00
parent 0a3bd01ef2
commit 1f87ca6ca2
4 changed files with 5 additions and 39 deletions

View File

@ -29,7 +29,6 @@ use App\Http\Middleware\QueryLogging;
use App\Http\Middleware\RedirectIfAuthenticated;
use App\Http\Middleware\SetDb;
use App\Http\Middleware\SetDbByCompanyKey;
use App\Http\Middleware\SetDefaultMailer;
use App\Http\Middleware\SetDomainNameDb;
use App\Http\Middleware\SetEmailDb;
use App\Http\Middleware\SetInviteDb;
@ -160,6 +159,5 @@ class Kernel extends HttpKernel
'contact_key_login' => ContactKeyLogin::class,
'check_client_existence' => CheckClientExistence::class,
'user_verified' => UserVerified::class,
'default_mailer' => SetDefaultMailer::class,
];
}

View File

@ -1,35 +0,0 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Middleware;
use App\Libraries\MultiDB;
use Closure;
use Illuminate\Http\Request;
use stdClass;
class SetDefaultMailer
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
config(['mail.default' => config('mail.default')]);
return $next($request);
}
}

View File

@ -26,6 +26,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Storage;
use ZipArchive;
class StartMigration implements ShouldQueue
@ -110,6 +111,8 @@ class StartMigration implements ShouldQueue
Import::dispatchNow($file, $this->company, $this->user);
Storage::deleteDirectory(public_path("storage/migrations/{$filename}"));
} catch (NonExistingMigrationFile | ProcessingMigrationArchiveFailed | ResourceNotAvailableForMigration | MigrationValidatorFailed | ResourceDependencyMissing $e) {
Mail::to($this->user)->send(new MigrationFailed($e, $e->getMessage()));

View File

@ -13,12 +13,12 @@
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => ['api_secret_check', 'default_mailer']], function () {
Route::group(['middleware' => ['api_secret_check']], function () {
Route::post('api/v1/signup', 'AccountController@store')->name('signup.submit');
Route::post('api/v1/oauth_login', 'Auth\LoginController@oauthApiLogin');
});
Route::group(['middleware' => ['api_secret_check', 'email_db', 'default_mailer']], function () {
Route::group(['middleware' => ['api_secret_check', 'email_db']], function () {
Route::post('api/v1/login', 'Auth\LoginController@apiLogin')->name('login.submit');
Route::post('api/v1/reset_password', 'Auth\ForgotPasswordController@sendResetLinkEmail');
});