mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 22:54:25 +01:00
Clean up for scheduled jobs
This commit is contained in:
parent
20e833e430
commit
53b522ea5d
@ -11,10 +11,11 @@
|
||||
|
||||
namespace App\Jobs\Cron;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class AutoBillCron
|
||||
{
|
||||
@ -45,6 +46,8 @@ class AutoBillCron
|
||||
/* Get all invoices where the send date is less than NOW + 30 minutes() */
|
||||
info('Performing Autobilling '.Carbon::now()->format('Y-m-d h:i:s'));
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
$auto_bill_partial_invoices = Invoice::whereDate('partial_due_date', '<=', now())
|
||||
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||
|
@ -11,13 +11,14 @@
|
||||
|
||||
namespace App\Jobs\Cron;
|
||||
|
||||
use App\Factory\RecurringExpenseToExpenseFactory;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\RecurringExpense;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Utils\Traits\GeneratesCounter;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Factory\RecurringExpenseToExpenseFactory;
|
||||
|
||||
class RecurringExpensesCron
|
||||
{
|
||||
@ -45,6 +46,8 @@ class RecurringExpensesCron
|
||||
/* Get all expenses where the send date is less than NOW + 30 minutes() */
|
||||
nlog('Sending recurring expenses '.Carbon::now()->format('Y-m-d h:i:s'));
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
$recurring_expenses = RecurringExpense::where('next_send_date', '<=', now()->toDateTimeString())
|
||||
->whereNotNull('next_send_date')
|
||||
|
@ -11,12 +11,13 @@
|
||||
|
||||
namespace App\Jobs\Cron;
|
||||
|
||||
use App\Jobs\RecurringInvoice\SendRecurring;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use App\Jobs\RecurringInvoice\SendRecurring;
|
||||
|
||||
class RecurringInvoicesCron
|
||||
{
|
||||
@ -44,6 +45,8 @@ class RecurringInvoicesCron
|
||||
$start = Carbon::now()->format('Y-m-d h:i:s');
|
||||
nlog('Sending recurring invoices '.$start);
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
$recurring_invoices = RecurringInvoice::where('status_id', RecurringInvoice::STATUS_ACTIVE)
|
||||
->where('is_deleted', false)
|
||||
|
@ -11,8 +11,9 @@
|
||||
|
||||
namespace App\Jobs\Cron;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Utils\Traits\SubscriptionHooker;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
@ -39,6 +40,8 @@ class SubscriptionCron
|
||||
{
|
||||
nlog('Subscription Cron');
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
$invoices = Invoice::where('is_deleted', 0)
|
||||
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||
|
@ -13,6 +13,7 @@ namespace App\Jobs\Cron;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
class UpdateCalculatedFields
|
||||
@ -37,6 +38,8 @@ class UpdateCalculatedFields
|
||||
{
|
||||
nlog("Updating calculated fields");
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
|
||||
Project::with('tasks')->where('updated_at', '>', now()->subHours(2))
|
||||
|
@ -11,13 +11,14 @@
|
||||
|
||||
namespace App\Jobs\Ninja;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Scheduler;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
//@rebuild it
|
||||
class TaskScheduler implements ShouldQueue
|
||||
@ -42,6 +43,8 @@ class TaskScheduler implements ShouldQueue
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
Scheduler::with('company')
|
||||
->where('is_paused', false)
|
||||
|
@ -19,6 +19,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class CleanStaleInvoiceOrder implements ShouldQueue
|
||||
{
|
||||
@ -39,6 +40,8 @@ class CleanStaleInvoiceOrder implements ShouldQueue
|
||||
{
|
||||
nlog("Cleaning Stale Invoices:");
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
Invoice::query()
|
||||
->withTrashed()
|
||||
|
@ -11,23 +11,22 @@
|
||||
|
||||
namespace App\Jobs\Util;
|
||||
|
||||
use App\Utils\Ninja;
|
||||
use App\Models\Invoice;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Carbon;
|
||||
use App\DataMapper\InvoiceItem;
|
||||
use App\Factory\InvoiceFactory;
|
||||
use App\Jobs\Entity\EmailEntity;
|
||||
use App\Jobs\Ninja\TransactionLog;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\TransactionEvent;
|
||||
use App\Utils\Ninja;
|
||||
use App\Utils\Traits\MakesDates;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use App\Utils\Traits\MakesReminders;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class ReminderJob implements ShouldQueue
|
||||
{
|
||||
@ -53,6 +52,8 @@ class ReminderJob implements ShouldQueue
|
||||
{
|
||||
set_time_limit(0);
|
||||
|
||||
Auth::logout();
|
||||
|
||||
if (! config('ninja.db.multi_db_enabled')) {
|
||||
nlog("Sending invoice reminders on ".now()->format('Y-m-d h:i:s'));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user