mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-24 08:00:12 -06:00
Small optimisations.
This commit is contained in:
parent
5c4d010bde
commit
2947ec0002
@ -51,7 +51,7 @@ class EncryptFile extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$file = e($this->argument('file'));
|
||||
$file = e(strval($this->argument('file')));
|
||||
if (!file_exists($file)) {
|
||||
$this->error(sprintf('File "%s" does not seem to exist.', $file));
|
||||
|
||||
@ -59,7 +59,7 @@ class EncryptFile extends Command
|
||||
}
|
||||
$content = file_get_contents($file);
|
||||
$content = Crypt::encrypt($content);
|
||||
$newName = $this->argument('key') . '.upload';
|
||||
$newName = e($this->argument('key')) . '.upload';
|
||||
|
||||
$path = storage_path('upload') . '/' . $newName;
|
||||
file_put_contents($path, $content);
|
||||
|
@ -168,7 +168,7 @@ class ImportController extends Controller
|
||||
|
||||
// return redirect to settings.
|
||||
// this could loop until the user is done.
|
||||
return redirect(route('import.settings', $job->key));
|
||||
return redirect(route('import.settings', [$job->key]));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,17 +345,14 @@ class ImportController extends Controller
|
||||
Log::debug('Will redirect to configure()');
|
||||
|
||||
return redirect(route('import.configure', [$job->key]));
|
||||
break;
|
||||
case 'import_configuration_saved':
|
||||
Log::debug('Will redirect to settings()');
|
||||
|
||||
return redirect(route('import.settings', [$job->key]));
|
||||
break;
|
||||
case 'settings_complete':
|
||||
Log::debug('Will redirect to complete()');
|
||||
|
||||
return redirect(route('import.complete', [$job->key]));
|
||||
break;
|
||||
}
|
||||
|
||||
throw new FireflyException('Cannot redirect for job state ' . $job->status);
|
||||
|
@ -290,6 +290,103 @@ class CreateMainTables extends Migration
|
||||
|
||||
}
|
||||
|
||||
private function createJournalTables()
|
||||
{
|
||||
if (!Schema::hasTable('transaction_journals')) {
|
||||
Schema::create(
|
||||
'transaction_journals', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->integer('user_id', false, true);
|
||||
$table->integer('transaction_type_id', false, true);
|
||||
$table->integer('bill_id', false, true)->nullable();
|
||||
$table->integer('transaction_currency_id', false, true);
|
||||
|
||||
$table->string('description', 1024);
|
||||
|
||||
$table->date('date');
|
||||
$table->date('interest_date')->nullable();
|
||||
$table->date('book_date')->nullable();
|
||||
$table->date('process_date')->nullable();
|
||||
|
||||
$table->integer('order', false, true);
|
||||
$table->integer('tag_count', false, true);
|
||||
|
||||
$table->boolean('encrypted')->default(1);
|
||||
$table->boolean('completed')->default(1);
|
||||
|
||||
// links to other tables:
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');
|
||||
$table->foreign('bill_id')->references('id')->on('bills')->onDelete('set null');
|
||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('journal_meta')) {
|
||||
Schema::create(
|
||||
'journal_meta', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
$table->string('name', 255);
|
||||
$table->text('data');
|
||||
$table->string('hash', 64);
|
||||
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private function createMoreJournalTables()
|
||||
{
|
||||
if (!Schema::hasTable('tag_transaction_journal')) {
|
||||
Schema::create(
|
||||
'tag_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('tag_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('budget_transaction_journal')) {
|
||||
Schema::create(
|
||||
'budget_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('budget_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
|
||||
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('category_transaction_journal')) {
|
||||
Schema::create(
|
||||
'category_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('category_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
|
||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -497,96 +594,9 @@ class CreateMainTables extends Migration
|
||||
*/
|
||||
private function createTransactionTables()
|
||||
{
|
||||
$this->createJournalTables();
|
||||
$this->createMoreJournalTables();
|
||||
|
||||
if (!Schema::hasTable('transaction_journals')) {
|
||||
Schema::create(
|
||||
'transaction_journals', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->integer('user_id', false, true);
|
||||
$table->integer('transaction_type_id', false, true);
|
||||
$table->integer('bill_id', false, true)->nullable();
|
||||
$table->integer('transaction_currency_id', false, true);
|
||||
|
||||
$table->string('description', 1024);
|
||||
|
||||
$table->date('date');
|
||||
$table->date('interest_date')->nullable();
|
||||
$table->date('book_date')->nullable();
|
||||
$table->date('process_date')->nullable();
|
||||
|
||||
$table->integer('order', false, true);
|
||||
$table->integer('tag_count', false, true);
|
||||
|
||||
$table->boolean('encrypted')->default(1);
|
||||
$table->boolean('completed')->default(1);
|
||||
|
||||
// links to other tables:
|
||||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->foreign('transaction_type_id')->references('id')->on('transaction_types')->onDelete('cascade');
|
||||
$table->foreign('bill_id')->references('id')->on('bills')->onDelete('set null');
|
||||
$table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('journal_meta')) {
|
||||
Schema::create(
|
||||
'journal_meta', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->timestamps();
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
$table->string('name', 255);
|
||||
$table->text('data');
|
||||
$table->string('hash', 64);
|
||||
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('tag_transaction_journal')) {
|
||||
Schema::create(
|
||||
'tag_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('tag_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('budget_transaction_journal')) {
|
||||
Schema::create(
|
||||
'budget_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('budget_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
|
||||
$table->foreign('budget_id')->references('id')->on('budgets')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('category_transaction_journal')) {
|
||||
Schema::create(
|
||||
'category_transaction_journal', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('category_id', false, true);
|
||||
$table->integer('transaction_journal_id', false, true);
|
||||
|
||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
$table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (!Schema::hasTable('piggy_bank_events')) {
|
||||
Schema::create(
|
||||
|
Loading…
Reference in New Issue
Block a user