Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed May 21, 2023
2 parents d7a095d + 68cb9ec commit 1c93e5b
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 23 deletions.
20 changes: 19 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,25 @@
"contributions": [
"code"
]
}
},
{
"login": "gorbunovav",
"name": "Andrey Gorbunov",
"avatar_url": "https://avatars.githubusercontent.com/u/2665015?v=4",
"profile": "https://github.com/gorbunovav",
"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
}
62 changes: 49 additions & 13 deletions .github/workflows/check-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."
Expand All @@ -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
28 changes: 28 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,34 @@

</IfModule>

############################################
## php8 settings

<IfModule mod_php.c>

############################################
## 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

</IfModule>

<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?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_Admin
* @copyright Copyright (c) 2023 The OpenMage Contributors (https://www.openmage.org)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/

/** @var Mage_Core_Model_Resource_Setup $installer */
$installer = $this;
$installer->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();
8 changes: 4 additions & 4 deletions app/code/core/Mage/Oauth/etc/adminhtml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<children>
<api>
<children>
<consumer translate="title" module="oauth">
<oauth_consumer translate="title" module="oauth">
<title>OAuth Consumers</title>
<sort_order>20</sort_order>
<children>
Expand All @@ -36,11 +36,11 @@
<sort_order>40</sort_order>
</delete>
</children>
</consumer>
<authorizedTokens translate="title" module="oauth">
</oauth_consumer>
<oauth_authorized_tokens translate="title" module="oauth">
<title>OAuth Authorized Tokens</title>
<sort_order>30</sort_order>
</authorizedTokens>
</oauth_authorized_tokens>
<oauth_admin_token translate="title" module="oauth">
<title>OAuth Admin My Apps</title>
<sort_order>40</sort_order>
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Oauth/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<config>
<modules>
<Mage_Oauth>
<version>1.0.0.0</version>
<version>1.0.0.1</version>
</Mage_Oauth>
</modules>
<global>
Expand Down
2 changes: 1 addition & 1 deletion lib/Varien/Data/Collection/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))) {
Expand Down

0 comments on commit 1c93e5b

Please sign in to comment.