2declare(strict_types=1);
24$_SERVER[
'SCRIPT_NAME'] =
'/dbxapp-docs/index.php';
26define(
'dbxSystem',
'dbxWebApp');
27define(
'dbxRunAsAdmin', 1);
29require
$base .
'/dbx/vendor/autoload.php';
30require_once
$base .
'/dbx/include/dbxKernel.php';
31require_once
$base .
'/dbx/modules/dbxSetup/include/dbxInstallationService.class.php';
39foreach (array(
'dbxUser',
'dbxUser_groups') as $name) {
40 $dd->sync_dd_to_db(
'dbx', $name,
'reset');
42 for ($step = 0; $step < 1000; $step++) {
43 $state =
$dd->sync_dd_to_db(
'dbx', $name,
'apply');
44 if (in_array((
string)(
$state[
'status'] ??
''), array(
'finished',
'error',
'cancelled'),
true)) {
53 static fn(array
$state):
bool => (
$state[
'status'] ??
'') !==
'finished'
56 throw new RuntimeException(
'Die Benutzer-DDs konnten nicht vollständig provisioniert werden.');
63 array(
'uname' =>
'admin'),
64 array(
'id',
'uname',
'roles',
'status',
'is_confirm'),
68if ((
int)(
$admin[
'id'] ?? 0) <= 0) {
69 $password = (string)getenv(
'DBX_DOCS_ADMIN_PASSWORD');
70 $email = (string)getenv(
'DBX_DOCS_ADMIN_EMAIL');
72 throw new RuntimeException(
73 'Admin fehlt. DBX_DOCS_ADMIN_PASSWORD und DBX_DOCS_ADMIN_EMAIL müssen lokal gesetzt sein.'
79 array(
'uname' =>
'admin'),
80 array(
'id',
'uname',
'roles',
'status',
'is_confirm'),
86 throw new RuntimeException(
'Die lokale Login-Konfiguration konnte nicht geschrieben werden.');
91 && (int)(
$admin[
'status'] ?? 0) === 1
92 && str_contains((
string)(
$admin[
'roles'] ??
''),
'admin')
93 && (string)
dbx()->get_config(
'dbxLogin',
'register') ===
'0';
95echo json_encode(array(
100 'present' => (
int)(
$admin[
'id'] ?? 0) > 0,
101 'active' => (
int)(
$admin[
'status'] ?? 0) === 1,
102 'confirmed' => (
int)(
$admin[
'is_confirm'] ?? 0) === 1,
104 'registration' =>
'disabled',
105 'user_storage' => (
string)(
$binding[
'resolved_server'] ??
''),
106), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
Reproduzierbare Erstinstallation aus DDs und idempotenten Seeds.
patch_local_config(string $modul, array $patch)
Fuehrt einen lokalen Konfigurationsausschnitt rekursiv zusammen.
$_SERVER['REQUEST_METHOD']
DBX schema administration.