Skip to content

Commit

Permalink
#1251 Change name Application_Configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
j3nsch committed Oct 30, 2024
1 parent 92f66a8 commit db81d06
Show file tree
Hide file tree
Showing 48 changed files with 145 additions and 79 deletions.
5 changes: 3 additions & 2 deletions library/Application/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\Log\LogService;
use Opus\Common\Repository;
use Opus\Db\DatabaseBootstrap;
Expand Down Expand Up @@ -274,7 +275,7 @@ protected function _initTranslation()

Application_Translate::setInstance($translate);

$configHelper = new Application_Configuration();
$configHelper = new Configuration();

$session = $this->getResource('Session');

Expand Down Expand Up @@ -379,7 +380,7 @@ protected function _initVersionInfo()
{
$this->bootstrap('View');
$view = $this->getResource('View');
$view->headMeta()->appendName('Opus-Version', Application_Configuration::getOpusVersion());
$view->headMeta()->appendName('Opus-Version', Configuration::getOpusVersion());
}

/**
Expand Down
5 changes: 3 additions & 2 deletions library/Application/Configuration/Workspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\OpusException;

/**
* Checking of information about workspace.
*/
class Application_Configuration_Workspace
class Configuration_Workspace
{
/**
* @return array
* @throws OpusException
*/
public function getFolders()
{
$workspacePath = Application_Configuration::getInstance()->getWorkspacePath();
$workspacePath = Configuration::getInstance()->getWorkspacePath();

$folders = [];

Expand Down
3 changes: 2 additions & 1 deletion library/Application/Console/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\Console\DefaultCommandProvider;
use Opus\Job\TaskManager;
use Opus\Pdf\Console\CoverGenerateCommand;
Expand All @@ -43,7 +44,7 @@ class Application_Console_App extends Application
{
public function __construct()
{
parent::__construct('OPUS 4 Console Tool', Application_Configuration::getOpusVersion());
parent::__construct('OPUS 4 Console Tool', Configuration::getOpusVersion());

$commandProvider = new DefaultCommandProvider();
$commands = $commandProvider->getCommands();
Expand Down
3 changes: 2 additions & 1 deletion library/Application/Controller/Action/Helper/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\LoggingTrait;

/**
Expand Down Expand Up @@ -82,7 +83,7 @@ public function setView($view)
public function getConfig()
{
if ($this->config === null) {
$this->config = Application_Configuration::getInstance()->getConfig();
$this->config = Configuration::getInstance()->getConfig();
}

return $this->config;
Expand Down
3 changes: 2 additions & 1 deletion library/Application/Controller/ModuleAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\LoggingTrait;
use Opus\Common\Security\Realm;

Expand Down Expand Up @@ -237,7 +238,7 @@ public function moduleAccessDeniedAction()
public function getConfig()
{
if ($this->config === null) {
$this->config = Application_Configuration::getInstance()->getConfig();
$this->config = Configuration::getInstance()->getConfig();
}
return $this->config;
}
Expand Down
3 changes: 2 additions & 1 deletion library/Application/Form/Element/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\Translate\TranslateException;
use Opus\Common\Translate\UnknownTranslationKeyException;

Expand Down Expand Up @@ -68,7 +69,7 @@ public function init()

public function loadDefaultOptions()
{
$languages = Application_Configuration::getInstance()->getSupportedLanguages();
$languages = Configuration::getInstance()->getSupportedLanguages();

$options = [];

Expand Down
4 changes: 3 additions & 1 deletion library/Application/Form/Validate/Filename.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* Class Application_Form_Validate_uploadFilenameCheck validates the filename.
*
Expand Down Expand Up @@ -137,7 +139,7 @@ public function setFilenameFormat($value)
*/
public function validateFilenameFormat($value)
{
$logger = Application_Configuration::getInstance()->getLogger();
$logger = Configuration::getInstance()->getLogger();

if (@preg_match($value, null) === false) {
$logger->warn('Your regular expression for your filename-validation is not valid.');
Expand Down
4 changes: 3 additions & 1 deletion library/Application/Form/Validate/Identifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* Validator that delegates validation of identifiers depending on the type.
*
Expand Down Expand Up @@ -73,7 +75,7 @@ public function isValid($value)
$this->_setValue($value);

$type = strtolower($this->element->getValue());
$config = Application_Configuration::getInstance()->getConfig();
$config = Configuration::getInstance()->getConfig();

if (isset($config->identifier->validation->$type->class)) {
$validatorClass = $config->identifier->validation->$type->class;
Expand Down
4 changes: 3 additions & 1 deletion library/Application/Search/FacetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* TODO allow adding search path for types
*/
Expand Down Expand Up @@ -101,7 +103,7 @@ public function getFacetConfig($name)
public function getConfig()
{
if ($this->config === null) {
$this->config = Application_Configuration::getInstance()->getConfig();
$this->config = Configuration::getInstance()->getConfig();
}
return $this->config;
}
Expand Down
5 changes: 3 additions & 2 deletions library/Application/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Application\Modules;
use Opus\Common\Config;
use Opus\Common\LoggingTrait;
Expand Down Expand Up @@ -145,7 +146,7 @@ public function loadDatabase($reload = false)
'reload' => $reload,
]);

$locales = Application_Configuration::getInstance()->getSupportedLanguages();
$locales = Configuration::getInstance()->getSupportedLanguages();

foreach ($locales as $locale) {
$this->addTranslation([
Expand Down Expand Up @@ -269,7 +270,7 @@ public function getTranslations($key)
return null;
}

$languages = Application_Configuration::getInstance()->getSupportedLanguages();
$languages = Configuration::getInstance()->getSupportedLanguages();

$translations = [];

Expand Down
3 changes: 2 additions & 1 deletion library/Application/Translate/TranslationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Application\Modules;
use Opus\Common\Translate\TranslateException;
use Opus\Common\Translate\UnknownTranslationKeyException;
Expand Down Expand Up @@ -296,7 +297,7 @@ protected function sortLanguages($translations)
protected function getLanguageOrderRef()
{
if ($this->languageOrderRef === null) {
$this->languageOrderRef = array_flip(Application_Configuration::getInstance()->getSupportedLanguages());
$this->languageOrderRef = array_flip(Configuration::getInstance()->getSupportedLanguages());
}

return $this->languageOrderRef;
Expand Down
3 changes: 2 additions & 1 deletion library/Application/Update/AddImportToWorkspace.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\Console\ConsoleColors;

/**
Expand All @@ -40,7 +41,7 @@ public function run()
{
$this->log('Checking import folder in workspace');

$workspacePath = Application_Configuration::getInstance()->getWorkspacePath();
$workspacePath = Configuration::getInstance()->getWorkspacePath();

$importPath = rtrim($workspacePath, '/') . '/import';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\CollectionRole;
use Opus\Common\Console\ConsoleColors;
use Opus\Common\Translate\UnknownTranslationKeyException;
Expand Down Expand Up @@ -62,7 +63,7 @@ public function run()
$this->log($colors->red("Collection role (id = $roleId) name is invalid (\"$name\")"));

// create translation values using invalid collection role name
$supportedLanguages = Application_Configuration::getInstance()->getSupportedLanguages();
$supportedLanguages = Configuration::getInstance()->getSupportedLanguages();
$translations = [];
foreach ($supportedLanguages as $lang) {
$translations[$lang] = $name;
Expand Down
4 changes: 3 additions & 1 deletion library/Application/Util/WorkspaceCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* TODO maybe merge with a Workspace or Mainenance or "whatever" class
*/
Expand All @@ -39,7 +41,7 @@ class Application_Util_WorkspaceCache
*/
public function clearTranslations()
{
$files = new DirectoryIterator(Application_Configuration::getInstance()->getWorkspacePath() . '/cache');
$files = new DirectoryIterator(Configuration::getInstance()->getWorkspacePath() . '/cache');

foreach ($files as $file) {
$basename = $file->getBasename();
Expand Down
3 changes: 2 additions & 1 deletion library/Application/View/Helper/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;
use Opus\Common\LoggingTrait;

/**
Expand All @@ -45,6 +46,6 @@ class Application_View_Helper_Abstract extends Zend_View_Helper_Abstract
*/
public function getConfig()
{
return Application_Configuration::getInstance()->getConfig();
return Configuration::getInstance()->getConfig();
}
}
4 changes: 3 additions & 1 deletion library/Application/View/Helper/IsDisplayField.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

class Application_View_Helper_IsDisplayField extends Zend_View_Helper_Abstract
{
/**
Expand All @@ -39,7 +41,7 @@ class Application_View_Helper_IsDisplayField extends Zend_View_Helper_Abstract
*/
public function isDisplayField($name)
{
$config = Application_Configuration::getInstance()->getConfig();
$config = Configuration::getInstance()->getConfig();

if ($config === null) {
return false;
Expand Down
4 changes: 3 additions & 1 deletion library/Application/View/Helper/LanguageSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* Builds the language selection form.
*/
Expand All @@ -49,7 +51,7 @@ public function languageSelector()

$currentLocale = new Zend_Locale(Application_Translate::getInstance()->getLocale());

$configHelper = new Application_Configuration();
$configHelper = new Configuration();

// only show languages that are present in resources and activated in configuration
$translations = Application_Translate::getInstance()->getList();
Expand Down
4 changes: 3 additions & 1 deletion library/Application/View/Helper/OptionEnabled.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* Checks if a configuration option is activated,
*/
Expand All @@ -49,7 +51,7 @@ public function optionEnabled($optionKey, $context = null)
$key = "$context.$key";
}

$value = Application_Configuration::getInstance()->getValue($key);
$value = Configuration::getInstance()->getValue($key);

return filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
Expand Down
4 changes: 3 additions & 1 deletion library/Application/View/Helper/OptionUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* Gets a URL from a configuration option and renders it properly.
*
Expand All @@ -53,7 +55,7 @@ public function optionUrl($optionKey, $context = null)
$key = "$context.$key";
}

$value = Application_Configuration::getInstance()->getValue($key);
$value = Configuration::getInstance()->getValue($key);

$urlParts = parse_url($value);

Expand Down
4 changes: 3 additions & 1 deletion library/Application/View/Helper/OptionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

/**
* View helper for returning value of configuration option.
*
Expand Down Expand Up @@ -57,7 +59,7 @@ public function optionValue($optionKey, $context = null, $escape = false)
$key = "$context.$key";
}

$value = Application_Configuration::getInstance()->getValue($key);
$value = Configuration::getInstance()->getValue($key);

if ($escape) {
return htmlspecialchars($value);
Expand Down
4 changes: 3 additions & 1 deletion modules/admin/controllers/ConfigController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* @license http://www.gnu.org/licenses/gpl.html General Public License
*/

use Opus\Application\Configuration;

class Admin_ConfigController extends Application_Controller_Action
{
public function indexAction()
Expand All @@ -47,7 +49,7 @@ public function indexAction()
if ($form->isValid($data)) {
$config = new Zend_Config([], true);
$form->updateModel($config);
Application_Configuration::save($config);
Configuration::save($config);
} else {
break;
}
Expand Down
Loading

0 comments on commit db81d06

Please sign in to comment.