commit
17f5074992
12 changed files with 77 additions and 13 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
# Custom config (legacy)
|
||||
custom.ini
|
||||
|
||||
# Ignore images & thumbnails directories (legacy)
|
||||
|
|
11
.htaccess
Normal file → Executable file
11
.htaccess
Normal file → Executable file
|
@ -1,4 +1,11 @@
|
|||
<Files ~ "\.(ini|sql)$">
|
||||
Options -Indexes
|
||||
|
||||
<Files ~ "\.(ini|sql|log|class\.php)$">
|
||||
Order Allow,Deny
|
||||
Deny from All
|
||||
</Files>
|
||||
</Files>
|
||||
|
||||
<Files ~ "^(\.|Dockerfile|docker-compose\.yml|README\.md)">
|
||||
Order Allow,Deny
|
||||
Deny from All
|
||||
</Files>
|
||||
|
|
21
Dockerfile
Executable file
21
Dockerfile
Executable file
|
@ -0,0 +1,21 @@
|
|||
FROM php:7.4-apache
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
MAINTAINER Miroslav Sedivy
|
||||
|
||||
RUN apt-get -y update --fix-missing
|
||||
|
||||
# Install curl
|
||||
RUN apt-get -y install libcurl4-openssl-dev
|
||||
RUN docker-php-ext-install curl
|
||||
|
||||
# Install PDO MYSQL
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
|
||||
COPY . .
|
||||
|
||||
VOLUME "data"
|
||||
|
||||
RUN chown -R www-data:www-data . \
|
||||
&& a2enmod rewrite
|
|
@ -1 +0,0 @@
|
|||
deny from all
|
|
@ -4,26 +4,43 @@ defined('PROJECT_PATH') OR exit('No direct script access allowed');
|
|||
class Config
|
||||
{
|
||||
const CONFIG = 'config.ini';
|
||||
const CUSTOM = 'custom.ini';
|
||||
const CUSTOM = 'data/config.ini';
|
||||
const CUSTOM_FALLBACK = 'custom.ini';
|
||||
|
||||
private static $_settings = null;
|
||||
|
||||
private static function init(){
|
||||
$config_file = PROJECT_PATH.self::CONFIG;
|
||||
|
||||
if(!is_readable($config_file)){
|
||||
throw new ConfigException('Cannot read config file.');
|
||||
}
|
||||
|
||||
self::$_settings = parse_ini_file($config_file);
|
||||
$custom_config = PROJECT_PATH.self::CUSTOM;
|
||||
if(self::$_settings === false){
|
||||
throw new ConfigException('Cannot parse config file.');
|
||||
}
|
||||
|
||||
if(is_readable($custom_config)){
|
||||
$custom = parse_ini_file($custom_config);
|
||||
$config_file = PROJECT_PATH.self::CUSTOM;
|
||||
if(is_readable($config_file)){
|
||||
$custom = parse_ini_file($config_file);
|
||||
if($custom !== false){
|
||||
self::$_settings = array_merge(self::$_settings, $custom);
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for legacy versions
|
||||
elseif(is_readable($config_file = PROJECT_PATH.self::CUSTOM_FALLBACK)){
|
||||
$custom = parse_ini_file($config_file);
|
||||
if($custom !== false){
|
||||
// Fallback for old direcotry structure
|
||||
if(!array_key_exists('images_path', $custom) && !array_key_exists('thumbnails_path', $custom)){
|
||||
$custom['images_path'] = 'i/';
|
||||
$custom['thumbnails_path'] = 't/';
|
||||
}
|
||||
|
||||
self::$_settings = array_merge(self::$_settings, $custom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function get($key){
|
||||
|
|
0
app/db.sql → app/db/01_schema.sql
Normal file → Executable file
0
app/db.sql → app/db/01_schema.sql
Normal file → Executable file
|
@ -1 +0,0 @@
|
|||
ALTER TABLE `posts`CHANGE `pirvacy` `privacy` SET('private','friends','public') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
|
|
@ -1,6 +1,6 @@
|
|||
[database]
|
||||
;mysql_socket = /tmp/mariadb55.sock
|
||||
mysql_host = localhost
|
||||
mysql_host = mariadb
|
||||
mysql_port = 3306
|
||||
mysql_user = root
|
||||
mysql_pass = root
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
Order Allow,Deny
|
||||
Deny from All
|
|
@ -1 +0,0 @@
|
|||
deny from all
|
23
docker-compose.yml
Executable file
23
docker-compose.yml
Executable file
|
@ -0,0 +1,23 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
webserver:
|
||||
build: ./
|
||||
container_name: blog_apache
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- ${HTTP_PORT-80}:80
|
||||
- ${HTTPS_PORT-443}:443
|
||||
volumes:
|
||||
- ${DATA-./data}:/var/www/html/data
|
||||
mariadb:
|
||||
image: mariadb:10.1
|
||||
environment:
|
||||
MYSQL_DATABASE: blog
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- mariadb:/var/lib/mysql
|
||||
- ./app/db:/docker-entrypoint-initdb.d:ro
|
||||
volumes:
|
||||
mariadb:
|
Loading…
Add table
Reference in a new issue