summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/common.php12
-rw-r--r--app/constants.php19
2 files changed, 19 insertions, 12 deletions
diff --git a/app/common.php b/app/common.php
index c9907ce1..aed07a50 100644
--- a/app/common.php
+++ b/app/common.php
@@ -14,12 +14,16 @@ if (getenv('DATABASE_URL')) {
define('DB_NAME', ltrim($dbopts["path"], '/'));
}
-if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'config.php')) {
- require __DIR__.DIRECTORY_SEPARATOR.'config.php';
+$config_file = implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'config.php'));
+
+if (file_exists($config_file)) {
+ require $config_file;
}
-if (file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php')) {
- require __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'config.php';
+$config_file = implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'data', 'config.php'));
+
+if (file_exists($config_file)) {
+ require $config_file;
}
require __DIR__.'/constants.php';
diff --git a/app/constants.php b/app/constants.php
index a09aac19..3dd827b3 100644
--- a/app/constants.php
+++ b/app/constants.php
@@ -1,11 +1,17 @@
<?php
+// Data directory location
+defined('DATA_DIR') or define('DATA_DIR', implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'data')));
+
+// Files directory (attachments)
+defined('FILES_DIR') or define('FILES_DIR', DATA_DIR.DIRECTORY_SEPARATOR.'files');
+
+// Plugins directory
+defined('PLUGINS_DIR') or define('PLUGINS_DIR', implode(DIRECTORY_SEPARATOR, array(__DIR__, '..', 'plugins')));
+
// Enable/disable debug
defined('DEBUG') or define('DEBUG', getenv('DEBUG'));
-defined('DEBUG_FILE') or define('DEBUG_FILE', getenv('DEBUG_FILE') ?: __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'debug.log');
-
-// Plugin directory
-defined('PLUGINS_DIR') or define('PLUGINS_DIR', __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'plugins');
+defined('DEBUG_FILE') or define('DEBUG_FILE', getenv('DEBUG_FILE') ?: DATA_DIR.DIRECTORY_SEPARATOR.'debug.log');
// Application version
defined('APP_VERSION') or define('APP_VERSION', build_app_version('$Format:%d$', '$Format:%H$'));
@@ -14,7 +20,7 @@ defined('APP_VERSION') or define('APP_VERSION', build_app_version('$Format:%d$',
defined('DB_DRIVER') or define('DB_DRIVER', 'sqlite');
// Sqlite configuration
-defined('DB_FILENAME') or define('DB_FILENAME', 'data'.DIRECTORY_SEPARATOR.'db.sqlite');
+defined('DB_FILENAME') or define('DB_FILENAME', DATA_DIR.DIRECTORY_SEPARATOR.'db.sqlite');
// Mysql/Postgres configuration
defined('DB_USERNAME') or define('DB_USERNAME', 'root');
@@ -82,9 +88,6 @@ defined('ENABLE_XFRAME') or define('ENABLE_XFRAME', true);
// Syslog
defined('ENABLE_SYSLOG') or define('ENABLE_SYSLOG', getenv('ENABLE_SYSLOG'));
-// Default files directory
-defined('FILES_DIR') or define('FILES_DIR', 'data'.DIRECTORY_SEPARATOR.'files');
-
// Escape html inside markdown text
defined('MARKDOWN_ESCAPE_HTML') or define('MARKDOWN_ESCAPE_HTML', true);