dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
update_docs_portal_media_20260728.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
14
15$base = dirname(__DIR__, 4);
16chdir($base);
17$_SERVER['REQUEST_URI'] = '/dbxapp-docs/';
18$_SERVER['HTTP_HOST'] = 'localhost';
19$_SERVER['HTTPS'] = 'on';
20$_SERVER['SCRIPT_NAME'] = '/dbxapp-docs/index.php';
21
22define('dbxSystem', 'dbxWebApp');
23define('dbxRunAsAdmin', 1);
24
25require $base . '/dbx/vendor/autoload.php';
26require_once $base . '/dbx/include/dbxKernel.php';
27require_once $base . '/dbx/modules/dbxContent/include/dbxContent_bootstrap_sync.php';
28
30
31$db = dbx()->get_system_obj('dbxDB');
32$mediaDd = 'dbx|dbxMedia';
33$usageDd = 'dbx|dbxMediaUsage';
34
35$media = array(
36 119 => array(
37 'title' => 'dbxapp – eine Plattform für Inhalte, Shop und Anwendungen',
38 'alt' => 'Vernetzte dbxapp-Plattform für CMS, Shop, Anwendungen, Workflows und KI',
39 'caption' => 'Eine Plattform für Inhalte, Shop und Anwendungen',
40 'file_name' => 'dbxapp-kurzfilm-poster-20260728.webp',
41 'file_path' => 'media/img/images/dbxapp-kurzfilm-poster-20260728.webp',
42 'tags' => 'dbxapp, plattform, cms, shop, anwendungen, ki',
43 ),
44 120 => array(
45 'title' => 'Bestehende Systeme neu denken und optimieren',
46 'alt' => 'Getrennte Altsysteme werden als klare modulare dbxapp-Lösung neu aufgebaut',
47 'caption' => 'Bestehende Systeme lassen sich leicht nachbilden und optimieren',
48 'file_name' => 'dbxapp-systeme-neu-denken-20260728.webp',
49 'file_path' => 'media/img/images/dbxapp-systeme-neu-denken-20260728.webp',
50 'tags' => 'dbxapp, systeme, modernisierung, optimierung',
51 ),
52 121 => array(
53 'title' => 'Mit dbxapp modular und sicher wachsen',
54 'alt' => 'Modulare dbxapp-Plattform mit CMS, Shop, Apps, Workflows und Sicherheit',
55 'caption' => 'Modular starten und sicher wachsen',
56 'file_name' => 'dbxapp-modular-wachsen-20260728.webp',
57 'file_path' => 'media/img/images/dbxapp-modular-wachsen-20260728.webp',
58 'tags' => 'dbxapp, module, wachstum, sicherheit',
59 ),
60);
61
64
65foreach ($media as $id => $record) {
66 $file = $base . '/files/' . $record['file_path'];
67 if (!is_file($file)) {
68 throw new RuntimeException('Dokumentationsmedium fehlt: ' . $file);
69 }
70
71 $image = getimagesize($file);
72 if (!is_array($image) || (int)($image[0] ?? 0) <= 0 || (int)($image[1] ?? 0) <= 0) {
73 throw new RuntimeException('Ungültiges Dokumentationsmedium: ' . $file);
74 }
75
76 $record += array(
77 'active' => 1,
78 'slot' => 'gallery',
79 'usage' => 'gallery',
80 'mime' => 'image/webp',
81 'size' => filesize($file),
82 'width' => (int)$image[0],
83 'height' => (int)$image[1],
84 'thumb_file_path' => '',
85 'thumb_width' => 0,
86 'thumb_height' => 0,
87 'media_type' => 'image',
88 'storage_type' => 'local',
89 'media_folder' => 'img/images',
90 );
91
92 if ($db->update($mediaDd, $record, $id, 0, 1, 0, 1) !== 1) {
93 throw new RuntimeException('Dokumentationsmedium #' . $id . ' konnte nicht aktualisiert werden.');
94 }
96
97 $usages = $db->select(
99 array('media_id' => $id),
100 'id,caption',
101 'id',
102 'ASC',
103 '',
104 0,
105 0,
106 0
107 );
108 foreach (is_array($usages) ? $usages : array() as $usage) {
109 $usageId = (int)($usage['id'] ?? 0);
110 if ($usageId <= 0) {
111 continue;
112 }
113 if ($db->update(
114 $usageDd,
115 array('caption' => $record['caption']),
116 $usageId,
117 0,
118 1,
119 0,
120 1
121 ) !== 1) {
122 throw new RuntimeException('Medienzuordnung #' . $usageId . ' konnte nicht aktualisiert werden.');
123 }
125 }
126}
127
128dbxContentPageCache::invalidateAll();
129
130echo json_encode(array(
131 'ok' => true,
132 'media_updated' => $updatedMedia,
133 'usages_updated' => $updatedUsages,
134 'cache_invalidated' => true,
135), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
$_SERVER['REQUEST_METHOD']
DBX schema administration.
for( $step=0;$step< 1000;$step++) if(($schema['status'] ?? '') !=='finished') $media