Page MenuHomeDevCentral

No OneTemporary

diff --git a/src/Environment.php b/src/Environment.php
index 69dedeb..0ebe73c 100644
--- a/src/Environment.php
+++ b/src/Environment.php
@@ -1,59 +1,59 @@
<?php
namespace Nasqueron\SAAS\MediaWiki;
use Dotenv\Dotenv;
use Dotenv\Exception\ValidationException;
class Environment {
/**
* @var bool
*/
static private $isLoaded = false;
/**
* Loads the environment, if it hasn't been loaded before.
*/
public static function load () : void {
if (!self::$isLoaded) {
$directory = self::getDirectory();
$dotenv = new Dotenv($directory);
$dotenv->safeLoad();
try {
$dotenv->required(self::getRequiredVariables());
} catch (ValidationException $exception) {
Service::serveInternalErrorResponse($exception);
}
self::$isLoaded = true;
}
}
public static function isLoaded () : bool {
return self::$isLoaded;
}
public static function get ($variableName, $defaultValue = "") : string {
return $_ENV[$variableName] ?? $defaultValue;
}
private static function getDirectory () : string {
return dirname(__DIR__);
}
private static function getRequiredVariables () : array {
return [
'MEDIAWIKI_ENTRY_POINT',
'MEDIAWIKI_SECRET_KEY',
'DB_HOST',
'DB_USER',
'DB_PASS',
];
}
public static function isBSD () : bool {
static $system;
$system = php_uname("s");
- return $system == "FreeBSD" || $system == "OpenBSD" || $system == "NetBSD";
+ return substr($system, -3) === "BSD" || $system === "DragonFly";
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Sep 18, 22:09 (7 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2991838
Default Alt Text
(1 KB)

Event Timeline