diff --git a/Controller/Adminhtml/FastlyCdn/Vcl/Upload.php b/Controller/Adminhtml/FastlyCdn/Vcl/Upload.php
index b8d1e7bc..3f0f2e02 100644
--- a/Controller/Adminhtml/FastlyCdn/Vcl/Upload.php
+++ b/Controller/Adminhtml/FastlyCdn/Vcl/Upload.php
@@ -38,8 +38,9 @@
use Magento\Framework\App\Cache\TypeListInterface;
/**
- * Class for VCL Upload
+ * Class Upload
*
+ * @package Fastly\Cdn\Controller\Adminhtml\FastlyCdn\Vcl
*/
class Upload extends Action
{
@@ -131,6 +132,7 @@ public function __construct(
parent::__construct($context);
$this->coreConfig = $coreConfig;
$this->typeList = $typeList;
+
}
/**
@@ -153,7 +155,6 @@ public function execute()
$customSnippetPath = $read->getAbsolutePath(Config::CUSTOM_SNIPPET_PATH);
$customSnippets = $this->config->getCustomSnippets($customSnippetPath);
- $allowedSnippets = [];
foreach ($snippets as $key => $value) {
$priority = 50;
if ($key == 'hash') {
@@ -166,7 +167,6 @@ public function execute()
'priority' => $priority,
'content' => $value
];
- $allowedSnippets[] = $snippetData['name'];
$this->api->uploadSnippet($clone->number, $snippetData);
}
@@ -183,12 +183,9 @@ public function execute()
'content' => $value,
'dynamic' => '0'
];
- $allowedSnippets[] = $customSnippetData['name'];
$this->api->uploadSnippet($clone->number, $customSnippetData);
}
- $this->syncSnippets($allowedSnippets, $clone->number);
-
$this->createGzipHeader($clone);
$condition = [
@@ -276,8 +273,6 @@ private function validateCustomSnippet($customSnippet)
}
/**
- * Setup Dictionary
- *
* @param $cloneNumber
* @param $currActiveVersion
* @return bool|mixed
@@ -296,8 +291,6 @@ private function setupDictionary($cloneNumber, $currActiveVersion)
}
/**
- * Setup Acl
- *
* @param $cloneNumber
* @param $currActiveVersion
* @return bool|mixed
@@ -316,12 +309,10 @@ private function setupAcl($cloneNumber, $currActiveVersion)
}
/**
- * Create Gzip Header
- *
* @param $clone
* @throws LocalizedException
*/
- private function createGzipHeader($clone): void
+ private function createGzipHeader($clone)
{
$condition = [
'name' => Config::FASTLY_MAGENTO_MODULE . '_gzip_safety',
@@ -343,29 +334,4 @@ private function createGzipHeader($clone): void
$this->api->createHeader($clone->number, $headerData);
}
-
- /**
- * Remove disabled snippets from current vcl file
- *
- * @param array $allowedSnippets
- * @param int $version
- * @throws LocalizedException
- */
- private function syncSnippets(array $allowedSnippets, int $version): void
- {
- $snippets = $this->api->getSnippets($version);
-
- $currentActiveSnippets = [];
- foreach ($snippets as $item) {
- $currentActiveSnippets[] = $item->name;
- }
- $snippetsForDelete = array_diff($currentActiveSnippets, $allowedSnippets);
-
- foreach ($snippetsForDelete as $snippetName) {
- //remove only snippet name which starts with magento prefix
- if (strpos($snippetName, Config::FASTLY_MAGENTO_MODULE . '_') === 0) {
- $this->api->removeSnippet($version, $snippetName);
- }
- }
- }
}
diff --git a/Model/Api.php b/Model/Api.php
index b009e8a1..853e94e2 100644
--- a/Model/Api.php
+++ b/Model/Api.php
@@ -500,21 +500,6 @@ public function activateVersion($version)
return $result;
}
- /**
- * Get all VCL snippets
- *
- * @param $version
- * @return bool|mixed
- * @throws LocalizedException
- */
- public function getSnippets($version)
- {
- $url = $this->_getApiServiceUri() . 'version/' .rawurlencode($version). '/snippet';
- $result = $this->_fetch($url, 'GET');
-
- return $result;
- }
-
/**
* Creating and updating regular VCL snippets
*