mirror of
https://github.com/cytopia/devilbox.git
synced 2025-02-20 09:26:36 +00:00
Merge pull request #35 from cytopia/DVL-001
DVL-001 Prepare HHVM support
This commit is contained in:
commit
bc62d4e46c
@ -42,23 +42,51 @@ $MYSQL_HOST_ADDR = gethostbyname($MYSQL_HOST_NAME);
|
|||||||
$POSTGRES_HOST_NAME = 'postgres';
|
$POSTGRES_HOST_NAME = 'postgres';
|
||||||
$POSTGRES_HOST_ADDR = gethostbyname($POSTGRES_HOST_NAME);
|
$POSTGRES_HOST_ADDR = gethostbyname($POSTGRES_HOST_NAME);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lazy Loader
|
||||||
|
//
|
||||||
|
function loadClass($class) {
|
||||||
|
|
||||||
//
|
global $LIB_DIR;
|
||||||
// Load files
|
global $MYSQL_HOST_ADDR;
|
||||||
//
|
global $POSTGRES_HOST_ADDR;
|
||||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Logger.php';
|
|
||||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Docker.php';
|
static $_LOADED_LIBS;
|
||||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mysql.php';
|
|
||||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Postgres.php';
|
|
||||||
|
|
||||||
|
|
||||||
//
|
if (isset($_LOADED_LIBS[$class])) {
|
||||||
// Instantiate Basics
|
return $_LOADED_LIBS[$class];
|
||||||
//
|
} else {
|
||||||
$Logger = \devilbox\Logger::getInstance();
|
switch($class) {
|
||||||
$Docker = \devilbox\Docker::getInstance();
|
|
||||||
$MySQL = \devilbox\Mysql::getInstance('root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR);
|
case 'Logger':
|
||||||
$Postgres = \devilbox\Postgres::getInstance($Docker->getEnv('POSTGRES_USER'), $Docker->getEnv('POSTGRES_PASSWORD'), $POSTGRES_HOST_ADDR);
|
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||||
|
$_LOADED_LIBS[$class] = \devilbox\Logger::getInstance();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Docker':
|
||||||
|
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||||
|
$_LOADED_LIBS[$class] = \devilbox\Docker::getInstance();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Mysql':
|
||||||
|
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||||
|
$Docker = loadClass('Docker');
|
||||||
|
$_LOADED_LIBS[$class] = \devilbox\Mysql::getInstance('root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Postgres':
|
||||||
|
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||||
|
$Docker = loadClass('Docker');
|
||||||
|
$_LOADED_LIBS[$class] = \devilbox\Postgres::getInstance($Docker->getEnv('POSTGRES_USER'), $Docker->getEnv('POSTGRES_PASSWORD'), $POSTGRES_HOST_ADDR);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
exit('Class does not exist: '.$class);
|
||||||
|
}
|
||||||
|
return $_LOADED_LIBS[$class];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,16 +4,16 @@ require '../config.php';
|
|||||||
if (isset($_GET['database'])) {
|
if (isset($_GET['database'])) {
|
||||||
if (isset($_GET['type']) && $_GET['type'] == 'mysql') {
|
if (isset($_GET['type']) && $_GET['type'] == 'mysql') {
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'size' => (string)$MySQL->getDBSize($_GET['database']),
|
'size' => (string)loadClass('Mysql')->getDBSize($_GET['database']),
|
||||||
'table' => (string)$MySQL->getTableCount($_GET['database'])
|
'table' => (string)loadClass('Mysql')->getTableCount($_GET['database'])
|
||||||
));
|
));
|
||||||
} else if (isset($_GET['type']) && $_GET['type'] == 'postgres') {
|
} else if (isset($_GET['type']) && $_GET['type'] == 'postgres') {
|
||||||
$schema = isset($_GET['schema']) ? $_GET['schema'] : '';
|
$schema = isset($_GET['schema']) ? $_GET['schema'] : '';
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'size' => (string)$Postgres->getSchemaSize($_GET['database'], $schema),
|
'size' => (string)loadClass('Postgres')->getSchemaSize($_GET['database'], $schema),
|
||||||
'table' => (string)$Postgres->getTableCount($_GET['database'], $schema)
|
'table' => (string)loadClass('Postgres')->getTableCount($_GET['database'], $schema)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else if (isset($_GET['vhost'])) {
|
} else if (isset($_GET['vhost'])) {
|
||||||
echo $Docker->PHP_checkVirtualHost($_GET['vhost']);
|
echo loadClass('Docker')->PHP_checkVirtualHost($_GET['vhost']);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php require '../config.php'; ?>
|
<?php require '../config.php'; ?>
|
||||||
|
<?php $MySQL = loadClass('Mysql'); ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php require '../config.php'; ?>
|
<?php require '../config.php'; ?>
|
||||||
|
<?php $Postgres = loadClass('Postgres'); ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
<?php $errors = $Logger->getAll(); ?>
|
<?php $errors = loadClass('Logger')->getAll(); ?>
|
||||||
<?php if ($errors === false): ?>
|
<?php if ($errors === false): ?>
|
||||||
<p>Writing to logfile is not possible. Errors will be sent as mail instead. Check the mail section.</p>
|
<p>Writing to logfile is not possible. Errors will be sent as mail instead. Check the mail section.</p>
|
||||||
<?php elseif (count($errors) === 0): ?>
|
<?php elseif (count($errors) === 0): ?>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php require '../config.php'; ?>
|
<?php require '../config.php'; ?>
|
||||||
|
<?php $Docker = loadClass('Docker'); ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -162,28 +163,28 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<?php $error; $valid = $Docker->PHP_has_valid_mysql_socket($error); ?>
|
<?php $err=null; $valid = $Docker->PHP_has_valid_mysql_socket($err); ?>
|
||||||
<th>MySQL socket</th>
|
<th>MySQL socket</th>
|
||||||
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
||||||
<?php echo !$valid ? 'Error<br/><sub>'.$error.'</sub>' : $Docker->getEnv('MYSQL_SOCKET_PATH'); ?>
|
<?php echo !$valid ? 'Error<br/><sub>'.$err.'</sub>' : $Docker->getEnv('MYSQL_SOCKET_PATH'); ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<?php $err; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), 'localhost'); ?>
|
<?php $err=null; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), 'localhost'); ?>
|
||||||
<th>MySQL test</th>
|
<th>MySQL test</th>
|
||||||
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
||||||
<?php echo $valid ? '<span class="bg-success">OK</span> localhost:3306' : 'Failed: localhost:3306<br/><sub>'.$err.'</sub>'; ?>
|
<?php echo $valid ? '<span class="bg-success">OK</span> localhost:3306' : 'Failed: localhost:3306<br/><sub>'.$err.'</sub>'; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<?php $err; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), '127.0.0.1'); ?>
|
<?php $err=null; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), '127.0.0.1'); ?>
|
||||||
<th>MySQL test</th>
|
<th>MySQL test</th>
|
||||||
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
||||||
<?php echo $valid ? '<span class="bg-success">OK</span> 127.0.0.1:3306' : 'Failed: 127.0.0.1:3306<br/><sub>'.$err.'</sub>'; ?>
|
<?php echo $valid ? '<span class="bg-success">OK</span> 127.0.0.1:3306' : 'Failed: 127.0.0.1:3306<br/><sub>'.$err.'</sub>'; ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<?php $err; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR); ?>
|
<?php $err=null; $valid = \devilbox\Mysql::testConnection($err, 'root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR); ?>
|
||||||
<th>MySQL test</th>
|
<th>MySQL test</th>
|
||||||
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
<td class="<?php echo !$valid ? 'bg-danger' : '';?>">
|
||||||
<?php echo $valid ? '<span class="bg-success">OK</span> '.$MYSQL_HOST_ADDR.':3306' : 'Failed: '.$MYSQL_HOST_ADDR.':3306<br/><sub>'.$err.'</sub>'; ?>
|
<?php echo $valid ? '<span class="bg-success">OK</span> '.$MYSQL_HOST_ADDR.':3306' : 'Failed: '.$MYSQL_HOST_ADDR.':3306<br/><sub>'.$err.'</sub>'; ?>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require '../config.php';
|
||||||
|
|
||||||
//
|
//
|
||||||
// $_POST submit for sending a test email
|
// $_POST submit for sending a test email
|
||||||
@ -7,7 +8,9 @@ if (isset($_GET['email']) && isset($_GET['subject']) && isset($_GET['message']))
|
|||||||
$mail = $_GET['email'];
|
$mail = $_GET['email'];
|
||||||
$subj = $_GET['subject'];
|
$subj = $_GET['subject'];
|
||||||
$mess = $_GET['message'];
|
$mess = $_GET['message'];
|
||||||
mail($mail, $subj, $mess);
|
if (! mail($mail, $subj, $mess)) {
|
||||||
|
loadClass('Logger')->error('Could not send mail to: '.$mail.' | subject: '.$subject);
|
||||||
|
}
|
||||||
header('Location: /mail.php');
|
header('Location: /mail.php');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
@ -15,7 +18,6 @@ if (isset($_GET['email']) && isset($_GET['subject']) && isset($_GET['message']))
|
|||||||
//
|
//
|
||||||
// Includes
|
// Includes
|
||||||
//
|
//
|
||||||
require '../config.php';
|
|
||||||
require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'Mbox.php';
|
require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'Mbox.php';
|
||||||
require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDecode.php';
|
require $VEN_DIR . DIRECTORY_SEPARATOR . 'Mail' . DIRECTORY_SEPARATOR .'mimeDecode.php';
|
||||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php';
|
require $LIB_DIR . DIRECTORY_SEPARATOR . 'Mail.php';
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php require '../config.php'; ?>
|
<?php require '../config.php'; ?>
|
||||||
|
<?php $Docker = loadClass('Docker'); ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
<style>
|
||||||
|
/* prevent hhvm phpinfo() from shrinking the width */
|
||||||
|
body {width: 100% !important;}
|
||||||
|
</style>
|
||||||
<?php phpinfo(); ?>
|
<?php phpinfo(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php require '../config.php'; ?>
|
<?php require '../config.php'; ?>
|
||||||
|
<?php $Docker = loadClass('Docker'); ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<?php require '../config.php'; ?>
|
<?php require '../config.php'; ?>
|
||||||
|
<?php $Docker = loadClass('Docker'); ?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
|
@ -107,8 +107,7 @@ class Docker
|
|||||||
public function getEnv($variable)
|
public function getEnv($variable)
|
||||||
{
|
{
|
||||||
if (!isset($this->_env[$variable])) {
|
if (!isset($this->_env[$variable])) {
|
||||||
$Logger = \devilbox\Logger::getInstance();
|
loadClass('Logger')->error('Docker environment variable not found: '.$variable);
|
||||||
$Logger->error('Docker environment variable not found: '.$variable);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return $this->_env[$variable];
|
return $this->_env[$variable];
|
||||||
@ -158,8 +157,13 @@ class Docker
|
|||||||
*/
|
*/
|
||||||
public function PHP_version()
|
public function PHP_version()
|
||||||
{
|
{
|
||||||
|
if (defined('HHVM_VERSION')) {
|
||||||
|
return 'HHVM ' .HHVM_VERSION . '<br/>(PHP '.str_replace('-hhvm', '', phpversion()).')';
|
||||||
|
//return 'PHP ' . phpversion() . '('. HHVM_VERSION . ')';
|
||||||
|
} else {
|
||||||
return 'PHP ' . phpversion() .' (' . php_sapi_name().')';
|
return 'PHP ' . phpversion() .' (' . php_sapi_name().')';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read out PHP Server configuration by variable
|
* Read out PHP Server configuration by variable
|
||||||
@ -338,7 +342,7 @@ class Docker
|
|||||||
};
|
};
|
||||||
|
|
||||||
$sql = 'SHOW VARIABLES;';
|
$sql = 'SHOW VARIABLES;';
|
||||||
$configs = \devilbox\Mysql::getInstance()->select($sql, $callback);
|
$configs = loadClass('Mysql')->select($sql, $callback);
|
||||||
|
|
||||||
return $configs ? $configs : array();
|
return $configs ? $configs : array();
|
||||||
|
|
||||||
@ -351,7 +355,7 @@ class Docker
|
|||||||
};
|
};
|
||||||
|
|
||||||
$sql = 'SHOW VARIABLES WHERE Variable_Name = "'.$key.'";';
|
$sql = 'SHOW VARIABLES WHERE Variable_Name = "'.$key.'";';
|
||||||
$val = \devilbox\Mysql::getInstance()->select($sql, $callback);
|
$val = loadClass('Mysql')->select($sql, $callback);
|
||||||
|
|
||||||
if (is_array($val) && $val) {
|
if (is_array($val) && $val) {
|
||||||
return array_values($val)[0];
|
return array_values($val)[0];
|
||||||
@ -379,7 +383,7 @@ class Docker
|
|||||||
$data = $row['version'];
|
$data = $row['version'];
|
||||||
};
|
};
|
||||||
|
|
||||||
$version = \devilbox\Postgres::getInstance()->select('SELECT version();', $callback);
|
$version = loadClass('Postgres')->select('SELECT version();', $callback);
|
||||||
|
|
||||||
// Extract shorthand
|
// Extract shorthand
|
||||||
preg_match('/\w+[[:space:]]*[.0-9]+/i', $version, $matches);
|
preg_match('/\w+[[:space:]]*[.0-9]+/i', $version, $matches);
|
||||||
@ -412,7 +416,7 @@ class Docker
|
|||||||
};
|
};
|
||||||
|
|
||||||
$sql = 'SELECT name, setting FROM pg_settings;';
|
$sql = 'SELECT name, setting FROM pg_settings;';
|
||||||
$configs = \devilbox\Postgres::getInstance()->select($sql, $callback);
|
$configs = loadClass('Postgres')->select($sql, $callback);
|
||||||
|
|
||||||
return $configs ? $configs : array();
|
return $configs ? $configs : array();
|
||||||
|
|
||||||
@ -423,7 +427,7 @@ class Docker
|
|||||||
};
|
};
|
||||||
|
|
||||||
$sql = "SELECT name, setting FROM pg_settings WHERE name = '".$key."';";
|
$sql = "SELECT name, setting FROM pg_settings WHERE name = '".$key."';";
|
||||||
$val = \devilbox\Postgres::getInstance()->select($sql, $callback);
|
$val = loadClass('Postgres')->select($sql, $callback);
|
||||||
|
|
||||||
return is_array($val) ? '' : $val;
|
return is_array($val) ? '' : $val;
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class Mysql
|
|||||||
}
|
}
|
||||||
// If current MySQL instance was unable to connect
|
// If current MySQL instance was unable to connect
|
||||||
if ((static::$instance->getConnectError())) {
|
if ((static::$instance->getConnectError())) {
|
||||||
\devilbox\Logger::getInstance()->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
|
loadClass('Logger')->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
|
||||||
//return null;
|
//return null;
|
||||||
}
|
}
|
||||||
return static::$instance;
|
return static::$instance;
|
||||||
@ -130,7 +130,7 @@ class Mysql
|
|||||||
if (mysqli_connect_errno()) {
|
if (mysqli_connect_errno()) {
|
||||||
$this->_connect_error = 'Failed to connect: ' .mysqli_connect_error();
|
$this->_connect_error = 'Failed to connect: ' .mysqli_connect_error();
|
||||||
$this->_connect_errno = mysqli_connect_errno();
|
$this->_connect_errno = mysqli_connect_errno();
|
||||||
\devilbox\Logger::getInstance()->error($this->_connect_error);
|
loadClass('Logger')->error($this->_connect_error);
|
||||||
} else {
|
} else {
|
||||||
$this->_link = $link;
|
$this->_link = $link;
|
||||||
}
|
}
|
||||||
@ -162,14 +162,14 @@ class Mysql
|
|||||||
public function select($query, $callback = null)
|
public function select($query, $callback = null)
|
||||||
{
|
{
|
||||||
if (!$this->_link) {
|
if (!$this->_link) {
|
||||||
\devilbox\Logger::getInstance()->error('MySQL error, link is no resource in select()');
|
loadClass('Logger')->error('MySQL error, link is no resource in select()');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!($result = mysqli_query($this->_link, $query))) {
|
if (!($result = mysqli_query($this->_link, $query))) {
|
||||||
$this->_error = mysqli_error($this->_link);
|
$this->_error = mysqli_error($this->_link);
|
||||||
$this->_errno = mysqli_errno($this->_link);
|
$this->_errno = mysqli_errno($this->_link);
|
||||||
\devilbox\Logger::getInstance()->error($this->_error);
|
loadClass('Logger')->error($this->_error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ class Postgres
|
|||||||
}
|
}
|
||||||
// If current Postgres instance was unable to connect
|
// If current Postgres instance was unable to connect
|
||||||
if ((static::$instance->getConnectError())) {
|
if ((static::$instance->getConnectError())) {
|
||||||
\devilbox\Logger::getInstance()->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
|
loadClass('Logger')->error('Instance has errors:' . "\r\n" . var_export(static::$instance, true) . "\r\n");
|
||||||
//return null;
|
//return null;
|
||||||
}
|
}
|
||||||
return static::$instance;
|
return static::$instance;
|
||||||
@ -135,7 +135,7 @@ class Postgres
|
|||||||
if (!$link || pg_connection_status($link) !== PGSQL_CONNECTION_OK) {
|
if (!$link || pg_connection_status($link) !== PGSQL_CONNECTION_OK) {
|
||||||
$this->_connect_error = 'Failed to connect to '.$user.'@'.$host;
|
$this->_connect_error = 'Failed to connect to '.$user.'@'.$host;
|
||||||
$this->_connect_errno = 1;
|
$this->_connect_errno = 1;
|
||||||
\devilbox\Logger::getInstance()->error($this->_connect_error);
|
loadClass('Logger')->error($this->_connect_error);
|
||||||
} else {
|
} else {
|
||||||
$this->_link = $link;
|
$this->_link = $link;
|
||||||
}
|
}
|
||||||
@ -171,14 +171,14 @@ class Postgres
|
|||||||
public function select($query, $callback = null)
|
public function select($query, $callback = null)
|
||||||
{
|
{
|
||||||
if (!$this->_link) {
|
if (!$this->_link) {
|
||||||
\devilbox\Logger::getInstance()->error('Postgres error, link is no resource in select()');
|
loadClass('Logger')->error('Postgres error, link is no resource in select()');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!($result = pg_query($this->_link, $query))) {
|
if (!($result = pg_query($this->_link, $query))) {
|
||||||
$this->_error = 'PostgreSQL - error on result: '.pg_result_error($result)."\n" . 'query:'."\n" . $query;
|
$this->_error = 'PostgreSQL - error on result: '.pg_result_error($result)."\n" . 'query:'."\n" . $query;
|
||||||
$this->_errno = 1;
|
$this->_errno = 1;
|
||||||
\devilbox\Logger::getInstance()->error($this->_error);
|
loadClass('Logger')->error($this->_error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ class Postgres
|
|||||||
|
|
||||||
// Get schemas for each database
|
// Get schemas for each database
|
||||||
foreach ($databases as $name => &$database) {
|
foreach ($databases as $name => &$database) {
|
||||||
$PSQL = new Postgres('postgres', \devilbox\Docker::getInstance()->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $name);
|
$PSQL = new Postgres('postgres', loadClass('Docker')->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $name);
|
||||||
|
|
||||||
$sql = "SELECT n.nspname AS schemas FROM pg_catalog.pg_namespace AS n WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema';";
|
$sql = "SELECT n.nspname AS schemas FROM pg_catalog.pg_namespace AS n WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema';";
|
||||||
$callback = function ($row, &$data) {
|
$callback = function ($row, &$data) {
|
||||||
@ -247,7 +247,7 @@ class Postgres
|
|||||||
*/
|
*/
|
||||||
public function getSchemaSize($database, $schema)
|
public function getSchemaSize($database, $schema)
|
||||||
{
|
{
|
||||||
$PSQL = new Postgres('postgres', \devilbox\Docker::getInstance()->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
|
$PSQL = new Postgres('postgres', loadClass('Docker')->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
|
||||||
$callback = function ($row, &$data) {
|
$callback = function ($row, &$data) {
|
||||||
$data = $row['size'];
|
$data = $row['size'];
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ class Postgres
|
|||||||
*/
|
*/
|
||||||
public function getTableCount($database, $schema)
|
public function getTableCount($database, $schema)
|
||||||
{
|
{
|
||||||
$PSQL = new Postgres('postgres', \devilbox\Docker::getInstance()->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
|
$PSQL = new Postgres('postgres', loadClass('Docker')->getEnv('POSTGRES_PASSWORD'), $GLOBALS['POSTGRES_HOST_ADDR'], $database);
|
||||||
$callback = function ($row, &$data) {
|
$callback = function ($row, &$data) {
|
||||||
$data = $row['count'];
|
$data = $row['count'];
|
||||||
};
|
};
|
||||||
|
1112
.devilbox/www/include/vendor/Mail/PEAR.php
vendored
Normal file
1112
.devilbox/www/include/vendor/Mail/PEAR.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
.gitignore
vendored
1
.gitignore
vendored
@ -31,6 +31,7 @@ cfg/php-fpm-5.5/*.ini
|
|||||||
cfg/php-fpm-5.6/*.ini
|
cfg/php-fpm-5.6/*.ini
|
||||||
cfg/php-fpm-7.0/*.ini
|
cfg/php-fpm-7.0/*.ini
|
||||||
cfg/php-fpm-7.1/*.ini
|
cfg/php-fpm-7.1/*.ini
|
||||||
|
cfg/hhvm-latest/*.ini
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
11
.travis.yml
11
.travis.yml
@ -40,6 +40,7 @@ env:
|
|||||||
- SERVER=php VERSION=php-fpm-5.6
|
- SERVER=php VERSION=php-fpm-5.6
|
||||||
- SERVER=php VERSION=php-fpm-7.0
|
- SERVER=php VERSION=php-fpm-7.0
|
||||||
- SERVER=php VERSION=php-fpm-7.1
|
- SERVER=php VERSION=php-fpm-7.1
|
||||||
|
- SERVER=php VERSION=hhvm-latest
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@ -54,6 +55,16 @@ before_install:
|
|||||||
- uname -a
|
- uname -a
|
||||||
|
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
|
||||||
|
# Disable services enabled by default
|
||||||
|
# http://docs.travis-ci.com/user/database-setup/#MySQL
|
||||||
|
- sudo /etc/init.d/mysql stop || true
|
||||||
|
- sudo /etc/init.d/postgresql stopA || true
|
||||||
|
- sudo service mysql stop || true
|
||||||
|
- sudo service postgresql stop || true
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
### Test
|
### Test
|
||||||
###
|
###
|
||||||
|
12
README.md
12
README.md
@ -79,12 +79,12 @@ No need to install and configure different versions locally. Simply choose your
|
|||||||
|
|
||||||
| Webserver | MySQL | PostgreSQL | PHP |
|
| Webserver | MySQL | PostgreSQL | PHP |
|
||||||
|-----------|-------|------------|-----|
|
|-----------|-------|------------|-----|
|
||||||
| [](https://travis-ci.org/cytopia/docker-apache-2.2) [Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | [](https://travis-ci.org/cytopia/docker-mysql-5.5) [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.2](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-5.4) [PHP 5.4](https://github.com/cytopia/docker-php-fpm-5.4) |
|
| [](https://travis-ci.org/cytopia/docker-apache-2.2) [Apache 2.2](https://github.com/cytopia/docker-apache-2.2) | [](https://travis-ci.org/cytopia/docker-mysql-5.5) [MySQL 5.5](https://github.com/cytopia/docker-mysql-5.5) | [](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.2](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-5.4) [PHP 5.4](https://github.com/cytopia/docker-php-fpm-5.4) |
|
||||||
| [](https://travis-ci.org/cytopia/docker-apache-2.4) [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | [](https://travis-ci.org/cytopia/docker-mysql-5.6) [MySQL 5.6](https://github.com/cytopia/docker-mysql-5.6) | [](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.3](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-5.5) [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) |
|
| [](https://travis-ci.org/cytopia/docker-apache-2.4) [Apache 2.4](https://github.com/cytopia/docker-apache-2.4) | [](https://travis-ci.org/cytopia/docker-mysql-5.6) [MySQL 5.6](https://github.com/cytopia/docker-mysql-5.6) | [](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.3](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-5.5) [PHP 5.5](https://github.com/cytopia/docker-php-fpm-5.5) |
|
||||||
| [](https://travis-ci.org/cytopia/docker-nginx-stable) [Nginx stable](https://github.com/cytopia/docker-nginx-stable) | [](https://travis-ci.org/cytopia/docker-mysql-5.7) [MySQL 5.7](https://github.com/cytopia/docker-mysql-5.7) | [](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.4](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-5.6) [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) |
|
| [](https://travis-ci.org/cytopia/docker-nginx-stable) [Nginx stable](https://github.com/cytopia/docker-nginx-stable) | [](https://travis-ci.org/cytopia/docker-mysql-5.7) [MySQL 5.7](https://github.com/cytopia/docker-mysql-5.7) | [](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.4](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-5.6) [PHP 5.6](https://github.com/cytopia/docker-php-fpm-5.6) |
|
||||||
| [](https://travis-ci.org/cytopia/docker-nginx-mainline) [Nginx mainline](https://github.com/cytopia/docker-nginx-mainline) | [](https://travis-ci.org/cytopia/docker-mariadb-5.5) [MariaDB 5.5](https://github.com/cytopia/docker-mariadb-5.5) | [](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.5](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-7.0) [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) |
|
| [](https://travis-ci.org/cytopia/docker-nginx-mainline) [Nginx mainline](https://github.com/cytopia/docker-nginx-mainline) | [](https://travis-ci.org/cytopia/docker-mariadb-5.5) [MariaDB 5.5](https://github.com/cytopia/docker-mariadb-5.5) | [](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.5](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-7.0) [PHP 7.0](https://github.com/cytopia/docker-php-fpm-7.0) |
|
||||||
| | [](https://travis-ci.org/cytopia/docker-mariadb-10.0) [MariaDB 10.0](https://github.com/cytopia/docker-mariadb-10.0) | [](https://travis-ci.org/docker-library/postgres/branches) [PostgreSQL 9.6](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-7.1) [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) |
|
| | [](https://travis-ci.org/cytopia/docker-mariadb-10.0) [MariaDB 10.0](https://github.com/cytopia/docker-mariadb-10.0) | [](https://travis-ci.org/docker-library/postgres/branches) [PgSQL 9.6](https://hub.docker.com/_/postgres/) | [](https://travis-ci.org/cytopia/docker-php-fpm-7.1) [PHP 7.1](https://github.com/cytopia/docker-php-fpm-7.1) |
|
||||||
| | [](https://travis-ci.org/cytopia/docker-mariadb-10.1) [MariaDB 10.1](https://github.com/cytopia/docker-mariadb-10.1) | |
|
| | [](https://travis-ci.org/cytopia/docker-mariadb-10.1) [MariaDB 10.1](https://github.com/cytopia/docker-mariadb-10.1) | | [](https://travis-ci.org/cytopia/docker-hhvm-latest) [HHVM latest](https://github.com/cytopia/docker-hhvm-latest)
|
||||||
| | [](https://travis-ci.org/cytopia/docker-mariadb-10.2) [MariaDB 10.2](https://github.com/cytopia/docker-mariadb-10.2) | |
|
| | [](https://travis-ci.org/cytopia/docker-mariadb-10.2) [MariaDB 10.2](https://github.com/cytopia/docker-mariadb-10.2) | |
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ services:
|
|||||||
# HTTP
|
# HTTP
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
httpd:
|
httpd:
|
||||||
image: cytopia/${HTTPD_SERVER}:0.8
|
image: cytopia/${HTTPD_SERVER}:latest
|
||||||
|
|
||||||
# Manually build via `docker-compose build`
|
# Manually build via `docker-compose build`
|
||||||
#build:
|
#build:
|
||||||
@ -97,7 +97,6 @@ services:
|
|||||||
- "php:php-fpm"
|
- "php:php-fpm"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# PHP-FPM
|
# PHP-FPM
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
@ -203,12 +202,11 @@ services:
|
|||||||
- "postgres:postgresql"
|
- "postgres:postgresql"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# DATABASE
|
# DATABASE
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
mysql:
|
mysql:
|
||||||
image: cytopia/${MYSQL_SERVER}:0.8
|
image: cytopia/${MYSQL_SERVER}:latest
|
||||||
|
|
||||||
# Manually build via `docker-compose build`
|
# Manually build via `docker-compose build`
|
||||||
#build:
|
#build:
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
###
|
###
|
||||||
### 1: Yes
|
### 1: Yes
|
||||||
### 0: No
|
### 0: No
|
||||||
DEBUG_COMPOSE_ENTRYPOINT=0
|
DEBUG_COMPOSE_ENTRYPOINT=1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,8 +96,7 @@ POSTGRES_SERVER=9.6
|
|||||||
#PHP_SERVER=php-fpm-5.6
|
#PHP_SERVER=php-fpm-5.6
|
||||||
PHP_SERVER=php-fpm-7.0
|
PHP_SERVER=php-fpm-7.0
|
||||||
#PHP_SERVER=php-fpm-7.1
|
#PHP_SERVER=php-fpm-7.1
|
||||||
#PHP_SERVER=hhvm-3
|
#PHP_SERVER=hhvm-latest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
Loading…
x
Reference in New Issue
Block a user