-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.php
36 lines (29 loc) · 927 Bytes
/
setup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
if(PHP_SAPI != 'cli') die('Please run this script in cli mode only');
// Autoloading für Klassen
function ivAutoloader( $class ) {
$file = 'lib/' . str_replace( '_', '/', $class ) . '.php';
if( file_exists( $file )) require( $file );
}
spl_autoload_register('ivAutoloader');
// Funktion
require 'inc/functions.php';
// Datenbankverbindung herstellen
require 'inc/database.config.php';
if( empty( $argv[1] )) {
$db->query("CREATE TABLE IF NOT EXISTS `update_migration` (
`id` varchar(250) NOT NULL,
`create_date` int(10) unsigned DEFAULT NULL,
`create_by` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
foreach( update_migration::listPending() as $migration ) {
if( !system('php setup.php '.$migration )) {
break;
}
}
} else {
$migrations = new update_migration();
$migrations->install( $argv[1] );
echo "\t {$argv[1]} installed.\n";
}