dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
update_docs_home_cinematic_20260728.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
11
12$base = dirname(__DIR__, 4);
13chdir($base);
14$_SERVER['REQUEST_URI'] = '/dbxapp-docs/';
15$_SERVER['HTTP_HOST'] = 'localhost';
16$_SERVER['HTTPS'] = 'on';
17$_SERVER['SCRIPT_NAME'] = '/dbxapp-docs/index.php';
18
19define('dbxSystem', 'dbxWebApp');
20define('dbxRunAsAdmin', 1);
21
22require $base . '/dbx/vendor/autoload.php';
23require_once $base . '/dbx/include/dbxKernel.php';
24require_once $base . '/dbx/modules/dbxContent/include/dbxContent_bootstrap_sync.php';
25
27
28$db = dbx()->get_system_obj('dbxDB');
29$contentDd = 'dbx|content_de';
30$usageDd = 'dbx|dbxMediaUsage';
31$cinematicFile = $base . '/dbx/modules/dbxDocs/content/dbxapp_home_cinematic.html';
32$cinematic = is_file($cinematicFile) ? trim((string)file_get_contents($cinematicFile)) : '';
33
34if ($cinematic === '' || !str_contains($cinematic, 'data-dbx-cinema')) {
35 throw new RuntimeException('Die gebündelte Startseitenanimation fehlt oder ist ungültig.');
36}
37
38$page = $db->select1(
40 array('permalink' => 'tutorials-dbxapp'),
41 array('id', 'permalink', 'content'),
42 0
43);
44$pageId = (int)($page['id'] ?? 0);
45if ($pageId <= 0) {
46 throw new RuntimeException('Die Dokumentations-Startseite tutorials-dbxapp wurde nicht gefunden.');
47}
48
49$content = (string)($page['content'] ?? '');
50$content = preg_replace(
51 '#<!--\s*dbxdocs-cinematic:start:[^>]+-->.*?<!--\s*dbxdocs-cinematic:end\s*-->#is',
52 '',
54);
55$content = $cinematic . "\n\n" . trim((string)$content);
56
57if ($db->update(
59 array('content' => $content),
60 $pageId,
61 0,
62 1,
63 0,
64 1
65) !== 1) {
66 throw new RuntimeException('Die Dokumentations-Startseite konnte nicht aktualisiert werden.');
67}
68
70$usages = $db->select(
72 array('content_id' => $pageId, 'slot' => 'gallery'),
73 'id,media_id,active',
74 'id',
75 'ASC',
76 '',
77 0,
78 0,
79 0
80);
81
82foreach (is_array($usages) ? $usages : array() as $usage) {
83 $usageId = (int)($usage['id'] ?? 0);
84 $mediaId = (int)($usage['media_id'] ?? 0);
85 if ($usageId <= 0
86 || !in_array($mediaId, array(119, 120, 121), true)
87 || (int)($usage['active'] ?? 0) === 0
88 ) {
89 continue;
90 }
91 if ($db->update(
93 array('active' => 0),
94 $usageId,
95 0,
96 1,
97 0,
98 1
99 ) !== 1) {
100 throw new RuntimeException('Galerie-Zuordnung #' . $usageId . ' konnte nicht deaktiviert werden.');
101 }
102 $disabled++;
103}
104
105dbxContentPageCache::invalidateAll();
106
107echo json_encode(array(
108 'ok' => true,
109 'content_id' => $pageId,
110 'permalink' => (string)($page['permalink'] ?? ''),
111 'cinematic_seconds' => 84,
112 'gallery_usages_disabled' => $disabled,
113 'cache_invalidated' => true,
114), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
$_SERVER['REQUEST_METHOD']
DBX schema administration.
if($cinematic===''||!str_contains($cinematic, 'data-dbx-cinema')) $page
if($db->update($contentDd, array('content'=> $content), $pageId, 0, 1, 0, 1) !==1) $disabled