From 7146d40ea28db8f596658b4ebdd057ffad4a77a3 Mon Sep 17 00:00:00 2001 From: filmroellchen Date: Sun, 2 Feb 2025 12:52:38 +0100 Subject: [PATCH] minor settings updates and job runners --- orga_mediawiki/LocalSettings.php | 1 + public_mediawiki/LocalSettings.php | 25 +++++++++++++++++++++++-- smw-jobs.sh | 25 +++++++++++++++++++++++++ system/mediawiki-jobrunner@.service | 18 ++++++++++++++++++ system/semantic-mediawiki-jobs@.service | 13 +++++++++++++ system/semantic-mediawiki-jobs@.timer | 13 +++++++++++++ 6 files changed, 93 insertions(+), 2 deletions(-) create mode 100755 smw-jobs.sh create mode 100644 system/mediawiki-jobrunner@.service create mode 100644 system/semantic-mediawiki-jobs@.service create mode 100644 system/semantic-mediawiki-jobs@.timer diff --git a/orga_mediawiki/LocalSettings.php b/orga_mediawiki/LocalSettings.php index ecda7c4..4b2f7eb 100644 --- a/orga_mediawiki/LocalSettings.php +++ b/orga_mediawiki/LocalSettings.php @@ -188,5 +188,6 @@ $wgPluggableAuth_Config["Chaostreff Backnang IdP"] = [ # for better error reporting - disable while in production #error_reporting( -1 ); #ini_set( 'display_errors', 1 ); + #$wgShowExceptionDetails = true; #$wgShowDBErrorBacktrace = true; diff --git a/public_mediawiki/LocalSettings.php b/public_mediawiki/LocalSettings.php index 54c0411..3551693 100755 --- a/public_mediawiki/LocalSettings.php +++ b/public_mediawiki/LocalSettings.php @@ -163,10 +163,13 @@ wfLoadExtension( 'WikiEditor' ); wfLoadExtension( 'PluggableAuth' ); wfLoadExtension( 'OpenIDConnect' ); +$wgPFEnableStringFunctions = true; + +# SMW config wfLoadExtension( 'SemanticMediaWiki' ); enableSemantics( 'wiki.ctbk.de' ); - -# Add more configuration options below. +$smwgQueryResultCacheType = CACHE_ANYTHING; +$wgGroupPermissions['sysop']['smw-admin'] = true; # Disable account creation - we only use SSO accounts $wgGroupPermissions['*']['autocreateaccount'] = true; @@ -185,7 +188,19 @@ $wgPluggableAuth_Config["Chaostreff Backnang IdP"] = [ 'data' => [ 'providerURL' => 'https://idp.ctbk.de/realms/ctbk/', 'clientID' => 'public_mediawiki', + 'scope' => [ 'openid', 'profile', 'email', 'groups' ], 'clientsecret' => $ctbkClientSecret + ], + # use Keycloak group definitions to manage groups centrally + 'groupsyncs' => [ + [ + 'type' => 'mapped', + 'map' => [ + 'sysop' => [ 'groups' => '/mediawiki/admins' ], + 'buerocrat' => [ 'groups' => '/mediawiki/admins' ], + 'interface-admin' => [ 'groups' => '/mediawiki/admins' ] + ] + ] ] ]; @@ -202,3 +217,9 @@ $wgHideInterlanguageLinks = false; # uncomment this if Semantic MediaWiki property locking is broken #$smwgChangePropagationProtection = false; + +# SVG config +$wgFileExtensions[] = 'svg'; +# This extension will no longer be needed in MediaWiki >= 1.41, then $wgSVGNativeRendering can be used +wfLoadExtension( 'NativeSvgHandler' ); + diff --git a/smw-jobs.sh b/smw-jobs.sh new file mode 100755 index 0000000..000cf0e --- /dev/null +++ b/smw-jobs.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# ignore single script failures +set +e + +SMW_PATH=$1 + +set -x + +# not needed in our current config according to the documentation +#php "${SMW_PATH}/maintenance/updateSpecialPages.php" --quiet + +# recommended daily jobs +php "${SMW_PATH}/maintenance/rebuildData.php" --shallow-update +php "${SMW_PATH}/maintenance/disposeOutdatedEntities.php" +php "${SMW_PATH}/maintenance/rebuildPropertyStatistics.php" +php "${SMW_PATH}/maintenance/rebuildConceptCache.php" --update --create + +# recommended weekly jobs — we still run them daily to simplify the timers +php "${SMW_PATH}/maintenance/rebuildData.php" -d 100 +php "${SMW_PATH}/maintenance/setupStore.php" --skip-import + +# recommended monthly jobs +php "${SMW_PATH}/maintenance/removeDuplicateEntities.php" + diff --git a/system/mediawiki-jobrunner@.service b/system/mediawiki-jobrunner@.service new file mode 100644 index 0000000..4de5700 --- /dev/null +++ b/system/mediawiki-jobrunner@.service @@ -0,0 +1,18 @@ +[Unit] +Description=MediaWiki job runner %I +Documentation=https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:RunJobs.php + +[Service] +User=www-data +Group=www-data +ExecStart=/usr/bin/php /var/lib/%i/maintenance/runJobs.php --wait --maxjobs=50 +Restart=always +RestartSec=15 +RuntimeMaxSec=300 +PrivateDevices=true +PrivateTmp=true +ProtectHome=read-only + +[Install] +WantedBy=multi-user.target + diff --git a/system/semantic-mediawiki-jobs@.service b/system/semantic-mediawiki-jobs@.service new file mode 100644 index 0000000..ce8fcd9 --- /dev/null +++ b/system/semantic-mediawiki-jobs@.service @@ -0,0 +1,13 @@ +[Unit] +Description=Semantic MediaWiki job runner %I +Documentation=https://www.semantic-mediawiki.org/wiki/Help:Cron_jobs + +[Service] +User=www-data +Group=www-data +ExecStart=/usr/local/bin/smw-jobs /var/lib/%i/extensions/SemanticMediaWiki +RestartSec=15 +PrivateDevices=true +PrivateTmp=true +ProtectHome=read-only + diff --git a/system/semantic-mediawiki-jobs@.timer b/system/semantic-mediawiki-jobs@.timer new file mode 100644 index 0000000..9b15214 --- /dev/null +++ b/system/semantic-mediawiki-jobs@.timer @@ -0,0 +1,13 @@ +[Unit] +Description=Semantic MediaWiki job timer %I +Documentation=https://www.semantic-mediawiki.org/wiki/Help:Cron_jobs + +[Timer] +# run the jobs in the morning, after the backups happen +OnCalendar=*-*-* 04:00:00 +RandomizedDelaySec=1h +Unit=semantic-mediawiki-jobs@%i.service + +[Install] +WantedBy=timers.target +