Skip to content

Commit

Permalink
fix(config): get good configuration file path
Browse files Browse the repository at this point in the history
  • Loading branch information
mrflos authored and J9rem committed Sep 15, 2023
1 parent 4c89a98 commit 83ec534
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions actions/EditConfigAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function run()
'message'=> get_class($this)." : " . _t('BAZ_NEED_ADMIN_RIGHTS')
]) ;
}
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'). ' '._t('FILE_WRITE_PROTECTED')
Expand Down Expand Up @@ -201,7 +201,7 @@ private function arrayIsList(array $array): bool
*/
private function save(): bool
{
$config = $this->configurationService->getConfiguration('wakka.config.php');
$config = $this->configurationService->getConfiguration($this->wiki->configFile);
$config->load();

$keysAsArray = $this->convertKeysAsArray($this->getAuthorizedKeys()[0]);
Expand Down Expand Up @@ -304,7 +304,7 @@ private function save(): bool
*/
private function getDataFromConfigFile(): array
{
$config = $this->configurationService->getConfiguration('wakka.config.php');
$config = $this->configurationService->getConfiguration($this->wiki->configFile);
$config->load();
$data = [];
$placeholders = [];
Expand Down
2 changes: 2 additions & 0 deletions includes/YesWiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Wiki
public $method;
public $page;
public $tag;
public $configFile;
public $parameter = array();
public $request;
// current output used for actions/handlers/formatters
Expand All @@ -74,6 +75,7 @@ public function __construct($config = array())
{
$init = new \YesWiki\Init($config);
$this->config = $init->config;
$this->configFile = $init->configFile;
$this->CookiePath = $init->initCookies();
$this->tag = $init->page;
$this->method = $init->method;
Expand Down
2 changes: 1 addition & 1 deletion includes/YesWikiInit.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct($config = array())
{
$this->getRoute();
if (!empty($_SERVER['YESWIKI_DATA_PATH']) && is_dir($_SERVER['YESWIKI_DATA_PATH'])) {
$this->configFile = $_SERVER['YESWIKI_DATA_PATH'].'/yeswiki.config.php';
$this->configFile = $_SERVER['YESWIKI_DATA_PATH'].'/'.$this->configFile;
}
$this->config = $this->getConfig($config);
$this->setIframeHeaders();
Expand Down

0 comments on commit 83ec534

Please sign in to comment.