dbxapp
4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
dbxapp.de
Portal
Start
Anwender
Entwickler
KI-Bereiche
Loading...
Searching...
No Matches
update_docs_portal_media_20260728.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types=1);
3
14
15
$base
= dirname(__DIR__, 4);
16
chdir(
$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
22
define(
'dbxSystem'
,
'dbxWebApp'
);
23
define(
'dbxRunAsAdmin'
, 1);
24
25
require
$base
.
'/dbx/vendor/autoload.php'
;
26
require_once
$base
.
'/dbx/include/dbxKernel.php'
;
27
require_once
$base
.
'/dbx/modules/dbxContent/include/dbxContent_bootstrap_sync.php'
;
28
29
use
dbx\dbxContent\dbxContentPageCache
;
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
62
$updatedMedia
= 0;
63
$updatedUsages
= 0;
64
65
foreach
(
$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
}
95
$updatedMedia
++;
96
97
$usages
=
$db
->select(
98
$usageDd
,
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
}
124
$updatedUsages
++;
125
}
126
}
127
128
dbxContentPageCache::invalidateAll();
129
130
echo 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;
$mediaDd
$mediaDd
Definition
activate_home_tvspot_v4_20260731.php:49
dbx\dbxContent\dbxContentPageCache
Definition
dbxContentPageCache.class.php:6
$_SERVER
$_SERVER['REQUEST_METHOD']
Definition
dbxApi_head_response_test.php:10
$base
$base
Definition
dbxApi_paths_test.php:11
$db
$db
Definition
dbxDB_dd_server_binding_test.php:52
dbx
DBX schema administration.
$file
$file
Definition
shop_repository_request_cache_test.php:3
$usages
$usages
Definition
update_docs_home_cinematic_20260728.php:70
$usageDd
$usageDd
Definition
update_docs_home_cinematic_20260728.php:30
$updatedMedia
$updatedMedia
Definition
update_docs_portal_media_20260728.php:62
$updatedUsages
$updatedUsages
Definition
update_docs_portal_media_20260728.php:63
$media
for( $step=0;$step< 1000;$step++) if(($schema['status'] ?? '') !=='finished') $media
Definition
update_homepage_20260728.php:45
dbx
modules
dbxDocs
tools
update_docs_portal_media_20260728.php
Generated by
1.17.0