corretto, era il DB che avevo cancellato l'utente dove era salvata la chiave...
This commit is contained in:
43
app/Console/Commands/FixStoragePermissions.php
Normal file
43
app/Console/Commands/FixStoragePermissions.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
|
||||||
|
class FixStoragePermissions extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'fix:storage-permissions';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Fix permissions for the storage/logs directory';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
// Esegui i comandi di shell
|
||||||
|
exec('sudo chown -R www-data:www-data /var/www/html/apimacro/storage/logs', $output, $returnVar);
|
||||||
|
exec('sudo chmod -R 775 /var/www/html/apimacro/storage/logs', $output, $returnVar);
|
||||||
|
|
||||||
|
// Controlla se ci sono stati errori
|
||||||
|
if ($returnVar !== 0) {
|
||||||
|
$this->error('Errore nel fix dei permessi.');
|
||||||
|
return 1; // Codice di errore
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info('Permessi del storage/logs aggiornati con successo.');
|
||||||
|
return 0; // Codice di successo
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ class Kernel extends ConsoleKernel
|
|||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $commands = [
|
protected $commands = [
|
||||||
//
|
\App\Console\Commands\FixStoragePermissions::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +28,10 @@ class Kernel extends ConsoleKernel
|
|||||||
|
|
||||||
// Log::info('Controllo schedule...');
|
// Log::info('Controllo schedule...');
|
||||||
// $schedule->command('inspire')->hourly();
|
// $schedule->command('inspire')->hourly();
|
||||||
|
|
||||||
|
// Pianifica l'esecuzione del comando ogni giorno a mezzanotte
|
||||||
|
$schedule->command('fix:storage-permissions')->daily();
|
||||||
|
|
||||||
$schedule->command('backup:clean')->daily()->at('02:00')->before(function () {
|
$schedule->command('backup:clean')->daily()->at('02:00')->before(function () {
|
||||||
Log::info('Running backup:clean command');
|
Log::info('Running backup:clean command');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -239,11 +239,10 @@ function loadArticleByIdArticle($id, $checkprevendita = false)
|
|||||||
$ris .= getarraystr($articles); // Converte solo i dati specificati in JSON
|
$ris .= getarraystr($articles); // Converte solo i dati specificati in JSON
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// $product = Product::where('sku', $id)->first();
|
$product = Product::where('sku', $id)->first();
|
||||||
$products = Product::all($options = ['per_page' => 100, 'page' => 1]);
|
|
||||||
|
|
||||||
$ris .= 'Product:' . PHP_EOL;
|
$ris .= 'Product:' . PHP_EOL;
|
||||||
//$ris .= getarraystr($products);
|
$ris .= getarraystr($product);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$ris .= "!!! Errore loadArticleByIdArticle Product: " . $e->getMessage();
|
$ris .= "!!! Errore loadArticleByIdArticle Product: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -300,9 +299,6 @@ function showDettOrdini()
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$orders = Order::all();
|
$orders = Order::all();
|
||||||
// $orders = Order::orderBy('DataOra', 'desc')->take(2)->get();
|
|
||||||
/*
|
|
||||||
$orders = Order::take(2)->get();
|
|
||||||
|
|
||||||
// Show the fields of the orders
|
// Show the fields of the orders
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
@@ -310,7 +306,7 @@ function showDettOrdini()
|
|||||||
$str .= getvalstr("Id", $order->id);
|
$str .= getvalstr("Id", $order->id);
|
||||||
//$str .= getvalstr("DataOra", $order->DataOra);
|
//$str .= getvalstr("DataOra", $order->DataOra);
|
||||||
//$str .= getvalstr("Totale", $order->Totale);
|
//$str .= getvalstr("Totale", $order->Totale);
|
||||||
}*/
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return "Errore showDettOrdini: " . $e->getMessage();
|
return "Errore showDettOrdini: " . $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class TestPaoController extends Controller
|
|||||||
{
|
{
|
||||||
echo "getProductBySku:" . $sku;
|
echo "getProductBySku:" . $sku;
|
||||||
$product = Product::where('sku', $sku)->first();
|
$product = Product::where('sku', $sku)->first();
|
||||||
/*
|
|
||||||
// Estrai il prodotto utilizzando il codice SKU
|
// Estrai il prodotto utilizzando il codice SKU
|
||||||
|
|
||||||
if ($product) {
|
if ($product) {
|
||||||
@@ -36,8 +36,6 @@ class TestPaoController extends Controller
|
|||||||
} else {
|
} else {
|
||||||
// Ritorna un errore se il prodotto non è trovato
|
// Ritorna un errore se il prodotto non è trovato
|
||||||
return response()->json(['error' => 'Product not found'], 404);
|
return response()->json(['error' => 'Product not found'], 404);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
response()->json(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user