forked from GithubBackups/vichan
Enhance Docker setup and installation process
- Updated Docker Compose configuration for web, PHP, and database services. - Added Redis service with health checks and environment variables. - Improved error handling and user prompts in installation scripts. - Introduced example environment variables for easier configuration. - Updated Nginx and PHP Docker images to latest versions.
This commit is contained in:
parent
83b644f0f5
commit
d3f36e48f7
28
.env.example
Normal file
28
.env.example
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# Example environment variables for the vichan imageboard Docker Compose setup.
|
||||||
|
# Copy this file to `.env` and customize values as needed.
|
||||||
|
# Do not commit `.env` with sensitive data to version control.
|
||||||
|
|
||||||
|
# General Settings
|
||||||
|
INSTANCE=0
|
||||||
|
|
||||||
|
# Web Service (Nginx) Settings
|
||||||
|
# SSL_CERT_PATH=/path/to/cert.pem
|
||||||
|
# SSL_KEY_PATH=/path/to/key.pem
|
||||||
|
|
||||||
|
# PHP Service Settings
|
||||||
|
VICHAN_MYSQL__HOST=db
|
||||||
|
VICHAN_MYSQL__USER=vichan
|
||||||
|
VICHAN_MYSQL__NAME=vichan
|
||||||
|
VICHAN_MYSQL__PASSWORD=vichan!
|
||||||
|
VICHAN_SECURE_LOGIN_ONLY=0
|
||||||
|
|
||||||
|
# Redis Settings
|
||||||
|
VICHAN_REDIS_HOST=redis
|
||||||
|
VICHAN_REDIS_PORT=6379
|
||||||
|
VICHAN_REDIS_PASSWORD=redis!
|
||||||
|
|
||||||
|
# Database Service (MariaDB) Settings
|
||||||
|
MYSQL_DATABASE=vichan
|
||||||
|
MYSQL_USER=vichan
|
||||||
|
MYSQL_PASSWORD=vichan!
|
||||||
|
MYSQL_ROOT_PASSWORD=vichan!!
|
||||||
57
compose.yml
57
compose.yml
@ -1,18 +1,22 @@
|
|||||||
services:
|
services:
|
||||||
#nginx webserver + php 8.x
|
|
||||||
web:
|
web:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./docker/nginx/Dockerfile
|
dockerfile: ./docker/nginx/Dockerfile
|
||||||
|
container_name: vichan_frontend
|
||||||
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "9090:80"
|
- "9090:80"
|
||||||
|
# - "9092:443" # optional for SSL
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
|
- php
|
||||||
volumes:
|
volumes:
|
||||||
- ./local-instances/${INSTANCE:-0}/www:/var/www/html
|
- ./local-instances/${INSTANCE:-0}/www:/var/www/html
|
||||||
- ./docker/nginx/vichan.conf:/etc/nginx/conf.d/default.conf
|
- ./docker/nginx/vichan.conf:/etc/nginx/conf.d/default.conf
|
||||||
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
|
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
- ./docker/nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf
|
- ./docker/nginx/proxy.conf:/etc/nginx/conf.d/proxy.conf
|
||||||
|
# - ./docker/nginx/ssl:/etc/nginx/ssl # optional For SSL
|
||||||
links:
|
links:
|
||||||
- php
|
- php
|
||||||
|
|
||||||
@ -20,21 +24,48 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: ./docker/php/Dockerfile
|
dockerfile: ./docker/php/Dockerfile
|
||||||
|
container_name: vichan_php
|
||||||
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./local-instances/${INSTANCE:-0}/www:/var/www
|
- ./local-instances/${INSTANCE:-0}/www:/var/www
|
||||||
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
|
- ./docker/php/www.conf:/usr/local/etc/php-fpm.d/www.conf
|
||||||
- ./docker/php/jit.ini:/usr/local/etc/php/conf.d/jit.ini
|
- ./docker/php/jit.ini:/usr/local/etc/php/conf.d/jit.ini
|
||||||
|
|
||||||
#MySQL Service
|
|
||||||
db:
|
|
||||||
image: mysql:8.0.35
|
|
||||||
container_name: db
|
|
||||||
restart: unless-stopped
|
|
||||||
tty: true
|
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: vichan
|
VICHAN_MYSQL__HOST: ${VICHAN_MYSQL__HOST}
|
||||||
MYSQL_ROOT_PASSWORD: password
|
VICHAN_MYSQL__USER: ${VICHAN_MYSQL__USER}
|
||||||
|
VICHAN_MYSQL__NAME: ${VICHAN_MYSQL__NAME}
|
||||||
|
VICHAN_MYSQL__PASSWORD: ${VICHAN_MYSQL__PASSWORD}
|
||||||
|
VICHAN_SECURE_LOGIN_ONLY: ${VICHAN_SECURE_LOGIN_ONLY}
|
||||||
|
VICHAN_REDIS_HOST: ${VICHAN_REDIS_HOST}
|
||||||
|
VICHAN_REDIS_PORT: ${VICHAN_REDIS_PORT}
|
||||||
|
VICHAN_REDIS_PASSWORD: ${VICHAN_REDIS_PASSWORD}
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: mariadb:latest
|
||||||
|
container_name: vichan_mariadb
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "9091:3306"
|
||||||
|
environment:
|
||||||
|
MYSQL_DATABASE: ${MYSQL_DATABASE}
|
||||||
|
MYSQL_USER: ${MYSQL_USER}
|
||||||
|
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
|
||||||
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- ./local-instances/${INSTANCE:-0}/mysql:/var/lib/mysql
|
- ./local-instances/${INSTANCE:-0}/db:/var/lib/mysql
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:latest
|
||||||
|
container_name: vichan_redis
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./local-instances/${INSTANCE:-0}/redis:/data
|
||||||
|
command: redis-server --requirepass ${VICHAN_REDIS_PASSWORD}
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "-a", "${VICHAN_REDIS_PASSWORD}", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
start_period: 30s
|
||||||
@ -1,4 +1,4 @@
|
|||||||
FROM nginx:1.25.3-alpine
|
FROM nginx:1.27.5-alpine-slim
|
||||||
|
|
||||||
COPY . /code
|
COPY . /code
|
||||||
RUN adduser --system www-data \
|
RUN adduser --system www-data \
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# Based on https://github.com/dead-guru/devichan/blob/master/php-fpm/Dockerfile
|
# Based on https://github.com/dead-guru/devichan/blob/master/php-fpm/Dockerfile
|
||||||
|
|
||||||
FROM composer:lts AS composer
|
FROM composer:lts AS composer
|
||||||
FROM php:8.1-fpm-alpine
|
FROM php:8.3-fpm-alpine
|
||||||
|
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
zlib \
|
zlib \
|
||||||
|
|||||||
@ -1,48 +1,73 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Vichan\Data\Driver;
|
namespace Vichan\Data\Driver;
|
||||||
|
|
||||||
|
// Prevent direct access to this file for security
|
||||||
defined('TINYBOARD') or exit;
|
defined('TINYBOARD') or exit;
|
||||||
|
|
||||||
|
// Defines the required methods for any cache driver
|
||||||
class RedisCacheDriver implements CacheDriver {
|
interface CacheDriver {
|
||||||
private string $prefix;
|
public function get(string $key): mixed;
|
||||||
private \Redis $inner;
|
public function set(string $key, mixed $value, mixed $expires = false): void;
|
||||||
|
public function delete(string $key): void;
|
||||||
public function __construct(string $prefix, string $host, int $port, ?string $password, string $database) {
|
public function flush(): void;
|
||||||
$this->inner = new \Redis();
|
}
|
||||||
$this->inner->connect($host, $port);
|
|
||||||
if ($password) {
|
// Handles caching using Redis, a fast in-memory data store
|
||||||
$this->inner->auth($password);
|
class RedisCacheDriver implements CacheDriver {
|
||||||
}
|
private string $prefix;
|
||||||
if (!$this->inner->select($database)) {
|
private \Redis $inner;
|
||||||
throw new \RuntimeException('Unable to connect to Redis!');
|
|
||||||
}
|
// Sets up the Redis connection
|
||||||
|
public function __construct(string $prefix, string $host, int $port, ?string $password, int $database) {
|
||||||
$$this->prefix = $prefix;
|
$this->inner = new \Redis();
|
||||||
}
|
$this->inner->connect($host, $port);
|
||||||
|
|
||||||
public function get(string $key): mixed {
|
if ($password) {
|
||||||
$ret = $this->inner->get($this->prefix . $key);
|
$this->inner->auth($password);
|
||||||
if ($ret === false) {
|
}
|
||||||
return null;
|
|
||||||
}
|
if (!$this->inner->select($database)) {
|
||||||
return \json_decode($ret, true);
|
throw new \RuntimeException('Unable to select Redis database ' . $database);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set(string $key, mixed $value, mixed $expires = false): void {
|
$this->prefix = $prefix;
|
||||||
if ($expires === false) {
|
}
|
||||||
$this->inner->set($this->prefix . $key, \json_encode($value));
|
|
||||||
} else {
|
// Retrieves a value from the cache by key
|
||||||
$expires = $expires * 1000; // Seconds to milliseconds.
|
public function get(string $key): mixed {
|
||||||
$this->inner->setex($this->prefix . $key, $expires, \json_encode($value));
|
|
||||||
}
|
$ret = $this->inner->get($this->prefix . $key);
|
||||||
}
|
if ($ret === false) {
|
||||||
|
// Return null if the key doesn't exist
|
||||||
public function delete(string $key): void {
|
return null;
|
||||||
$this->inner->del($this->prefix . $key);
|
}
|
||||||
}
|
|
||||||
|
return \json_decode($ret, true);
|
||||||
public function flush(): void {
|
}
|
||||||
$this->inner->flushDB();
|
|
||||||
}
|
// Stores a value in the cache with an optional expiration time
|
||||||
|
public function set(string $key, mixed $value, mixed $expires = false): void {
|
||||||
|
// Convert the value to JSON for storage
|
||||||
|
$encodedValue = \json_encode($value);
|
||||||
|
|
||||||
|
if ($expires === false || !is_numeric($expires) || $expires <= 0) {
|
||||||
|
// Store the value without an expiration
|
||||||
|
$this->inner->set($this->prefix . $key, $encodedValue);
|
||||||
|
} else {
|
||||||
|
// Store the value with an expiration time (in seconds)
|
||||||
|
$ttl_seconds = (int)$expires;
|
||||||
|
$this->inner->setex($this->prefix . $key, $ttl_seconds, $encodedValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deletes a specific key from the cache
|
||||||
|
public function delete(string $key): void {
|
||||||
|
// Remove the key from Redis
|
||||||
|
$this->inner->del($this->prefix . $key);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clears all data in the current Redis database
|
||||||
|
public function flush(): void {
|
||||||
|
$this->inner->flushDB();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
178
install.php
178
install.php
@ -387,7 +387,7 @@ if (file_exists($config['has_installed'])) {
|
|||||||
CHANGE `theme` `theme` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
CHANGE `theme` `theme` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL ,
|
||||||
CHANGE `name` `name` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
CHANGE `name` `name` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
||||||
CHANGE `value` `value` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
CHANGE `value` `value` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL ,
|
||||||
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or eror(db_error());
|
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error());
|
||||||
case 'v0.9.6-dev-10':
|
case 'v0.9.6-dev-10':
|
||||||
query("ALTER TABLE `antispam`
|
query("ALTER TABLE `antispam`
|
||||||
CHANGE `board` `board` VARCHAR( 58 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;") or error(db_error());
|
CHANGE `board` `board` VARCHAR( 58 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;") or error(db_error());
|
||||||
@ -680,12 +680,12 @@ function create_config_from_array(&$instance_config, &$array, $prefix = '') {
|
|||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
if ($step == 0) {
|
if ($step == 0) {
|
||||||
// Agreeement
|
// Agreement
|
||||||
$page['body'] = '
|
$page['body'] = '
|
||||||
<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" disabled>' . htmlentities(file_get_contents('LICENSE.md')) . '</textarea>
|
<textarea style="width:700px;height:370px;margin:auto;display:block;background:white;color:black" disabled>' . htmlentities(file_get_contents('LICENSE.md')) . '</textarea>
|
||||||
<p style="text-align:center">
|
<p style="text-align:center">
|
||||||
<a href="?step=1">I have read and understood the agreement. Proceed to installation.</a>
|
<button onclick="window.location.href=\'?step=1\'">I have read and understood the agreement. Proceed to installation.</button>
|
||||||
</p>';
|
</p>';
|
||||||
|
|
||||||
echo Element('page.html', $page);
|
echo Element('page.html', $page);
|
||||||
} elseif ($step == 1) {
|
} elseif ($step == 1) {
|
||||||
@ -914,23 +914,35 @@ if ($step == 0) {
|
|||||||
'config' => $config,
|
'config' => $config,
|
||||||
));
|
));
|
||||||
} elseif ($step == 2) {
|
} elseif ($step == 2) {
|
||||||
|
$page['title'] = 'Configuration';
|
||||||
|
$sg = new SaltGen();
|
||||||
|
$config['cookies']['salt'] = $sg->generate();
|
||||||
|
$config['secure_trip_salt'] = $sg->generate();
|
||||||
|
$config['secure_password_salt'] = $sg->generate();
|
||||||
|
|
||||||
|
// Set database configuration from Docker environment variables, leave empty if not found
|
||||||
|
$config['db'] = array(
|
||||||
|
'type' => 'mysql', // Default, required for MySQL
|
||||||
|
'server' => getenv('VICHAN_MYSQL__HOST') !== false ? getenv('VICHAN_MYSQL__HOST') : '',
|
||||||
|
'database' => getenv('VICHAN_MYSQL__NAME') !== false ? getenv('VICHAN_MYSQL__NAME') : '',
|
||||||
|
'user' => getenv('VICHAN_MYSQL__USER') !== false ? getenv('VICHAN_MYSQL__USER') : '',
|
||||||
|
'password' => getenv('VICHAN_MYSQL__PASSWORD') !== false ? getenv('VICHAN_MYSQL__PASSWORD') : '',
|
||||||
|
);
|
||||||
|
|
||||||
// Basic config
|
// Append secure_login_only to $_SESSION['more'] if VICHAN_SECURE_LOGIN_ONLY is set from Docker environment variables
|
||||||
$page['title'] = 'Configuration';
|
if (getenv('VICHAN_SECURE_LOGIN_ONLY') !== false) {
|
||||||
|
$secure_login_only = (int)getenv('VICHAN_SECURE_LOGIN_ONLY');
|
||||||
$sg = new SaltGen();
|
$_SESSION['more'] .= "\n\$config['cookies']['secure_login_only'] = $secure_login_only;";
|
||||||
$config['cookies']['salt'] = $sg->generate();
|
}
|
||||||
$config['secure_trip_salt'] = $sg->generate();
|
|
||||||
$config['secure_password_salt'] = $sg->generate();
|
echo Element('page.html', array(
|
||||||
|
'body' => Element('installer/config.html', array(
|
||||||
echo Element('page.html', array(
|
'config' => $config,
|
||||||
'body' => Element('installer/config.html', array(
|
'more' => $_SESSION['more'],
|
||||||
'config' => $config,
|
)),
|
||||||
'more' => $_SESSION['more'],
|
'title' => 'Configuration',
|
||||||
)),
|
'config' => $config
|
||||||
'title' => 'Configuration',
|
));
|
||||||
'config' => $config
|
|
||||||
));
|
|
||||||
} elseif ($step == 3) {
|
} elseif ($step == 3) {
|
||||||
$more = $_POST['more'];
|
$more = $_POST['more'];
|
||||||
unset($_POST['more']);
|
unset($_POST['more']);
|
||||||
@ -973,69 +985,85 @@ if ($step == 0) {
|
|||||||
echo Element('page.html', $page);
|
echo Element('page.html', $page);
|
||||||
}
|
}
|
||||||
} elseif ($step == 4) {
|
} elseif ($step == 4) {
|
||||||
// SQL installation
|
buildJavascript();
|
||||||
|
|
||||||
buildJavascript();
|
$sql = @file_get_contents('install.sql') or error("Couldn't load install.sql.");
|
||||||
|
|
||||||
$sql = @file_get_contents('install.sql') or error("Couldn't load install.sql.");
|
sql_open();
|
||||||
|
$mysql_version = mysql_version();
|
||||||
|
|
||||||
sql_open();
|
// This code is probably horrible, but what I'm trying
|
||||||
$mysql_version = mysql_version();
|
// to do is find all of the SQL queires and put them
|
||||||
|
// in an array.
|
||||||
|
preg_match_all("/(^|\n)((SET|CREATE|INSERT).+)\n\n/msU", $sql, $queries);
|
||||||
|
$queries = $queries[2];
|
||||||
|
|
||||||
// This code is probably horrible, but what I'm trying
|
$queries[] = Element('posts.sql', array('board' => 'b'));
|
||||||
// to do is find all of the SQL queires and put them
|
|
||||||
// in an array.
|
|
||||||
preg_match_all("/(^|\n)((SET|CREATE|INSERT).+)\n\n/msU", $sql, $queries);
|
|
||||||
$queries = $queries[2];
|
|
||||||
|
|
||||||
$queries[] = Element('posts.sql', array('board' => 'b'));
|
$sql_errors = '';
|
||||||
|
$sql_err_count = 0;
|
||||||
|
foreach ($queries as $query) {
|
||||||
|
if ($mysql_version < 50503)
|
||||||
|
$query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query);
|
||||||
|
$query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query);
|
||||||
|
if (!query($query)) {
|
||||||
|
$sql_err_count++;
|
||||||
|
$error = db_error();
|
||||||
|
$sql_errors .= "<li>$sql_err_count<ul><li>$query</li><li>$error</li></ul></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sql_errors = '';
|
$page['title'] = 'Installation complete';
|
||||||
$sql_err_count = 0;
|
$page['body'] = '<p style="text-align:center">Thank you for installing vichan. Please report any bugs you discover. <a href="https://github.com/vichan-devel/vichan/wiki/Configuration-Basics">How do I edit the config files?</a></p>';
|
||||||
foreach ($queries as $query) {
|
|
||||||
if ($mysql_version < 50503)
|
|
||||||
$query = preg_replace('/(CHARSET=|CHARACTER SET )utf8mb4/', '$1utf8', $query);
|
|
||||||
$query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query);
|
|
||||||
if (!query($query)) {
|
|
||||||
$sql_err_count++;
|
|
||||||
$error = db_error();
|
|
||||||
$sql_errors .= "<li>$sql_err_count<ul><li>$query</li><li>$error</li></ul></li>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$page['title'] = 'Installation complete';
|
// notice and button
|
||||||
$page['body'] = '<p style="text-align:center">Thank you for using vichan. Please remember to report any bugs you discover. <a href="https://github.com/vichan-devel/vichan/wiki/Configuration-Basics">How do I edit the config files?</a></p>';
|
$page['body'] .= '<div class="ban"><h2>Next Steps</h2>' .
|
||||||
|
'<p>You can now log in to the admin panel at <strong>/mod.php</strong> using the default credentials: <strong>Username: admin</strong>, <strong>Password: password</strong>.</p>' .
|
||||||
|
'<p><strong>Important:</strong> For security, please change the administrator password immediately after logging in.</p>' .
|
||||||
|
'<p style="text-align:center"><button onclick="window.location.href=\'/mod.php\'">Go to Admin Panel</button></p></div>';
|
||||||
|
|
||||||
if (!empty($sql_errors)) {
|
if (!empty($sql_errors)) {
|
||||||
$page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a vichan installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';
|
$page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a vichan installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul>' .
|
||||||
} else {
|
'<p style="text-align:center;color:#d00"><strong>Warning:</strong> Ignoring errors is not recommended and may cause installation issues.</p>' .
|
||||||
$boards = listBoards();
|
'<p style="text-align:center"><button onclick="window.location.href=\'?step=5\'">Next</button></p></div>';
|
||||||
foreach ($boards as &$_board) {
|
} else {
|
||||||
setupBoard($_board);
|
$boards = listBoards();
|
||||||
buildIndex();
|
foreach ($boards as &$_board) {
|
||||||
}
|
setupBoard($_board);
|
||||||
|
buildIndex();
|
||||||
|
}
|
||||||
|
|
||||||
file_write($config['has_installed'], VERSION);
|
file_write($config['has_installed'], VERSION);
|
||||||
/*if (!file_unlink(__FILE__)) {
|
/*if (!file_unlink(__FILE__)) {
|
||||||
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
|
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Element('page.html', $page);
|
echo Element('page.html', $page);
|
||||||
} elseif ($step == 5) {
|
} elseif ($step == 5) {
|
||||||
$page['title'] = 'Installation complete';
|
$page['title'] = 'Installation complete';
|
||||||
$page['body'] = '<p style="text-align:center">Thank you for using vichan. Please remember to report any bugs you discover.</p>';
|
$page['body'] = '<p style="text-align:center">Thank you for installing vichan. Please report any bugs you discover.</p>';
|
||||||
|
|
||||||
$boards = listBoards();
|
// onboarding notice and button to mod.php
|
||||||
foreach ($boards as &$_board) {
|
$page['body'] .= '<div class="ban"><h2>Next Steps</h2>' .
|
||||||
setupBoard($_board);
|
'<p>You can now log in to the admin panel at <strong>/mod.php</strong> using the default credentials:</p>' .
|
||||||
buildIndex();
|
'<ul>' .
|
||||||
}
|
'<li><strong>Username:</strong> admin</li>' .
|
||||||
|
'<li><strong>Password:</strong> password</li>' .
|
||||||
|
'</ul>' .
|
||||||
|
'<p><strong>Important:</strong> For security, please change the administrator password immediately after logging in.</p>' .
|
||||||
|
'<p style="text-align:center"><button onclick="window.location.href=\'/mod.php\'">Go to Admin Panel</button></p></div>';
|
||||||
|
|
||||||
file_write($config['has_installed'], VERSION);
|
$boards = listBoards();
|
||||||
if (!file_unlink(__FILE__)) {
|
foreach ($boards as &$_board) {
|
||||||
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
|
setupBoard($_board);
|
||||||
}
|
buildIndex();
|
||||||
|
}
|
||||||
|
|
||||||
echo Element('page.html', $page);
|
file_write($config['has_installed'], VERSION);
|
||||||
}
|
if (!file_unlink(__FILE__)) {
|
||||||
|
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Element('page.html', $page);
|
||||||
|
}
|
||||||
@ -1,56 +1,57 @@
|
|||||||
<div style="max-width:700px;margin:auto">
|
<div style="max-width:700px;margin:auto">
|
||||||
<h2 style="text-align:center">Pre-installation tests</h2>
|
<h2 style="text-align:center">Pre-installation tests</h2>
|
||||||
<table class="modlog" style="margin-top:10px;max-width:600px">
|
<table class="modlog" style="margin-top:10px;max-width:600px">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Category</th>
|
<th>Category</th>
|
||||||
<th>Test</th>
|
<th>Test</th>
|
||||||
<th>Result</th>
|
<th>Result</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% set errors = 0 %}
|
{% set errors = 0 %}
|
||||||
{% set warnings = 0 %}
|
{% set warnings = 0 %}
|
||||||
{% for test in tests %}
|
{% for test in tests %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="minimal"><strong>{{ test.category }}</strong></td>
|
<td class="minimal"><strong>{{ test.category }}</strong></td>
|
||||||
<td>{{ test.name }}</td>
|
<td>{{ test.name }}</td>
|
||||||
<td class="minimal" style="text-align:center">
|
<td class="minimal" style="text-align:center">
|
||||||
{% if test.result %}
|
{% if test.result %}
|
||||||
<i style="font-size:11pt;color:#090" class="fa fa-check"></i>
|
<i style="font-size:11pt;color:#090" class="fa fa-check"></i>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if test.required %}
|
{% if test.required %}
|
||||||
{% set errors = errors + 1 %}
|
{% set errors = errors + 1 %}
|
||||||
<i style="font-size:11pt;color:#d00" class="fa fa-exclamation"></i>
|
<i style="font-size:11pt;color:#d00" class="fa fa-exclamation"></i>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% set warnings = warnings + 1 %}
|
{% set warnings = warnings + 1 %}
|
||||||
<i style="font-size:11pt;color:#f80" class="fa fa-warning"></i>
|
<i style="font-size:11pt;color:#f80" class="fa fa-warning"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% if errors or warnings %}
|
{% if errors or warnings %}
|
||||||
<p><strong>There were {{ errors }} error(s) and {{ warnings }} warning(s).</strong></p>
|
<p><strong>There were {{ errors }} error(s) and {{ warnings }} warning(s).</strong></p>
|
||||||
<ul>
|
<ul>
|
||||||
{% for test in tests %}
|
{% for test in tests %}
|
||||||
{% if not test.result %}
|
{% if not test.result %}
|
||||||
<li style="margin-bottom:5px">
|
<li style="margin-bottom:5px">
|
||||||
{% if test.required %}
|
{% if test.required %}
|
||||||
<i style="font-size:11pt;color:#d00" class="fa fa-exclamation"></i> <strong>Error:</strong>
|
<i style="font-size:11pt;color:#d00" class="fa fa-exclamation"></i> <strong>Error:</strong>
|
||||||
{% else %}
|
{% else %}
|
||||||
<i style="font-size:11pt;color:#f80" class="fa fa-warning"></i> <strong>Warning:</strong>
|
<i style="font-size:11pt;color:#f80" class="fa fa-warning"></i> <strong>Warning:</strong>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{{ test.message }}
|
{{ test.message }}
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% if errors %}
|
{% if errors %}
|
||||||
<p style="text-align:center"><a href="?step=2">Click here to ignore errors and attempt installing anyway (not recommended).</a></p>
|
<p style="text-align:center;color:#d00"><strong>Warning:</strong> Ignoring these problems is not recommended and may cause installation issues.</p>
|
||||||
{% else %}
|
<p style="text-align:center"><button onclick="window.location.href='?step=2'">Proceed Anyway</button></p>
|
||||||
<p style="text-align:center"><a href="?step=2">Click here to proceed with installation.</a></p>
|
{% else %}
|
||||||
{% endif %}
|
<p style="text-align:center"><button onclick="window.location.href='?step=2'">Next</button></p>
|
||||||
{% else %}
|
{% endif %}
|
||||||
<p>There were no errors or warnings. Good!</p>
|
{% else %}
|
||||||
<p style="text-align:center"><a href="?step=2">Clik here to proceed with installation.</a></p>
|
<p>There were no errors or warnings. Good!</p>
|
||||||
{% endif %}
|
<p style="text-align:center"><button onclick="window.location.href='?step=2'">Next</button></p>
|
||||||
</div>
|
{% endif %}
|
||||||
|
</div>
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<input type="text" id="db_user" name="db[user]" value="{{ config.db.user }}">
|
<input type="text" id="db_user" name="db[user]" value="{{ config.db.user }}">
|
||||||
|
|
||||||
<label for="db_pass">Password:</label>
|
<label for="db_pass">Password:</label>
|
||||||
<input type="password" id="db_pass" name="db[password]" value="">
|
<input type="password" id="db_pass" name="db[password]" value="{{ config.db.password }}">
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<p style="text-align:center" class="unimportant">The following is all later configurable. For more options, <a href="http://tinyboard.org/docs/?p=Config">edit your configuration files</a> after installing.</p>
|
<p style="text-align:center" class="unimportant">The following is all later configurable. For more options, <a href="http://tinyboard.org/docs/?p=Config">edit your configuration files</a> after installing.</p>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user