gestione gare pubbliche
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

90 righe
1.9 KiB

<?php
namespace App\Jobs\Preservation;
use Illuminate\Bus\Queueable;
use Illuminate\Support\Facades\DB;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
class DeleteZipArchiveJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* The number of times the job may be attempted.
*
* @var int
*/
public $tries = 5;
/**
* The maximum number of unhandled exceptions to allow before failing.
*
* @var int
*/
public $maxExceptions = 5;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 1800;
/**
* Indicate if the job should be marked as failed on timeout.
*
* @var bool
*/
public $failOnTimeout = true;
/**
* Tenant's id
*
* @var Int
*/
protected $tenant;
/**
* Package's id
*
* @var Int
*/
protected $package;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct(Int $tenant, Int $package)
{
$this->tenant = $tenant;
$this->package = $package;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
config(['database.connections.mysql-tenant.database' => config('json.prefix_db') . "_ente{$this->tenant}"]);
DB::purge('mysql-tenant');
$path = dirname(base_path());
include "{$path}/config.php";
if(file_exists("{$config["mediaFolder"]}/{$this->tenant}/conservazione/ZIPARCH-{$this->package}.zip")) {
unlink("{$config["mediaFolder"]}/{$this->tenant}/conservazione/ZIPARCH-{$this->package}.zip");
}
}
}