]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Install.php
Make BaseModule methods dynamic
[friendica.git] / src / Module / Install.php
index 95644ae6259b1e3aaa2e34ca118e3face19a7e16..8f872c683e4421cab608df6d6bbb4e093ddf0706 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -24,12 +24,12 @@ namespace Friendica\Module;
 use Friendica\App;
 use Friendica\BaseModule;
 use Friendica\Core;
-use Friendica\Core\Config\Cache;
+use Friendica\Core\Config\ValueObject\Cache;
 use Friendica\Core\Renderer;
+use Friendica\Core\Theme;
 use Friendica\DI;
 use Friendica\Network\HTTPException;
 use Friendica\Util\BasePath;
-use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
 class Install extends BaseModule
@@ -65,7 +65,7 @@ class Install extends BaseModule
         */
        private static $installer;
 
-       public static function init(array $parameters = [])
+       public function init()
        {
                $a = DI::app();
 
@@ -94,7 +94,7 @@ class Install extends BaseModule
                self::$currentWizardStep = ($_POST['pass'] ?? '') ?: self::SYSTEM_CHECK;
        }
 
-       public static function post(array $parameters = [])
+       public function post()
        {
                $a           = DI::app();
                $configCache = $a->getConfigCache();
@@ -162,12 +162,22 @@ class Install extends BaseModule
                                }
 
                                self::$installer->installDatabase($configCache->get('system', 'basepath'));
+                       
+                               // install allowed themes to register theme hooks
+                               // this is same as "Reload active theme" in /admin/themes
+                               $allowed_themes = Theme::getAllowedList();
+                               $allowed_themes = array_unique($allowed_themes);
+                               foreach ($allowed_themes as $theme) {
+                                       Theme::uninstall($theme);
+                                       Theme::install($theme);
+                               }
+                               Theme::setAllowedList($allowed_themes);
 
                                break;
                }
        }
 
-       public static function content(array $parameters = [])
+       public function content(): string
        {
                $a           = DI::app();
                $configCache = $a->getConfigCache();
@@ -360,19 +370,17 @@ class Install extends BaseModule
        /**
         * Checks the $_POST settings and updates the config Cache for it
         *
-        * @param Cache       $configCache The current config cache
-        * @param array       $post        The $_POST data
-        * @param string      $cat         The category of the setting
-        * @param string      $key         The key of the setting
-        * @param null|string $default     The default value
+        * @param \Friendica\Core\Config\ValueObject\Cache $configCache The current config cache
+        * @param array                                    $post        The $_POST data
+        * @param string                                   $cat         The category of the setting
+        * @param string                                   $key         The key of the setting
+        * @param null|string                              $default     The default value
         */
        private static function checkSetting(Cache $configCache, array $post, $cat, $key, $default = null)
        {
                $configCache->set($cat, $key,
-                       Strings::escapeTags(
-                               trim(($post[sprintf('%s-%s', $cat, $key)] ?? '') ?:
-                                               ($default ?? $configCache->get($cat, $key))
-                               )
+                       trim(($post[sprintf('%s-%s', $cat, $key)] ?? '') ?:
+                                       ($default ?? $configCache->get($cat, $key))
                        )
                );
        }