Page MenuHomeDevCentral

D3742.diff
No OneTemporary

D3742.diff

diff --git a/LocalSettings.php b/LocalSettings.php
--- a/LocalSettings.php
+++ b/LocalSettings.php
@@ -64,6 +64,7 @@
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CommonSettings::fixGroupPermissions($saasExtraGroupPermissions);
+CommonSettings::setReadOnly($saasReadOnly);
if ($saasUseScribunto) {
CommonSettings::enableScribunto();
diff --git a/composer.json b/composer.json
--- a/composer.json
+++ b/composer.json
@@ -18,7 +18,8 @@
"require": {
"vlucas/phpdotenv": "^5.5.0",
"nasqueron/saas-service": "^0.0.2",
- "keruald/commands": "^0.0.1"
+ "keruald/commands": "^0.0.1",
+ "keruald/omnitools": "^0.14.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
diff --git a/config/CommonSettings.php b/config/CommonSettings.php
--- a/config/CommonSettings.php
+++ b/config/CommonSettings.php
@@ -2,6 +2,7 @@
namespace Nasqueron\SAAS\MediaWiki\Configuration;
+use Keruald\OmniTools\DataTypes\Option\Option;
use Nasqueron\SAAS\ConfigurationException;
use Nasqueron\SAAS\MediaWiki\WithExecutablesPathsFix;
use Nasqueron\SAAS\MediaWiki\WithLog;
@@ -13,6 +14,8 @@
use WithScribunto;
use WithLog;
+ const CACHE_NONE = 0;
+
///
/// Individual set of settings
///
@@ -87,6 +90,35 @@
}
}
+ /**
+ * Set the wiki in read-only mode
+ */
+ public static function setReadOnly (Option $readOnlyMessage) : void {
+ if ($readOnlyMessage->isNone() || PHP_SAPI === "cli") {
+ return;
+ }
+
+ global $wgReadOnly;
+ global $wgMessageCacheType;
+ global $wgMainCacheType;
+ global $wgParserCacheType;
+ global $wgSessionCacheType;
+ global $wgLocalisationCacheConf;
+ global $wgIgnoreImageErrors;
+
+ $wgReadOnly = $readOnlyMessage->getValue();
+
+ // DB caching
+ $wgMessageCacheType = self::CACHE_NONE;
+ $wgMainCacheType = self::CACHE_NONE;
+ $wgParserCacheType = self::CACHE_NONE;
+ $wgSessionCacheType = self::CACHE_NONE;
+ $wgLocalisationCacheConf["storeClass"] = "LCStoreNull";
+
+ // Thumbnails
+ $wgIgnoreImageErrors = true;
+ }
+
///
/// Helper methods to apply those settings fix
///
diff --git a/config/Settings.php b/config/Settings.php
--- a/config/Settings.php
+++ b/config/Settings.php
@@ -2,6 +2,8 @@
namespace Nasqueron\SAAS\MediaWiki\Configuration;
+use Keruald\OmniTools\DataTypes\Option\None;
+
class Settings extends MappableSettings {
static public function getDatabaseMap () : array {
@@ -15,6 +17,14 @@
static public function getMappedSettings () : array {
return [
+ ///
+ /// Maintenance
+ ///
+
+ 'saasReadOnly' => [
+ 'default' => new None,
+ ],
+
///
/// MediaWiki Core
///

File Metadata

Mime Type
text/plain
Expires
Tue, Oct 14, 20:30 (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3074597
Default Alt Text
D3742.diff (2 KB)

Event Timeline