mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-30 20:54:04 -06:00
29 lines
651 B
PHP
29 lines
651 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace FireflyIII\Support\System;
|
|
|
|
use Log;
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
/**
|
|
* Trait GeneratesInstallationId
|
|
*/
|
|
trait GeneratesInstallationId
|
|
{
|
|
/**
|
|
*
|
|
*/
|
|
protected function generateInstallationId(): void
|
|
{
|
|
$config = app('fireflyconfig')->get('installation_id', null);
|
|
if (null === $config) {
|
|
$uuid5 = Uuid::uuid5(Uuid::NAMESPACE_URL, 'firefly-iii.org');
|
|
$uniqueId = (string) $uuid5;
|
|
Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId));
|
|
app('fireflyconfig')->set('installation_id', $uniqueId);
|
|
}
|
|
}
|
|
|
|
}
|