mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-13 10:30:16 +00:00
mediawiki: Fix issue with re-installation
Fixes #1288 Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
d8356c1a61
commit
b8d540446b
@ -30,6 +30,7 @@ from plinth.utils import generate_password, grep
|
|||||||
|
|
||||||
MAINTENANCE_SCRIPTS_DIR = "/usr/share/mediawiki/maintenance"
|
MAINTENANCE_SCRIPTS_DIR = "/usr/share/mediawiki/maintenance"
|
||||||
CONF_FILE = '/etc/mediawiki/FreedomBoxSettings.php'
|
CONF_FILE = '/etc/mediawiki/FreedomBoxSettings.php'
|
||||||
|
LOCAL_SETTINGS_CONF = '/etc/mediawiki/LocalSettings.php'
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
@ -71,7 +72,8 @@ def subcommand_setup(_):
|
|||||||
if not os.path.exists(data_dir):
|
if not os.path.exists(data_dir):
|
||||||
os.mkdir(data_dir)
|
os.mkdir(data_dir)
|
||||||
|
|
||||||
if not os.path.exists(os.path.join(data_dir, 'my_wiki.sqlite')):
|
if not os.path.exists(os.path.join(data_dir, 'my_wiki.sqlite')) or \
|
||||||
|
not os.path.exists(LOCAL_SETTINGS_CONF):
|
||||||
install_script = os.path.join(MAINTENANCE_SCRIPTS_DIR, 'install.php')
|
install_script = os.path.join(MAINTENANCE_SCRIPTS_DIR, 'install.php')
|
||||||
password = generate_password()
|
password = generate_password()
|
||||||
with tempfile.NamedTemporaryFile() as password_file_handle:
|
with tempfile.NamedTemporaryFile() as password_file_handle:
|
||||||
@ -90,9 +92,8 @@ def subcommand_setup(_):
|
|||||||
def include_custom_config():
|
def include_custom_config():
|
||||||
"""Include FreedomBox specific configuration in LocalSettings.php
|
"""Include FreedomBox specific configuration in LocalSettings.php
|
||||||
"""
|
"""
|
||||||
local_settings_conf = '/etc/mediawiki/LocalSettings.php'
|
if not grep(r'FreedomBoxSettings', LOCAL_SETTINGS_CONF):
|
||||||
if not grep(r'FreedomBoxSettings', local_settings_conf):
|
with open(LOCAL_SETTINGS_CONF, 'a') as conf_file:
|
||||||
with open(local_settings_conf, 'a') as conf_file:
|
|
||||||
conf_file.write(
|
conf_file.write(
|
||||||
'include dirname(__FILE__)."/FreedomBoxSettings.php";\n')
|
'include dirname(__FILE__)."/FreedomBoxSettings.php";\n')
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user