Skip to content

Commit

Permalink
1.1.1 RELEASE FINAL
Browse files Browse the repository at this point in the history
  • Loading branch information
d-belousov committed Sep 12, 2016
1 parent 8331911 commit b81ae0c
Show file tree
Hide file tree
Showing 36 changed files with 777 additions and 153 deletions.
2 changes: 1 addition & 1 deletion Block/Adminhtml/ControlPanel/Info/Actual.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function _beforeToHtml()
' (' . $this->getHelper('Magento')->getVersion() . ')';

// ---------------------------------------
$this->moduleVersion = $this->getHelper('Module')->getVersion();
$this->moduleVersion = $this->getHelper('Module')->getPublicVersion();
// ---------------------------------------

// ---------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions Block/Adminhtml/ControlPanel/Info/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public function _construct()
protected function _beforeToHtml()
{
$this->moduleName = $this->getHelper('Module')->getName();
$this->moduleVersion = $this->getHelper('Module')->getVersion();
$this->moduleRevision = $this->getHelper('Module')->getRevision();
$this->moduleVersion = $this->getHelper('Module')->getPublicVersion();

return parent::_beforeToHtml();
}
Expand Down
10 changes: 1 addition & 9 deletions Block/Adminhtml/Developers/Tabs/AboutModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ protected function _prepareForm()
'note',
[
'label' => $this->__('Version'),
'text' => $this->getHelper('Module')->getVersion()
]
);

$fieldSet->addField('m2e_revision',
'note',
[
'label' => $this->__('Revision'),
'text' => $this->getHelper('Module')->getRevision()
'text' => $this->getHelper('Module')->getPublicVersion()
]
);

Expand Down
3 changes: 0 additions & 3 deletions Block/Adminhtml/Magento/Product/Rule/Renderer/Editable.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@

class Editable extends AbstractBlock implements \Magento\Framework\Data\Form\Element\Renderer\RendererInterface
{
protected $filterManager;
protected $translateInline;

//########################################

public function __construct(
\Magento\Framework\Filter\FilterManager $filterManager,
\Magento\Framework\Translate\Inline $translateInline,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
array $data = []
)
{
$this->filterManager = $filterManager;
$this->translateInline = $translateInline;
parent::__construct($context, $data);
}
Expand Down
13 changes: 11 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
* 1.1.0 (r1171) (07/09/2016)
* 1.1.1 (12/09/2016)

* Improvement: Different versions values will be used for Marketing and Setup purposes
* Improvement: Just upgrades will be executed if there are module MySQL tables of previous version
* Improvement: New composer package name "ebay-amazon-rakuten-sears-magento-integration-order-import-and-stock-level-synchronization"
* Fix: Some errors that happens during setup:di:compile and setup:di:compile-multi-tenant
* Fix: Much stability of Installation/Upgrade (module sets maintenance and doesn't break setup:upgrade process)
* Fix: Redefinition of parameter $helperFactory in Ess/M2ePro/Model/Setup/Database/Modifier/AbstractModifier.php on line 29

* 1.1.0 (07/09/2016)

* Added: Ability to create Magento Attributes "On the Fly"
* Added: Advanced Filter for Magento Products / Listings Views Grids
Expand Down Expand Up @@ -46,6 +55,6 @@
* Fix: [Amazon] Incorrect behavior during adding Virtual Attributes to active Variation Products
* Removed: [eBay] List/Relist Scheduling was removed from Synchronization Policy

* 1.0.0 (r752) (04/07/2016)
* 1.0.0 (04/07/2016)

* Initial version for Magento v2.*
3 changes: 1 addition & 2 deletions Controller/Adminhtml/ControlPanel/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ protected function init()
$this->addCss('control_panel.css');

$title = $this->__('Control Panel')
.' (M2E Pro '.$this->getHelper('Module')->getVersion()
.'#'.$this->getHelper('Module')->getRevision().')';
.' (M2E Pro '.$this->getHelper('Module')->getPublicVersion().')';

$this->getResultPage()->getConfig()->getTitle()->prepend($title);
}
Expand Down
129 changes: 78 additions & 51 deletions Controller/Adminhtml/ControlPanel/Tools/M2ePro/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,38 +11,44 @@

class Install extends Command
{
protected $directoryReaderFactory;
protected $filesystemDriver;
protected $fileSystem;
protected $fileReaderFactory;

protected $directoryList;
protected $componentRegistrar;

protected $fileSystem;

//########################################

public function __construct(
\Magento\Framework\Filesystem\Directory\ReadFactory $directoryReaderFactory,
ComponentRegistrar $componentRegistrar,
\Magento\Framework\Filesystem\Driver\File $filesystemDriver,
\Magento\Framework\Filesystem $filesystem,
\Magento\Framework\Filesystem\File\ReadFactory $fileReaderFactory,
\Magento\Framework\App\Filesystem\DirectoryList $directoryList,
ComponentRegistrar $componentRegistrar,
Context $context
) {
$this->directoryReaderFactory = $directoryReaderFactory;
$this->fileSystem = $filesystem;
$this->componentRegistrar = $componentRegistrar;
$this->filesystemDriver = $filesystemDriver;
$this->fileSystem = $filesystem;
$this->fileReaderFactory = $fileReaderFactory;

$this->directoryList = $directoryList;
$this->componentRegistrar = $componentRegistrar;

parent::__construct($context);
}

//########################################

//todo implement
/**
* @title "Check Files Validity"
* @description "Check Files Validity"
*/
public function checkFilesValidityAction()
{
$dispatcherObject = $this->modelFactory->getObject('M2ePro\Connector\Dispatcher');
$connectorObj = $dispatcherObject->getVirtualConnector('files','get','info');
$connectorObj = $dispatcherObject->getVirtualConnector('files','get','info',
['magento_version' => 2]);
$dispatcherObject->process($connectorObj);
$responseData = $connectorObj->getResponseData();

Expand All @@ -51,26 +57,29 @@ public function checkFilesValidityAction()
}

$problems = array();

$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, Module::IDENTIFIER);
$directoryReader = $this->directoryReaderFactory->create($path);
$basePath = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, Module::IDENTIFIER);

foreach ($responseData['files_info'] as $info) {

if (!$directoryReader->isFile($info['path'])) {
$filePath = $basePath .DIRECTORY_SEPARATOR. $info['path'];

if (!$this->filesystemDriver->isExists($filePath)) {
$problems[] = array(
'path' => $info['path'],
'path' => $info['path'],
'reason' => 'File is missing'
);
continue;
}

$fileContent = trim($directoryReader->readFile($info['path']));
/** @var \Magento\Framework\Filesystem\File\Read $fileReader */
$fileReader = $this->fileReaderFactory->create($filePath, $this->filesystemDriver);

$fileContent = trim($fileReader->readAll());
$fileContent = str_replace(array("\r\n","\n\r",PHP_EOL), chr(10), $fileContent);

if (md5($fileContent) != $info['hash']) {
$problems[] = array(
'path' => $info['path'],
'path' => $info['path'],
'reason' => 'Hash mismatch'
);
continue;
Expand Down Expand Up @@ -119,7 +128,6 @@ public function checkFilesValidityAction()
return str_replace('%count%',count($problems),$html);
}

//todo implement
/**
* @title "Check Tables Structure Validity"
* @description "Check Tables Structure Validity"
Expand All @@ -130,7 +138,10 @@ public function checkTablesStructureValidityAction()

$dispatcherObject = $this->modelFactory->getObject('M2ePro\Connector\Dispatcher');
$connectorObj = $dispatcherObject->getVirtualConnector('tables','get','diff',
array('tables_info' => json_encode($tablesInfo)));
[
'magento_version' => 2,
'tables_info' => json_encode($tablesInfo)
]);

$dispatcherObject->process($connectorObj);
$responseData = $connectorObj->getResponseData();
Expand Down Expand Up @@ -182,34 +193,36 @@ public function checkTablesStructureValidityAction()
}
}

$linkTitle = '';
$urlParams = array(
'action' => 'fixColumn',
'table_name' => $tableName,
'column_info' => json_encode($resultInfo['original_data'])
);

if (empty($resultInfo['current_data']) ||
(isset($diffData['type']) || isset($diffData['default']) || isset($diffData['null']))) {

$linkTitle = 'Fix Properties';
$urlParams['mode'] = 'properties';
$url = $this->getUrl('*/*/fixColumn', $urlParams);
$actionsHtml .= "<a href=\"{$url}\">Fix Properties</a>";
}

if (isset($diffData['key'])) {

$linkTitle = 'Fix Index';
$urlParams['mode'] = 'index';
$url = $this->getUrl('*/*/fixColumn', $urlParams);
$actionsHtml .= "<a href=\"{$url}\">Fix Index</a>";
}

if (empty($resultInfo['original_data']) && !empty($resultInfo['current_data'])) {

$linkTitle = 'Drop';
$urlParams['mode'] = 'drop';
$urlParams['column_info'] = json_encode($resultInfo['current_data']);
$url = $this->getUrl('*/*/fixColumn', $urlParams);
$actionsHtml .= "<a href=\"{$url}\">Drop</a>";
}

$url = $this->getUrl('*/*/*', $urlParams);
$actionsHtml .= "<a href=\"{$url}\">{$linkTitle}</a>";

$html .= <<<HTML
<tr>
<td>{$tableName}</td>
Expand All @@ -225,15 +238,15 @@ public function checkTablesStructureValidityAction()
return str_replace('%count%',count($responseData['diff']),$html);
}

