Skip to content

Commit fb74bdb

Browse files
committed
MAGE-1374 Restore changes introduced on PR #1779
1 parent 48e448a commit fb74bdb

File tree

1 file changed

+75
-48
lines changed

1 file changed

+75
-48
lines changed

Helper/ConfigHelper.php

Lines changed: 75 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Algolia\AlgoliaSearch\Api\Product\ReplicaManagerInterface;
66
use Algolia\AlgoliaSearch\Helper\Configuration\AutocompleteHelper;
77
use Algolia\AlgoliaSearch\Helper\Configuration\InstantSearchHelper;
8+
use Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper;
89
use Algolia\AlgoliaSearch\Service\AlgoliaConnector;
910
use Algolia\AlgoliaSearch\Service\Serializer;
1011
use Magento\Cookie\Helper\Cookie as CookieHelper;
@@ -84,13 +85,6 @@ class ConfigHelper
8485
public const XML_PATH_IMAGE_HEIGHT = 'algoliasearch_images/image/height';
8586
public const XML_PATH_IMAGE_TYPE = 'algoliasearch_images/image/type';
8687

87-
// --- Indexing Queue / Cron --- //
88-
89-
public const IS_ACTIVE = 'algoliasearch_queue/queue/active';
90-
public const USE_BUILT_IN_CRON = 'algoliasearch_queue/queue/use_built_in_cron';
91-
public const NUMBER_OF_JOB_TO_RUN = 'algoliasearch_queue/queue/number_of_job_to_run';
92-
public const RETRY_LIMIT = 'algoliasearch_queue/queue/number_of_retries';
93-
9488
// --- Indexing Manager --- //
9589

9690
public const ENABLE_INDEXING = 'algoliasearch_indexing_manager/algolia_indexing/enable_indexing';
@@ -177,7 +171,8 @@ public function __construct(
177171
protected GroupExcludedWebsiteRepositoryInterface $groupExcludedWebsiteRepository,
178172
protected CookieHelper $cookieHelper,
179173
protected AutocompleteHelper $autocompleteConfig,
180-
protected InstantSearchHelper $instantSearchConfig
174+
protected InstantSearchHelper $instantSearchConfig,
175+
protected QueueHelper $queueHelper
181176
)
182177
{}
183178

@@ -943,46 +938,6 @@ public function getImageType($storeId = null)
943938
return $this->configInterface->getValue(self::XML_PATH_IMAGE_TYPE, ScopeInterface::SCOPE_STORE, $storeId);
944939
}
945940

946-
// --- Indexing Queue / Cron --- //
947-
948-
/**
949-
* @param $storeId
950-
* @return mixed
951-
*/
952-
public function getNumberOfJobToRun($storeId = null): int
953-
{
954-
$nbJobs = (int) $this->configInterface->getValue(self::NUMBER_OF_JOB_TO_RUN, ScopeInterface::SCOPE_STORE, $storeId);
955-
956-
return (int) max($nbJobs, 1);
957-
}
958-
959-
/**
960-
* @param $storeId
961-
* @return int
962-
*/
963-
public function getRetryLimit($storeId = null): int
964-
{
965-
return (int) $this->configInterface->getValue(self::RETRY_LIMIT, ScopeInterface::SCOPE_STORE, $storeId);
966-
}
967-
968-
/**
969-
* @param $storeId
970-
* @return bool
971-
*/
972-
public function isQueueActive($storeId = null): bool
973-
{
974-
return $this->configInterface->isSetFlag(self::IS_ACTIVE, ScopeInterface::SCOPE_STORE, $storeId);
975-
}
976-
977-
/**
978-
* @param $storeId
979-
* @return bool
980-
*/
981-
public function useBuiltInCron($storeId = null): bool
982-
{
983-
return $this->configInterface->isSetFlag(self::USE_BUILT_IN_CRON, ScopeInterface::SCOPE_STORE, $storeId);
984-
}
985-
986941
// --- Indexing Manager --- //
987942

988943
/**
@@ -1740,6 +1695,32 @@ public function getCacheTime($storeId = null)
17401695
*/
17411696
public const LEGACY_USE_VIRTUAL_REPLICA_ENABLED = 'algoliasearch_instant/instant/use_virtual_replica';
17421697

1698+
// --- Indexing Queue / Cron --- //
1699+
1700+
/**
1701+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1702+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::IS_ACTIVE
1703+
*/
1704+
public const IS_ACTIVE = QueueHelper::IS_ACTIVE;
1705+
1706+
/**
1707+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1708+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::USE_BUILT_IN_CRON
1709+
*/
1710+
public const USE_BUILT_IN_CRON = QueueHelper::USE_BUILT_IN_CRON;
1711+
1712+
/**
1713+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1714+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::NUMBER_OF_JOB_TO_RUN
1715+
*/
1716+
public const NUMBER_OF_JOB_TO_RUN = QueueHelper::NUMBER_OF_JOB_TO_RUN;
1717+
1718+
/**
1719+
* @deprecated This constant has been moved to a domain specific config helper and will be removed in a future release
1720+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::RETRY_LIMIT
1721+
*/
1722+
public const RETRY_LIMIT = QueueHelper::RETRY_LIMIT;
1723+
17431724
// --- Indexing Manager --- //
17441725

17451726
/**
@@ -2088,6 +2069,52 @@ public function hidePaginationInInstantSearchPage($storeId = null)
20882069
return $this->instantSearchConfig->shouldHidePagination($storeId);
20892070
}
20902071

2072+
// --- Indexing Queue / Cron --- //
2073+
2074+
/**
2075+
* @param $storeId
2076+
* @return bool
2077+
* @deprecated This method has been moved to the Queue config helper and will be removed in a future version
2078+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::isQueueActive()
2079+
*/
2080+
public function isQueueActive($storeId = null)
2081+
{
2082+
return $this->queueHelper->isQueueActive($storeId);
2083+
}
2084+
2085+
/**
2086+
* @param $storeId
2087+
* @return bool
2088+
* @deprecated This method has been moved to the Queue config helper and will be removed in a future version
2089+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::useBuiltInCron()
2090+
*/
2091+
public function useBuiltInCron($storeId = null)
2092+
{
2093+
return $this->queueHelper->useBuiltInCron($storeId);
2094+
}
2095+
2096+
/**
2097+
* @param $storeId
2098+
* @return bool
2099+
* @deprecated This method has been moved to the Queue config helper and will be removed in a future version
2100+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::getNumberOfJobToRun()
2101+
*/
2102+
public function getNumberOfJobToRun($storeId = null)
2103+
{
2104+
return $this->queueHelper->getNumberOfJobToRun($storeId);
2105+
}
2106+
2107+
/**
2108+
* @param $storeId
2109+
* @return bool
2110+
* @deprecated This method has been moved to the Queue config helper and will be removed in a future version
2111+
* @see \Algolia\AlgoliaSearch\Helper\Configuration\QueueHelper::getRetryLimit()
2112+
*/
2113+
public function getRetryLimit($storeId = null)
2114+
{
2115+
return $this->queueHelper->getRetryLimit($storeId);
2116+
}
2117+
20912118
// --- Indexing Manager --- //
20922119

20932120
/**

0 commit comments

Comments
 (0)