Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11725849
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
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
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Sep 18, 22:09 (26 m, 43 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2991838
Default Alt Text
(1 KB)
Attached To
Mode
rSAASMW SaaS MediaWiki
Attached
Detach File
Event Timeline
Log In to Comment