//todo implement
/**
* @title "Check Configs Validity"
* @description "Check Configs Validity"
*/
public function checkConfigsValidityAction()
{
$dispatcherObject = $this->modelFactory->getObject('M2ePro\Connector\Dispatcher');
$connectorObj = $dispatcherObject->getVirtualConnector('configs','get','info');
$connectorObj = $dispatcherObject->getVirtualConnector('configs','get','info',
['magento_version' => 2]);
$dispatcherObject->process($connectorObj);
$responseData = $connectorObj->getResponseData();

Expand All @@ -247,7 +260,7 @@ public function checkConfigsValidityAction()
foreach ($originalData as $tableName => $configInfo) {

$currentData[$tableName] = $this->getHelper('Module\Database\Structure')
->getConfigSnapshot($tableName);
->getConfigSnapshot($tableName);
}

$differenses = array();
Expand Down Expand Up @@ -284,7 +297,15 @@ public function checkConfigsValidityAction()

$html = $this->getStyleHtml();

$srcPath = $this->getHelper('Magento')->getBaseUrl() .
$this->directoryList->getUrlPath(\Magento\Framework\App\Filesystem\DirectoryList::STATIC_VIEW) .'/'.
$this->getHelper('Magento')->getThemePath() .'/'.
$this->getHelper('Magento')->getDefaultLocale();


$html .= <<<HTML
<script type="text/javascript" src="{$srcPath}/jquery.js"></script>
<h2 style="margin: 20px 0 0 10px">Configs Validity
<span style="color: #808080; font-size: 15px;">(%count% entries)</span>
</h2>
Expand All @@ -305,33 +326,32 @@ public function checkConfigsValidityAction()
if ($row['solution'] == 'insert') {

$url = $this->getUrl('*/controlPanel_database/addTableRow', array(
'table' => $row['table'],
'model' => $this->getHelper('Module\Database\Structure')->getTableModel($row['table']),
'table' => $row['table'],
));

} else {

$url = $this->getUrl('*/controlPanel_database/deleteTableRows', array(
'table' => $row['table'],
'model' => $this->getHelper('Module\Database\Structure')->getTableModel($row['table']),
'ids' => $row['item']['id']
'table'=> $row['table'],
'ids' => $row['item']['id']
));
}

$actionWord = $row['solution'] == 'insert' ? 'Insert' : 'Drop';
$styles = $row['solution'] == 'insert' ? '' : 'color: red;';
$styles = $row['solution'] == 'insert' ? '' : 'color: red;';

$onclickAction = <<<JS
var elem = $(this.id),
formData = Form.serialize(elem.up('tr').down('form'));
var elem = $(this);
elem.up('tr').remove();
new Ajax.Request( '{$url}' , {
new $.ajax({
url: '{$url}',
method: 'get',
asynchronous : true,
parameters : formData
data: elem.parents('tr').find('form').serialize(),
success: function(transport) {
elem.parents('tr').remove();
}
});
JS;
$html .= <<<HTML
<tr>
Expand Down Expand Up @@ -363,7 +383,6 @@ public function checkConfigsValidityAction()

// ---------------------------------------

//todo implement
/**
* @hidden
*/
Expand All @@ -376,18 +395,18 @@ public function fixColumnAction()
$repairMode = $this->getRequest()->getParam('mode');

if (!$tableName || !$repairMode) {
return $this->_redirect('*/*/checkTablesStructureValidity');
return $this->_redirect('*/*/*', ['action' => 'checkTablesStructureValidity']);
}

$helper = $this->getHelper('Module\Database\Repair');
$repairMode == 'index' && $helper->fixColumnIndex($tableName, $columnInfo);

$repairMode == 'index' && $helper->fixColumnIndex($tableName, $columnInfo);
$repairMode == 'properties' && $helper->fixColumnProperties($tableName, $columnInfo);
$repairMode == 'drop' && $helper->dropColumn($tableName, $columnInfo);
$repairMode == 'drop' && $helper->dropColumn($tableName, $columnInfo);

return $this->_redirect('*/*/checkTablesStructureValidity');
return $this->_redirect('*/*/*', ['action' => 'checkTablesStructureValidity']);
}

//todo implement
/**
* @title "Files Diff"
* @description "Files Diff"
Expand All @@ -398,14 +417,22 @@ public function filesDiffAction()
$filePath = base64_decode($this->getRequest()->getParam('filePath'));
$originalPath = base64_decode($this->getRequest()->getParam('originalPath'));

$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, Module::IDENTIFIER);
$directoryReader = $this->directoryReaderFactory->create($path);
$basePath = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, Module::IDENTIFIER);
$fullPath = $basePath .DIRECTORY_SEPARATOR. $filePath;

$params = array(
'content' => $directoryReader->read($filePath),
'path' => $originalPath ? $originalPath : $filePath
'magento_version' => 2,
'content' => '',
'path' => $originalPath ? $originalPath : $filePath
);

if ($this->filesystemDriver->isExists($fullPath)) {

/** @var \Magento\Framework\Filesystem\File\Read $fileReader */
$fileReader = $this->fileReaderFactory->create($fullPath, $this->filesystemDriver);
$params['content'] = $fileReader->readAll();
}

$dispatcherObject = $this->modelFactory->getObject('M2ePro\Connector\Dispatcher');
$connectorObj = $dispatcherObject->getVirtualConnector('files','get','diff', $params);

Expand Down
Loading

0 comments on commit b81ae0c

Please sign in to comment.