Rebuild DEEG as a fifth installation, add stepped forms and a plugin system, and clear the review backlog
Forms gained steps, conditions, image choices, number fields with units and a summary step; the DEEG price finder uses all of it. Plugins are manifest plus Twig: blocks, settings, containers, routes, presets and theme packs, switched per installation. The review backlog is done: archive pages render through the normal page pipeline, forms and post lists work inside areas and sections, repeated sections get their own ids, breakpoints and colours come from the palette, backup and update work on MySQL and lock each other out. The task worker no longer shortens a process that has no time limit: set_time_limit() sets the limit instead of extending it, which turned an unlimited CLI run into eighty seconds and killed the full test suite far away from the scheduler. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
66ff68abf8
commit
c8a8fa7460
74 files changed
+5352
-243
No files matched your search
@@ -99,7 +99,7 @@ final class PartialRepository
|
||||
$slug = 'default';
|
||||
}
|
||||
$document = $this->richText->normaliseDocument($document);
|
||||
$this->validator->validate($document, false);
|
||||
$this->validator->validate($document, false, true);
|
||||
if (null !== $this->findByKind($kind, $slug, $locale)) {
|
||||
throw new InvalidPage(sprintf('„%s“ ist als Adresse bereits vergeben.', $slug));
|
||||
}
|
||||
@@ -117,7 +117,7 @@ final class PartialRepository
|
||||
public function save(string $id, array $document, int $expectedVersion): void
|
||||
{
|
||||
$document = $this->richText->normaliseDocument($document);
|
||||
$this->validator->validate($document, false);
|
||||
$this->validator->validate($document, false, true);
|
||||
$this->db->transactional(function () use ($id, $document, $expectedVersion): void {
|
||||
// A section must not end up containing itself, directly or through another section.
|
||||
$this->guardAgainstCycles($id, $document);
|
||||
@@ -179,6 +179,71 @@ final class PartialRepository
|
||||
}
|
||||
|
||||
/** @return list<string> */
|
||||
/**
|
||||
* Dieselbe Sektion mehrfach auf einer Seite: die zweite und jede weitere Verknüpfung bekommt
|
||||
* eine Kopie mit eigenen Kennungen (`id-2`, `id-3`) und ohne Sprungziele, damit die Seite keine
|
||||
* doppelten IDs trägt - ein Anker, ein Stil und jede Skriptsuche träfen sonst nur die erste.
|
||||
*
|
||||
* Gezählt wird in Renderreihenfolge über alle Dokumente einer Seite hinweg (`$seen` teilen sich
|
||||
* Kopf, Inhalt und Fuß); verschachtelte Verknüpfungen in einer Sektion zählen mit, bis zur
|
||||
* Verschachtelungsgrenze. `$sections` bekommt die Kopien unter `slug~n`, der Verweis im
|
||||
* zurückgegebenen Dokument zeigt dorthin.
|
||||
*
|
||||
* @param array<string, array> $sections die aufgelösten Sektionen, werden um Kopien ergänzt
|
||||
* @param array<string, int> $seen Zähler je Slug
|
||||
* @param array<string, array> $pristine die Sektionen, wie sie gespeichert sind
|
||||
*/
|
||||
public function expandRepeatedLinks(array $document, array &$sections, array &$seen, array $pristine, int $depth = 0): array
|
||||
{
|
||||
$walk = function (array $blocks) use (&$walk, &$sections, &$seen, $pristine, $depth): array {
|
||||
foreach ($blocks as $i => $block) {
|
||||
$slug = 'partialref' === ($block['type'] ?? null) && is_string($block['props']['partial'] ?? null) ? $block['props']['partial'] : null;
|
||||
if (null !== $slug && isset($pristine[$slug])) {
|
||||
$n = $seen[$slug] = ($seen[$slug] ?? 0) + 1;
|
||||
if (1 === $n) {
|
||||
if ($depth < self::MAX_NESTING) {
|
||||
$sections[$slug] = $this->expandRepeatedLinks($pristine[$slug], $sections, $seen, $pristine, $depth + 1);
|
||||
}
|
||||
} else {
|
||||
$key = $slug.'~'.$n;
|
||||
$copy = $this->renamed($pristine[$slug], '-'.$n);
|
||||
$sections[$key] = $depth < self::MAX_NESTING ? $this->expandRepeatedLinks($copy, $sections, $seen, $pristine, $depth + 1) : $copy;
|
||||
$blocks[$i]['props']['partial'] = $key;
|
||||
}
|
||||
}
|
||||
if (isset($block['children']) && is_array($block['children'])) {
|
||||
$blocks[$i]['children'] = $walk($block['children']);
|
||||
}
|
||||
}
|
||||
|
||||
return $blocks;
|
||||
};
|
||||
$document['blocks'] = $walk($document['blocks'] ?? []);
|
||||
|
||||
return $document;
|
||||
}
|
||||
|
||||
/** Ein Dokument mit angehängter Kennung an jedem Block, ohne Sprungziele. */
|
||||
private function renamed(array $document, string $suffix): array
|
||||
{
|
||||
$walk = static function (array $blocks) use (&$walk, $suffix): array {
|
||||
foreach ($blocks as $i => $block) {
|
||||
if (isset($block['id'])) {
|
||||
$blocks[$i]['id'] = substr((string) $block['id'], 0, 64 - strlen($suffix)).$suffix;
|
||||
}
|
||||
unset($blocks[$i]['anchor']);
|
||||
if (isset($block['children']) && is_array($block['children'])) {
|
||||
$blocks[$i]['children'] = $walk($block['children']);
|
||||
}
|
||||
}
|
||||
|
||||
return $blocks;
|
||||
};
|
||||
$document['blocks'] = $walk($document['blocks'] ?? []);
|
||||
|
||||
return $document;
|
||||
}
|
||||
|
||||
public function referencedSlugs(array $document): array
|
||||
{
|
||||
$slugs = [];
|
||||
|
||||
Reference in new issue
Block a user