Moved stuff to /data/
"Stuff" means: - Config - Local config - SQLite db file - Files - Thumbnails - Logs
This commit is contained in:
parent
a892410f5d
commit
5780917e82
6 changed files with 28 additions and 13 deletions
0
.gitignore → data/.gitignore
vendored
0
.gitignore → data/.gitignore
vendored
|
@ -2,13 +2,13 @@
|
||||||
prettyPrint=1
|
prettyPrint=1
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
dbPath=./db.sqlite
|
dbPath = "./data/db.sqlite"
|
||||||
filesPath=./files/
|
filesPath = "./data/files/"
|
||||||
thumbsPath=./thumbs/
|
thumbsPath = "./data/thumbs/"
|
||||||
mediaPath=./public_html/media/
|
logsPath = "./data/logs/"
|
||||||
title=szurubooru
|
mediaPath = "./public_html/media/"
|
||||||
salt = "1A2/$_4xVa"
|
title = "szurubooru"
|
||||||
logsPath=./logs/
|
salt = "1A2/$_4xVa"
|
||||||
|
|
||||||
[misc]
|
[misc]
|
||||||
featuredPostMaxDays=7
|
featuredPostMaxDays=7
|
0
files/.gitignore → data/files/.gitignore
vendored
0
files/.gitignore → data/files/.gitignore
vendored
0
logs/.gitignore → data/logs/.gitignore
vendored
0
logs/.gitignore → data/logs/.gitignore
vendored
0
thumbs/.gitignore → data/thumbs/.gitignore
vendored
0
thumbs/.gitignore → data/thumbs/.gitignore
vendored
27
src/core.php
27
src/core.php
|
@ -2,30 +2,45 @@
|
||||||
define('SZURU_VERSION', '0.4.1');
|
define('SZURU_VERSION', '0.4.1');
|
||||||
define('SZURU_LINK', 'http://github.com/rr-/szurubooru');
|
define('SZURU_LINK', 'http://github.com/rr-/szurubooru');
|
||||||
|
|
||||||
|
//basic settings and preparation
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
$startTime = microtime(true);
|
$startTime = microtime(true);
|
||||||
$rootDir = __DIR__ . DS . '..' . DS;
|
$rootDir = __DIR__ . DS . '..' . DS;
|
||||||
|
date_default_timezone_set('UTC');
|
||||||
|
setlocale(LC_CTYPE, 'en_US.UTF-8');
|
||||||
|
ini_set('memory_limit', '128M');
|
||||||
|
|
||||||
|
//extension sanity checks
|
||||||
$requiredExtensions = ['pdo', 'pdo_sqlite', 'gd', 'openssl'];
|
$requiredExtensions = ['pdo', 'pdo_sqlite', 'gd', 'openssl'];
|
||||||
foreach ($requiredExtensions as $ext)
|
foreach ($requiredExtensions as $ext)
|
||||||
if (!extension_loaded($ext))
|
if (!extension_loaded($ext))
|
||||||
die('PHP extension "' . $ext . '" must be enabled to continue.' . PHP_EOL);
|
die('PHP extension "' . $ext . '" must be enabled to continue.' . PHP_EOL);
|
||||||
|
|
||||||
date_default_timezone_set('UTC');
|
//basic include calls, autoloader init
|
||||||
setlocale(LC_CTYPE, 'en_US.UTF-8');
|
|
||||||
ini_set('memory_limit', '128M');
|
|
||||||
|
|
||||||
require_once $rootDir . 'lib' . DS . 'php-markdown' . DS . 'Michelf' . DS . 'Markdown.php';
|
require_once $rootDir . 'lib' . DS . 'php-markdown' . DS . 'Michelf' . DS . 'Markdown.php';
|
||||||
require_once $rootDir . 'lib' . DS . 'redbean' . DS . 'RedBean' . DS . 'redbean.inc.php';
|
require_once $rootDir . 'lib' . DS . 'redbean' . DS . 'RedBean' . DS . 'redbean.inc.php';
|
||||||
require_once $rootDir . 'lib' . DS . 'chibi-core' . DS . 'Facade.php';
|
require_once $rootDir . 'lib' . DS . 'chibi-core' . DS . 'Facade.php';
|
||||||
|
|
||||||
\Chibi\AutoLoader::init(__DIR__);
|
\Chibi\AutoLoader::init(__DIR__);
|
||||||
|
|
||||||
|
//load config manually
|
||||||
|
$configPaths =
|
||||||
|
[
|
||||||
|
$rootDir . DS . 'data' . DS . 'config.ini',
|
||||||
|
$rootDir . DS . 'data' . DS . 'local.ini',
|
||||||
|
];
|
||||||
|
$config = new \Chibi\Config();
|
||||||
|
foreach ($configPaths as $path)
|
||||||
|
if (file_exists($path))
|
||||||
|
$config->loadIni($path);
|
||||||
|
\Chibi\Registry::setConfig($config);
|
||||||
|
|
||||||
|
//prepare context
|
||||||
\Chibi\Facade::init();
|
\Chibi\Facade::init();
|
||||||
$config = \Chibi\Registry::getConfig();
|
|
||||||
$context = \Chibi\Registry::getContext();
|
$context = \Chibi\Registry::getContext();
|
||||||
$context->startTime = $startTime;
|
$context->startTime = $startTime;
|
||||||
$context->rootDir = $rootDir;
|
$context->rootDir = $rootDir;
|
||||||
|
|
||||||
|
//load database
|
||||||
R::setup('sqlite:' . $config->main->dbPath);
|
R::setup('sqlite:' . $config->main->dbPath);
|
||||||
R::freeze(true);
|
R::freeze(true);
|
||||||
R::dependencies(['tag' => ['post'], 'favoritee' => ['post', 'user'], 'comment' => ['post', 'user']]);
|
R::dependencies(['tag' => ['post'], 'favoritee' => ['post', 'user'], 'comment' => ['post', 'user']]);
|
||||||
|
|
Loading…
Reference in a new issue