dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxCmsLazyTreePerformance_contract_test.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
4$base = dirname(__DIR__, 2);
5$failures = array();
6$assert = static function (bool $condition, string $message) use (&$failures): void {
7 if (!$condition) $failures[] = $message;
8};
9
10$cmsJs = (string)file_get_contents($base . '/js/lib/cms.js');
11$cmsCss = (string)file_get_contents($base . '/design/dbxapp/css/c-cms.css');
12$cmsPhp = (string)file_get_contents($base . '/modules/dbxContent_admin/include/dbxContent_cms.class.php');
13
14$initStart = strpos($cmsJs, 'init(el, cfg)');
15$initEnd = strpos($cmsJs, 'rescan(root)', $initStart);
18 str_contains($initSource, 'loadInitialSelection(el, cfg || {})')
19 && !str_contains($initSource, 'loadTree(el, cfg || {})'),
20 'Der CMS-Start lädt den Content-Baum weiterhin sofort.'
21);
23 str_contains($cmsJs, 'if (!collapsed) ensureTreeLoaded(root, cfg || cmsConfig(root));')
24 && str_contains($cmsJs, 'if (s.treeLoaded) return Promise.resolve(s.tree);')
25 && str_contains($cmsJs, 'if (s.treeLoading && s.treePromise) return s.treePromise;'),
26 'Lazy Loading oder Request-Zusammenführung des Content-Baums fehlt.'
27);
28$initialStart = strpos($cmsJs, 'function loadInitialSelection(root, cfg)');
29$initialEnd = strpos($cmsJs, 'function setSelectValues(', $initialStart);
32 substr_count($initialSource, 'ensureTreeLoaded(root, cfg)') === 1
33 && !str_contains($initialSource, 'const firstPage ='),
34 'Eine leere oder frische CMS-Sitzung lädt den Baum noch als Seiten-Fallback.'
35);
36
37$caretStart = strpos($cmsJs, 'function refreshEditorCaretHint(root)');
38$caretEnd = strpos($cmsJs, 'function hideEditorCaretHint(root)', $caretStart);
41 str_contains($caretSource, 'hideEditorCaretHint(root);')
42 && !str_contains($caretSource, 'showEditorCaretHint(root')
43 && !str_contains($cmsCss, '.dbx-cms-editor-caret-hint'),
44 'Der versetzbare künstliche Editor-Cursor ist noch aktiv.'
45);
46
47$renderStart = strpos($cmsPhp, 'private function render_cms()');
48$renderEnd = strpos($cmsPhp, 'private function mod_class_files(', $renderStart);
51 !str_contains($renderSource, '$this->cms_tree()')
52 && str_contains($renderSource, '$db->count(dbxContentLng::ddContent(), \'\')')
53 && str_contains($renderSource, '$db->count(dbxContentLng::ddFolder(), \'\')'),
54 'Der initiale CMS-Render baut den vollständigen Baum noch für die Zähler auf.'
55);
56$resolveStart = strpos($cmsPhp, 'private function resolve_cms_page_id(): int');
57$resolveEnd = strpos($cmsPhp, 'private function attach_unreachable_tree_nodes(', $resolveStart);
60 str_contains($resolveSource, "'sorter,title,id'")
61 && str_contains($resolveSource, "\n 1,\n 0,\n 0\n"),
62 'Die initiale Seite wird ohne URL nicht per kleiner Einzelabfrage bestimmt.'
63);
65 str_contains($cmsPhp, 'private function tree_lng_coverage_rows($db): array')
66 && !str_contains($cmsPhp, '$node[\'_row_html\'] =')
67 && !str_contains($cmsPhp, '$tree[\'tree_html\'] ='),
68 'Der Tree-Endpunkt erzeugt weiterhin zeilenweise DB-/Template-Arbeit.'
69);
70
71if ($failures !== array()) {
72 fwrite(STDERR, "FAIL\n- " . implode("\n- ", $failures) . "\n");
73 exit(1);
74}
75
76echo "OK CMS cursor and lazy content tree performance contract.\n";
exit
Definition index.php:146