-
Notifications
You must be signed in to change notification settings - Fork 0
/
migration.php
executable file
·37 lines (31 loc) · 945 Bytes
/
migration.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
36
#!/usr/bin/env php
<?php
date_default_timezone_set('Europe/Moscow');
require_once __DIR__.'/init.php';
$cli_params = Helper::parseCommandLineArgs($argv);
if(empty($cli_params['options']['config']))
{
$cli_params['options']['config'] = __DIR__ . DIR_SEP . 'config.ini';
}
if(file_exists($cli_params['options']['config']))
{
$config = parse_ini_file($cli_params['options']['config']);
$config = array_replace($config, $cli_params['options']); //command line overrides everything
}
else
{
Output::error('mmp: could not find config file "' . $cli_params['options']['config'] . '"');
exit(1);
}
Helper::setConfig($config);
$controller = Helper::getController($cli_params['command']['name'], $cli_params['command']['args']);
if($controller !== false)
{
$controller->runStrategy();
}
else
{
Output::error('mmp: unknown command "' . $cli_params['command']['name'] . '"');
Helper::getController('help')->runStrategy();
exit(1);
}