dbXapp 2.0
RAD, CMS, Module und Runtime-IDE fuer dbXapp
Loading...
Searching...
No Matches
run_cms_anleitung_provision.php
Go to the documentation of this file.
1<?php
2$base = dirname(__DIR__, 4);
3chdir($base);
4$_SERVER['REQUEST_URI'] = '/dbxapp/';
5$_SERVER['HTTP_HOST'] = 'localhost';
6$_SERVER['HTTPS'] = 'on';
7$_SERVER['SCRIPT_NAME'] = '/dbxapp/index.php';
8
9define('dbxSystem', 'dbxWebApp');
10define('dbxRunAsAdmin', 1);
11
12function dbx_get_base_dir($cut_Data = 0) {
13 global $base;
14 $path = str_replace('\\', '/', $base) . '/';
15 if ($cut_Data) {
16 $path = str_ends_with($path, '/Data/') ? substr($path, 0, -5) : $path;
17 }
18 return rtrim($path, '/') . '/';
19}
20
21function dbx_get_file_dir() {
22 return dbx_get_base_dir() . 'files/';
23}
24
26 $path_file = str_replace(array('\\', '//', '\\\\'), '/', $path_file);
27 $path_file = preg_replace('#(?<!:)//+#', '/', $path_file);
28 if (DIRECTORY_SEPARATOR === '\\') {
29 $path_file = str_replace('/', '\\', $path_file);
30 }
31 return $path_file;
32}
33
34function dbx_path_is_absolute(string $path): bool {
35 $path = str_replace('\\', '/', trim($path));
36 if ($path === '') {
37 return false;
38 }
39 if ($path[0] === '/') {
40 return true;
41 }
42 return (bool) preg_match('#^[A-Za-z]:/#', $path);
43}
44
45function dbx_config_path_store(string $path, bool $dirTrailingSlash = false): string {
46 $path = str_replace('\\', '/', trim($path));
47 if ($path === '') {
48 return '';
49 }
50 $base = str_replace('\\', '/', dbx_get_base_dir());
51 if (dbx_path_is_absolute($path) || str_starts_with($path, $base)) {
52 $abs = str_replace('\\', '/', dbx_os_path_file($path));
53 $baseNorm = str_replace('\\', '/', dbx_os_path_file($base));
54 if (str_starts_with($abs, $baseNorm)) {
55 $path = substr($abs, strlen($baseNorm));
56 }
57 }
58 $path = ltrim($path, '/');
59 if ($dirTrailingSlash && $path !== '') {
60 $path = rtrim($path, '/') . '/';
61 }
62 return $path;
63}
64
65function dbx_config_path_resolve(string $path): string {
66 $path = str_replace('\\', '/', trim($path));
67 if ($path === '') {
68 return '';
69 }
70 if (!dbx_path_is_absolute($path)) {
71 $path = dbx_get_base_dir() . ltrim($path, '/');
72 }
73 return dbx_os_path_file($path);
74}
75
76require $base . '/dbx/vendor/autoload.php';
77require_once $base . '/dbx/include/dbxKernel.php';
78require_once $base . '/dbx/modules/dbxKi/include/dbxKiCmsHelpProvision.class.php';
79
81echo json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . PHP_EOL;
82
83if (empty($result['errors'])) {
84 $config = dbx()->get_config('dbxKi');
85 if (!is_array($config)) {
86 $config = array();
87 }
89 dbx()->set_config('dbxKi', $config);
90 exit(0);
91}
92
93exit(1);
$config['version']
Definition config.php:2
exit
Definition index.php:532
$path_file
Definition index.php:270
DBX schema administration.
dbx_os_path_file($path_file)
dbx_config_path_store(string $path, bool $dirTrailingSlash=false)
dbx_config_path_resolve(string $path)
dbx_path_is_absolute(string $path)
dbx_get_base_dir($cut_Data=0)
if(! $db->connect_db_server($server)) $result
$_SERVER['REQUEST_URI']