Skip to content

Commit

Permalink
Merge pull request #919 from magento-troll/MAGETWO-65293
Browse files Browse the repository at this point in the history
Stories:
- MAGETWO-65181: Remove serialize/unserialize in \Magento\Framework\Unserialize\Unserialize
- MAGETWO-65183: Remove serialize/unserialize in \Magento\Framework\Acl\Cache
  • Loading branch information
MomotenkoNatalia authored Mar 15, 2017
2 parents b14d70e + 7420e24 commit e01d54c
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 341 deletions.
12 changes: 0 additions & 12 deletions app/code/Magento/Authorization/Model/ResourceModel/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@ class Rules extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
*/
protected $_rootResource;

/**
* Acl object cache
*
* @var \Magento\Framework\Acl\CacheInterface
* @deprecated since 2.2 due to native serialization elimination.
* Use data cache \Magento\Framework\Acl\Data\CacheInterface instead.
*/
protected $_aclCache;

/**
* @var \Magento\Framework\Acl\Builder
*/
Expand All @@ -50,7 +41,6 @@ class Rules extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
* @param \Magento\Framework\Acl\Builder $aclBuilder
* @param \Psr\Log\LoggerInterface $logger
* @param \Magento\Framework\Acl\RootResource $rootResource
* @param \Magento\Framework\Acl\CacheInterface $aclCache
* @param string $connectionName
* @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
*/
Expand All @@ -59,14 +49,12 @@ public function __construct(
\Magento\Framework\Acl\Builder $aclBuilder,
\Psr\Log\LoggerInterface $logger,
\Magento\Framework\Acl\RootResource $rootResource,
\Magento\Framework\Acl\CacheInterface $aclCache,
$connectionName = null,
\Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null
) {
$this->_aclBuilder = $aclBuilder;
parent::__construct($context, $connectionName);
$this->_rootResource = $rootResource;
$this->_aclCache = $aclCache;
$this->_logger = $logger;
$this->aclDataCache = $aclDataCache ?: ObjectManager::getInstance()->get(
\Magento\Framework\Acl\Data\CacheInterface::class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class RulesTest extends \PHPUnit_Framework_TestCase
*/
private $rootResourceMock;

/**
* @var \Magento\Framework\Acl\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $aclCacheMock;

/**
* @var \Magento\Framework\Acl\Data\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
*/
Expand Down Expand Up @@ -117,11 +112,6 @@ protected function setUp()
->setMethods([])
->getMock();

$this->aclCacheMock = $this->getMockBuilder(\Magento\Framework\Acl\CacheInterface::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();

$this->aclDataCacheMock = $this->getMockBuilder(\Magento\Framework\Acl\Data\CacheInterface::class)
->disableOriginalConstructor()
->setMethods([])
Expand All @@ -145,7 +135,6 @@ protected function setUp()
$this->aclBuilderMock,
$this->loggerMock,
$this->rootResourceMock,
$this->aclCacheMock,
'connection',
$this->aclDataCacheMock
);
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Authorization/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<type name="Magento\Authorization\Model\ResourceModel\Rules">
<arguments>
<argument name="rootResource" xsi:type="object">Magento\Framework\Acl\RootResource\Proxy</argument>
<argument name="aclCache" xsi:type="object">Magento\Framework\Acl\Cache\Proxy</argument>
</arguments>
</type>
<type name="Magento\Framework\Acl\Builder">
Expand Down
5 changes: 0 additions & 5 deletions app/code/Magento/Backend/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@
<argument name="resourceLoader" xsi:type="object">Magento\Framework\Acl\Loader\ResourceLoader</argument>
</arguments>
</type>
<type name="Magento\Framework\Acl\Cache">
<arguments>
<argument name="cacheKey" xsi:type="string">backend_acl_resources</argument>
</arguments>
</type>
<type name="Magento\Framework\Acl\RootResource">
<arguments>
<argument name="identifier" xsi:type="string">Magento_Backend::all</argument>
Expand Down
5 changes: 0 additions & 5 deletions app/code/Magento/Store/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,6 @@
<argument name="default" xsi:type="string">frontend</argument>
</arguments>
</type>
<type name="Magento\Framework\Acl\Cache">
<arguments>
<argument name="cacheKey" xsi:type="string">global_acl_resources</argument>
</arguments>
</type>
<type name="Magento\Framework\App\Config\Initial\Converter">
<arguments>
<argument name="nodeMap" xsi:type="array">
Expand Down
10 changes: 0 additions & 10 deletions app/code/Magento/User/Model/ResourceModel/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
*/
class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
{
/**
* @var \Magento\Framework\Acl\CacheInterface
* @deprecated since 2.2 due to native serialization elimination.
* Use data cache \Magento\Framework\Acl\Data\CacheInterface instead.
*/
protected $_aclCache;

/**
* Role model
*
Expand All @@ -45,22 +38,19 @@ class User extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
* Construct
*
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
* @param \Magento\Framework\Acl\CacheInterface $aclCache
* @param \Magento\Authorization\Model\RoleFactory $roleFactory
* @param \Magento\Framework\Stdlib\DateTime $dateTime
* @param string $connectionName
* @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
*/
public function __construct(
\Magento\Framework\Model\ResourceModel\Db\Context $context,
\Magento\Framework\Acl\CacheInterface $aclCache,
\Magento\Authorization\Model\RoleFactory $roleFactory,
\Magento\Framework\Stdlib\DateTime $dateTime,
$connectionName = null,
\Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null
) {
parent::__construct($context, $connectionName);
$this->_aclCache = $aclCache;
$this->_roleFactory = $roleFactory;
$this->dateTime = $dateTime;
$this->aclDataCache = $aclDataCache ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ class UserTest extends \PHPUnit_Framework_TestCase
/** @var \Magento\User\Model\User|\PHPUnit_framework_MockObject_MockObject */
protected $userMock;

/** @var \Magento\Framework\Acl\CacheInterface|\PHPUnit_Framework_MockObject_MockObject */
protected $aclCacheMock;

/** @var \Magento\Framework\Model\ResourceModel\Db\Context|\PHPUnit_Framework_MockObject_MockObject */
protected $contextMock;

Expand Down Expand Up @@ -62,11 +59,6 @@ protected function setUp()
->setMethods([])
->getMock();

$this->aclCacheMock = $this->getMockBuilder(\Magento\Framework\Acl\CacheInterface::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();

$this->roleFactoryMock = $this->getMockBuilder(\Magento\Authorization\Model\RoleFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
Expand Down Expand Up @@ -102,7 +94,6 @@ protected function setUp()
\Magento\User\Model\ResourceModel\User::class,
[
'resource' => $this->resourceMock,
'aclCache' => $this->aclCacheMock,
'roleFactory' => $this->roleFactoryMock,
'dateTime' => $this->dateTimeMock,
'aclDataCache' => $this->aclDataCacheMock,
Expand Down
5 changes: 0 additions & 5 deletions app/code/Magento/User/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\User\Model\ResourceModel\User">
<arguments>
<argument name="aclCache" xsi:type="object">Magento\Framework\Acl\Cache\Proxy</argument>
</arguments>
</type>
<type name="Magento\Authorization\Model\Role">
<plugin name="updateRoleUsersAcl" type="Magento\User\Model\Plugin\AuthorizationRole" sortOrder="20"/>
</type>
Expand Down
1 change: 0 additions & 1 deletion app/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
<preference for="Magento\Framework\App\ResourceConnection\ConnectionAdapterInterface" type="Magento\Framework\Model\ResourceModel\Type\Db\Pdo\Mysql"/>
<preference for="Magento\Framework\DB\QueryInterface" type="Magento\Framework\DB\Query"/>
<preference for="Magento\Framework\App\ProductMetadataInterface" type="Magento\Framework\App\ProductMetadata"/>
<preference for="Magento\Framework\Acl\CacheInterface" type="Magento\Framework\Acl\Cache" />
<preference for="Magento\Framework\Acl\Data\CacheInterface" type="Magento\Framework\Acl\Data\Cache" />
<preference for="Magento\Framework\App\AreaInterface" type="Magento\Framework\App\Area" />
<preference for="Magento\Framework\Setup\ModuleDataSetupInterface" type="Magento\Setup\Module\DataSetup" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4227,4 +4227,7 @@
['Magento\Framework\Search\Document', 'Magento\Framework\Api\Search\Document'],
['Magento\Framework\Search\DocumentField'],
['Magento\Quote\Setup\Recurring'],
['Magento\Framework\Acl\Cache'],
['Magento\Framework\Acl\CacheInterface'],
['Magento\Framework\Acl\Test\Unit\CacheTest'],
];
11 changes: 0 additions & 11 deletions lib/internal/Magento/Framework/Acl/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,35 +25,24 @@ class Builder
*/
protected $_loaderPool;

/**
* ACL cache
*
* @var \Magento\Framework\Acl\CacheInterface
* @deprecated
*/
protected $_cache;

/**
* @var \Magento\Framework\AclFactory
*/
protected $_aclFactory;

/**
* @param \Magento\Framework\AclFactory $aclFactory
* @param \Magento\Framework\Acl\CacheInterface $cache
* @param \Magento\Framework\Acl\LoaderInterface $roleLoader
* @param \Magento\Framework\Acl\LoaderInterface $resourceLoader
* @param \Magento\Framework\Acl\LoaderInterface $ruleLoader
*/
public function __construct(
\Magento\Framework\AclFactory $aclFactory,
\Magento\Framework\Acl\CacheInterface $cache,
\Magento\Framework\Acl\LoaderInterface $roleLoader,
\Magento\Framework\Acl\LoaderInterface $resourceLoader,
\Magento\Framework\Acl\LoaderInterface $ruleLoader
) {
$this->_aclFactory = $aclFactory;
$this->_cache = $cache;
$this->_loaderPool = [$roleLoader, $resourceLoader, $ruleLoader];
}

Expand Down
92 changes: 0 additions & 92 deletions lib/internal/Magento/Framework/Acl/Cache.php

This file was deleted.

45 changes: 0 additions & 45 deletions lib/internal/Magento/Framework/Acl/CacheInterface.php

This file was deleted.

Loading

0 comments on commit e01d54c

Please sign in to comment.