12 $pathList = array_merge( array(
"."),explode(PATH_SEPARATOR,get_include_path()));
13 set_include_path(implode(PATH_SEPARATOR,
$pathList));
14 require_once(
'AutoLoader.php');
19 define(
'ALTERNC_PANEL',realpath(__DIR__.
"/../bureau"));;
20 define(
'PHPUNIT_DATASETS_PATH',realpath(__DIR__.
"/tests/_datasets"));
27 if(is_readable(
'local.sh')){
29 }
else if(is_readable(
'local.sh_generic')){
30 $configFile = file_get_contents(
'local.sh_generic');
32 throw new Exception(
"You must provide a local.sh file", 1 );
36 'MYSQL_USER' =>
'MYSQL_LOGIN',
37 'MYSQL_PASS' =>
'MYSQL_PWD',
38 'NS1_HOSTNAME' =>
'NS1',
39 'NS2_HOSTNAME' =>
'NS2'
42 if (preg_match(
'/^([A-Za-z0-9_]*) *= *"?(.*?)"?$/', trim($line), $matches)) {
44 eval(
'$L_'.$matches[1].
' = $matches[2];'); # Ugly, but work with phpunit...
45 if (isset(
$compat[$matches[1]])) {
46 $GLOBALS[
'L_'.$compat[$matches[1]]] = $matches[2];
56 if( !defined(
"ALTERNC_MAIL") ) { define(
'ALTERNC_MAIL',
"$L_ALTERNC_MAIL"); };
57 if( !defined(
"ALTERNC_HTML") ) { define(
'ALTERNC_HTML',
"$L_ALTERNC_HTML"); };
58 if( !defined(
"ALTERNC_LOGS") ) { define(
'ALTERNC_LOGS',
"$L_ALTERNC_LOGS"); };
60 define(
'ALTERNC_LOGS_ARCHIVE',
"$L_ALTERNC_LOGS_ARCHIVE");
62 if( !defined(
"ALTERNC_LOCALES") ) { define(
'ALTERNC_LOCALES',
ALTERNC_PANEL.
"/locales"); };
63 if( !defined(
"ALTERNC_LOCK_JOBS") ) { define(
'ALTERNC_LOCK_JOBS',
'/run/alternc/jobs-lock'); };
64 if( !defined(
"ALTERNC_LOCK_PANEL") ) { define(
'ALTERNC_LOCK_PANEL',
'/var/lib/alternc/panel/nologin.lock'); };
65 if( !defined(
"ALTERNC_APACHE2_GEN_TMPL_DIR") ) { define(
'ALTERNC_APACHE2_GEN_TMPL_DIR',
'/etc/alternc/templates/apache2/'); };
66 if( !defined(
"ALTERNC_VHOST_DIR") ) { define(
'ALTERNC_VHOST_DIR',
"/var/lib/alternc/apache-vhost/"); };
67 if( !defined(
"ALTERNC_VHOST_FILE") ) { define(
'ALTERNC_VHOST_FILE',
ALTERNC_VHOST_DIR.
"vhosts_all.conf"); };
68 if( !defined(
"ALTERNC_VHOST_MANUALCONF") ) { define(
'ALTERNC_VHOST_MANUALCONF',
ALTERNC_VHOST_DIR.
"manual/"); };
69 define(
"THROW_EXCEPTIONS", TRUE);
75 if (! is_dir($crdir)) {
76 mkdir($crdir, 0777,
true);
87 if ( is_readable(
"my.cnf") ) {
88 $mysqlConfigFile = file(
"my.cnf");
89 }
else if(is_readable(
'my.cnf_generic')){
90 $mysqlConfigFile = file(
'my.cnf_generic');
92 throw new Exception(
"You must provide a my.cnf file", 1 );
95 foreach ($mysqlConfigFile as $line) {
96 if (preg_match(
'/^([A-Za-z0-9_]*) *= *"?(.*?)"?$/', trim($line), $matches)) {
97 switch ($matches[1]) {
109 if (preg_match(
'/^#alternc_var ([A-Za-z0-9_]*) *= *"?(.*?)"?$/', trim($line), $matches)) {
110 $$matches[1] = $matches[2];
130 echo
"*** In progress: importing mysql.sql\n";
132 "mysql -u $user --password='$password' -e 'DROP DATABASE IF EXISTS $database '",
133 "mysql -u $user --password='$password' -e 'CREATE DATABASE $database'",
134 "mysql -u $user --password='$password' $database < ".__DIR__.
"/../install/mysql.sql"
137 exec($exec_command,$output,$return_var);
139 throw new \Exception(
"[!] Mysql exec error : $exec_command \n Error : \n ".print_r($output,
true));
142 echo
"*** In progress: mysql.sql imported\n";
if(isset($L_ALTERNC_LOGS_ARCHIVE)) define('ALTERNC_LOGS_ARCHIVE' $L_ALTERNC_LOGS_ARCHIVE
static registerDirectory($dirName)
Store the filename (sans extension) & full path of all ".php" files found.
Class for MySQL management in the panel.
__construct($database, $user, $password)
foreach(array(ALTERNC_MAIL, ALTERNC_HTML, ALTERNC_LOGS) as $crdir) $database