This commit is contained in:
salam committed 2026-09-21 16:28:55 +02:00
1 parent db98383da0
commit 2085d0f512
6 files changed
+70 -21

No files matched your search

@@ -26,7 +26,7 @@ class DaysTournament
public static function get(string $day)
{
$debug = Grap::$options['d'] ?? 0;
$force = Grap::$options['f'] ?? 0;
$force = Grap::$options['F'] ?? 0;
$tournaments_counter = 0;
@@ -8,16 +8,21 @@ use Illuminate\Filesystem\Filesystem;
class ClearDir
{
public static function clear(): void
public static function clear($dir = ''): void
{
$file = new Filesystem;
$debug = Grap::$options['d'];
$file = new Filesystem;
$file->cleanDirectory(Grap::$storage);
if ($debug) {
Notice::note('Directory: ' . Grap::$storage . ' - All content cleard', 'p');
if ($dir) {
$file->cleanDirectory($dir);
if ($debug) {
Notice::note('Dir: ' . $dir . ' - removed', 'p');
}
} else {
$file->cleanDirectory(Grap::$storage);
if ($debug) {
Notice::note('Dir: ' . Grap::$storage . ' - content deleted', 'p');
}
}
}
}
@@ -0,0 +1,23 @@
<?php
namespace App\Console\Commands\Grapper\Sofascore\Helper;
use App\Console\Commands\Grap;
use App\Utilities\Notice;
use Illuminate\Support\Facades\Storage;
class RemoveDir
{
public static function remove(): void
{
$debug = Grap::$options['d'];
// Deletes the directory and everything inside it relative to the disk root
Storage::deleteDirectory(Grap::$storage . '/' . Grap::$folder);
if ($debug) {
Notice::note('Directory: ' . Grap::$storage . '/' . Grap::$folder . ' removed', 'p');
}
}
}
@@ -19,7 +19,7 @@ class SetStorage
$date = Grap::$options['date'] ?? '';
$day = Grap::$options['day'] == 0 ? 2 : Grap::$options['day'];
$day = Grap::$options['day'] ?? 1;
// must be connectet to task for activated ligas
$task = SofaScoreTask::where('id', $task_id)->first();
@@ -62,6 +62,7 @@ class SetStorage
if ($debug) {
Notice::note(Grap::$storage, 'g');
Notice::note(Grap::$folder, 'g');
if (!$force) {
sleep(4);
}
@@ -11,9 +11,9 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet;
class MakeExcel
{
public static $max = 1000;
public static $max = 2000;
public static function create()
public static function create(string $what = '')
{
ini_set('memory_limit', -1);
@@ -23,7 +23,12 @@ class MakeExcel
Notice::note("Make Excel");
}
$files = ReadDir::get_tree(Grap::$storage);
if ($what == 'day') {
$files = ReadDir::get_tree(Grap::$storage . '/' . Grap::$folder);
} else {
$files = ReadDir::get_tree(Grap::$storage);
}
$files = array_chunk(FileType::filter($files), self::$max);