Install selected theme during settings persistence.

Themes have to be installed to be usable by the system. This is not done
automatically which lead to the problems with the site when themes where
switched right after the install and before the "Reload themes" button
was pressed in the admin page.

This patch makes sure that the selected them is always installed when
it is selected by the user either in the admin or settings page.

Fixes #4921.
This commit is contained in:
Andreas Neustifter 2018-04-27 20:45:34 +02:00
parent a19784d209
commit 846f8becae
2 changed files with 3 additions and 0 deletions

View file

@ -1120,6 +1120,7 @@ function admin_page_site_post(App $a)
} }
Config::set('system', 'language', $language); Config::set('system', 'language', $language);
Config::set('system', 'theme', $theme); Config::set('system', 'theme', $theme);
Theme::install($theme);
if ($theme_mobile == '---') { if ($theme_mobile == '---') {
Config::delete('system', 'mobile-theme'); Config::delete('system', 'mobile-theme');

View file

@ -12,6 +12,7 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBM; use Friendica\Database\DBM;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -354,6 +355,7 @@ function settings_post(App $a)
theme_post($a); theme_post($a);
} }
} }
Theme::install($theme);
$r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d", $r = q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
dbesc($theme), dbesc($theme),