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

No files matched your search

@@ -46,7 +46,7 @@ class DaysTournament
while ($page) { 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); Sleeper::rand($langsam);
@@ -66,10 +66,6 @@ class DaysTournament
$tournament = $row['tournament']; $tournament = $row['tournament'];
} }
if ($debug) {
Notice::note($tournament, 'g');
}
$category = $tournament['category']; $category = $tournament['category'];
if ($sport_id == 5) { if ($sport_id == 5) {
@@ -151,7 +147,7 @@ class DaysTournament
$tournaments_counter++; $tournaments_counter++;
if ($debug) { if ($debug) {
Notice::note('tournament: '.$tournament['name'], 'p'); Notice::note('tournament: ' . $tournament['name'], 'p');
} }
/** /**
@@ -169,7 +165,8 @@ class DaysTournament
} }
} }
} }
if ($debug) {
Notice::note('days tournament done', 'g'); Notice::note('days tournament done', 'g');
}
} }
} }
@@ -36,14 +36,14 @@ class Grapper
$day = $d['day']; $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) { if ($debug) {
Notice::note($day, 'g'); 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); Sleeper::rand(1);
@@ -57,7 +57,7 @@ class Grapper
foreach ($data['events'] as $event) { 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); File::makeDirectory($folder, 0775, true, true);
@@ -65,7 +65,7 @@ class Grapper
* EVENT event * EVENT event
*********************************/ *********************************/
File::put($folder.'/event.json', json_encode($event)); File::put($folder . '/event.json', json_encode($event));
/********************************* /*********************************
* EVENT statistics * EVENT statistics
@@ -73,9 +73,9 @@ class Grapper
$event_id = $event['id']; $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); Sleeper::rand($langsam);
@@ -83,16 +83,16 @@ class Grapper
$data['id'] = $event_id; $data['id'] = $event_id;
File::put($folder.'/statistics.json', json_encode($data)); File::put($folder . '/statistics.json', json_encode($data));
} }
/********************************* /*********************************
* EVENT lineups * 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); Sleeper::rand($langsam);
@@ -100,16 +100,16 @@ class Grapper
$data['id'] = $event_id; $data['id'] = $event_id;
File::put($folder.'/lineups.json', json_encode($data)); File::put($folder . '/lineups.json', json_encode($data));
} }
/********************************* /*********************************
* EVENT odds * 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); Sleeper::rand($langsam);
@@ -117,16 +117,16 @@ class Grapper
$data['id'] = $event_id; $data['id'] = $event_id;
File::put($folder.'/odds.json', json_encode($data)); File::put($folder . '/odds.json', json_encode($data));
} }
/********************************* /*********************************
* EVENT incidents * 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); Sleeper::rand($langsam);
@@ -134,13 +134,15 @@ class Grapper
$data['id'] = $event_id; $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');
}
} }
} }
} }
@@ -17,15 +17,15 @@ class LoadDays
$dates = []; $dates = [];
if(!$task_id){ if (!$task_id) {
Notice::note('no task id', 'br'); Notice::note('no task id', 'br');
return []; return [];
} }
$task = SofaScoreTask::with('sport')->where('id', $task_id)->first(); $task = SofaScoreTask::with('sport')->where('id', $task_id)->first();
if(!$debug){ if ($debug) {
Notice::note('grapper: '.$task->mode.' sport: '.$task->sport_id); Notice::note('LoadDays ' . $task->mode . ' sport: ' . $task->sport_id);
} }
switch ($task->mode) { switch ($task->mode) {
@@ -78,7 +78,7 @@ class LoadDays
} }
if (! $dates) { 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) // remove when element in array is double (day and slug)
@@ -11,6 +11,11 @@ class LoadTournaments
public static function load() public static function load()
{ {
$sport_id = Nuh::$options['sport_id']; $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(); $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") "2")
# AUTO GRAPPER SOFASCORE (production no debug and 10s breaks) # AUTO GRAPPER SOFASCORE (production no debug and 10s breaks)
echo "\n⚽ process function $1 sofa_score_task $2"
killall ssh killall ssh
ssh -f -N -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190 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 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=3 --task=$2
php artisan nuh --f 67 --fun=4 --task=$2 php artisan nuh --f 67 --fun=4 --task=$2
php artisan nuh --f 67 --fun=8 --task=$2 php artisan nuh --f 67 --fun=8 --task=$2
echo "\n😎 done :)"
;; ;;
*) *)
echo "" 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