Skip to content

Commit

Permalink
Merge branch 'main' into rector-1-cq
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel authored Aug 7, 2024
2 parents 675cf95 + 4005bc3 commit adcee64
Show file tree
Hide file tree
Showing 26 changed files with 401 additions and 331 deletions.
17 changes: 17 additions & 0 deletions .ddev/commands/web/magerun
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

## Description: Execute n98-magerun
## Usage: magerun
## Example: "ddev magerun"

if [ ! -f vendor/bin/n98-magerun ]; then
read -r -p "n98-magerun is not installed. Do you want to install it? [y/N] " INSTALL_MAGE
INSTALL_MAGERUN=${INSTALL_MAGERUN,,} # to lower
if [[ "${INSTALL_MAGERUN}" =~ ^(yes|y) ]]; then
composer require --dev n98/magerun:dev-develop
else
exit 1
fi
fi

php -d error_reporting="E_ALL ^E_DEPRECATED" vendor/bin/n98-magerun "$@"
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ for more information.
* [Lee Saferite](https://github.com/LeeSaferite)
* [Mohamed Elidrissi](https://github.com/elidrissidev)
* [Ng Kiat Siong](https://github.com/kiatng)
* [Sven Reichel](https://github.com/sreichel)
* [Tymoteusz Motylewski](https://github.com/tmotyl)
## License
Expand Down
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public static function getOpenMageVersionInfo(): array
return [
'major' => '20',
'minor' => '10',
'patch' => '0',
'patch' => '2',
'stability' => '', // beta,alpha,rc
'number' => '', // 1,2,3,0.3.7,x.7.z.92 @see https://semver.org/#spec-item-9
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*/
class Mage_Adminhtml_Model_System_Config_Backend_File extends Mage_Core_Model_Config_Data
{
public const SYSTEM_FILESYSTEM_REGEX = '/{{([a-z_]+)}}(.*)/';

/**
* Upload max file size in kilobytes
*
Expand Down Expand Up @@ -144,6 +146,12 @@ protected function _getUploadDir()
*/
protected function _getUploadRoot($token)
{
$value = Mage::getStoreConfig($token) ?? '';
if (strlen($value) && preg_match(self::SYSTEM_FILESYSTEM_REGEX, $value, $matches) !== false) {
$dir = str_replace('root_dir', 'base_dir', $matches[1]);
$path = str_replace('/', DS, $matches[2]);
return Mage::getConfig()->getOptions()->getData($dir) . $path;
}
return Mage::getBaseDir('media');
}

Expand Down
7 changes: 0 additions & 7 deletions app/code/core/Mage/Core/etc/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1520,13 +1520,6 @@
</no_route>
</fields>
</default>
<polls translate="label">
<label>Polls</label>
<sort_order>40</sort_order>
<show_in_default>1</show_in_default>
<show_in_website>1</show_in_website>
<show_in_store>1</show_in_store>
</polls>
<cookie translate="label">
<label>Session Cookie Management</label>
<sort_order>50</sort_order>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ public function getFilterElementName($attributeCode)
* Get row edit URL.
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $row
* @return false
* @return string
*/
public function getRowUrl($row)
{
return false;
return '';
}

/**
Expand Down
4 changes: 3 additions & 1 deletion app/code/core/Mage/ImportExport/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class Mage_ImportExport_Helper_Data extends Mage_Core_Helper_Data
*/
public function getMaxUploadSize()
{
return min(ini_get('post_max_size'), ini_get('upload_max_filesize'));
$postMaxSizeBytes = ini_parse_quantity(ini_get('post_max_size'));
$uploadMaxSizeBytes = ini_parse_quantity(ini_get('upload_max_filesize'));
return min($postMaxSizeBytes, $uploadMaxSizeBytes);
}

/**
Expand Down
11 changes: 7 additions & 4 deletions app/code/core/Mage/ImportExport/Model/Export.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ protected function _getEntityAdapter()

if (isset($validTypes[$this->getEntity()])) {
try {
$this->_entityAdapter = Mage::getModel($validTypes[$this->getEntity()]['model']);
/** @var Mage_ImportExport_Model_Export_Entity_Abstract $_entityAdapter */
$_entityAdapter = Mage::getModel($validTypes[$this->getEntity()]['model']);
$this->_entityAdapter = $_entityAdapter;
} catch (Exception $e) {
Mage::logException($e);
Mage::throwException(
Expand Down Expand Up @@ -104,7 +106,9 @@ protected function _getWriter()

if (isset($validWriters[$this->getFileFormat()])) {
try {
$this->_writer = Mage::getModel($validWriters[$this->getFileFormat()]['model']);
/** @var Mage_ImportExport_Model_Export_Adapter_Abstract $_writer */
$_writer = Mage::getModel($validWriters[$this->getFileFormat()]['model']);
$this->_writer = $_writer;
} catch (Exception $e) {
Mage::logException($e);
Mage::throwException(
Expand Down Expand Up @@ -185,8 +189,7 @@ public function exportFile()
Mage::throwException(
Mage::helper('importexport')->__('There is no data for export')
);
}
if ($result['rows']) {
} else {
$this->addLogComment([
Mage::helper('importexport')->__('Exported %s rows.', $result['rows']),
Mage::helper('importexport')->__('Export has been done.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ abstract class Mage_ImportExport_Model_Export_Entity_Abstract
/**
* Entity type id.
*
* @var int
* @var string|null
*/
protected $_entityTypeId;

Expand Down Expand Up @@ -170,7 +170,10 @@ public function __construct()
{
$entityCode = $this->getEntityTypeCode();
$this->_entityTypeId = Mage::getSingleton('eav/config')->getEntityType($entityCode)->getEntityTypeId();
$this->_connection = Mage::getSingleton('core/resource')->getConnection('write');

/** @var Varien_Db_Adapter_Pdo_Mysql $_connection */
$_connection = Mage::getSingleton('core/resource')->getConnection('write');
$this->_connection = $_connection;
}

/**
Expand Down Expand Up @@ -436,7 +439,7 @@ abstract public function getEntityTypeCode();
/**
* Entity type ID getter.
*
* @return int
* @return string|null
*/
public function getEntityTypeId()
{
Expand Down
8 changes: 5 additions & 3 deletions app/code/core/Mage/ImportExport/Model/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Mage_ImportExport_Model_Import extends Mage_ImportExport_Model_Abstract
/**
* Entity invalidated indexes.
*
* @var Mage_ImportExport_Model_Import_Entity_Abstract
* @var array<string, array<int, string>>
*/
protected static $_entityInvalidatedIndexes = [
'catalog_product' => [
Expand All @@ -80,7 +80,9 @@ protected function _getEntityAdapter()

if (isset($validTypes[$this->getEntity()])) {
try {
$this->_entityAdapter = Mage::getModel($validTypes[$this->getEntity()]['model']);
/** @var Mage_ImportExport_Model_Import_Entity_Abstract $_entityAdapter */
$_entityAdapter = Mage::getModel($validTypes[$this->getEntity()]['model']);
$this->_entityAdapter = $_entityAdapter;
} catch (Exception $e) {
Mage::logException($e);
Mage::throwException(
Expand Down Expand Up @@ -366,7 +368,7 @@ public function expandSource()
if (!empty($row[$colName])) {
preg_match($regExps[$regExpType], $row[$colName], $m);

$row[$colName] = $m[1] . ($m[2] + $size) . ($regExpType == 'middle' ? $m[3] : '');
$row[$colName] = $m[1] . ((int) $m[2] + $size) . ($regExpType == 'middle' ? $m[3] : '');
}
}
$writer->writeRow($row);
Expand Down
13 changes: 8 additions & 5 deletions app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ abstract class Mage_ImportExport_Model_Import_Entity_Abstract
/**
* DB connection.
*
* @var Varien_Convert_Adapter_Interface
* @var Varien_Db_Adapter_Pdo_Mysql
*/
protected $_connection;

Expand All @@ -54,7 +54,7 @@ abstract class Mage_ImportExport_Model_Import_Entity_Abstract
/**
* Entity type id.
*
* @var int
* @var string|null
*/
protected $_entityTypeId;

Expand Down Expand Up @@ -183,10 +183,13 @@ abstract class Mage_ImportExport_Model_Import_Entity_Abstract

public function __construct()
{
$entityType = Mage::getSingleton('eav/config')->getEntityType($this->getEntityTypeCode());
$entityType = Mage::getSingleton('eav/config')->getEntityType($this->getEntityTypeCode());
$this->_entityTypeId = $entityType->getEntityTypeId();
$this->_dataSourceModel = Mage_ImportExport_Model_Import::getDataSourceModel();
$this->_connection = Mage::getSingleton('core/resource')->getConnection('write');

/** @var Varien_Db_Adapter_Pdo_Mysql $_connection */
$_connection = Mage::getSingleton('core/resource')->getConnection('write');
$this->_connection = $_connection;
}

/**
Expand Down Expand Up @@ -398,7 +401,7 @@ abstract public function getEntityTypeCode();
/**
* Entity type ID getter.
*
* @return int
* @return string|null
*/
public function getEntityTypeId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ protected function _saveCustomers()
$entityRowsIn = [];
$entityRowsUp = [];
$attributes = [];
$entityId = null;

$oldCustomersToLower = array_change_key_case($this->_oldCustomers, CASE_LOWER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo
/**
* url_key attribute id
*
* @var int
* @var string|false|null
*/
protected $_urlKeyAttributeId;

Expand Down Expand Up @@ -901,6 +901,8 @@ protected function _saveCustomOptions()
'updated_at' => Varien_Date::now()
];
}

$prevOptionId = 0;
if ($rowIsMain) {
$solidParams = [
'option_id' => $nextOptionId,
Expand Down Expand Up @@ -1152,6 +1154,7 @@ protected function _saveLinks()
$productIds = [];
$linkRows = [];
$positionRows = [];
$sku = null;

foreach ($bunch as $rowNum => $rowData) {
$this->_filterRowData($rowData);
Expand Down Expand Up @@ -1362,6 +1365,7 @@ protected function _saveProducts()
$tierPrices = [];
$groupPrices = [];
$mediaGallery = [];
$rowSku = null;
$uploadedGalleryFiles = [];
$previousType = null;
$previousAttributeSet = null;
Expand Down Expand Up @@ -2207,7 +2211,7 @@ public function getAffectedEntityIds()
/**
* Get product url_key attribute id
*
* @return null|int
* @return string|false|null
*/
protected function _getUrlKeyAttributeId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ public function saveData()
$newSku = $this->_entityModel->getNewSku();
$oldSku = $this->_entityModel->getOldSku();
$productSuperData = [];
$productSuperAttrId = null;
$productId = null;
$productData = null;
/** @var Mage_ImportExport_Model_Resource_Helper_Mysql4 $helper */
$helper = Mage::getResourceHelper('importexport');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public function saveData()
$newSku = $this->_entityModel->getNewSku();
$oldSku = $this->_entityModel->getOldSku();
$attributes = [];
$productData = [];

// pre-load attributes parameters
$select = $connection->select()
Expand Down Expand Up @@ -101,6 +102,7 @@ public function saveData()
} else {
continue;
}

$scope = $this->_entityModel->getRowScope($rowData);
if (Mage_ImportExport_Model_Import_Entity_Product::SCOPE_DEFAULT == $scope) {
$productData = $newSku[$rowData[Mage_ImportExport_Model_Import_Entity_Product::COL_SKU]];
Expand Down
27 changes: 27 additions & 0 deletions app/code/core/Mage/Newsletter/Block/Widget/Subscribe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/**
* OpenMage
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available at https://opensource.org/license/osl-3-0-php
*
* @category Mage
* @package Mage_Newsletter
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/**
* Newsletter subscribe form Widget
*
* @category Mage
* @package Mage_Newsletter
* @method string getSuccessMessage()
* @method string getErrorMessage()
* @method string getFormActionUrl()
*/
class Mage_Newsletter_Block_Widget_Subscribe extends Mage_Newsletter_Block_Subscribe implements Mage_Widget_Block_Interface
{
}
38 changes: 38 additions & 0 deletions app/code/core/Mage/Newsletter/etc/widget.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<!--
/**
* OpenMage
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available at https://opensource.org/license/afl-3-0-php
*
* @category Mage
* @package Mage_Newsletter
* @copyright Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
* @copyright Copyright (c) 2024 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
*/
-->
<widgets>
<newsletter_subscribe type="newsletter/widget_subscribe" translate="name description" module="newsletter">
<name>Newsletter Subscription Form</name>
<description>Newsletter Subscribe Form</description>
<is_email_compatible>0</is_email_compatible>
<parameters>
<template translate="label">
<label>Template</label>
<visible>1</visible>
<type>select</type>
<value>newsletter/subscribe.phtml</value>
<values>
<default translate="label">
<value>newsletter/subscribe.phtml</value>
<label>Default Template</label>
</default>
</values>
<sort_order>10</sort_order>
</template>
</parameters>
</newsletter_subscribe>
</widgets>
2 changes: 1 addition & 1 deletion app/code/core/Mage/Shipping/Model/Carrier/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object
/**
* Rate result data
*
* @var Mage_Shipping_Model_Rate_Result|null
* @var Mage_Shipping_Model_Rate_Result|Mage_Shipping_Model_Tracking_Result|null
*/
protected $_result;

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Uploader/Helper/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ public function getUploadMaxSize()
/**
* Get max upload size
*
* @return mixed
* @return string
*/
public function getDataMaxSize()
{
Expand Down
Loading

0 comments on commit adcee64

Please sign in to comment.