mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-19 21:03:54 -07:00
Use native __DIR__ for BB_PATH (#702)
This commit is contained in:
parent
16e07952e8
commit
f7d9a1c53d
2 changed files with 8 additions and 12 deletions
15
common.php
15
common.php
|
@ -13,6 +13,7 @@ if (isset($_REQUEST['GLOBALS'])) {
|
|||
|
||||
define('TIMESTART', utime());
|
||||
define('TIMENOW', time());
|
||||
define('BB_PATH', __DIR__);
|
||||
|
||||
if (empty($_SERVER['REMOTE_ADDR'])) {
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
|
@ -42,13 +43,13 @@ if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
|
|||
}
|
||||
|
||||
// Get all constants
|
||||
require_once __DIR__ . '/library/defines.php';
|
||||
require_once BB_PATH . '/library/defines.php';
|
||||
|
||||
// Composer
|
||||
if (!file_exists(__DIR__ . '/vendor/autoload.php')) {
|
||||
if (!file_exists(BB_PATH . '/vendor/autoload.php')) {
|
||||
die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
|
||||
}
|
||||
require_once __DIR__ . '/vendor/autoload.php';
|
||||
require_once BB_PATH . '/vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* Gets the value of an environment variable.
|
||||
|
@ -63,13 +64,13 @@ function env(string $key, $default = null)
|
|||
}
|
||||
|
||||
// Get initial config
|
||||
$dotenv = Dotenv\Dotenv::createMutable(__DIR__);
|
||||
$dotenv = Dotenv\Dotenv::createMutable(BB_PATH);
|
||||
$dotenv->safeLoad();
|
||||
require_once __DIR__ . '/library/config.php';
|
||||
require_once BB_PATH . '/library/config.php';
|
||||
|
||||
// Local config
|
||||
if (file_exists(__DIR__ . '/library/config.local.php')) {
|
||||
require_once __DIR__ . '/library/config.local.php';
|
||||
if (file_exists(BB_PATH . '/library/config.local.php')) {
|
||||
require_once BB_PATH . '/library/config.local.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,11 +11,6 @@ if (!defined('BB_ROOT')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
// Root path
|
||||
$rootPath = __DIR__;
|
||||
if (DIRECTORY_SEPARATOR != '/') $rootPath = str_replace(DIRECTORY_SEPARATOR, '/', $rootPath);
|
||||
define('BB_PATH', dirname($rootPath));
|
||||
|
||||
// System
|
||||
define('CHECK_REQIREMENTS', [
|
||||
'status' => true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue