mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Alert if cron job isn't running.
This commit is contained in:
parent
6c9eb1b699
commit
7327941c77
@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException;
|
|||||||
use FireflyIII\Http\Controllers\Controller;
|
use FireflyIII\Http\Controllers\Controller;
|
||||||
use FireflyIII\Models\Recurrence;
|
use FireflyIII\Models\Recurrence;
|
||||||
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
|
||||||
|
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
|
||||||
use FireflyIII\Transformers\RecurrenceTransformer;
|
use FireflyIII\Transformers\RecurrenceTransformer;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Pagination\LengthAwarePaginator;
|
use Illuminate\Pagination\LengthAwarePaginator;
|
||||||
@ -41,6 +42,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
|
|||||||
*/
|
*/
|
||||||
class IndexController extends Controller
|
class IndexController extends Controller
|
||||||
{
|
{
|
||||||
|
use GetConfigurationData;
|
||||||
/** @var RecurringRepositoryInterface Recurring repository */
|
/** @var RecurringRepositoryInterface Recurring repository */
|
||||||
private $recurring;
|
private $recurring;
|
||||||
|
|
||||||
@ -97,6 +99,8 @@ class IndexController extends Controller
|
|||||||
$paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);
|
$paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);
|
||||||
$paginator->setPath(route('recurring.index'));
|
$paginator->setPath(route('recurring.index'));
|
||||||
|
|
||||||
|
$this->verifyRecurringCronJob();
|
||||||
|
|
||||||
return view('recurring.index', compact('paginator', 'page', 'pageSize', 'total'));
|
return view('recurring.index', compact('paginator', 'page', 'pageSize', 'total'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ use Log;
|
|||||||
*/
|
*/
|
||||||
trait GetConfigurationData
|
trait GetConfigurationData
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All packages that are installed.
|
* All packages that are installed.
|
||||||
*
|
*
|
||||||
@ -247,4 +248,21 @@ trait GetConfigurationData
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected function verifyRecurringCronJob(): void
|
||||||
|
{
|
||||||
|
$config = app('fireflyconfig')->get('last_rt_job', 0);
|
||||||
|
$lastTime = (int)$config->data;
|
||||||
|
$now = time();
|
||||||
|
if (0 === $lastTime) {
|
||||||
|
request()->session()->flash('info', trans('firefly.recurring_never_cron'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if($now - $lastTime > 129600) {
|
||||||
|
request()->session()->flash('warning', trans('firefly.recurring_cron_long_ago'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -59,8 +59,6 @@ use Illuminate\Support\Collection;
|
|||||||
*/
|
*/
|
||||||
trait PeriodOverview
|
trait PeriodOverview
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns "period entries", so nov-2015, dec-2015, etc etc (this depends on the users session range)
|
* This method returns "period entries", so nov-2015, dec-2015, etc etc (this depends on the users session range)
|
||||||
* and for each period, the amount of money spent and earned. This is a complex operation which is cached for
|
* and for each period, the amount of money spent and earned. This is a complex operation which is cached for
|
||||||
|
@ -1266,6 +1266,8 @@ return [
|
|||||||
'created_Deposits' => 'Created deposits',
|
'created_Deposits' => 'Created deposits',
|
||||||
'created_Transfers' => 'Created transfers',
|
'created_Transfers' => 'Created transfers',
|
||||||
'created_from_recurrence' => 'Created from recurring transaction ":title" (#:id)',
|
'created_from_recurrence' => 'Created from recurring transaction ":title" (#:id)',
|
||||||
|
'recurring_never_cron' => 'It seems the cron job that is necessary to support recurring transactions has never run. This is of course normal when you have just installed Firefly III, but this should be something to set up as soon as possible. Please check out the help-pages using the (?)-icon in the top right corner of the page.',
|
||||||
|
'recurring_cron_long_ago' => 'It looks like it has been more than 36 hours since the cron job to support recurring transactions has fired for the last time. Are you sure it has been set up correctly? Please check out the help-pages using the (?)-icon in the top right corner of the page.',
|
||||||
|
|
||||||
'recurring_meta_field_tags' => 'Tags',
|
'recurring_meta_field_tags' => 'Tags',
|
||||||
'recurring_meta_field_notes' => 'Notes',
|
'recurring_meta_field_notes' => 'Notes',
|
||||||
|
Loading…
Reference in New Issue
Block a user