remove lucide

This commit is contained in:
salam committed 2026-01-10 15:57:23 +01:00
1 parent d2caac4bcc
commit 208ef96178
46 files changed
+174 -337

No files matched your search

-88
View File
@@ -1,88 +0,0 @@
<?php
namespace App\Actions;
use App\Models\Bookmaker;
use App\Models\ClientBookmaker;
use App\Models\Provider;
use App\Models\Sport;
use App\Models\Supervisor;
class SupervisorDb
{
public static function generate($command)
{
return;
$_client_bookmaker = ClientBookmaker::get()->all();
$_provider = Provider::get()->all();
$_sports = Sport::where('is_active', 1)->get()->all();
$_bookmaker = Bookmaker::where('is_active', 1)->get()->all();
$processes = Supervisor::where('command', $command)->get()->all();
$have = [];
foreach ($processes as $process) {
dd($process);
$have[] = $process['code'];
$tmp = [];
$tmp['process'] = $process->command;
if (! $process->per_sport && ! $process->per_client) {
// $tmp['code'] = $row->command.$row->process;
// $tmp['command'] = $row->command.' '.$row->process;
// $tmp['description'] = $row->description;
// $res = Supervisor::where('code', $tmp['code'])->get();
// if (! $res->count()) {
// Supervisor::insert($tmp);
// }
} elseif ($process->per_sport && ! $process->per_client) {
foreach ($sports as $sport) {
$tmp['command'] = $process->process.$sport->code;
$tmp['sport_id'] = $sport->id;
$tmp['description'] = $process->description.' '.$sport->sport;
Supervisor::updateOrCreate(
['code' => $process->command.$sport->code, 'sport_id' => $sport->id],
['command' => $process->process.$sport->code, 'description' => $process->description]
);
}
// } elseif (! $row->per_sport && $row->per_client) {
// foreach ($clients as $client) {
// $tmp['customer_id'] = $client->id;
// if ($row->command == 'sen') {
// $tmp['code'] = $row->command.$row->process.$client->id;
// $tmp['command'] = $row->command.' '.$row->process.' '.$client->id;
// } else {
// $tmp['code'] = $row->command.$client->id;
// $tmp['command'] = $row->command.' '.$client->id;
// }
// $tmp['description'] = $row->description.' '.$client->customer;
// $res = Supervisor::where('code', $tmp['code'])->get();
// if (! $res->count()) {
// Supervisor::insert($tmp);
// }
// }
// } else {
// foreach ($sports as $sport) {
// foreach ($clients as $client) {
// $tmp['sport_id'] = $sport->id;
// $tmp['customer_id'] = $client->id;
// $tmp['code'] = $row->command.$sport->code.$client->id;
// $tmp['command'] = $row->command.' '.$sport->code.' '.$client->id;
// $tmp['description'] = $row->description.' '.$client->customer.' '.$sport->sport;
// $res = Supervisor::where('code', $tmp['code'])->get();
// if (! $res->count()) {
// Supervisor::insert($tmp);
// }
// }
// }
}
}
Supervisor::where('process', $command)->whereNotIn('code', $have)->delete();
}
}
+33 -43
View File
@@ -3,6 +3,7 @@
namespace App\Actions;
use App\Models\Supervisor;
use App\Utilities\Notice;
class SupervisorMaker
{
@@ -10,66 +11,55 @@ class SupervisorMaker
public static $path = '';
public static function run()
public static function run($supervisor)
{
self::$base = base_path().DIRECTORY_SEPARATOR.'supervisor'.DIRECTORY_SEPARATOR;
$supervisors = Supervisor::get();
$sup = Supervisor::with('option')
->with('sport')
->with('provider')
->with('client')
->with('bookmaker')
->get()->all();
foreach ($supervisors as $supervisor) {
foreach ($sup as $row) {
$dirname = self::fix_string($supervisor->provider->name);
$process = $row->command;
if ($row->option) {
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->option->name));
}
if ($row->provider) {
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->provider->name));
}
if ($row->sport) {
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->sport->name));
}
if ($row->client) {
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->client->name));
}
if ($row->bookmaker) {
$process .= '_'.strtolower(preg_replace('"\W"', '', $row->bookmaker->name));
$path = base_path().'/supervisor/'.strtolower($dirname);
if (! is_dir($path)) {
mkdir($path, 0777);
}
if (! is_dir(self::$base.$row->command)) {
mkdir(self::$base.$row->command, 0777, true);
$sport = self::fix_string($supervisor->sport?->name) ?? 'all';
$process = 'p'.$supervisor->id.'_'.self::fix_string($supervisor->name).'_'.$sport;
if ($supervisor->days_to) {
$process .= '_'.$supervisor->days_from;
$process .= '_'.$supervisor->days_to;
}
self::$path = self::$base.$row->command.DIRECTORY_SEPARATOR;
$content = '[program:'.$process.']'.PHP_EOL;
$content .= 'command=/usr/bin/php '.base_path().'/artisan nuh '.$supervisor->id.PHP_EOL;
$content .= 'autostart=true'.PHP_EOL;
$content .= 'autorestart=true'.PHP_EOL;
self::create_single($process, $row->is_active, $row->is_cron, $row->command, $row->id);
$file = $path.'/'.$process.'.ini';
if ($supervisor->is_active && ! $supervisor->is_cron) {
file_put_contents($file, $content);
chmod($file, 0777);
} else {
if (is_file($file)) {
unlink($file);
}
}
}
if (config('env.app_env') == 'production') {
$exec = base_path().'/super_update.sh';
$exec = base_path().'/supervisor/super_update.sh';
exec($exec, $out, $rcode);
}
Notice::note('SUPERVISOR '.\count($supervisors).' PROCESSES UPDATED', 'b', 1);
}
public static function create_single($process, $is_active, $is_cron, $command, $id)
public static function fix_string($string)
{
$file = self::$path.$process.'.ini';
$content = '[program:'.$process.']'.PHP_EOL;
$content .= 'command=/usr/bin/php '.base_path().'/artisan '.$command.' '.$id.PHP_EOL;
$content .= 'autostart=true'.PHP_EOL;
$content .= 'autorestart=true'.PHP_EOL;
$string = preg_replace("'\W'", '_', $string);
if ($is_active && ! $is_cron) {
file_put_contents($file, $content);
chmod($file, 0777);
} else {
if (is_file($file)) {
unlink($file);
}
}
return strtolower($string);
}
}