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 a58147e
Showing
13 changed files
with
418 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
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
89 changes: 89 additions & 0 deletions
89
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,89 @@ | ||
<?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 string | ||
*/ | ||
public function getDefaultNumberOfReplicas() | ||
{ | ||
return $this->getConfigParam('number_of_replicas_value'); | ||
} | ||
|
||
/** | ||
* @return bool | ||
*/ | ||
public function changeRefreshInterval() | ||
{ | ||
return (bool) $this->getConfigParam('refresh_interval'); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getDefaultRefreshInterval() | ||
{ | ||
return $this->getConfigParam('refresh_interval_value'); | ||
} | ||
|
||
/** | ||
* @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.