dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
provision_docs_content.php
Go to the documentation of this file.
1<?php
2declare(strict_types=1);
3
4$base = dirname(__DIR__, 4);
5chdir($base);
6$_SERVER['REQUEST_URI'] = '/dbxapp-docs/';
7$_SERVER['HTTP_HOST'] = 'localhost';
8$_SERVER['HTTPS'] = 'on';
9$_SERVER['SCRIPT_NAME'] = '/dbxapp-docs/index.php';
10
11define('dbxSystem', 'dbxWebApp');
12define('dbxRunAsAdmin', 1);
13
14require $base . '/dbx/vendor/autoload.php';
15require_once $base . '/dbx/include/dbxKernel.php';
16require_once $base . '/dbx/modules/dbxDocs/include/dbxDocsContentProvision.class.php';
17
18$force = in_array('--force', $argv ?? array(), true);
19$db = dbx()->get_system_obj('dbxDB');
20$dd = dbx()->get_system_obj('dbxDD');
21
22$schema = array();
23foreach (array('content_de', 'content_en', 'content_es') as $name) {
24 $dd->sync_dd_to_db('dbx', $name, 'reset');
25 $state = array();
26 for ($step = 0; $step < 1000; $step++) {
27 $state = $dd->sync_dd_to_db('dbx', $name, 'apply');
28 if (in_array((string)($state['status'] ?? ''), array('finished', 'error', 'cancelled'), true)) {
29 break;
30 }
31 }
32 $schema[$name] = $state;
33}
34
35$failed = array_filter($schema, static fn(array $state): bool => ($state['status'] ?? '') !== 'finished');
36if ($failed !== array()) {
37 fwrite(STDERR, json_encode(array('ok' => false, 'schema' => $schema), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL);
38 exit(1);
39}
40
41$service = new \dbx\dbxDocs\dbxDocsContentProvision($db, $base, $force);
43echo json_encode(array('schema' => $schema, 'content' => $result), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
44exit(!empty($result['ok']) ? 0 : 1);
$_SERVER['REQUEST_METHOD']
exit
Definition index.php:146
DBX schema administration.