mirror of
https://github.com/x86dev/docker-ttrss
synced 2025-12-13 01:46:00 +00:00
Added tt-rss-mobilize plugin for supporting Readability and other
mobilizer services out of the box.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
include '/utils.php';
|
||||
|
||||
$ename = 'DB';
|
||||
$eport = 5432;
|
||||
$confpath = '/var/www/ttrss/config.php';
|
||||
@@ -69,46 +71,3 @@ foreach ($config as $name => $value) {
|
||||
$contents = preg_replace('/(define\s*\(\'' . $name . '\',\s*)(.*)(\);)/', '$1"' . $value . '"$3', $contents);
|
||||
}
|
||||
file_put_contents($confpath, $contents);
|
||||
|
||||
function env($name, $default = null)
|
||||
{
|
||||
$v = getenv($name) ?: $default;
|
||||
|
||||
if ($v === null) {
|
||||
error('The env ' . $name . ' does not exist');
|
||||
}
|
||||
|
||||
return $v;
|
||||
}
|
||||
|
||||
function error($text)
|
||||
{
|
||||
echo 'Error: ' . $text . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
function dbconnect($config)
|
||||
{
|
||||
$map = array('host' => 'HOST', 'port' => 'PORT', 'dbname' => 'NAME', 'user' => 'USER', 'password' => 'PASS');
|
||||
$dsn = $config['DB_TYPE'] . ':';
|
||||
foreach ($map as $d => $h) {
|
||||
if (isset($config['DB_' . $h])) {
|
||||
$dsn .= $d . '=' . $config['DB_' . $h] . ';';
|
||||
}
|
||||
}
|
||||
$pdo = new \PDO($dsn);
|
||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
return $pdo;
|
||||
}
|
||||
|
||||
function dbcheck($config)
|
||||
{
|
||||
try {
|
||||
dbconnect($config);
|
||||
return true;
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user