mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 19:01:39 +00:00
Update collector classes
This commit is contained in:
@@ -43,10 +43,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AttachmentCollector constructor.
|
* AttachmentCollector constructor.
|
||||||
*
|
|
||||||
* @param ExportJob $job
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ExportJob $job)
|
public function __construct()
|
||||||
{
|
{
|
||||||
/** @var AttachmentRepositoryInterface repository */
|
/** @var AttachmentRepositoryInterface repository */
|
||||||
$this->repository = app(AttachmentRepositoryInterface::class);
|
$this->repository = app(AttachmentRepositoryInterface::class);
|
||||||
@@ -54,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
|||||||
$this->uploadDisk = Storage::disk('upload');
|
$this->uploadDisk = Storage::disk('upload');
|
||||||
$this->exportDisk = Storage::disk('export');
|
$this->exportDisk = Storage::disk('export');
|
||||||
|
|
||||||
parent::__construct($job);
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -31,13 +31,10 @@ class BasicCollector
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* BasicCollector constructor.
|
* BasicCollector constructor.
|
||||||
*
|
|
||||||
* @param ExportJob $job
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ExportJob $job)
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->entries = new Collection;
|
$this->entries = new Collection;
|
||||||
$this->job = $job;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,5 +53,13 @@ class BasicCollector
|
|||||||
$this->entries = $entries;
|
$this->entries = $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportJob $job
|
||||||
|
*/
|
||||||
|
public function setJob(ExportJob $job)
|
||||||
|
{
|
||||||
|
$this->job = $job;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Export\Collector;
|
namespace FireflyIII\Export\Collector;
|
||||||
|
|
||||||
|
use FireflyIII\Models\ExportJob;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,6 +33,13 @@ interface CollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function run(): bool;
|
public function run(): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ExportJob $job
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function setJob(ExportJob $job);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Collection $entries
|
* @param Collection $entries
|
||||||
*
|
*
|
||||||
|
@@ -14,7 +14,6 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Export\Collector;
|
namespace FireflyIII\Export\Collector;
|
||||||
|
|
||||||
use Crypt;
|
use Crypt;
|
||||||
use FireflyIII\Models\ExportJob;
|
|
||||||
use Illuminate\Contracts\Encryption\DecryptException;
|
use Illuminate\Contracts\Encryption\DecryptException;
|
||||||
use Log;
|
use Log;
|
||||||
use Storage;
|
use Storage;
|
||||||
@@ -35,22 +34,12 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* AttachmentCollector constructor.
|
* AttachmentCollector constructor.
|
||||||
*
|
|
||||||
* @param ExportJob $job
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ExportJob $job)
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct($job);
|
parent::__construct();
|
||||||
|
|
||||||
Log::debug('Going to collect attachments', ['key' => $job->key]);
|
|
||||||
|
|
||||||
// make storage:
|
|
||||||
$this->uploadDisk = Storage::disk('upload');
|
$this->uploadDisk = Storage::disk('upload');
|
||||||
$this->exportDisk = Storage::disk('export');
|
$this->exportDisk = Storage::disk('export');
|
||||||
|
|
||||||
// file names associated with the old import routine.
|
|
||||||
$this->vintageFormat = sprintf('csv-upload-%d-', auth()->user()->id);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,6 +49,11 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
|||||||
*/
|
*/
|
||||||
public function run(): bool
|
public function run(): bool
|
||||||
{
|
{
|
||||||
|
Log::debug('Going to collect attachments', ['key' => $this->job->key]);
|
||||||
|
|
||||||
|
// file names associated with the old import routine.
|
||||||
|
$this->vintageFormat = sprintf('csv-upload-%d-', $this->job->user->id);
|
||||||
|
|
||||||
// collect old upload files (names beginning with "csv-upload".
|
// collect old upload files (names beginning with "csv-upload".
|
||||||
$this->collectVintageUploads();
|
$this->collectVintageUploads();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user