_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q243900 | Api.createRequest | validation | public function createRequest($version, $request)
{
$checkIfExists = $this->getRequest($version, $request['name']);
$url = $this->_getApiServiceUri(). 'version/' .$version. '/request_settings';
if (!$checkIfExists) {
$verb = \Zend_Http_Client::POST;
} else {
$... | php | {
"resource": ""
} |
q243901 | Api.getRequest | validation | public function getRequest($version, $name)
{
$url = $this->_getApiServiceUri(). 'version/'. $version. '/request_settings/' . $name;
$result = $this->_fetch($url, \Zend_Http_Client::GET, '', false, null, false);
return $result;
} | php | {
"resource": ""
} |
q243902 | Api.deleteRequest | validation | public function deleteRequest($version, $name)
{
$url = $this->_getApiServiceUri(). 'version/'. $version. '/request_settings/' . $name;
$result = $this->_fetch($url, \Zend_Http_Client::DELETE);
if (!$result) {
throw new LocalizedException(__('Failed to delete the REQUEST object.... | php | {
"resource": ""
} |
q243903 | Api.getBackends | validation | public function getBackends($version)
{
$url = $this->_getApiServiceUri(). 'version/'. $version. '/backend';
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243904 | Api.configureBackend | validation | public function configureBackend($params, $version, $old_name)
{
$url = $this->_getApiServiceUri()
. 'version/'
. $version
. '/backend/'
. str_replace(' ', '%20', $old_name);
$result = $this->_fetch(
$url,
\Zend_Http_Client::PU... | php | {
"resource": ""
} |
q243905 | Api.sendWebHook | validation | public function sendWebHook($message)
{
$url = $this->config->getIncomingWebhookURL();
$messagePrefix = $this->config->getWebhookMessagePrefix();
$currentUsername = 'System';
try {
if ($this->state->getAreaCode() == 'adminhtml') {
$getUser = $this->authSes... | php | {
"resource": ""
} |
q243906 | Api.createDictionary | validation | public function createDictionary($version, $params)
{
$url = $this->_getApiServiceUri(). 'version/'. $version . '/dictionary';
$result = $this->_fetch($url, \Zend_Http_Client::POST, $params);
return $result;
} | php | {
"resource": ""
} |
q243907 | Api.dictionaryItemsList | validation | public function dictionaryItemsList($dictionaryId)
{
$url = $this->_getApiServiceUri(). 'dictionary/'.$dictionaryId.'/items';
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243908 | Api.getSingleDictionary | validation | public function getSingleDictionary($version, $dictionaryName)
{
$url = $this->_getApiServiceUri(). 'version/'. $version . '/dictionary/' . $dictionaryName;
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243909 | Api.getAuthDictionary | validation | public function getAuthDictionary($version)
{
$name = Config::AUTH_DICTIONARY_NAME;
$dictionary = $this->getSingleDictionary($version, $name);
return $dictionary;
} | php | {
"resource": ""
} |
q243910 | Api.checkAuthDictionaryPopulation | validation | public function checkAuthDictionaryPopulation($version)
{
$dictionary = $this->getAuthDictionary($version);
if ((is_array($dictionary) && empty($dictionary)) || !isset($dictionary->id)) {
throw new LocalizedException(__('You must add users in order to enable Basic Authentication.'));
... | php | {
"resource": ""
} |
q243911 | Api.createDictionaryItems | validation | public function createDictionaryItems($dictionaryId, $params)
{
$url = $this->_getApiServiceUri().'dictionary/'.$dictionaryId.'/items';
$result = $this->_fetch($url, \Zend_Http_Client::PATCH, $params);
return $result;
} | php | {
"resource": ""
} |
q243912 | Api.deleteDictionaryItem | validation | public function deleteDictionaryItem($dictionaryId, $itemKey)
{
$url = $this->_getApiServiceUri(). 'dictionary/'. $dictionaryId . '/item/' . urlencode($itemKey);
$result = $this->_fetch($url, \Zend_Http_Client::DELETE);
return $result;
} | php | {
"resource": ""
} |
q243913 | Api.upsertDictionaryItem | validation | public function upsertDictionaryItem($dictionaryId, $itemKey, $itemValue)
{
$body = ['item_value' => $itemValue];
$url = $this->_getApiServiceUri(). 'dictionary/'. $dictionaryId . '/item/' . urlencode($itemKey);
$result = $this->_fetch($url, \Zend_Http_Client::PUT, $body);
if (!$res... | php | {
"resource": ""
} |
q243914 | Api.getSingleAcl | validation | public function getSingleAcl($version, $acl)
{
$url = $this->_getApiServiceUri(). 'version/'. $version . '/acl/' . $acl;
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243915 | Api.deleteAcl | validation | public function deleteAcl($version, $name)
{
$url = $this->_getApiServiceUri(). 'version/'. $version . '/acl/' . $name;
$result = $this->_fetch($url, \Zend_Http_Client::DELETE);
return $result;
} | php | {
"resource": ""
} |
q243916 | Api.aclItemsList | validation | public function aclItemsList($aclId)
{
$url = $this->_getApiServiceUri() . 'acl/'. $aclId . '/entries';
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243917 | Api.upsertAclItem | validation | public function upsertAclItem($aclId, $itemValue, $negated, $comment = 'Added by Magento Module', $subnet = false)
{
$body = [
'ip' => $itemValue,
'negated' => $negated,
'comment' => $comment
];
if ($subnet) {
$body['subnet'] = $subnet;
... | php | {
"resource": ""
} |
q243918 | Api.deleteAclItem | validation | public function deleteAclItem($aclId, $aclItemId)
{
$url = $this->_getApiServiceUri(). 'acl/'. $aclId . '/entry/' . $aclItemId;
$result = $this->_fetch($url, \Zend_Http_Client::DELETE);
return $result;
} | php | {
"resource": ""
} |
q243919 | Api.updateAclItem | validation | public function updateAclItem($aclId, $aclItemId, $itemValue, $negated, $comment = '', $subnet = false)
{
$body = [
'ip' => $itemValue,
'negated' => $negated,
'comment' => $comment
];
if ($subnet) {
$body['subnet'] = $subnet;
}
... | php | {
"resource": ""
} |
q243920 | Api.queryHistoricStats | validation | public function queryHistoricStats(array $parameters)
{
$uri = $this->_getHistoricalEndpoint()
. '?region='.$parameters['region']
. '&from='.$parameters['from']
. '&to='.$parameters['to']
. '&by='
. $parameters['sample_rate'];
$result = $t... | php | {
"resource": ""
} |
q243921 | Api.checkImageOptimizationStatus | validation | public function checkImageOptimizationStatus()
{
$url = $this->_getApiServiceUri(). 'dynamic_io_settings';
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243922 | Api.configureImageOptimizationDefaultConfigOptions | validation | public function configureImageOptimizationDefaultConfigOptions($params, $version)
{
$url = $this->_getApiServiceUri(). 'version/'. $version . '/io_settings';
$result = $this->_fetch($url, \Zend_Http_Client::PATCH, $params);
return $result;
} | php | {
"resource": ""
} |
q243923 | Api.getServiceDetails | validation | public function getServiceDetails()
{
$url = $this->_getApiServiceUri() . 'details';
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243924 | Api.getWafSettings | validation | public function getWafSettings($id)
{
$url = $this->_getWafEndpoint() . $id;
$result = $this->_fetch($url, \Zend_Http_Client::GET);
return $result;
} | php | {
"resource": ""
} |
q243925 | Api._fetch | validation | private function _fetch(
$uri,
$method = \Zend_Http_Client::GET,
$body = '',
$test = false,
$testApiKey = null,
$logError = true
) {
$apiKey = ($test == true) ? $testApiKey : $this->config->getApiKey();
// Correctly format $body string
if (is_... | php | {
"resource": ""
} |
q243926 | FrontControllerPlugin.aroundDispatch | validation | public function aroundDispatch(FrontController $subject, callable $proceed, ...$args) // @codingStandardsIgnoreLine - unused parameter
{
$isRateLimitingEnabled = $this->config->isRateLimitingEnabled();
$isCrawlerProtectionEnabled = $this->config->isCrawlerProtectionEnabled();
if (!$isRateLi... | php | {
"resource": ""
} |
q243927 | CheckFastlyIoSetting.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$req = $this->api->checkImageOptimizationStatus();
if (!$req) {
return $result->setData([
'status' => false,
'msg' => 'Failed to check im... | php | {
"resource": ""
} |
q243928 | SerializeToJson.execute | validation | protected function execute(InputInterface $input, OutputInterface $output) // @codingStandardsIgnoreLine - required by parent class
{
$configPaths = [
'geoip_country_mapping' => \Fastly\Cdn\Model\Config::XML_FASTLY_GEOIP_COUNTRY_MAPPING
];
foreach ($configPaths as $path) {
... | php | {
"resource": ""
} |
q243929 | Image.fastlyRotate | validation | private function fastlyRotate($angle)
{
$angle = (int) $angle;
$orient = null;
if ($angle == 90) {
$orient = 'r';
}
if ($angle == -90 || $angle == 270) {
$orient = 'l';
}
if ($angle == 180) {
$orient = 3;
}
... | php | {
"resource": ""
} |
q243930 | Image.fastlyResize | validation | private function fastlyResize()
{
if ($this->getWidth() === null && $this->getHeight() === null) {
return $this;
}
$this->adjustSize();
return $this;
} | php | {
"resource": ""
} |
q243931 | Image.getResizedImageInfo | validation | public function getResizedImageInfo()
{
if ($this->isFastlyImageOptimizationEnabled() == false) {
return parent::getResizedImageInfo();
}
// Return image data
if ($this->getBaseFile() !== null) {
return [
0 => $this->getWidth(),
... | php | {
"resource": ""
} |
q243932 | Image.getForceLossyUrl | validation | public function getForceLossyUrl()
{
$baseFile = $this->getBaseFile();
$extension = pathinfo($baseFile, PATHINFO_EXTENSION); // @codingStandardsIgnoreLine
$url = $this->getBaseFileUrl($baseFile);
if ($extension == 'png' || $extension == 'bmp') {
if ($this->isFastlyImageOp... | php | {
"resource": ""
} |
q243933 | Image.getFastlyUrl | validation | public function getFastlyUrl()
{
$baseFile = $this->getBaseFile();
$url = $this->getBaseFileUrl($baseFile);
$imageQuality = $this->_scopeConfig->getValue(Config::XML_FASTLY_IMAGE_OPTIMIZATION_IMAGE_QUALITY);
$this->setQuality($imageQuality);
$this->fastlyParameters['qualit... | php | {
"resource": ""
} |
q243934 | Image.compileFastlyParameters | validation | private function compileFastlyParameters()
{
if (isset($this->fastlyParameters['width']) == false) {
$this->fastlyParameters['height'] = $this->_height;
$this->fastlyParameters['width'] = $this->_width;
}
$params = [];
foreach ($this->fastlyParameters as $key... | php | {
"resource": ""
} |
q243935 | IoDefaultConfigOptions.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activate_flag = $this->getRequest()->getParam('activate_flag');
$activeVersion = $this->getRequest()->getParam('active_version');
$formData = $this->getRequest()->getParams();
if... | php | {
"resource": ""
} |
q243936 | MarkEsiBlock.execute | validation | public function execute(Observer $observer) // @codingStandardsIgnoreLine - required, but not needed
{
if ($this->fastlyConfig->isFastlyEnabled() != true) {
return;
}
// If not set, causes issues with embedded ESI
$this->response->setHeader("x-esi", "1");
} | php | {
"resource": ""
} |
q243937 | ConfigPlugin.afterGetType | validation | public function afterGetType(Config $config, $result)
{
if (!($config instanceof \Fastly\Cdn\Model\Config)) {
if ($result == \Fastly\Cdn\Model\Config::FASTLY) {
return Config::VARNISH;
}
}
return $result;
} | php | {
"resource": ""
} |
q243938 | EnableAuth.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$activateVcl = $this->getRequest()->getParam('activate_flag');
$service = $this->api->checkServiceDetails();
$ena... | php | {
"resource": ""
} |
q243939 | UpgradeData.upgrade | validation | public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$version = $context->getVersion();
if (!$version) {
return;
}
$oldConfigPaths = [
'stale_ttl' => 'system/full_page_cache/fastly/stale_ttl',
... | php | {
"resource": ""
} |
q243940 | UpgradeData.upgrade108 | validation | private function upgrade108($oldConfigPaths, $newConfigPaths)
{
foreach ($oldConfigPaths as $key => $value) {
$oldValue = $this->scopeConfig->getValue($value);
if ($oldValue != null) {
$this->configWriter->save($newConfigPaths[$key], $oldValue); // @codingStandardsIgn... | php | {
"resource": ""
} |
q243941 | UpgradeData.upgrade1010 | validation | private function upgrade1010($newConfigPaths)
{
$oldData = $this->scopeConfig->getValue($newConfigPaths['geoip_country_mapping']);
try {
$oldData = unserialize($oldData); // @codingStandardsIgnoreLine - used for conversion of old Magento format to json_decode
} catch (\Exception ... | php | {
"resource": ""
} |
q243942 | GetAllModules.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$modules = $this->manifest->getAllModlyManifests();
if (!$modules) {
return $result->setData([
'status' => false,
'modules' => '',
... | php | {
"resource": ""
} |
q243943 | CustomSnippetUpload.beforeSave | validation | public function beforeSave()
{
$value = $this->getValue();
$file = $this->getFileData();
if (!empty($file)) {
$uploadDir = $this->_getUploadDir();
try {
$uploader = $this->_uploaderFactory->create(['fileId' => $file]);
$uploader->setAll... | php | {
"resource": ""
} |
q243944 | Additional.canShowBlock | validation | public function canShowBlock()
{
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q243945 | Additional.getContentTypeOptions | validation | public function getContentTypeOptions()
{
$contentTypes = [
self::CONTENT_TYPE_HTML => __('HTML'),
self::CONTENT_TYPE_CSS => __('CSS'),
self::CONTENT_TYPE_JS => __('JavaScript'),
self::CONTENT_TYPE_IMAGE => __('Images')
];
return $content... | php | {
"resource": ""
} |
q243946 | CheckAuthSetting.execute | validation | public function execute()
{
$result = $this->resultJsonFactory->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$snippets = $this->config->getVclSnippets(Config::VCL_AUTH_SNIPPET_PATH);
foreach ($snippets as $key => $value) {
... | php | {
"resource": ""
} |
q243947 | Manifest.getAllModules | validation | public function getAllModules()
{
$modules = [];
$moduleCollection = $this->collectionFactory->create()->getData();
foreach ($moduleCollection as $module) {
$modules[] = $module;
}
return $modules;
} | php | {
"resource": ""
} |
q243948 | GetWafPageRespObj.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$response = $this->api->getResponse($activeVersion, Config::WAF_PAGE_RESPONSE_OBJECT);
if (!$response) {
ret... | php | {
"resource": ""
} |
q243949 | ConfigRewrite.afterSave | validation | public function afterSave(\Magento\Config\Model\Config $subject) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->purge) {
$this->api->cleanBySurrogateKey(['text']);
}
} | php | {
"resource": ""
} |
q243950 | ConfigRewrite.beforeSave | validation | public function beforeSave(\Magento\Config\Model\Config $subject)
{
$data = $subject->getData();
if (!empty($data['groups']['full_page_cache']['fields']['caching_application']['value'])) {
$currentCacheConfig = $data['groups']['full_page_cache']['fields']['caching_application']['value'];... | php | {
"resource": ""
} |
q243951 | GetDomains.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$domains = $this->api->getAllDomains($activeVersion);
$storeBaseUrl = $this->storeManager->getStore()->getBaseUrl();
... | php | {
"resource": ""
} |
q243952 | CheckAuthUsersAvailable.execute | validation | public function execute()
{
$result = $this->resultJsonFactory->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$dictionaryName = Config::AUTH_DICTIONARY_NAME;
$dictionary = $this->api->getSingleDictionary($activeVersion, $diction... | php | {
"resource": ""
} |
q243953 | Checkbox._getElementHtml | validation | public function _getElementHtml(AbstractElement $element)
{
$this->setNamePrefix($element->getName())
->setHtmlId($element->getHtmlId());
return $this->_toHtml();
} | php | {
"resource": ""
} |
q243954 | Checkbox.getValues | validation | public function getValues()
{
$values = [];
$ratios = $this->pixelRatios->toOptionArray();
foreach ($ratios as $value) {
$values[$value['value']] = $value['label'];
}
return $values;
} | php | {
"resource": ""
} |
q243955 | Checkbox.getCheckedValues | validation | public function getCheckedValues()
{
if ($this->values === null) {
$data = $this->config->getImageOptimizationRatios();
if (!isset($data)) {
$data = '';
}
$this->values = explode(',', $data);
}
return $this->values;
} | php | {
"resource": ""
} |
q243956 | Node.render | validation | public function render()
{
return [
'id' => $this->getId(),
'translate' => 'label comment',
'showInDefault' => 1,
'showInWebsite' => 0,
'showInStore' => 0,
'sortOrder' => 1,
'label' => $this->lab... | php | {
"resource": ""
} |
q243957 | Node.addTextInput | validation | public function addTextInput($id, $label, $comment, $required = true)
{
$this->children[$id] = [
'id' => $id,
'type' => 'text',
'translate' => 'label comment',
'showInDefault' => 1,
'showInWebsite' => 0,
'showInS... | php | {
"resource": ""
} |
q243958 | WafBtn.render | validation | public function render(AbstractElement $element)
{
$element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue();
return parent::render($element);
} | php | {
"resource": ""
} |
q243959 | GetCustomSnippet.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$snippet = $this->getRequest()->getParam('snippet_id');
$read = $this->filesystem->getDirectoryRead(DirectoryList::VAR_DIR);
$snippetPath = $read->getRelativePath(Config::CUSTOM_SNIPPET_PAT... | php | {
"resource": ""
} |
q243960 | Quick.isHostInDomainList | validation | private function isHostInDomainList($host)
{
$urlTypes = [
UrlInterface::URL_TYPE_LINK,
UrlInterface::URL_TYPE_DIRECT_LINK,
UrlInterface::URL_TYPE_WEB,
UrlInterface::URL_TYPE_MEDIA,
UrlInterface::URL_TYPE_STATIC
];
$secureScheme = [... | php | {
"resource": ""
} |
q243961 | GetAction.execute | validation | public function execute()
{
$resultLayout = null;
try {
$resultLayout = $this->resultLayoutFactory->create();
$resultLayout->addDefaultHandle();
// get target store from country code
$countryCode = $this->getRequest()->getParam(self::REQUEST_PARAM_CO... | php | {
"resource": ""
} |
q243962 | GetAction.getMessageInStoreLocale | validation | private function getMessageInStoreLocale(StoreInterface $emulatedStore)
{
$currentStore = $this->storeManager->getStore();
// emulate locale and store of new store to fetch message translation
$this->localeResolver->emulate($emulatedStore->getId());
$this->storeManager->setCurrentSt... | php | {
"resource": ""
} |
q243963 | PurgeCachePlugin.aroundSendPurgeRequest | validation | public function aroundSendPurgeRequest(PurgeCache $subject, callable $proceed, ...$args) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->config->isFastlyEnabled() !== true) {
$proceed(...$args);
}
} | php | {
"resource": ""
} |
q243964 | MarkEsiPage.execute | validation | public function execute(Observer $observer)
{
if ($this->fastlyConfig->isFastlyEnabled() != true) {
return;
}
$event = $observer->getEvent();
$name = $event->getElementName();
/** @var \Magento\Framework\View\Layout $layout */
$layout = $event->getLayout... | php | {
"resource": ""
} |
q243965 | InvalidateVarnishObserver.execute | validation | public function execute(\Magento\Framework\Event\Observer $observer)
{
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
$object = $observer->getEvent()->getObject();
if ($object instanceof \Magento\Framework\DataObject\IdentityInterface && $this->canPu... | php | {
"resource": ""
} |
q243966 | InvalidateVarnishObserver.canPurgeObject | validation | private function canPurgeObject(\Magento\Framework\DataObject\IdentityInterface $object)
{
if ($object instanceof \Magento\Catalog\Model\Category && !$this->config->canPurgeCatalogCategory()) {
return false;
}
if ($object instanceof \Magento\Catalog\Model\Product && !$this->confi... | php | {
"resource": ""
} |
q243967 | ListAll.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$dictionary = $this->api->getSingleDictionary($activeVersion, 'magentomodule_basic_auth');
// Fetch Authentication items
... | php | {
"resource": ""
} |
q243968 | UpdateWafAllowlist.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$service = $this->api->checkServiceDetails();
$currActiveVersion = $this->vcl->determineVersions($service->versions);
$snippet = $this->config->getVclSnippets(
Config::VCL_WA... | php | {
"resource": ""
} |
q243969 | EditCustomSnippet.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$name = $this->getRequest()->getParam('name');
$type = $this->getRequest()->getParam('type');
$priority = $this->getRequest()->getParam('priority');
$vcl = $this->getRequest()->ge... | php | {
"resource": ""
} |
q243970 | AdaptivePixelRationPlugin.beforeToHtml | validation | public function beforeToHtml(Image $subject)
{
if ($this->config->isImageOptimizationPixelRatioEnabled() !== true) {
return;
}
$srcSet = [];
$imageUrl = $subject->getData('image_url');
$pixelRatios = $this->config->getImageOptimizationRatios();
$pixelRati... | php | {
"resource": ""
} |
q243971 | Delete.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$dictionary = $this->api->getSingleDictionary($activeVersion, Config::AUTH_DICTIONARY_NAME);
$vclPath = Config::VCL_AUTH_SNI... | php | {
"resource": ""
} |
q243972 | GetBackends.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$backends = $this->api->getBackends($activeVersion);
if (!$backends) {
return $result->setData([
... | php | {
"resource": ""
} |
q243973 | All.execute | validation | public function execute()
{
// Flush all Magento caches
$types = $this->cacheManager->getAvailableTypes();
$types = array_diff($types, ['full_page']); // FPC is Handled separately
$this->cacheManager->clean($types);
// Purge everything from Fastly
$result = $this->a... | php | {
"resource": ""
} |
q243974 | SaveErrorPageHtml.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$activateVcl = $this->getRequest()->getParam('activate_flag');
$html = $this->getRequest()->getParam('html');
$se... | php | {
"resource": ""
} |
q243975 | LayoutPlugin.afterGenerateXml | validation | public function afterGenerateXml(\Magento\Framework\View\Layout $subject, $result)
{
// if subject is cacheable, FPC cache is enabled, Fastly module is chosen and general TTL is > 0
if ($subject->isCacheable() && $this->config->isEnabled()
&& $this->config->getType() == Config::FASTLY &&... | php | {
"resource": ""
} |
q243976 | LayoutPlugin.afterGetOutput | validation | public function afterGetOutput(\Magento\Framework\View\Layout $subject, $result) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->config->getType() == Config::FASTLY) {
$this->response->setHeader("Fastly-Module-Enabled", "1.2.99", true);
}
return $result;
} | php | {
"resource": ""
} |
q243977 | GetCountries.execute | validation | public function execute()
{
$result = $this->resultJson->create();
try {
$countries = $this->countryHelper->toOptionArray();
if (!$countries) {
return $result->setData([
'status' => false,
'msg' => 'Could not fe... | php | {
"resource": ""
} |
q243978 | EnableCommand.setServiceID | validation | private function setServiceID($serviceId)
{
$this->configWriter->save(Config::XML_FASTLY_SERVICE_ID, $serviceId);
$this->output->writeln(
'<info>Service ID updated.</info>',
OutputInterface::OUTPUT_NORMAL
);
} | php | {
"resource": ""
} |
q243979 | EnableCommand.setToken | validation | private function setToken($token)
{
$this->configWriter->save(Config::XML_FASTLY_API_KEY, $token);
$this->output->writeln(
'<info>Token updated.</info>',
OutputInterface::OUTPUT_NORMAL
);
} | php | {
"resource": ""
} |
q243980 | EnableCommand.uploadVcl | validation | private function uploadVcl($activate)
{
try {
$service = $this->api->checkServiceDetails();
$currActiveVersion = $this->vcl->getCurrentVersion($service->versions);
$clone = $this->api->cloneVersion($currActiveVersion);
$snippets = $this->config->getVclSnippets... | php | {
"resource": ""
} |
q243981 | CheckBlockingSetting.execute | validation | public function execute()
{
$result = $this->resultJsonFactory->create();
try {
$activeVersion = $this->getRequest()->getParam('active_version');
$snippet = Config::BLOCKING_SETTING_NAME;
$req = $this->api->hasSnippet($activeVersion, $snippet);
if ($r... | php | {
"resource": ""
} |
q243982 | Manifest.getAllRepoManifests | validation | public function getAllRepoManifests()
{
$fastlyEdgeModules = $this->config->getFastlyEdgeModules();
$manifests = [];
foreach ($fastlyEdgeModules as $key => $value) {
$decodedManifestData = json_decode($value, true);
$manifests[] = $decodedManifestData;
}
... | php | {
"resource": ""
} |
q243983 | IsAlreadyConfigured.execute | validation | public function execute()
{
$result = $this->resultJsonFactory->create();
try {
$serviceId = $this->config->getServiceId();
$apiKey = $this->config->getApiKey();
if ($serviceId == null && $apiKey == null) {
return $result->setData([
... | php | {
"resource": ""
} |
q243984 | CheckVersion.execute | validation | public function execute(Observer $observer) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->backendAuthSession->isLoggedIn() == false) {
return;
}
if ($this->getFrequency() + $this->getLastUpdate() > time()) {
return;
}
$modulePath = $t... | php | {
"resource": ""
} |
q243985 | FlushAllCacheObserver.execute | validation | public function execute(\Magento\Framework\Event\Observer $observer) // @codingStandardsIgnoreLine - unused parameter
{
if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {
$this->purgeCache->sendPurgeRequest();
}
} | php | {
"resource": ""
} |
q243986 | Config.isImageOptimizationEnabled | validation | public function isImageOptimizationEnabled()
{
if ($this->isFastlyEnabled() !== true) {
return false;
}
return $this->_scopeConfig->isSetFlag(self::XML_FASTLY_IMAGE_OPTIMIZATIONS);
} | php | {
"resource": ""
} |
q243987 | Config.isImageOptimizationPixelRatioEnabled | validation | public function isImageOptimizationPixelRatioEnabled()
{
if ($this->isImageOptimizationEnabled() !== true) {
return false;
}
return $this->_scopeConfig->isSetFlag(self::XML_FASTLY_IMAGE_OPTIMIZATIONS_PIXEL_RATIO);
} | php | {
"resource": ""
} |
q243988 | Config.getGeoIpMappingForCountry | validation | public function getGeoIpMappingForCountry($countryCode)
{
if ($mapping = $this->_scopeConfig->getValue(self::XML_FASTLY_GEOIP_COUNTRY_MAPPING)) {
return $this->extractMapping($mapping, $countryCode);
}
return null;
} | php | {
"resource": ""
} |
q243989 | Config.extractMapping | validation | private function extractMapping($mapping, $countryCode)
{
$final = null;
$extractMapping = json_decode($mapping, true);
if (!$extractMapping) {
try {
$extractMapping = unserialize($mapping); // @codingStandardsIgnoreLine
} catch (\Exception $e) {
... | php | {
"resource": ""
} |
q243990 | Config.getVclFile | validation | public function getVclFile($vclTemplatePath) // @codingStandardsIgnoreLine - Unused parameter required due to compatibility with parent class
{
$moduleEtcPath = $this->reader->getModuleDir(Dir::MODULE_ETC_DIR, 'Fastly_Cdn');
$configFilePath = $moduleEtcPath . '/' . $this->_scopeConfig->getValue(self... | php | {
"resource": ""
} |
q243991 | Config.getVclSnippets | validation | public function getVclSnippets($path = '/vcl_snippets', $specificFile = null)
{
$snippetsData = [];
$moduleEtcPath = $this->reader->getModuleDir(Dir::MODULE_ETC_DIR, 'Fastly_Cdn') . $path;
$directoryRead = $this->readFactory->create($moduleEtcPath);
if (!$specificFile) {
... | php | {
"resource": ""
} |
q243992 | Config.validateCustomSnippet | validation | public function validateCustomSnippet($name, $type, $priority)
{
$snippetName = str_replace(' ', '', $name);
$types = ['init', 'recv', 'hit', 'miss', 'pass', 'fetch', 'error', 'deliver', 'log', 'hash', 'none'];
$inArray = in_array($type, $types);
$isNumeric = is_numeric($priority);
... | php | {
"resource": ""
} |
q243993 | Config.processBlockedItems | validation | public function processBlockedItems($strippedBlockedItems, $blockingType = null)
{
if (empty($blockingType)) {
$blockingType = $this->_scopeConfig->getValue(self::XML_FASTLY_BLOCKING_TYPE);
}
if ($blockingType == '1') {
$strippedBlockedItems = '!(' . $strippedBlockedI... | php | {
"resource": ""
} |
q243994 | ThunderArticleBreadcrumbBuilder.getRequestForPath | validation | protected function getRequestForPath($path, array $exclude) {
if (!empty($exclude[$path])) {
return NULL;
}
// @todo Use the RequestHelper once https://www.drupal.org/node/2090293 is
// fixed.
$request = Request::create($path);
// Performance optimization: set a short accept header to re... | php | {
"resource": ""
} |
q243995 | FilterExtension.plainText | validation | public static function plainText($value) {
$element = render($value);
$element = strip_tags($element);
$element = html_entity_decode($element, ENT_QUOTES);
return $element;
} | php | {
"resource": ""
} |
q243996 | ImportSubscriber.onImport | validation | public function onImport(ImportEvent $event) {
$uuids = [
'0bd5c257-2231-450f-b4c2-ab156af7b78d',
'36b2e2b2-3df0-43eb-a282-d792b0999c07',
'94ad928b-3ec8-4bcb-b617-ab1607bf69cb',
'bbb1ee17-15f8-46bd-9df5-21c58040d741',
];
foreach ($event->getImportedEntities() as $entity) {
if ... | php | {
"resource": ""
} |
q243997 | ConfigEventsSubscriber.configDelete | validation | public function configDelete(ConfigCrudEvent $event) {
$config = $event->getConfig();
if ($config->getName() === 'views.view.thunder_media' && ($media_view = View::load('media'))) {
$media_view->setStatus(TRUE)->save();
}
} | php | {
"resource": ""
} |
q243998 | ThunderTaxonomyPermissions.permissions | validation | public function permissions() {
$permissions = [];
foreach ($this->entityTypeManager->getStorage('taxonomy_vocabulary')->loadMultiple() as $vocabulary) {
$permissions += [
'view published terms in ' . $vocabulary->id() => [
'title' => $this->t('View published terms in %vocabulary', ['%vo... | php | {
"resource": ""
} |
q243999 | LeakyBucket.getNewRatio | validation | protected function getNewRatio($key, $limit, $milliseconds)
{
$lastRequest = $this->getLastRequest($key) ?: 0;
$lastRatio = $this->getLastRatio($key) ?: 0;
$diff = (microtime(1) - $lastRequest) * 1000;
$newRatio = $lastRatio - $diff;
$newRatio = $newRatio < 0 ? 0 : $newRa... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.