mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
mediawiki: Fix problem with session cache failing logins
Set the session cache to use database. This will also have the added benefit of sessions persisting across reboots (and PHP session cleanups). See bug report on why this is needed. https://salsa.debian.org/freedombox-team/plinth/issues/1736 We are unfortunately modifying the MediaWiki settings that file that we are shipping when preferences are modified in the FreedomBox UI. This means that if a newer version of this settings file is shipped, then FreedomBox package will show configuration file prompts. To solve this, introduce a new static settings file that will have lower priority than the file modified by FreedomBox UI. Closes: #1736. Tests: - Test that running FreedomBox daemon with changes runs the MediaWiki app's setup and introduces the new line into LocalSettings.php - That LocalSettings.php will be populated with lines to include FreedomBoxStaticSettings.php and FreedomBoxSettings.php in that order when 'actions/mediawiki setup' is run. This should work when no lines are present, one of the lines is already present and both the lines are already present. - Test that running './setup.py install' installs FreedomBoxStaticSettings.php. - Test that MediaWiki runs without FreedomBoxStaticSettings.php - Test that private wiki and public registrations settings work with the new changes. - Run functional tests for MediaWiki app with the changes. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
89aefc00cf
commit
8a4fd1def4
@ -25,7 +25,7 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from plinth.utils import generate_password, grep
|
||||
from plinth.utils import generate_password
|
||||
|
||||
MAINTENANCE_SCRIPTS_DIR = "/usr/share/mediawiki/maintenance"
|
||||
CONF_FILE = '/etc/mediawiki/FreedomBoxSettings.php'
|
||||
@ -87,12 +87,30 @@ def subcommand_setup(_):
|
||||
|
||||
|
||||
def include_custom_config():
|
||||
"""Include FreedomBox specific configuration in LocalSettings.php
|
||||
"""
|
||||
if not grep(r'FreedomBoxSettings', LOCAL_SETTINGS_CONF):
|
||||
with open(LOCAL_SETTINGS_CONF, 'a') as conf_file:
|
||||
conf_file.write(
|
||||
'include dirname(__FILE__)."/FreedomBoxSettings.php";\n')
|
||||
"""Include FreedomBox specific configuration in LocalSettings.php."""
|
||||
with open(LOCAL_SETTINGS_CONF, 'r') as conf_file:
|
||||
lines = conf_file.readlines()
|
||||
|
||||
static_settings_index = None
|
||||
settings_index = None
|
||||
for line_number, line in enumerate(lines):
|
||||
if 'FreedomBoxSettings.php' in line:
|
||||
settings_index = line_number
|
||||
|
||||
if 'FreedomBoxStaticSettings.php' in line:
|
||||
static_settings_index = line_number
|
||||
|
||||
if settings_index is None:
|
||||
settings_index = len(lines)
|
||||
lines.append('include dirname(__FILE__)."/FreedomBoxSettings.php";\n')
|
||||
|
||||
if static_settings_index is None:
|
||||
lines.insert(
|
||||
settings_index,
|
||||
'include dirname(__FILE__)."/FreedomBoxStaticSettings.php";\n')
|
||||
|
||||
with open(LOCAL_SETTINGS_CONF, 'w') as conf_file:
|
||||
conf_file.writelines(lines)
|
||||
|
||||
|
||||
def subcommand_change_password(arguments):
|
||||
|
||||
@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall
|
||||
|
||||
from .manifest import backup, clients # noqa, pylint: disable=unused-import
|
||||
|
||||
version = 6
|
||||
version = 7
|
||||
|
||||
managed_packages = ['mediawiki', 'imagemagick', 'php-sqlite3']
|
||||
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/*
|
||||
This file is shipped by FreedomBox to manage static settings. Newer versions of
|
||||
this file are shipped by FreedomBox and are expected to override this file
|
||||
without any user prompts. It should not be modified by the system
|
||||
administrator. Additional setting modified by FreedomBox at placed in
|
||||
FreedomBoxSettings.php. No newer version of that file is ever shipped by
|
||||
FreedomBox.
|
||||
*/
|
||||
|
||||
# Default logo
|
||||
$wgLogo = "$wgResourceBasePath/resources/assets/mediawiki.png";
|
||||
|
||||
# Enable file uploads
|
||||
$wgEnableUploads = true;
|
||||
|
||||
# Public registrations
|
||||
$wgGroupPermissions['*']['createaccount'] = false;
|
||||
|
||||
# Read/write permissions for anonymous users
|
||||
$wgGroupPermissions['*']['edit'] = false;
|
||||
$wgGroupPermissions['*']['read'] = true;
|
||||
|
||||
# Short urls
|
||||
$wgArticlePath = "/mediawiki/$1";
|
||||
$wgUsePathInfo = true;
|
||||
|
||||
# Instant Commons
|
||||
$wgUseInstantCommons = true;
|
||||
|
||||
# SVG Enablement
|
||||
$wgFileExtensions[] = 'svg';
|
||||
$wgAllowTitlesInSVG = true;
|
||||
$wgSVGConverter = 'ImageMagick';
|
||||
|
||||
# Fix issue with session cache preventing logins, #1736
|
||||
$wgSessionCacheType = CACHE_DB;
|
||||
Loading…
x
Reference in New Issue
Block a user