Adds an instance id via app settings.
$this->data['exported_at'] = date(DATE_ATOM);
$this->data['instance'] = [
- 'version' => trim(file_get_contents(base_path('version'))),
- 'id_ciphertext' => encrypt('bookstack'),
+ 'id' => setting('instance-id', ''),
+ 'version' => trim(file_get_contents(base_path('version'))),
];
$zipFile = tempnam(sys_get_temp_dir(), 'bszip-');
--- /dev/null
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Carbon;
+use Illuminate\Support\Facades\DB;
+
+return new class extends Migration
+{
+ /**
+ * Run the migrations.
+ */
+ public function up(): void
+ {
+ DB::table('settings')->insert([
+ 'setting_key' => 'instance-id',
+ 'value' => Str::uuid(),
+ 'created_at' => Carbon::now(),
+ 'updated_at' => Carbon::now(),
+ 'type' => 'string',
+ ]);
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ DB::table('settings')->where('setting_key', '=', 'instance-id')->delete();
+ }
+};
#### Instance
-These details are mainly informational regarding the exporting BookStack instance from where an export was created from.
+These details are informational regarding the exporting BookStack instance from where an export was created from.
+- `id` - String, required, unique identifier for the BookStack instance.
- `version` - String, required, BookStack version of the export source instance.
-- `id_ciphertext` - String, required, identifier for the BookStack instance.
-
-The `id_ciphertext` is the ciphertext of encrypting the text `bookstack`. This is used as a simple & rough way for a BookStack instance to be able to identify if they were the source (by attempting to decrypt the ciphertext).
#### Book
$version = trim(file_get_contents(base_path('version')));
$this->assertEquals($version, $zip->data['instance']['version']);
- $instanceId = decrypt($zip->data['instance']['id_ciphertext']);
- $this->assertEquals('bookstack', $instanceId);
+ $zipInstanceId = $zip->data['instance']['id'];
+ $instanceId = setting('instance-id');
+ $this->assertNotEmpty($instanceId);
+ $this->assertEquals($instanceId, $zipInstanceId);
}
public function test_page_export()