This commit is contained in:
salam committed 2026-07-10 08:30:50 +02:00
1 parent 1905440212
commit fc0f18ba73
6 files changed
+40 -73

No files matched your search

@@ -46,7 +46,7 @@ class DaysTournament
while ($page) {
$url = Nuh::$options['base_url']."api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
$url = Nuh::$options['base_url'] . "api/v1/sport/$slug/scheduled-tournaments/$day/page/$page";
Sleeper::rand($langsam);
@@ -66,10 +66,6 @@ class DaysTournament
$tournament = $row['tournament'];
}
if ($debug) {
Notice::note($tournament, 'g');
}
$category = $tournament['category'];
if ($sport_id == 5) {
@@ -151,7 +147,7 @@ class DaysTournament
$tournaments_counter++;
if ($debug) {
Notice::note('tournament: '.$tournament['name'], 'p');
Notice::note('tournament: ' . $tournament['name'], 'p');
}
/**
@@ -169,7 +165,8 @@ class DaysTournament
}
}
}
Notice::note('days tournament done', 'g');
if ($debug) {
Notice::note('days tournament done', 'g');
}
}
}
@@ -17,7 +17,7 @@ class Grapper
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$task_id = Nuh::$options['task'] ?? 0;
$days = LoadDays::load();
@@ -36,14 +36,14 @@ class Grapper
$day = $d['day'];
$res = SofaScoreDayTournament::whereDate('day','=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
$res = SofaScoreDayTournament::whereDate('day', '=', $day)->where('tournament_id', $tournament->sofa_score_tournament_id)->first();
if($res){
if ($res) {
if ($debug) {
Notice::note($day, 'g');
}
}
$url = Nuh::$options['base_url']."api/v1/unique-tournament/$tournament->sofa_score_tournament_id/scheduled-events/$day";
$url = Nuh::$options['base_url'] . "api/v1/unique-tournament/$tournament->sofa_score_tournament_id/scheduled-events/$day";
Sleeper::rand(1);
@@ -57,7 +57,7 @@ class Grapper
foreach ($data['events'] as $event) {
$folder = Sofascore::$grapper_path.$day.'/'.$event['tournament']['slug'].'/'.$event['slug'];
$folder = Sofascore::$grapper_path . $day . '/' . $event['tournament']['slug'] . '/' . $event['slug'];
File::makeDirectory($folder, 0775, true, true);
@@ -65,7 +65,7 @@ class Grapper
* EVENT event
*********************************/
File::put($folder.'/event.json', json_encode($event));
File::put($folder . '/event.json', json_encode($event));
/*********************************
* EVENT statistics
@@ -73,9 +73,9 @@ class Grapper
$event_id = $event['id'];
if(!File::exists($folder.'/statistics.json')){
if (!File::exists($folder . '/statistics.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/statistics";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/statistics";
Sleeper::rand($langsam);
@@ -83,16 +83,16 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/statistics.json', json_encode($data));
File::put($folder . '/statistics.json', json_encode($data));
}
/*********************************
* EVENT lineups
*********************************/
if(!File::exists($folder.'/lineups.json')){
if (!File::exists($folder . '/lineups.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/lineups";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/lineups";
Sleeper::rand($langsam);
@@ -100,16 +100,16 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/lineups.json', json_encode($data));
File::put($folder . '/lineups.json', json_encode($data));
}
/*********************************
* EVENT odds
*********************************/
if(!File::exists($folder.'/odds.json')){
if (!File::exists($folder . '/odds.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/odds/1/all";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/odds/1/all";
Sleeper::rand($langsam);
@@ -117,16 +117,16 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/odds.json', json_encode($data));
File::put($folder . '/odds.json', json_encode($data));
}
/*********************************
* EVENT incidents
*********************************/
if(!File::exists($folder.'/incidents.json')){
if (!File::exists($folder . '/incidents.json')) {
$url = Nuh::$options['base_url']."api/v1/event/$event_id/incidents";
$url = Nuh::$options['base_url'] . "api/v1/event/$event_id/incidents";
Sleeper::rand($langsam);
@@ -134,13 +134,15 @@ class Grapper
$data['id'] = $event_id;
File::put($folder.'/incidents.json', json_encode($data));
File::put($folder . '/incidents.json', json_encode($data));
}
}
}
}
}
Notice::note('tournament done', 'bb');
if ($debug) {
Notice::note('tournament done', 'bb');
}
}
}
}
@@ -12,20 +12,20 @@ class LoadDays
public static function load()
{
$debug = Nuh::$options['d'] ?? 0;
$task_id = Nuh::$options['task'] ?? 0;
$dates = [];
if(!$task_id){
if (!$task_id) {
Notice::note('no task id', 'br');
return [];
}
$task = SofaScoreTask::with('sport')->where('id', $task_id)->first();
if(!$debug){
Notice::note('grapper: '.$task->mode.' sport: '.$task->sport_id);
if ($debug) {
Notice::note('LoadDays ' . $task->mode . ' sport: ' . $task->sport_id);
}
switch ($task->mode) {
@@ -78,13 +78,13 @@ class LoadDays
}
if (! $dates) {
Notice::note(__FILE__.PHP_EOL.'no dates', 'r', 1);
Notice::note(__FILE__ . PHP_EOL . 'no dates', 'r', 1);
}
// remove when element in array is double (day and slug)
$dates = array_unique($dates, SORT_REGULAR);
return $dates;
}
@@ -11,6 +11,11 @@ class LoadTournaments
public static function load()
{
$sport_id = Nuh::$options['sport_id'];
$debug = Nuh::$options['d'] ?? 0;
if ($debug) {
Notice::note('LoadTournaments, sport: ' . $sport_id);
}
$tornaments = SofaScoreTournament::select('name', 'tournament_id')->where('sport_id', $sport_id)->where('enabled', 1)->get();
+2
View File
@@ -38,6 +38,7 @@ case "$1" in
;;
"2")
# AUTO GRAPPER SOFASCORE (production no debug and 10s breaks)
echo "\n⚽ process function $1 sofa_score_task $2"
killall ssh
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
php artisan nuh --f 67 --fun=2 --task=$2
@@ -48,6 +49,7 @@ case "$1" in
php artisan nuh --f 67 --fun=3 --task=$2
php artisan nuh --f 67 --fun=4 --task=$2
php artisan nuh --f 67 --fun=8 --task=$2
echo "\n😎 done :)"
;;
*)
echo ""
-39
View File
@@ -1,39 +0,0 @@
#!/bin/bash
#----------------------------------------
# MySQL Backup Script
#----------------------------------------
# 🔧 Configuration
HOST='localhost' # MySQL server host
USER='root' # Username
PASSWORD='salam' # Password
DB='nutzwerte_fi4'
DAYS_TO_KEEP=60 # Delete backups older than X days
GZIP=1 # 1 = gzip compression, 0 = plain .sql
BACKUP_PATH='/var/www/html/nutzwerte_fi4/storage/backup_database/archive' # Location to store backups
#TIMESTAMP=$(date +"%d_%m_%Y_%H_%M_%S") # Date-time for unique file names
TIMESTAMP=$(date -d "yesterday" +"%d_%m_%Y") #Date-time for previous date file names. reminder here crontab use after 12 am
#----------------------------------------
# Create the backup folder
if [ ! -d $BACKUP_PATH ]; then
mkdir -p $BACKUP_PATH
fi
# Backup (with or without compression)
if [ "$GZIP" -eq 0 ]; then
echo "Backing up database: $DB (no compression)"
mysqldump -h "$HOST" -u "$USER" -p"$PASSWORD" --databases "$DB" --single-transaction --quick --extended-insert --compact --hex-blob --max-allowed-packet=256M --net-buffer-length=2M > "$BACKUP_PATH/${DB}-${TIMESTAMP}.sql"
else
echo "Backing up database: $DB (with compression)"
mysqldump -h "$HOST" -u "$USER" -p"$PASSWORD" --databases "$DB" --single-transaction --quick --extended-insert --compact --hex-blob --max-allowed-packet=256M --net-buffer-length=2M | gzip -9 -c > "$BACKUP_PATH/${DB}-${TIMESTAMP}.sql.gz"
fi
# Delete old backups
if [ "$DAYS_TO_KEEP" -gt 0 ] ; then
echo "Deleting backups older than $DAYS_TO_KEEP days"
find $BACKUP_PATH/* -mtime +$DAYS_TO_KEEP -exec rm {} \;
fi