From 63a7200d6db04e469d47b33023c022584f164b31 Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Thu, 18 May 2023 22:35:32 +0100 Subject: [PATCH 1/4] Added PHP8 configurations to .htaccess (#3254) --- .htaccess | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.htaccess b/.htaccess index 9a9d3b18db0..7251495a9dc 100644 --- a/.htaccess +++ b/.htaccess @@ -40,6 +40,34 @@ +############################################ +## php8 settings + + + +############################################ +## adjust max execution time + + 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 + + + ########################################### # disable POST processing to not break multiple image upload From 090e21750d4aa733f5e360baf274cca3ac907a8c Mon Sep 17 00:00:00 2001 From: Fabrizio Balliano Date: Fri, 19 May 2023 09:02:00 +0100 Subject: [PATCH 2/4] PHPCS fix relative to #2210 --- lib/Varien/Data/Collection/Db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Varien/Data/Collection/Db.php b/lib/Varien/Data/Collection/Db.php index 1126bed1297..b20a4791d38 100644 --- a/lib/Varien/Data/Collection/Db.php +++ b/lib/Varien/Data/Collection/Db.php @@ -241,7 +241,7 @@ public function getSelectCountSql() $countSelect->columns('COUNT(*)'); // Simple optimization - remove all joins if there are no where clauses using joined tables and all joins are left joins - $leftJoins = array_filter($countSelect->getPart(Zend_Db_Select::FROM), function($table) { + $leftJoins = array_filter($countSelect->getPart(Zend_Db_Select::FROM), function ($table) { return ($table['joinType'] == Zend_Db_Select::LEFT_JOIN || $table['joinType'] == Zend_Db_Select::FROM); }); if (count($leftJoins) == count($countSelect->getPart(Zend_Db_Select::FROM))) { From 58be830f5fdea8e65aff6bd020826f0678083520 Mon Sep 17 00:00:00 2001 From: Andrey Gorbunov Date: Sun, 21 May 2023 13:01:00 +0200 Subject: [PATCH 3/4] GitHub Actions - `check-files` workflow - split into steps as a workaround for step template size limit (#3276) * Refs #3275: GitHub Actions - `check-files` workflow - split into steps as a workaround for step template size limit * Update .all-contributorsrc --------- Co-authored-by: Fabrizio Balliano --- .all-contributorsrc | 9 +++++ .github/workflows/check-files.yml | 62 ++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index e2ce8b9ae93..3d7e60208a1 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1382,6 +1382,15 @@ "contributions": [ "code" ] + }, + { + "login": "gorbunovav", + "name": "Andrey Gorbunov", + "avatar_url": "https://avatars.githubusercontent.com/u/2665015?v=4", + "profile": "https://github.com/gorbunovav", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7 diff --git a/.github/workflows/check-files.yml b/.github/workflows/check-files.yml index ac14aa845bc..b9c092c84ca 100644 --- a/.github/workflows/check-files.yml +++ b/.github/workflows/check-files.yml @@ -41,16 +41,16 @@ jobs: name: Changed runs-on: [ubuntu-latest] outputs: - composer: ${{ steps.all.outputs.composer }} - php: ${{ steps.all.outputs.php }} - xml: ${{ steps.all.outputs.xml }} - workflow: ${{ steps.all.outputs.workflow }} - phpcs: ${{ steps.all.outputs.phpcs }} - php-cs-fixer: ${{ steps.all.outputs.php-cs-fixer }} - phpstan: ${{ steps.all.outputs.phpstan }} - phpunit-test: ${{ steps.all.outputs.phpunit-test }} - phpunit: ${{ steps.all.outputs.phpunit }} - sonar: ${{ steps.all.outputs.sonar }} + composer: ${{ steps.changes-composer.outputs.composer }} + php: ${{ steps.changes-php.outputs.php }} + xml: ${{ steps.changes-xml.outputs.xml }} + workflow: ${{ steps.changes-workflow.outputs.workflow }} + phpcs: ${{ steps.changes-phpcs.outputs.phpcs }} + php-cs-fixer: ${{ steps.changes-php-cs-fixer.outputs.php-cs-fixer }} + phpstan: ${{ steps.changes-phpstan.outputs.phpstan }} + phpunit-test: ${{ steps.changes-phpunit-test.outputs.phpunit-test }} + phpunit: ${{ steps.changes-phpunit.outputs.phpunit }} + sonar: ${{ steps.changes-sonar.outputs.sonar }} steps: - name: Checkout code @@ -86,8 +86,8 @@ jobs: dev/phpunit* dev/sonar* - - name: Run step if any file(s) changed - id: all + - name: Check if composer files changed + id: changes-composer if: steps.changed-files-specific.outputs.any_modified == 'true' run: | echo "One or more files have changed." @@ -96,38 +96,74 @@ jobs: echo "$count Composer file(s) changed" echo "composer=$count" >> $GITHUB_OUTPUT + - name: Check if PHP files changed + id: changes-php + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "*.php" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count PHP file(s) changed" echo "php=$count" >> $GITHUB_OUTPUT + - name: Check if XML files changed + id: changes-xml + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "*.xml" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count XML file(s) changed" echo "xml=$count" >> $GITHUB_OUTPUT + - name: Check if Workflow files changed + id: changes-workflow + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE ".github/workflows/**" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count Workflow file(s) changed" echo "workflow=$count" >> $GITHUB_OUTPUT + - name: Check if PHPCS test files changed + id: changes-phpcs + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "**phpcs**" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count PHPCS file(s) changed" echo "phpcs=$count" >> $GITHUB_OUTPUT + - name: Check if PHP-CS-Fixer files changed + id: changes-php-cs-fixer + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "**php-cs-fixer**" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count PHP-CS-Fixer file(s) changed" echo "php-cs-fixer=$count" >> $GITHUB_OUTPUT + - name: Check if PHPStan files changed + id: changes-phpstan + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "**phpstan**" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count PHPStan file(s) changed" echo "phpstan=$count" >> $GITHUB_OUTPUT + - name: Check if PHPUnit test files changed + id: changes-phpunit-test + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "dev/tests/" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count UnitTest test file(s) changed" echo "phpunit-test=$count" >> $GITHUB_OUTPUT + - name: Check if PHPUnit files changed + id: changes-phpunit + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "dev/phpunit*" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" - echo "$count UnitTest file(s) changed" + echo "$count PHPUnit file(s) changed" echo "phpunit=$count" >> $GITHUB_OUTPUT + - name: Check if Sonar files changed + id: changes-sonar + if: steps.changed-files-specific.outputs.any_modified == 'true' + run: | count="$(grep -oE "dev/sonar*" <<< "${{ steps.changed-files-specific.outputs.all_modified_files }}" | wc -l)" echo "$count Sonar file(s) changed" echo "sonar=$count" >> $GITHUB_OUTPUT From 68cb9ecd7bc30e8d973cb600c9c6e193fb9adde4 Mon Sep 17 00:00:00 2001 From: Tomasz Gregorczyk Date: Sun, 21 May 2023 13:04:23 +0200 Subject: [PATCH 4/4] Fix admin ACL mismatch for OAuth (#3272) (#3274) Co-authored-by: Ng Kiat Siong Co-authored-by: Fabrizio Balliano --- .all-contributorsrc | 11 +++++- .../Adminhtml/Oauth/Admin/TokenController.php | 2 +- .../Oauth/AuthorizedTokensController.php | 2 +- .../Adminhtml/Oauth/ConsumerController.php | 2 +- .../oauth_setup/upgrade-1.0.0.0-1.0.0.1.php | 35 +++++++++++++++++++ app/code/core/Mage/Oauth/etc/adminhtml.xml | 8 ++--- app/code/core/Mage/Oauth/etc/config.xml | 2 +- 7 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 app/code/core/Mage/Oauth/data/oauth_setup/upgrade-1.0.0.0-1.0.0.1.php diff --git a/.all-contributorsrc b/.all-contributorsrc index 3d7e60208a1..16a3a91a860 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -1391,7 +1391,16 @@ "contributions": [ "code" ] - } + }, + { + "login": "Tomasz-Silpion", + "name": "Tomasz Gregorczyk", + "avatar_url": "https://avatars.githubusercontent.com/u/5328659?v=4", + "profile": "https://github.com/Tomasz-Silpion", + "contributions": [ + "code" + ] + }, ], "contributorsPerLine": 7 } diff --git a/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php index 6914471f929..1e51d84dbb9 100644 --- a/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php +++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/Admin/TokenController.php @@ -155,6 +155,6 @@ protected function _isAllowed() { /** @var Mage_Admin_Model_Session $session */ $session = Mage::getSingleton('admin/session'); - return $session->isAllowed('system/acl/admin_token'); + return $session->isAllowed('system/api/oauth_admin_token'); } } diff --git a/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php index 55b0e372bc9..d6a1b9e84c6 100644 --- a/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php +++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/AuthorizedTokensController.php @@ -149,7 +149,7 @@ protected function _isAllowed() { /** @var Mage_Admin_Model_Session $session */ $session = Mage::getSingleton('admin/session'); - return $session->isAllowed('system/oauth/authorizedTokens'); + return $session->isAllowed('system/api/oauth_authorized_tokens'); } /** diff --git a/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php index fbf8056771d..bc25301639d 100644 --- a/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php +++ b/app/code/core/Mage/Oauth/controllers/Adminhtml/Oauth/ConsumerController.php @@ -240,7 +240,7 @@ protected function _isAllowed() } /** @var Mage_Admin_Model_Session $session */ $session = Mage::getSingleton('admin/session'); - return $session->isAllowed('system/oauth/consumer' . $action); + return $session->isAllowed('system/api/oauth_consumer' . $action); } /** diff --git a/app/code/core/Mage/Oauth/data/oauth_setup/upgrade-1.0.0.0-1.0.0.1.php b/app/code/core/Mage/Oauth/data/oauth_setup/upgrade-1.0.0.0-1.0.0.1.php new file mode 100644 index 00000000000..fd764978c23 --- /dev/null +++ b/app/code/core/Mage/Oauth/data/oauth_setup/upgrade-1.0.0.0-1.0.0.1.php @@ -0,0 +1,35 @@ +startSetup(); + +$table = $installer->getTable('admin/rule'); +$resourceIds = [ + 'admin/system/api/consumer' => 'admin/system/api/oauth_consumer', + 'admin/system/api/consumer/delete' => 'admin/system/api/oauth_consumer/delete', + 'admin/system/api/consumer/edit' => 'admin/system/api/oauth_consumer/edit', + 'admin/system/api/authorizedTokens' => 'admin/system/api/oauth_authorized_tokens' +]; + +foreach ($resourceIds as $oldId => $newId) { + $installer->getConnection()->update( + $table, + ['resource_id' => $newId], + ['resource_id = ?' => $oldId] + ); +} + +$installer->endSetup(); diff --git a/app/code/core/Mage/Oauth/etc/adminhtml.xml b/app/code/core/Mage/Oauth/etc/adminhtml.xml index 1e6ea5d4ed0..dc2f3c02664 100644 --- a/app/code/core/Mage/Oauth/etc/adminhtml.xml +++ b/app/code/core/Mage/Oauth/etc/adminhtml.xml @@ -23,7 +23,7 @@ - + OAuth Consumers 20 @@ -36,11 +36,11 @@ 40 - - + + OAuth Authorized Tokens 30 - + OAuth Admin My Apps 40 diff --git a/app/code/core/Mage/Oauth/etc/config.xml b/app/code/core/Mage/Oauth/etc/config.xml index d1745e635aa..ccf844d1660 100644 --- a/app/code/core/Mage/Oauth/etc/config.xml +++ b/app/code/core/Mage/Oauth/etc/config.xml @@ -17,7 +17,7 @@ - 1.0.0.0 + 1.0.0.1