diff --git a/vendor/magento/module-backend/Block/Widget/Grid/Column/Renderer/Action.php b/vendor/magento/module-backend/Block/Widget/Grid/Column/Renderer/Action.php index 0da7e4db9b9..df1cb16ab89 100644 --- a/vendor/magento/module-backend/Block/Widget/Grid/Column/Renderer/Action.php +++ b/vendor/magento/module-backend/Block/Widget/Grid/Column/Renderer/Action.php @@ -15,6 +15,7 @@ use Magento\Framework\View\Helper\SecureHtmlRenderer; * * @api * @deprecated 100.2.0 in favour of UI component implementation + * @see don't recommend this approach in favour of UI component implementation * @since 100.0.2 */ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text @@ -132,7 +133,7 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text } if (empty($action['id'])) { - $action['id'] = 'id' .$this->random->getRandomString(10); + $action['id'] = 'id' . $this->random->getRandomString(10); } $actionAttributes->setData($action); $onclick = $actionAttributes->getData('onclick'); @@ -140,6 +141,8 @@ class Action extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Text $actionAttributes->unsetData(['onclick', 'style']); $html = 'serialize() . '>' . $actionCaption . ''; if ($onclick) { + // phpcs:ignore Magento2.Functions.DiscouragedFunction + $onclick = mb_convert_encoding($onclick, "UTF-8", "HTML-ENTITIES"); $html .= $this->secureHtmlRenderer->renderEventListenerAsTag('onclick', $onclick, "#{$action['id']}"); } if ($style) { diff --git a/vendor/magento/module-backup/Model/ResourceModel/Db.php b/vendor/magento/module-backup/Model/ResourceModel/Db.php index c38a7b3005e..cf39406d54a 100644 --- a/vendor/magento/module-backup/Model/ResourceModel/Db.php +++ b/vendor/magento/module-backup/Model/ResourceModel/Db.php @@ -301,7 +301,7 @@ class Db */ public function runCommand($command) { - $this->connection->query($command); + $this->connection->multiQuery($command); return $this; } } diff --git a/vendor/magento/framework/Backup/Filesystem/Iterator/File.php b/vendor/magento/framework/Backup/Filesystem/Iterator/File.php index 9602807a8ae..4a29271fc51 100644 --- a/vendor/magento/framework/Backup/Filesystem/Iterator/File.php +++ b/vendor/magento/framework/Backup/Filesystem/Iterator/File.php @@ -19,6 +19,13 @@ class File extends \SplFileObject */ protected $_currentStatement = ''; + /** + * Store current statement delimiter. + * + * @var string + */ + private string $statementDelimiter = ';'; + /** * Return current sql statement * @@ -39,15 +46,35 @@ class File extends \SplFileObject $this->_currentStatement = ''; while (!$this->eof()) { $line = $this->fgets(); - if (strlen(trim($line))) { - $this->_currentStatement .= $line; - if ($this->_isLineLastInCommand($line)) { + $trimmedLine = trim($line); + if (!empty($trimmedLine) && !$this->isDelimiterChanged($trimmedLine)) { + $statementFinalLine = '/(?.*)' . preg_quote($this->statementDelimiter, '/') . '$/'; + if (preg_match($statementFinalLine, $trimmedLine, $matches)) { + $this->_currentStatement .= $matches['statement']; break; + } else { + $this->_currentStatement .= $line; } } } } + /** + * Check whether statement delimiter has been changed. + * + * @param string $line + * @return bool + */ + private function isDelimiterChanged(string $line): bool + { + if (preg_match('/^delimiter\s+(?.+)$/i', $line, $matches)) { + $this->statementDelimiter = $matches['delimiter']; + return true; + } + + return false; + } + /** * Return to first statement * @@ -69,26 +96,4 @@ class File extends \SplFileObject { return $line[0] == '#' || substr($line, 0, 2) == '--'; } - - /** - * Check is line a last in sql command - * - * @param string $line - * @return bool - */ - protected function _isLineLastInCommand($line) - { - $cleanLine = trim($line); - $lineLength = strlen($cleanLine); - - $returnResult = false; - if ($lineLength > 0) { - $lastSymbolIndex = $lineLength - 1; - if ($cleanLine[$lastSymbolIndex] == ';') { - $returnResult = true; - } - } - - return $returnResult; - } }