-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyncDatabases.php
58 lines (42 loc) · 1.28 KB
/
syncDatabases.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* Created by PhpStorm.
* User: Kabbali
* Date: 11/12/2017
* Time: 3:53 PM
*/
include "Assets/CommandOptions.php";
include "Assets/ConfigReader.php";
include "Assets/SqlManager.php";
$account_value;
$mysqluser_value;
$mysqlpass_value;
$config_file;
$config_file_path = "/usr/local/ezproxy/config.txt";
if(!in_array($ACCOUNT, $argv)){
echo "ERROR: You must specify the account id --> use ".$ACCOUNT."\n";
exit(1);
}else{
$account_value = $argv[array_search($ACCOUNT, $argv)+1];
}
if(!in_array($MYSQLUSER, $argv)){
echo "ERROR: You must specify the mysql user on Intelproxy database --> use ".$MYSQLUSER."\n";
exit(1);
}else{
$mysqluser_value = $argv[array_search($MYSQLUSER, $argv)+1];
}
if(!in_array($MYSQLPASS, $argv)){
echo "ERROR: You must specify the mysql password on Intelproxy database --> use ".$MYSQLPASS."\n";
exit(1);
}else{
$mysqlpass_value = $argv[array_search($MYSQLPASS, $argv)+1];
}
if(file_exists($config_file_path)){
$config_file = file_get_contents('config.txt');
}else{
echo "ERROR: There ir not config.txt file --> check it in ".$config_file_path."\n";
exit(1);
}
$stanzas_array = applyRegexToConfigFile($config_file);
GenerateSQL($stanzas_array, $account_value, $mysqluser_value, $mysqlpass_value);
exit(0);