mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
remove cache build steps
This commit is contained in:
parent
3ab899f58e
commit
698a376de3
@ -90,9 +90,9 @@ class DemoMode extends Command
|
||||
Artisan::call('migrate:fresh --force');
|
||||
|
||||
$this->info('Seeding');
|
||||
Artisan::call('db:seed --force');
|
||||
|
||||
$this->buildCache(true);
|
||||
Artisan::call('db:seed --force');
|
||||
Artisan::call('cache:clear');
|
||||
|
||||
$this->info('Seeding Random Data');
|
||||
$this->createSmallAccount();
|
||||
|
@ -62,7 +62,6 @@ class HostedMigrations extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->buildCache();
|
||||
|
||||
if (! MultiDB::userFindAndSetDb($this->option('email'))) {
|
||||
$this->info('Could not find a user with that email address');
|
||||
|
@ -75,8 +75,6 @@ class ImportMigrations extends Command
|
||||
{
|
||||
$this->faker = Factory::create();
|
||||
|
||||
$this->buildCache();
|
||||
|
||||
$path = $this->option('path') ?? public_path('storage/migrations/import');
|
||||
|
||||
$directory = new DirectoryIterator($path);
|
||||
|
@ -86,8 +86,7 @@ class PostUpdate extends Command
|
||||
|
||||
info('queue restarted');
|
||||
|
||||
$this->buildCache(true);
|
||||
|
||||
Artisan::call('cache:clear');
|
||||
VersionCheck::dispatch();
|
||||
|
||||
info('Sent for version check');
|
||||
|
@ -262,7 +262,7 @@ class BaseRule implements RuleInterface
|
||||
return $this->client->state;
|
||||
}
|
||||
|
||||
return USStates::getState(strlen($this->client->postal_code) > 1 ? $this->client->postal_code : $this->client->shipping_postal_code);
|
||||
return USStates::getState(strlen($this->client->postal_code ?? '') > 1 ? $this->client->postal_code : $this->client->shipping_postal_code);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return 'CA';
|
||||
|
@ -34006,7 +34006,7 @@ class USStates
|
||||
'WA', 'WA', 'WA', 'WA', 'WA', 'WA', 'WA', 'AK', 'AK', 'AK', 'AK', 'AK'
|
||||
];
|
||||
|
||||
$prefix = substr($zip, 0, 3);
|
||||
$prefix = substr(($zip ?? ''), 0, 3);
|
||||
$index = intval($prefix);
|
||||
/* converts prefix to integer */
|
||||
return $zip_by_state[$index] == "--" ? false : $zip_by_state[$index];
|
||||
|
@ -203,6 +203,7 @@ class ActivityController extends BaseController
|
||||
$activity->notes = $request->notes;
|
||||
$activity->user_id = $user->id;
|
||||
$activity->ip = $request->ip();
|
||||
$activity->activity_type_id = Activity::USER_NOTE;
|
||||
|
||||
switch (get_class($entity)) {
|
||||
case Invoice::class:
|
||||
|
@ -1158,8 +1158,6 @@ class BaseController extends Controller
|
||||
|
||||
$data['path'] = $this->setBuild();
|
||||
|
||||
$this->buildCache();
|
||||
|
||||
if (Ninja::isSelfHost() && $account->set_react_as_default_ap) {
|
||||
return response()->view('react.index', $data)->header('X-Frame-Options', 'SAMEORIGIN', false);
|
||||
} else {
|
||||
|
@ -112,8 +112,7 @@ class SelfUpdateController extends BaseController
|
||||
Artisan::call('view:clear');
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('config:clear');
|
||||
|
||||
$this->buildCache(true);
|
||||
Artisan::call('cache:clear');
|
||||
|
||||
$this->runModelChecks();
|
||||
|
||||
|
@ -159,8 +159,6 @@ class SetupController extends Controller
|
||||
|
||||
(new VersionCheck())->handle();
|
||||
|
||||
$this->buildCache(true);
|
||||
|
||||
return redirect('/');
|
||||
} catch (Exception $e) {
|
||||
nlog($e->getMessage());
|
||||
@ -287,8 +285,7 @@ class SetupController extends Controller
|
||||
|
||||
Artisan::call('migrate', ['--force' => true]);
|
||||
Artisan::call('db:seed', ['--force' => true]);
|
||||
|
||||
$this->buildCache(true);
|
||||
Artisan::call('cache:clear');
|
||||
|
||||
(new SchedulerCheck())->handle();
|
||||
|
||||
|
@ -23,6 +23,7 @@ use App\Models\DateFormat;
|
||||
use App\Models\PaymentTerm;
|
||||
use App\Models\PaymentType;
|
||||
use App\Models\DatetimeFormat;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\DataMapper\EmailTemplateDefaults;
|
||||
|
||||
@ -37,62 +38,174 @@ class StaticServiceProvider extends ServiceProvider
|
||||
{
|
||||
/** @return \Illuminate\Support\Collection<Currency> */
|
||||
app()->singleton('currencies', function ($app) {
|
||||
return Currency::query()->orderBy('name')->get();
|
||||
|
||||
if($resource = Cache::get('currencies')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Currency::query()->orderBy('name')->get();
|
||||
|
||||
Cache::forever('currencies', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Language> */
|
||||
app()->singleton('languages', function ($app) {
|
||||
return Language::query()->orderBy('name')->get();
|
||||
|
||||
if($resource = Cache::get('languages')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Language::query()->orderBy('name')->get();
|
||||
|
||||
Cache::forever('languages', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Country> */
|
||||
app()->singleton('countries', function ($app) {
|
||||
return Country::query()->orderBy('name')->get();
|
||||
|
||||
if($resource = Cache::get('countries')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Country::query()->orderBy('name')->get();
|
||||
|
||||
Cache::forever('countries', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<PaymentType> */
|
||||
app()->singleton('payment_types', function ($app) {
|
||||
return PaymentType::query()->orderBy('id')->get();
|
||||
|
||||
if($resource = Cache::get('payment_types')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = PaymentType::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('payment_types', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Industry> */
|
||||
app()->singleton('industries', function ($app) {
|
||||
return Industry::query()->orderBy('name')->get();
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Bank> */
|
||||
app()->singleton('banks', function ($app) {
|
||||
return Bank::query()->orderBy('name')->get();
|
||||
|
||||
|
||||
if($resource = Cache::get('banks')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Bank::query()->orderBy('name')->get();
|
||||
|
||||
Cache::forever('banks', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<DateFormat> */
|
||||
app()->singleton('date_formats', function ($app) {
|
||||
return DateFormat::query()->orderBy('id')->get();
|
||||
|
||||
|
||||
if($resource = Cache::get('date_formats')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = DateFormat::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('date_formats', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Timezone> */
|
||||
app()->singleton('timezones', function ($app) {
|
||||
return Timezone::query()->orderBy('id')->get();
|
||||
|
||||
|
||||
if($resource = Cache::get('timezones')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Timezone::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('timezones', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Gateway> */
|
||||
app()->singleton('gateways', function ($app) {
|
||||
return Gateway::query()->orderBy('id')->get();
|
||||
|
||||
if($resource = Cache::get('gateways')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Gateway::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('gateways', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Industry> */
|
||||
app()->singleton('industries', function ($app) {
|
||||
return Industry::query()->orderBy('id')->get();
|
||||
|
||||
|
||||
if($resource = Cache::get('industries')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Industry::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('industries', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<Size> */
|
||||
app()->singleton('sizes', function ($app) {
|
||||
return Size::query()->orderBy('id')->get();
|
||||
|
||||
|
||||
if($resource = Cache::get('sizes')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = Size::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('sizes', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
/** @return \Illuminate\Support\Collection<DatetimeFormat> */
|
||||
app()->singleton('datetime_formats', function ($app) {
|
||||
return DatetimeFormat::query()->orderBy('id')->get();
|
||||
|
||||
if($resource = Cache::get('datetime_formats')) {
|
||||
return $resource;
|
||||
}
|
||||
|
||||
$resource = DatetimeFormat::query()->orderBy('id')->get();
|
||||
|
||||
Cache::forever('datetime_formats', $resource);
|
||||
|
||||
return $resource;
|
||||
|
||||
});
|
||||
|
||||
app()->singleton('templates', function ($app) {
|
||||
|
@ -30,8 +30,16 @@ trait AppSetup
|
||||
return $check['system_health'] == 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*
|
||||
* @param mixed $force
|
||||
* @return void
|
||||
*/
|
||||
public function buildCache($force = false)
|
||||
{
|
||||
return;
|
||||
|
||||
$cached_tables = config('ninja.cached_tables');
|
||||
|
||||
foreach ($cached_tables as $name => $class) {
|
||||
@ -53,61 +61,6 @@ trait AppSetup
|
||||
}
|
||||
|
||||
/*Build template cache*/
|
||||
$this->buildTemplates();
|
||||
}
|
||||
|
||||
private function buildTemplates($name = 'templates')
|
||||
{
|
||||
$data = [
|
||||
|
||||
'invoice' => [
|
||||
'subject' => EmailTemplateDefaults::emailInvoiceSubject(),
|
||||
'body' => EmailTemplateDefaults::emailInvoiceTemplate(),
|
||||
],
|
||||
|
||||
'quote' => [
|
||||
'subject' => EmailTemplateDefaults::emailQuoteSubject(),
|
||||
'body' => EmailTemplateDefaults::emailQuoteTemplate(),
|
||||
],
|
||||
'payment' => [
|
||||
'subject' => EmailTemplateDefaults::emailPaymentSubject(),
|
||||
'body' => EmailTemplateDefaults::emailPaymentTemplate(),
|
||||
],
|
||||
'payment_partial' => [
|
||||
'subject' => EmailTemplateDefaults::emailPaymentPartialSubject(),
|
||||
'body' => EmailTemplateDefaults::emailPaymentPartialTemplate(),
|
||||
],
|
||||
'reminder1' => [
|
||||
'subject' => EmailTemplateDefaults::emailReminder1Subject(),
|
||||
'body' => EmailTemplateDefaults::emailReminder1Template(),
|
||||
],
|
||||
'reminder2' => [
|
||||
'subject' => EmailTemplateDefaults::emailReminder2Subject(),
|
||||
'body' => EmailTemplateDefaults::emailReminder2Template(),
|
||||
],
|
||||
'reminder3' => [
|
||||
'subject' => EmailTemplateDefaults::emailReminder3Subject(),
|
||||
'body' => EmailTemplateDefaults::emailReminder3Template(),
|
||||
],
|
||||
'reminder_endless' => [
|
||||
'subject' => EmailTemplateDefaults::emailReminderEndlessSubject(),
|
||||
'body' => EmailTemplateDefaults::emailReminderEndlessTemplate(),
|
||||
],
|
||||
'statement' => [
|
||||
'subject' => EmailTemplateDefaults::emailStatementSubject(),
|
||||
'body' => EmailTemplateDefaults::emailStatementTemplate(),
|
||||
],
|
||||
'credit' => [
|
||||
'subject' => EmailTemplateDefaults::emailCreditSubject(),
|
||||
'body' => EmailTemplateDefaults::emailCreditTemplate(),
|
||||
],
|
||||
'purchase_order' => [
|
||||
'subject' => EmailTemplateDefaults::emailPurchaseOrderSubject(),
|
||||
'body' => EmailTemplateDefaults::emailPurchaseOrderTemplate(),
|
||||
],
|
||||
];
|
||||
|
||||
Cache::forever($name, $data);
|
||||
}
|
||||
|
||||
private function updateEnvironmentProperty(string $property, $value): void
|
||||
|
@ -20,7 +20,6 @@ return new class extends Migration {
|
||||
$currency->update(['symbol' => '$']);
|
||||
}
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,8 +19,6 @@ return new class extends Migration {
|
||||
if ($currency) {
|
||||
$currency->update(['symbol' => '$']);
|
||||
}
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,6 @@ return new class extends Migration {
|
||||
$checkout->save();
|
||||
});
|
||||
|
||||
// $this->buildCache(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,6 @@ return new class extends Migration {
|
||||
$record->save();
|
||||
}
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ return new class extends Migration {
|
||||
$table->dropColumn('show_production_description_dropdown');
|
||||
});
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,8 +36,6 @@ class AddPurchaseOrderToExpense extends Migration
|
||||
if (!$language) {
|
||||
Language::unguard();
|
||||
Language::create(['id' => 36, 'name' => 'Bulgarian', 'locale' => 'bg']);
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,8 +60,6 @@ return new class extends Migration {
|
||||
}
|
||||
|
||||
\Illuminate\Support\Facades\Artisan::call('ninja:design-update');
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,6 @@ return new class extends Migration {
|
||||
|
||||
\Illuminate\Support\Facades\Artisan::call('ninja:design-update');
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,8 +59,6 @@ class RandomDataSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
|
||||
$this->buildCache(true);
|
||||
|
||||
$this->command->info('Running RandomDataSeeder');
|
||||
|
||||
Model::unguard();
|
||||
|
@ -44,7 +44,6 @@ class ClientMergeTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->faker = Factory::create();
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
public function testSearchingForContacts()
|
||||
|
@ -40,7 +40,6 @@ class CreditsTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->faker = Factory::create();
|
||||
$this->buildCache(true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,6 @@ class InvoicesTest extends TestCase
|
||||
parent::setUp();
|
||||
|
||||
$this->faker = Factory::create();
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
public function testInvoiceTableFilters()
|
||||
|
@ -46,8 +46,6 @@ class ArDetailReportTest extends TestCase
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
$this->buildCache(true);
|
||||
|
||||
}
|
||||
|
||||
public $company;
|
||||
|
@ -47,8 +47,6 @@ class ProductSalesReportTest extends TestCase
|
||||
);
|
||||
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
public $company;
|
||||
|
@ -57,7 +57,6 @@ class CompanyLedgerTest extends TestCase
|
||||
$this->withoutExceptionHandling();
|
||||
|
||||
$this->artisan('db:seed --force');
|
||||
$this->buildCache(true);
|
||||
|
||||
$this->faker = \Faker\Factory::create();
|
||||
$fake_email = $this->faker->email();
|
||||
|
@ -14,7 +14,5 @@ abstract class TestCase extends BaseTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->buildCache(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,6 @@ class CreditBalanceTest extends TestCase
|
||||
});
|
||||
|
||||
$this->makeTestData();
|
||||
|
||||
$this->buildCache(true);
|
||||
}
|
||||
|
||||
public function testCreditBalance()
|
||||
|
@ -33,8 +33,6 @@ class RecurringExpenseCloneTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
$this->faker = \Faker\Factory::create();
|
||||
$this->buildCache(true);
|
||||
|
||||
}
|
||||
|
||||
public function testBadBase64String()
|
||||
|
Loading…
x
Reference in New Issue
Block a user