This commit is contained in:
salam committed 2026-06-08 15:12:27 +02:00
1 parent 336af556a1
commit 8578ec96bb
6 files changed
+45 -62

No files matched your search

+8
View File
@@ -1,3 +1,11 @@
## REMOTE DB SETTING
# make port changes in .env file to forward
# use remote db with mariadb
ssh -L 13306:127.0.0.1:3306 -p 58371 root@162.55.242.190
# use remote db with mongodb
ssh -L 27027:127.0.0.1:27017 -p 58371 root@162.55.242.190
importing importing
https://github.com/christophrumpel/laravel-import-million-rows https://github.com/christophrumpel/laravel-import-million-rows
-3
View File
@@ -132,13 +132,10 @@ class Curl
} }
sleep(2); // Optional: Sleep between retries sleep(2); // Optional: Sleep between retries
} else { } else {
curl_close($ch);
return $response; return $response;
} }
} }
echo "All attempts failed.\n"; echo "All attempts failed.\n";
curl_close($ch);
return null; // Return null if all retries fail return null; // Return null if all retries fail
} }
@@ -32,7 +32,11 @@ class Events
// to grap event id // to grap event id
// https://www.sofascore.com/api/v1/unique-tournament/2480/scheduled-events/2022-05-19 // https://www.sofascore.com/api/v1/unique-tournament/2480/scheduled-events/2022-05-19
// https://www.sofascore.com/api/v1/unique-tournament/2480/scheduled-events/2026-05-31
// per event
// https://www.sofascore.com/api/v1/event/16198485/statistics
// https://www.sofascore.com/api/v1/event/16198485/odds/1/all
$years_back = 7; $years_back = 7;
$dates = Carbon::now()->subYears($years_back); $dates = Carbon::now()->subYears($years_back);
@@ -18,24 +18,32 @@ class Tournament
{ {
public static function load() public static function load()
{ {
$days = 1;
$debug = Nuh::$options['d'] ?? 0; $debug = Nuh::$options['d'] ?? 0;
$force = Nuh::$options['f'] ?? 0;
$sport_id = Nuh::$options['sport_id']; $sport_id = Nuh::$options['sport_id'];
$sport = Sport::where('id', $sport_id)->first(); $sport = Sport::where('id', $sport_id)->first();
$dates = Carbon::now(); // start yesterday
$grapping_date = Carbon::now()->subDay();
while ($dates >= Carbon::now()->subYears($sport->ss_grap_years)) { $days++;
$days_back = Carbon::now()->subDays($days);
while ($grapping_date >= $days_back) {
$tournaments_counter = 0; $tournaments_counter = 0;
$day = $dates->format('Y-m-d'); $day = $grapping_date->format('Y-m-d');
/** /**
* grap only one time/sport check * grap only one time/sport check
*/ */
if (! SofaScoreDay::where('day', $day)->where($sport->ss_slug, 1)->first()) { if ($force || ! SofaScoreDay::where('day', $day)->where($sport->ss_slug, 1)->first()) {
if ($debug) { if ($debug) {
Notice::note('Grapping Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'g'); Notice::note('Grapping Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'g');
@@ -168,7 +176,7 @@ class Tournament
Notice::note('Having Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'b'); Notice::note('Having Sport: ' . Nuh::$options['sport'] . ' Day: ' . $day, 'b');
} }
} }
$dates->subDay(); $grapping_date->subDay();
} }
} }
} }
-2
View File
@@ -96,7 +96,6 @@ class Xml
echo "Attempt $attempt failed. Retrying...\n"; echo "Attempt $attempt failed. Retrying...\n";
sleep(2); // Optional: Sleep between retries sleep(2); // Optional: Sleep between retries
} else { } else {
curl_close($ch);
if (mb_substr($response, 0, 1) != '<') { if (mb_substr($response, 0, 1) != '<') {
Log::debug('INVALID XML ' . $url . '----' . $response); Log::debug('INVALID XML ' . $url . '----' . $response);
} else { } else {
@@ -105,7 +104,6 @@ class Xml
} }
} }
echo "All attempts failed.\n"; echo "All attempts failed.\n";
curl_close($ch);
return null; // Return null if all retries fail return null; // Return null if all retries fail
} }
+20 -52
View File
@@ -42,25 +42,25 @@ return [
'synchronous' => null, 'synchronous' => null,
], ],
'mysql' => [ // 'mysql' => [
'driver' => 'mysql', // 'driver' => 'mysql',
'url' => env('DB_URL'), // 'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'), // 'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'), // 'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'laravel'), // 'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'), // 'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''), // 'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''), // 'unix_socket' => env('DB_SOCKET', ''),
'charset' => env('DB_CHARSET', 'utf8mb4'), // 'charset' => env('DB_CHARSET', 'utf8mb4'),
'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), // 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
'prefix' => '', // 'prefix' => '',
'prefix_indexes' => true, // 'prefix_indexes' => true,
'strict' => false, // 'strict' => false,
'engine' => null, // 'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([ // 'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), // PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [], // ]) : [],
], // ],
'mariadb' => [ 'mariadb' => [
'driver' => 'mariadb', 'driver' => 'mariadb',
@@ -78,39 +78,6 @@ return [
'prefix_indexes' => true, 'prefix_indexes' => true,
'strict' => false, 'strict' => false,
'engine' => null, 'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'pgsql' => [
'driver' => 'pgsql',
'url' => env('DB_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
'search_path' => 'public',
'sslmode' => 'prefer',
],
'sqlsrv' => [
'driver' => 'sqlsrv',
'url' => env('DB_URL'),
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'laravel'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => env('DB_CHARSET', 'utf8'),
'prefix' => '',
'prefix_indexes' => true,
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
], ],
'mongodb' => [ 'mongodb' => [
@@ -119,6 +86,7 @@ return [
'database' => env('MONGODB_DATABASE', 'nuhodds'), 'database' => env('MONGODB_DATABASE', 'nuhodds'),
], ],
// ssh -L 27017:127.0.0.1:27017 ssh -p 58371 root@162.55.242.190
], ],
/* /*