mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
mediawiki: Use drop-in config component for /etc files
- Don't ship /etc/mediawiki/FreedomBoxSettings.php anymore. Create the file on first setup. Keep old file on update. - Simplify and unify how the configuration settings are read and written. Tests: - Run unit and functional tests. - All the drop-in config files in /etc/ are symlinks. - Shipped configuration is effective. - Upgrade from older version keeps old configuration. - Config files are all symlinks in /etc/ - When upgrading from older version FreedomBoxSettings.php does not change. FreedomBoxStaticSettings.php becomes a symlink. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
c326b35238
commit
cd512bd24c
8 files changed
+106
-174
No files matched your search
@@ -10,8 +10,7 @@ from plinth import app as app_module
|
||||
from plinth import views
|
||||
from plinth.modules import mediawiki
|
||||
|
||||
from . import (get_default_skin,
|
||||
get_server_url, get_site_name, get_default_language, privileged)
|
||||
from . import privileged
|
||||
from .forms import MediaWikiForm
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -27,20 +26,7 @@ class MediaWikiAppView(views.AppView):
|
||||
def get_initial(self):
|
||||
"""Return the values to fill in the form."""
|
||||
initial = super().get_initial()
|
||||
initial.update({
|
||||
'enable_public_registrations':
|
||||
privileged.public_registrations('status'),
|
||||
'enable_private_mode':
|
||||
privileged.private_mode('status'),
|
||||
'default_skin':
|
||||
get_default_skin(),
|
||||
'domain':
|
||||
get_server_url(),
|
||||
'site_name':
|
||||
get_site_name(),
|
||||
'default_lang':
|
||||
get_default_language()
|
||||
})
|
||||
initial.update(mediawiki.get_config())
|
||||
return initial
|
||||
|
||||
def form_valid(self, form):
|
||||
@@ -66,7 +52,7 @@ class MediaWikiAppView(views.AppView):
|
||||
# note action public-registration restarts, if running now
|
||||
if new_config['enable_public_registrations']:
|
||||
if not new_config['enable_private_mode']:
|
||||
privileged.public_registrations('enable')
|
||||
privileged.set_public_registrations(True)
|
||||
messages.success(self.request,
|
||||
_('Public registrations enabled'))
|
||||
else:
|
||||
@@ -74,19 +60,19 @@ class MediaWikiAppView(views.AppView):
|
||||
self.request, 'Public registrations ' +
|
||||
'cannot be enabled when private mode is enabled')
|
||||
else:
|
||||
privileged.public_registrations('disable')
|
||||
privileged.set_public_registrations(False)
|
||||
messages.success(self.request,
|
||||
_('Public registrations disabled'))
|
||||
|
||||
if is_changed('enable_private_mode'):
|
||||
if new_config['enable_private_mode']:
|
||||
privileged.private_mode('enable')
|
||||
privileged.set_private_mode(True)
|
||||
messages.success(self.request, _('Private mode enabled'))
|
||||
if new_config['enable_public_registrations']:
|
||||
# If public registrations are enabled, then disable it
|
||||
privileged.public_registrations('disable')
|
||||
privileged.set_public_registrations(False)
|
||||
else:
|
||||
privileged.private_mode('disable')
|
||||
privileged.set_private_mode(False)
|
||||
messages.success(self.request, _('Private mode disabled'))
|
||||
|
||||
app = app_module.App.get('mediawiki')
|
||||
|
||||
Reference in new issue
Block a user