mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +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:
1 parent
89aefc00cf
commit
8a4fd1def4
3 files changed
+63
-8
No files matched your search
+25
-7
@@ -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):
|
||||
|
||||
Reference in new issue
Block a user