Merge pull request #802 from llaville/patch-intranet

Patch intranet to fix issue 801
This commit is contained in:
cytopia 2021-05-19 16:04:34 +02:00 committed by GitHub
commit d8e728a6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 66 additions and 1 deletions

View File

@ -19,7 +19,7 @@
<div class="col-md-12">
<?php if (!loadClass('Memcd')->isAvailable()): ?>
<p>Memcahed container is not running.</p>
<p>Memcached container is not running.</p>
<?php else: ?>
<?php foreach (loadClass('Memcd')->getInfo() as $srv => $data): ?>
<h2><?php echo $srv; ?></h2>

View File

@ -37,6 +37,11 @@ class Memcd extends BaseClass implements BaseInterface
{
parent::__construct($hostname, $data);
// Faster check if memcached is not loaded
if (!$this->isAvailable()) {
return;
}
if (class_exists('Memcached')) {
$memcd = new \Memcached('_devilbox');
$list = $memcd->getServerList();
@ -274,4 +279,14 @@ class Memcd extends BaseClass implements BaseInterface
}
return $this->_version;
}
public function isAvailable()
{
if (extension_loaded('memcached')) {
return parent::isAvailable();
}
// when php module 'memcached' not available or just disable by configuration (see .env PHP_MODULES_DISABLE)
return false;
}
}

View File

@ -230,4 +230,14 @@ class Mongo extends BaseClass implements BaseInterface
}
return $this->_version;
}
public function isAvailable()
{
if (extension_loaded('mongo') || extension_loaded('mongodb')) {
return parent::isAvailable();
}
// when php modules 'mongo' or 'mongodb' not available or just disable by configuration (see .env PHP_MODULES_DISABLE)
return false;
}
}

View File

@ -31,6 +31,11 @@ class Mysql extends BaseClass implements BaseInterface
{
parent::__construct($hostname, $data);
// Faster check if mysql is not loaded
if (!$this->isAvailable()) {
return;
}
$user = $data['user'];
$pass = $data['pass'];
@ -308,4 +313,14 @@ class Mysql extends BaseClass implements BaseInterface
return $this->_version;
}
public function isAvailable()
{
if (extension_loaded('mysqli')) {
return parent::isAvailable();
}
// when php module 'mysqli' not available or just disable by configuration (see .env PHP_MODULES_DISABLE)
return false;
}
}

View File

@ -38,6 +38,11 @@ class Pgsql extends BaseClass implements BaseInterface
{
parent::__construct($hostname, $data);
// Faster check if pgsql is not loaded
if (!$this->isAvailable()) {
return;
}
$user = $data['user'];
$pass = $data['pass'];
$db = isset($data['db']) ? $data['db'] : null;
@ -372,4 +377,14 @@ class Pgsql extends BaseClass implements BaseInterface
return $this->_version;
}
public function isAvailable()
{
if (extension_loaded('pgsql')) {
return parent::isAvailable();
}
// when php module 'pgsql' not available or just disable by configuration (see .env PHP_MODULES_DISABLE)
return false;
}
}

View File

@ -218,4 +218,14 @@ class Redis extends BaseClass implements BaseInterface
return $this->_version;
}
public function isAvailable()
{
if (extension_loaded('redis')) {
return parent::isAvailable();
}
// when php module 'redis' not available or just disable by configuration (see .env PHP_MODULES_DISABLE)
return false;
}
}