]> git.bts.cx Git - cx.git/blob - cx/lib/setup.php
post metadata support (not very good yet)
[cx.git] / cx / lib / setup.php
1 <?php
2
3 $cx_setup_functions = [];
4
5 function cx_setup_register(int $version, $function) {
6 global $cx_setup_functions;
7
8 if (isset($version, $cx_setup_functions) == false) {
9 $cx_setup_functions[$version] = [];
10 }
11
12 $cx_setup_functions[$version][] = $function;
13 }
14
15 function cx_setup_required() {
16 return file_exists(CX_DATABASE_FILE) == false;
17 }
18
19 function cx_setup_run() {
20 global $cx_setup_functions;
21 foreach ($cx_setup_functions as $version => $functions) {
22 foreach ($functions as $function) {
23 $function();
24 }
25 }
26 }