From 8f3e6ea60d3c46f9b6207e0b8f9d00f02debf4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Dufraisse?= Date: Fri, 15 Sep 2023 19:45:14 +0200 Subject: [PATCH] refactor($this->wiki->configFile): use when needed --- handlers/UpdateHandler.php | 2 +- handlers/page/dbutf8.php | 2 +- includes/services/ArchiveService.php | 6 +++--- tools/templates/actions/SetWikiDefaultThemeAction.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/handlers/UpdateHandler.php b/handlers/UpdateHandler.php index 0d75419d2..b5527c5d9 100644 --- a/handlers/UpdateHandler.php +++ b/handlers/UpdateHandler.php @@ -288,7 +288,7 @@ private function updateDefaultCommentsAcls(): string $output = "ℹ️ Resetting comment acls
"; // default acls in wakka.config.php - $config = $this->getService(ConfigurationService::class)->getConfiguration('wakka.config.php'); + $config = $this->getService(ConfigurationService::class)->getConfiguration($this->wiki->configFile); $config->load(); $baseKey = 'default_comment_acl'; diff --git a/handlers/page/dbutf8.php b/handlers/page/dbutf8.php index 601ad7c2a..0e9099466 100644 --- a/handlers/page/dbutf8.php +++ b/handlers/page/dbutf8.php @@ -92,7 +92,7 @@ $output .= "

Complete ALL

"; // ajout du charset utf8mb4 dans wakka.config.php - $config = $this->services->get(ConfigurationService::class)->getConfiguration('wakka.config.php'); + $config = $this->services->get(ConfigurationService::class)->getConfiguration($this->wiki->configFile); $config->load(); $config->db_charset = 'utf8mb4'; $config->write(); diff --git a/includes/services/ArchiveService.php b/includes/services/ArchiveService.php index ee402f802..8cad98656 100644 --- a/includes/services/ArchiveService.php +++ b/includes/services/ArchiveService.php @@ -905,7 +905,7 @@ private function writeOutput(&$output, string $text, bool $newline = true, strin private function getWakkaConfigSanitized(array $foldersToInclude, array $foldersToExclude, ?array $hideConfigValuesParams = null): string { // get wakka.config.php content - $config = $this->configurationService->getConfiguration('wakka.config.php'); + $config = $this->configurationService->getConfiguration($this->wiki->configFile); $config->load(); if (!isset($config[self::PARAMS_KEY_IN_WAKKA]) || !is_array($config[self::PARAMS_KEY_IN_WAKKA])) { @@ -950,14 +950,14 @@ private function setDefaultValuesRecursive(array $defaultValues, $values) protected function setWikiStatus() { - $config = $this->configurationService->getConfiguration('wakka.config.php'); + $config = $this->configurationService->getConfiguration($this->wiki->configFile); $config->load(); $config['wiki_status'] = 'archiving'; $this->configurationService->write($config); } protected function unsetWikiStatus() { - $config = $this->configurationService->getConfiguration('wakka.config.php'); + $config = $this->configurationService->getConfiguration($this->wiki->configFile); $config->load(); unset($config['wiki_status']); $this->configurationService->write($config); diff --git a/tools/templates/actions/SetWikiDefaultThemeAction.php b/tools/templates/actions/SetWikiDefaultThemeAction.php index 0c0b327b1..866a3f198 100644 --- a/tools/templates/actions/SetWikiDefaultThemeAction.php +++ b/tools/templates/actions/SetWikiDefaultThemeAction.php @@ -20,7 +20,7 @@ public function run() 'message' => _t('ERROR_NO_ACCESS'). " setwikidefaulttheme" ]); } - if (!is_writable('wakka.config.php')) { + if (!is_writable($this->wiki->configFile)) { return $this->render('@templates/alert-message.twig',[ 'type' => 'danger', 'message' => _t('ERROR_NO_ACCESS'). " setwikidefaulttheme, "._t('FILE_WRITE_PROTECTED') @@ -32,7 +32,7 @@ public function run() $this->themeManager = $this->getService(ThemeManager::class); $themes = $this->getTemplatesList(); - $config = $this->getService(ConfigurationService::class)->getConfiguration('wakka.config.php'); + $config = $this->getService(ConfigurationService::class)->getConfiguration($this->wiki->configFile); $config->load(); if (isset($_POST['action']) and $_POST['action'] === 'setTemplate') {