This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,40 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleControllerBackpressure\Controller\Read;
use Magento\Framework\App\Action\Action;
use Magento\Framework\App\Response\Http as HttpResponse;
class Read extends Action
{
/**
* @var int
*/
private int $counter = 0;
/**
* @inheritDoc
*/
public function execute()
{
/** @var HttpResponse $response */
$response = $this->getResponse();
return $response->representJson('{"str": "controller-read", "counter": ' .(++$this->counter) .'}');
}
public function resetCounter(): void
{
$this->counter = 0;
}
public function getCounter(): int
{
return $this->counter;
}
}
@@ -0,0 +1,24 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleControllerBackpressure\Model;
use Magento\Framework\App\Backpressure\ContextInterface;
use Magento\Framework\App\Backpressure\SlidingWindow\LimitConfig;
use Magento\Framework\App\Backpressure\SlidingWindow\LimitConfigManagerInterface;
class LimitConfigManager implements LimitConfigManagerInterface
{
/**
* @inheritDoc
*/
public function readLimit(ContextInterface $context): LimitConfig
{
return new LimitConfig(2, 60);
}
}
@@ -0,0 +1,28 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\TestModuleControllerBackpressure\Model;
use Magento\Framework\App\ActionInterface;
use Magento\Framework\App\Request\Backpressure\RequestTypeExtractorInterface;
use Magento\Framework\App\RequestInterface;
class TypeExtractor implements RequestTypeExtractorInterface
{
/**
* @inheritDoc
*/
public function extract(RequestInterface $request, ActionInterface $action): ?string
{
if ($action instanceof Index) {
return 'testcontrollerbackpressure';
}
return null;
}
}
@@ -0,0 +1,21 @@
{
"name": "magento/module-test-controller-backpressure",
"description": "test controller module",
"config": {
"sort-packages": true
},
"require": {
"php": "~7.4.0||~8.0.0",
"magento/framework": "*",
"magento/module-integration": "*"
},
"type": "magento2-module",
"extra": {
"map": [
[
"*",
"Magento/TestModuleControllerBackpressure"
]
]
}
}
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Framework\App\Request\Backpressure\CompositeRequestTypeExtractor">
<arguments>
<argument name="extractors" xsi:type="array">
<item name="controllertestbackpressure" xsi:type="object">
Magento\TestModuleControllerBackpressure\Model\TypeExtractor
</item>
</argument>
</arguments>
</type>
<type name="Magento\Framework\App\Backpressure\SlidingWindow\CompositeLimitConfigManager">
<arguments>
<argument name="configs" xsi:type="array">
<item name="testcontrollerbackpressure" xsi:type="object">
Magento\TestModuleControllerBackpressure\Model\LimitConfigManager
</item>
</argument>
</arguments>
</type>
</config>
@@ -0,0 +1,14 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="testbackpressure" frontName="testbackpressure">
<module name="Magento_TestModuleControllerBackpressure" />
</route>
</router>
</config>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestModuleControllerBackpressure" />
</config>
@@ -0,0 +1,13 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestModuleControllerBackpressure') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestModuleControllerBackpressure', __DIR__);
}