db install process
This commit is contained in:
@@ -23,6 +23,7 @@ EXPOSE 80 443
|
||||
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY ttrss.conf /etc/php7/php-fpm.d/ttrss.conf
|
||||
COPY install-db.php /var/lib/tt-rss-install/install-db.php
|
||||
|
||||
ADD https://git.tt-rss.org/fox/tt-rss/archive/18.12.tar.gz /tmp/ttrss.tar.gz
|
||||
RUN tar -xzf /tmp/ttrss.tar.gz -C /var/lib
|
||||
|
||||
26
install-db.php
Normal file
26
install-db.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
require "/var/lib/tt-rss/config.php";
|
||||
|
||||
$pdo = pdo_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_TYPE, DB_PORT);
|
||||
|
||||
if (!$pdo) {
|
||||
print_error("Unable to connect to database using specified parameters.");
|
||||
exit;
|
||||
}
|
||||
|
||||
$lines = explode(";", preg_replace("/[\r\n]/", "",
|
||||
file_get_contents("/var/lib/tt-rss/schema/ttrss_schema_".basename(DB_TYPE).".sql")));
|
||||
|
||||
foreach ($lines as $line) {
|
||||
if (strpos($line, "--") !== 0 && $line) {
|
||||
$res = $pdo->query($line);
|
||||
|
||||
if (!$res) {
|
||||
print_notice("Query: $line");
|
||||
print_error("Error: " . implode(", ", $this->pdo->errorInfo()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print_notice("Database initialization completed.");
|
||||
Reference in New Issue
Block a user