forked from vuestorefront/magento2-vsbridge-indexer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vuestorefront#308: Secure vsbridge reindexing
- Loading branch information
1 parent
b5e0f72
commit d6090c6
Showing
11 changed files
with
411 additions
and
1 deletion.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
73 changes: 73 additions & 0 deletions
73
src/module-vsbridge-indexer-core/Config/OptimizationSettings.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,73 @@ | ||
<?php | ||
/** | ||
* Copyright Divante Sp. z o.o. | ||
* See LICENSE_DIVANTE.txt for license details. | ||
*/ | ||
|
||
namespace Divante\VsbridgeIndexerCore\Config; | ||
|
||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
|
||
class OptimizationSettings | ||
{ | ||
const OPTIMIZATION_SETTINGS_CONFIG_XML_PREFIX = 'vsbridge_indexer_settings/optimization_settings'; | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
private $scopeConfig; | ||
|
||
/** | ||
* ClientConfiguration constructor. | ||
* | ||
* @param ScopeConfigInterface $scopeConfig | ||
*/ | ||
public function __construct(ScopeConfigInterface $scopeConfig) | ||
{ | ||
$this->scopeConfig = $scopeConfig; | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function checkClusterHealth() | ||
{ | ||
return (bool) $this->getConfigParam('cluster_health'); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function checkMaxBulkQueueRequirement() | ||
{ | ||
return (bool) $this->getConfigParam('max_bulk_queue_requirement'); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function changeNumberOfReplicas() | ||
{ | ||
return (bool) $this->getConfigParam('number_of_replicas'); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function changeRefreshInterval() | ||
{ | ||
return (bool) $this->getConfigParam('refresh_interval'); | ||
} | ||
|
||
/** | ||
* @param string $configField | ||
* | ||
* @return string|null | ||
*/ | ||
private function getConfigParam(string $configField) | ||
{ | ||
$path = self::OPTIMIZATION_SETTINGS_CONFIG_XML_PREFIX . '/' . $configField; | ||
|
||
return $this->scopeConfig->getValue($path); | ||
} | ||
} |
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
Oops, something went wrong.