forked from vufind-org/vufind
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Inheritance of local dirs for configuration files (vufind-org#2947)
- Loading branch information
Showing
5 changed files
with
134 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
; A parent local directory can be specified. When resolving paths to configuration | ||
; files this dir will also be searched if the file does not exist in the current dir. | ||
[Parent_Dir] | ||
; Path to the parent directory | ||
;path = | ||
; Whether the path is relative to this file (true) or absolute (false). | ||
; Defaults to false. | ||
;is_relative_path = | ||
|
||
; Configurations for this local directory | ||
[Local_Dir] | ||
; A custom config subdir can be configured. The default is config/vufind. | ||
;config_subdir = |
68 changes: 68 additions & 0 deletions
68
module/VuFind/src/VuFind/Config/Feature/IniReaderTrait.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
/** | ||
* Trait for creating INI readers | ||
* | ||
* PHP version 8 | ||
* | ||
* Copyright (C) Hebis Verbundzentrale 2023. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
* | ||
* @category VuFind | ||
* @package Config | ||
* @author Thomas Wagener <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Site | ||
*/ | ||
|
||
namespace VuFind\Config\Feature; | ||
|
||
use Laminas\Config\Reader\Ini as IniReader; | ||
|
||
/** | ||
* Trait for creating INI readers | ||
* | ||
* @category VuFind | ||
* @package Config | ||
* @author Thomas Wagener <[email protected]> | ||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License | ||
* @link https://vufind.org Main Site | ||
*/ | ||
trait IniReaderTrait | ||
{ | ||
/** | ||
* INI reader | ||
* | ||
* @var IniReader | ||
*/ | ||
protected $iniReader = null; | ||
|
||
/** | ||
* Creates INI reader if it does not exist and returns it. | ||
* | ||
* @return IniReader | ||
*/ | ||
protected function getIniReader() | ||
{ | ||
if (null == $this->iniReader) { | ||
// Use ASCII 0 as a nest separator; otherwise some of the unusual key names | ||
// we have (i.e. in WorldCat.ini search options) will get parsed in | ||
// unexpected ways. | ||
$this->iniReader = new IniReader(); | ||
$this->iniReader->setNestSeparator(chr(0)); | ||
} | ||
return $this->iniReader; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters