Schneller und stabiler bei Updates (0.45.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 12m25s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 12m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 10m43s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 10m37s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 12m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m38s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 12m25s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 12m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 10m43s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 10m37s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 12m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m38s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
- Ladefehler während eines Updates schalten keine Plugins mehr ab: Wartungsmodus merkt sich den Update-Zeitraum (+2 min Nachlauf), Plugin-Uploads markieren den Dateiaustausch ohne Wartungsmodus; guard/recoverFromCrash prüfen das, betroffene Plugins (mit disabled_at im Zeitraum) werden wieder eingeschaltet - Plugin-Oberflächen werden nach public/plugin-assets kopiert (Webserver statt PHP), bei Deaktivieren/Löschen/Neu-Hochladen entfernt; Route bleibt als Rückfall - RichTextEditor in SDK, Leichte-Sprache-Leiste und Glossar asynchron; fehlende Menü-Symbole kuratiert → kein Laden des kompletten Symbolsatzes - Inertia-Prefetch (hover, 10 s) für Menülinks und Neuigkeiten-Vorschauen; Prefetch zählt nicht als Lesen (Reach) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55a26e3f8e
commit
bf68be68f9
205 changed files with 773 additions and 464 deletions
|
|
@ -94,4 +94,16 @@ class LikesAndReachTest extends TestCase
|
|||
$this->getJson('/api/v1/news', $headers)->assertJsonPath('data.0.likes', 2)->assertJsonPath('data.0.comments', 2)->assertJsonPath('data.1.comments', null);
|
||||
$this->assertSame($quiet->id, $this->getJson('/api/v1/news', $headers)->json('data.1.id'));
|
||||
}
|
||||
|
||||
public function test_prefetching_a_post_does_not_count_as_reading(): void
|
||||
{
|
||||
$post = NewsPost::factory()->create(['published_at' => now()->subHour()]);
|
||||
$user = User::factory()->create();
|
||||
|
||||
$this->actingAs($user)->get("/neuigkeiten/{$post->slug}", ['Purpose' => 'prefetch'])->assertOk();
|
||||
$this->assertSame(0, DB::table('news_reads')->count());
|
||||
|
||||
$this->actingAs($user)->get("/neuigkeiten/{$post->slug}")->assertOk();
|
||||
$this->assertSame(1, DB::table('news_reads')->count());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ class PluginSdkTest extends TestCase
|
|||
$this->dir = sys_get_temp_dir().'/inhaus-sdk-'.bin2hex(random_bytes(4));
|
||||
mkdir($this->dir.'/core', 0777, true);
|
||||
mkdir($this->dir.'/custom', 0777, true);
|
||||
config(['inhaus.plugin_assets_path' => $this->dir.'/public']);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
|
@ -114,6 +115,26 @@ class PluginSdkTest extends TestCase
|
|||
$this->assertNull(app(PluginAssets::class)->file('mit-ui', '../plugin-geheim.js'));
|
||||
}
|
||||
|
||||
public function test_assets_are_published_for_the_web_server_and_removed_again(): void
|
||||
{
|
||||
$this->makeUiPlugin('mit-ui');
|
||||
file_put_contents($this->dir.'/custom/mit-ui/dist/geheim.php', '<?php echo 1;');
|
||||
$manager = $this->boot('mit-ui');
|
||||
@mkdir($this->dir.'/public/mit-ui/1.0.0', 0777, true); // ältere Version
|
||||
|
||||
app(PluginAssets::class)->forFrontend();
|
||||
|
||||
$published = $this->dir.'/public/mit-ui/1.2.3';
|
||||
$this->assertFileExists($published.'/pages/Index.js');
|
||||
$this->assertFileExists($published.'/style.css');
|
||||
$this->assertFileDoesNotExist($published.'/geheim.php', 'Nur erlaubte Dateitypen');
|
||||
$this->assertDirectoryDoesNotExist($this->dir.'/public/mit-ui/1.0.0');
|
||||
$this->assertSame(file_get_contents($this->dir.'/custom/mit-ui/dist/pages/Index.js'), file_get_contents($published.'/pages/Index.js'));
|
||||
|
||||
$manager->deactivate('mit-ui');
|
||||
$this->assertDirectoryDoesNotExist($this->dir.'/public/mit-ui');
|
||||
}
|
||||
|
||||
public function test_pages_carry_import_map_and_plugin_manifest(): void
|
||||
{
|
||||
$this->makeUiPlugin('mit-ui');
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use App\Plugins\PluginState;
|
|||
use App\Plugins\VersionConstraint;
|
||||
use App\Support\Navigation;
|
||||
use App\Support\Update\Filesystem;
|
||||
use App\Support\Update\MaintenanceFlag;
|
||||
use App\Support\Update\ZipExtractor;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -34,6 +35,7 @@ class PluginSystemTest extends TestCase
|
|||
$this->dir = sys_get_temp_dir().'/inhaus-plugins-'.bin2hex(random_bytes(4));
|
||||
mkdir($this->dir.'/core', 0777, true);
|
||||
mkdir($this->dir.'/custom', 0777, true);
|
||||
$this->app->instance(MaintenanceFlag::class, new MaintenanceFlag($this->dir.'/.maintenance'));
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
|
@ -303,6 +305,11 @@ class PluginSystemTest extends TestCase
|
|||
$this->assertFalse($manifest->core);
|
||||
$this->assertFileExists($this->dir.'/custom/hochgeladen/plugin.json');
|
||||
$this->assertNotNull($manager->find('hochgeladen'));
|
||||
|
||||
// Der Austausch der Dateien zählt als Update-Zeitraum: Ladefehler darin schalten nichts ab
|
||||
$this->assertFalse(app(MaintenanceFlag::class)->isActive(), 'Die Seite bleibt erreichbar.');
|
||||
$this->assertTrue(app(MaintenanceFlag::class)->isUpdating());
|
||||
$this->assertFileDoesNotExist($this->dir.'/.maintenance-quiet');
|
||||
}
|
||||
|
||||
public function test_zip_without_manifest_or_with_core_slug_is_rejected(): void
|
||||
|
|
@ -413,4 +420,59 @@ class PluginSystemTest extends TestCase
|
|||
|
||||
return $zip;
|
||||
}
|
||||
|
||||
public function test_load_errors_during_an_update_do_not_disable_plugins(): void
|
||||
{
|
||||
$this->makePlugin('wackelig', register: "throw new \\RuntimeException('Datei halb kopiert');", base: 'core');
|
||||
$flag = app(MaintenanceFlag::class);
|
||||
|
||||
// Während des Updates und kurz danach: nur diese Anfrage ohne das Plugin
|
||||
$flag->activate(300);
|
||||
$manager = $this->manager();
|
||||
$manager->registerAll();
|
||||
$this->assertTrue($manager->isEnabled('wackelig'));
|
||||
$this->assertArrayNotHasKey('wackelig', $manager->loaded());
|
||||
$this->assertFileDoesNotExist(storage_path('framework/plugins/booting-wackelig'));
|
||||
|
||||
$flag->deactivate();
|
||||
$this->assertTrue($flag->isUpdating());
|
||||
$manager = $this->manager();
|
||||
$manager->registerAll();
|
||||
$this->assertTrue($manager->isEnabled('wackelig'));
|
||||
|
||||
// Lange nach dem Update: wirklich defekt → abgeschaltet
|
||||
file_put_contents($this->dir.'/.maintenance-last', json_encode(['since' => time() - 900, 'until' => time() - 600]));
|
||||
$this->assertFalse($flag->isUpdating());
|
||||
$manager = $this->manager();
|
||||
$manager->registerAll();
|
||||
$this->assertFalse($manager->isEnabled('wackelig'));
|
||||
}
|
||||
|
||||
public function test_crash_markers_from_an_update_keep_the_plugin_and_old_victims_come_back(): void
|
||||
{
|
||||
$this->makePlugin('absturz', base: 'core');
|
||||
$this->makePlugin('opfer', base: 'core');
|
||||
file_put_contents($this->dir.'/.maintenance-last', json_encode(['since' => time() - 200, 'until' => time() - 100]));
|
||||
|
||||
// Absturz mitten im Update (Markierung aus dem Update-Zeitraum)
|
||||
$marker = storage_path('framework/plugins/booting-absturz');
|
||||
@mkdir(dirname($marker), 0777, true);
|
||||
file_put_contents($marker, '1');
|
||||
touch($marker, time() - 150);
|
||||
|
||||
// Von einer älteren Version während des Updates abgeschaltet
|
||||
$state = new PluginState($this->dir.'/state.json');
|
||||
$state->setEnabled('opfer', false, 'Schwerer Fehler beim Laden (das Portal wurde dadurch unterbrochen).');
|
||||
$data = json_decode(file_get_contents($this->dir.'/state.json'), true);
|
||||
$data['opfer']['disabled_at'] = time() - 150;
|
||||
file_put_contents($this->dir.'/state.json', json_encode($data));
|
||||
|
||||
$manager = $this->manager();
|
||||
$manager->registerAll();
|
||||
|
||||
$this->assertTrue($manager->isEnabled('absturz'));
|
||||
$this->assertFileDoesNotExist($marker);
|
||||
$this->assertTrue($manager->isEnabled('opfer'));
|
||||
$this->assertArrayHasKey('opfer', $manager->loaded());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue