Skip to content

Commit

Permalink
Merge remote-tracking branch 'mainline/develop' into MAGETWO-55589-ba…
Browse files Browse the repository at this point in the history
…tch-size
  • Loading branch information
Oleksii Korshenko committed Sep 2, 2016
2 parents 789c465 + 70b8638 commit 8263ddb
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 56 deletions.
24 changes: 24 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

DirectoryIndex index.php

<IfModule mod_php5.c>
############################################
## adjust memory limit

Expand All @@ -53,7 +54,30 @@
## disable user agent verification to not break multiple image upload

php_flag suhosin.session.cryptua off
</IfModule>
<IfModule mod_php7.c>
############################################
## adjust memory limit

php_value memory_limit 768M
php_value max_execution_time 18000

############################################
## disable automatic session start
## before autoload was initialized

php_flag session.auto_start off

############################################
## enable resulting html compression

#php_flag zlib.output_compression on

###########################################
## disable user agent verification to not break multiple image upload

php_flag suhosin.session.cryptua off
</IfModule>
<IfModule mod_security.c>
###########################################
## disable POST processing to not break multiple image upload
Expand Down
4 changes: 4 additions & 0 deletions .user.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
memory_limit = 768M
max_execution_time = 18000
session.auto_start = off
suhosin.session.cryptua = off
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ class Content extends \Magento\Backend\Block\Widget
*/
private $imageHelper;

/**
* @var \Magento\Framework\View\Asset\Repository
*/
private $assetRepo;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Framework\Json\EncoderInterface $jsonEncoder
Expand Down Expand Up @@ -147,13 +142,8 @@ public function getImagesJson()
$fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file']));
$image['size'] = $fileHandler['size'];
} catch (FileSystemException $e) {
$staticDir = $this->_filesystem->getDirectoryRead(DirectoryList::STATIC_VIEW);
$image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('thumbnail');
$fileHandler = $staticDir->stat(
$this->getAssetRepo()
->createAsset($this->getImageHelper()->getPlaceholder('thumbnail'))->getPath()
);
$image['size'] = $fileHandler['size'];
$image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('small_image');
$image['size'] = 0;
$this->_logger->warning($e);
}
}
Expand Down Expand Up @@ -262,18 +252,4 @@ private function getImageHelper()
}
return $this->imageHelper;
}

/**
* @return \Magento\Framework\View\Asset\Repository
* @deprecated
*/
private function getAssetRepo()
{
if ($this->assetRepo === null) {
$this->assetRepo = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\View\Asset\Repository::class);
}

return $this->assetRepo;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ class ContentTest extends \PHPUnit_Framework_TestCase
*/
protected $imageHelper;

/**
* @var \Magento\Framework\View\Asset\Repository|\PHPUnit_Framework_MockObject_MockObject
*/
protected $assetRepo;

/**
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
*/
Expand Down Expand Up @@ -171,12 +166,7 @@ public function testGetImagesJsonWithException()
{
$this->imageHelper = $this->getMockBuilder(\Magento\Catalog\Helper\Image::class)
->disableOriginalConstructor()
->setMethods(['getDefaultPlaceholderUrl', 'getPlaceholder'])
->getMock();

$this->assetRepo = $this->getMockBuilder(\Magento\Framework\View\Asset\Repository::class)
->disableOriginalConstructor()
->setMethods(['createAsset', 'getPath'])
->setMethods(['getDefaultPlaceholderUrl'])
->getMock();

$this->objectManager->setBackwardCompatibleProperty(
Expand All @@ -185,32 +175,24 @@ public function testGetImagesJsonWithException()
$this->imageHelper
);

$this->objectManager->setBackwardCompatibleProperty(
$this->content,
'assetRepo',
$this->assetRepo
);

$placeholderUrl = 'url_to_the_placeholder/placeholder.jpg';

$sizePlaceholder = ['size' => 399659];

$imagesResult = [
[
'value_id' => '2',
'file' => 'file_2.jpg',
'media_type' => 'image',
'position' => '0',
'url' => 'url_to_the_placeholder/placeholder.jpg',
'size' => 399659
'size' => 0
],
[
'value_id' => '1',
'file' => 'file_1.jpg',
'media_type' => 'image',
'position' => '1',
'url' => 'url_to_the_placeholder/placeholder.jpg',
'size' => 399659
'size' => 0
]
];

Expand Down Expand Up @@ -238,18 +220,13 @@ public function testGetImagesJsonWithException()
$this->mediaConfigMock->expects($this->any())->method('getMediaPath');
$this->readMock->expects($this->any())->method('stat')->willReturnOnConsecutiveCalls(
$this->throwException(
new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('test'))
new \Magento\Framework\Exception\FileSystemException(new Phrase('test'))
),
$sizePlaceholder,
$this->throwException(
new \Magento\Framework\Exception\FileSystemException(new \Magento\Framework\Phrase('test'))
),
$sizePlaceholder
new \Magento\Framework\Exception\FileSystemException(new Phrase('test'))
)
);
$this->imageHelper->expects($this->any())->method('getDefaultPlaceholderUrl')->willReturn($placeholderUrl);
$this->imageHelper->expects($this->any())->method('getPlaceholder');
$this->assetRepo->expects($this->any())->method('createAsset')->willReturnSelf();
$this->assetRepo->expects($this->any())->method('getPath');
$this->jsonEncoderMock->expects($this->once())->method('encode')->willReturnCallback('json_encode');

$this->assertSame(json_encode($imagesResult), $this->content->getImagesJson());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<argument name="dataSource" xsi:type="object">Magento\Sales\Model\ResourceModel\Status\Collection</argument>
<argument name="default_sort" xsi:type="string">state</argument>
<argument name="default_dir" xsi:type="string">desc</argument>
<argument name="pager_visibility" xsi:type="string">0</argument>
<argument name="pager_visibility" xsi:type="string">1</argument>
</arguments>
<block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="sales_order_status.grid.columnSet">
<arguments>
Expand Down
26 changes: 26 additions & 0 deletions pub/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

DirectoryIndex index.php

<IfModule mod_php5.c>
############################################
## Adjust memory limit

Expand All @@ -53,6 +54,31 @@
# Disable user agent verification to not break multiple image upload

php_flag suhosin.session.cryptua off
</IfModule>
<IfModule mod_php7.c>
############################################
## Adjust memory limit

php_value memory_limit 768M
php_value max_execution_time 18000

############################################
## Disable automatic session start
## before autoload was initialized

php_flag session.auto_start off

############################################
## Enable resulting html compression

#php_flag zlib.output_compression on

###########################################
# Disable user agent verification to not break multiple image upload

php_flag suhosin.session.cryptua off
</IfModule>


<IfModule mod_security.c>
###########################################
Expand Down
4 changes: 4 additions & 0 deletions pub/.user.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
memory_limit = 768M
max_execution_time = 18000
session.auto_start = off
suhosin.session.cryptua = off

0 comments on commit 8263ddb

Please sign in to comment.