mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Update installation commands.
This commit is contained in:
@@ -79,7 +79,7 @@ class AppendBudgetLimitPeriods extends Command
|
||||
|
||||
$this->theresNoLimit();
|
||||
|
||||
$this->markAsExecuted();
|
||||
$this->markAsExecuted();
|
||||
|
||||
$end = round(microtime(true) - $start, 2);
|
||||
$this->info(sprintf('Fixed budget limits in %s seconds.', $end));
|
||||
@@ -100,6 +100,44 @@ class AppendBudgetLimitPeriods extends Command
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function theresNoLimit(): void
|
||||
{
|
||||
$limits = BudgetLimit::whereNull('period')->get();
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($limits as $limit) {
|
||||
$this->fixLimit($limit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BudgetLimit $limit
|
||||
*/
|
||||
private function fixLimit(BudgetLimit $limit)
|
||||
{
|
||||
$period = $this->getLimitPeriod($limit);
|
||||
|
||||
if (null === $period) {
|
||||
$message = sprintf(
|
||||
'Could not guesstimate budget limit #%d (%s - %s) period.', $limit->id, $limit->start_date->format('Y-m-d'), $limit->end_date->format('Y-m-d')
|
||||
);
|
||||
$this->warn($message);
|
||||
Log::warning($message);
|
||||
|
||||
return;
|
||||
}
|
||||
$limit->period = $period;
|
||||
$limit->save();
|
||||
|
||||
$msg = sprintf(
|
||||
'Budget limit #%d (%s - %s) period is "%s".', $limit->id, $limit->start_date->format('Y-m-d'), $limit->end_date->format('Y-m-d'), $period
|
||||
);
|
||||
Log::debug($msg);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BudgetLimit $limit
|
||||
*
|
||||
@@ -160,37 +198,4 @@ class AppendBudgetLimitPeriods extends Command
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function theresNoLimit(): void
|
||||
{
|
||||
$limits = BudgetLimit::whereNull('period')->get();
|
||||
/** @var BudgetLimit $limit */
|
||||
foreach ($limits as $limit) {
|
||||
$this->fixLimit($limit);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param BudgetLimit $limit
|
||||
*/
|
||||
private function fixLimit(BudgetLimit $limit)
|
||||
{
|
||||
$period = $this->getLimitPeriod($limit);
|
||||
|
||||
if (null === $period) {
|
||||
$message = sprintf('Could not guesstimate budget limit #%d (%s - %s) period.', $limit->id, $limit->start_date->format('Y-m-d'), $limit->end_date->format('Y-m-d'));
|
||||
$this->warn($message);
|
||||
Log::warning($message);
|
||||
return;
|
||||
}
|
||||
$limit->period = $period;
|
||||
$limit->save();
|
||||
|
||||
$msg = sprintf('Budget limit #%d (%s - %s) period is "%s".', $limit->id, $limit->start_date->format('Y-m-d'), $limit->end_date->format('Y-m-d'), $period);
|
||||
Log::debug($msg);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user