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

+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);
}
}