forked from Sky/Dragon-Knight
Update path to database
This commit is contained in:
parent
51a65506c1
commit
c615a978e4
@ -34,10 +34,6 @@ if (! $autoloader = require file_exists(__DIR__.'/../vendor/autoload.php') ? __D
|
|||||||
// Check required extensions
|
// Check required extensions
|
||||||
$requiredExtensions = [
|
$requiredExtensions = [
|
||||||
'sqlite3',
|
'sqlite3',
|
||||||
'gd',
|
|
||||||
'imap',
|
|
||||||
'redis',
|
|
||||||
'mongodb'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($missing = array_filter($requiredExtensions, fn($ext) => !extension_loaded($ext))) {
|
if ($missing = array_filter($requiredExtensions, fn($ext) => !extension_loaded($ext))) {
|
||||||
|
@ -15,7 +15,6 @@ namespace DragonKnight;
|
|||||||
|
|
||||||
use DragonKnight\Actions\Install;
|
use DragonKnight\Actions\Install;
|
||||||
|
|
||||||
define('DRAGONKNIGHTBOT_START', microtime(true));
|
|
||||||
ini_set('display_errors', 1);
|
ini_set('display_errors', 1);
|
||||||
error_reporting(E_ALL);
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ ignore_user_abort(true);
|
|||||||
ini_set('max_execution_time', 0);
|
ini_set('max_execution_time', 0);
|
||||||
ini_set('memory_limit', '-1'); // Unlimited memory usage
|
ini_set('memory_limit', '-1'); // Unlimited memory usage
|
||||||
|
|
||||||
function loadEnv(string $filePath = __DIR__.'/.env'): void
|
function loadEnv(string $filePath = __DIR__.'/../.env'): void
|
||||||
{
|
{
|
||||||
if (! file_exists($filePath)) {
|
if (! file_exists($filePath)) {
|
||||||
throw new \Exception('The .env file does not exist.');
|
throw new \Exception('The .env file does not exist.');
|
||||||
@ -41,9 +40,9 @@ function loadEnv(string $filePath = __DIR__.'/.env'): void
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
loadEnv(getcwd().'/.env');
|
loadEnv(getcwd().'/../.env');
|
||||||
|
|
||||||
if (! $autoloader = require file_exists(__DIR__.'/vendor/autoload.php') ? __DIR__.'/vendor/autoload.php' : __DIR__.'/../../autoload.php') {
|
if (! $autoloader = require file_exists(__DIR__.'/../vendor/autoload.php') ? __DIR__.'/../vendor/autoload.php' : __DIR__.'/../../autoload.php') {
|
||||||
throw new \Exception('Composer autoloader not found. Run `composer install` and try again.');
|
throw new \Exception('Composer autoloader not found. Run `composer install` and try again.');
|
||||||
}
|
}
|
||||||
|
|
@ -132,12 +132,12 @@ function babblebox_messages(): string
|
|||||||
*/
|
*/
|
||||||
function db(): Database
|
function db(): Database
|
||||||
{
|
{
|
||||||
if (! is_dir($path = getcwd().'/db')) {
|
if (! is_dir($path = __DIR__.'/../../db')) {
|
||||||
error_log('Database folder not found at '.$path.'. Please run the installer first.');
|
error_log('Database folder not found at '.$path.'. Please run the installer first.');
|
||||||
throw new \RuntimeException('Database folder not found. Please run the installer first.');
|
throw new \RuntimeException("Database folder not found at $path. Please run the installer first.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $GLOBALS['database'] ??= new Database(getcwd().'/db/database.db');
|
return $GLOBALS['database'] ??= new Database($path.'/database.db');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -681,7 +681,7 @@ function is_post(): bool
|
|||||||
/**
|
/**
|
||||||
* Get the current page title per updates. Optionally set a new title.
|
* Get the current page title per updates. Optionally set a new title.
|
||||||
*/
|
*/
|
||||||
function page_title(?string $new_title = null): string
|
function page_title(?string $new_title = null): ?string
|
||||||
{
|
{
|
||||||
if ($new_title) {
|
if ($new_title) {
|
||||||
return $GLOBALS['state']['new-page-title'] = $new_title;
|
return $GLOBALS['state']['new-page-title'] = $new_title;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user