Skip to content

Commit

Permalink
Merge branch '1.9.4.x' into phpstan/mage-backup
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/code/core/Mage/Backup/Model/Config/Backend/Cron.php
  • Loading branch information
sreichel committed Jan 2, 2023
2 parents e672935 + e29f7c5 commit 3c278e3
Show file tree
Hide file tree
Showing 137 changed files with 490 additions and 327 deletions.
14 changes: 13 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,10 @@
"login": "cebe",
"name": "Carsten Brandt",
"avatar_url": "https://avatars.githubusercontent.com/u/189796?v=4",
"profile": "http://cebe.cc/"
"profile": "http://cebe.cc/",
"contributions": [
"code"
]
},
{
"login": "eneiasramos",
Expand All @@ -1351,6 +1354,15 @@
"contributions": [
"code"
]
},
{
"login": "rfeese",
"name": "Roger Feese",
"avatar_url": "https://avatars.githubusercontent.com/u/7074181?v=4",
"profile": "https://github.com/rfeese",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7
Expand Down
7 changes: 7 additions & 0 deletions .ddev/commands/web/php-cs-fixer
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHP-CS-Fixer
## Usage: php-cs-fixer
## Example: ddev php-cs-fixer <path-to-files>

php vendor/bin/php-cs-fixer fix "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpcbf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPCodeBeautifier
## Usage: phpcbf
## Example: ddev phpcbf <path-to-files>

php vendor/bin/phpcbf -s -p --report=full,source,summary "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpcs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPCodeSniffer
## Usage: phpcs
## Example: ddev phpcs <path-to-files>

php vendor/bin/phpcs -s -p --report=full,summary "$@"
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPMD
## Usage: phpmd
## Example: ddev phpmd <path-to-files>

php vendor/bin/phpmd "$@" text .phpmd.dist.xml
7 changes: 7 additions & 0 deletions .ddev/commands/web/phpstan
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

## Description: run PHPStan
## Usage: phpstan
## Example: ddev phpstan <path-to-files>

XDEBUG_MODE=off php vendor/bin/phpstan analyze "$@"
22 changes: 22 additions & 0 deletions .github/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

paths-ignore:
- 'js/prototype/prototype.js'
- 'skin/frontend/rwd/default/js/lib/selectivizr.js'
- 'js/mage/adminhtml/flexuploader.js'
- 'js/mage/adminhtml/sales/packaging.js'
- 'js/mage/adminhtml/uploader/instance.js'
- 'js/mage/adminhtml/wysiwyg/tiny_mce/setup.js'
- 'js/prototype/validation.js'
- 'js/tiny_mce/tiny_mce_dev.js'
- 'js/tiny_mce/tiny_mce.js'
- 'js/tiny_mce/tiny_mce_src.js'
- 'js/tiny_mce/tiny_mce_jquery.js'
- 'js/tiny_mce/tiny_mce_jquery_src.js'
- 'js/tiny_mce/tiny_mce_prototype.js'
- 'js/tiny_mce/tiny_mce_prototype_src.js'
- 'js/tiny_mce/classes/**/*.js'
- 'js/tiny_mce/utils/**/*.js'
- 'js/tiny_mce/plugins/**/*.js'
- 'js/lib/jquery/jquery-1.12.4.js'
- 'js/extjs/ext-tree.js'
- '**/*.test.js'
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -623,3 +623,7 @@
- dev/sonar*
- .github/workflows/phpunit.yml
- .github/workflows/sonar.yml

'ddev':
- .ddev/*
- .ddev/**/*
76 changes: 76 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "1.9.4.x", 20.0 ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "1.9.4.x", 20.0 ]
paths-ignore:
- '**/*.md'
- '**/*.txt'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
93 changes: 47 additions & 46 deletions .phpmd.dist.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
<ruleset name="OpenMage ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
Expand All @@ -9,22 +9,22 @@
</description>

<!-- UNUSEDCODE
UnusedFormalParameter [fixed]
UnusedLocalVariable
UnusedPrivateField
UnusedPrivateMethod
[?] UnusedFormalParameter
[x] UnusedLocalVariable
[x] UnusedPrivateField
[x] UnusedPrivateMethod
-->
<rule ref="rulesets/unusedcode.xml" />

<!-- CLEANCODE
BooleanArgumentFlag
ElseExpression
ErrorControlOperator
DuplicatedArrayKey
IfStatementAssignment
MissingImport
StaticAccess
UndefinedVariable
[-] BooleanArgumentFlag
[?] ElseExpression
[?] ErrorControlOperator
[x] DuplicatedArrayKey
[ ] IfStatementAssignment
[?] MissingImport
[-] StaticAccess
[?] UndefinedVariable
-->
<rule ref="rulesets/cleancode.xml">
<exclude name="BooleanArgumentFlag" />
Expand All @@ -41,12 +41,12 @@
</rule>

<!-- CONTROVERSIAL
CamelCaseClassName
CamelCaseMethodName
CamelCaseParameterName
CamelCasePropertyName
CamelCaseVariableName
Superglobals
[ ] CamelCaseClassName
[ ] CamelCaseMethodName
[ ] CamelCaseParameterName
[ ] CamelCasePropertyName
[ ] CamelCaseVariableName
[x] Superglobals
-->
<rule ref="rulesets/controversial.xml/CamelCaseMethodName">
<properties>
Expand All @@ -67,31 +67,32 @@
<rule ref="rulesets/controversial.xml/Superglobals" />

<!-- NAMEING
BooleanGetMethodName
ConstantNamingConventions
ConstructorWithNameAsEnclosingClass
LongClassName
ShortClassName
LongVariable
ShortVariable
ShortMethodName
[ ] BooleanGetMethodName
[ ] ConstantNamingConventions
[ ] ConstructorWithNameAsEnclosingClass
[ ] LongClassName
[ ] ShortClassName
[ ] LongVariable
[?] ShortVariable
[ ] ShortMethodName
-->
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="a,b,e,id,idx,io,ip,to,x,y,x1,x2,y1,y2" />
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName" />

<!-- DESIGN
CountInLoopExpression
CouplingBetweenObjects
DepthOfInheritance
DevelopmentCodeFragment
EmptyCatchBlock
EvalExpression
ExitExpression
GotoStatement
NumberOfChildren
[-] CountInLoopExpression
[x] CouplingBetweenObjects
[-] DepthOfInheritance
[x] DevelopmentCodeFragment
[x] EmptyCatchBlock
[x] EvalExpression
[x] ExitExpression
[x] GotoStatement
[-] NumberOfChildren
-->
<rule ref="rulesets/design.xml">
<exclude name="CouplingBetweenObjects" />
Expand All @@ -100,16 +101,16 @@
</rule>

<!-- CODESIZE
ExcessiveClassComplexity
ExcessiveClassLength
ExcessiveMethodLength
ExcessiveParameterList
ExcessivePublicCount
CyclomaticComplexity
NPathComplexity
TooManyFields
TooManyMethods
TooManyPublicMethods
[-] ExcessiveClassComplexity
[-] ExcessiveClassLength
[-] ExcessiveMethodLength
[-] ExcessiveParameterList
[-] ExcessivePublicCount
[-] CyclomaticComplexity
[-] NPathComplexity
[-] TooManyFields
[-] TooManyMethods
[-] TooManyPublicMethods
-->
<rule ref="rulesets/codesize.xml">
<exclude name="CyclomaticComplexity" />
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<tr>
<td align="center"><a href="https://github.com/eneiasramos"><img src="https://avatars.githubusercontent.com/u/2862728?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>Enéias Ramos de Melo</b></sub></a></td>
<td align="center"><a href="https://github.com/discountscott"><img src="https://avatars.githubusercontent.com/u/5454596?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>Scott Moore</b></sub></a></td>
<td align="center"><a href="https://github.com/rfeese"><img src="https://avatars.githubusercontent.com/u/7074181?v=4" loading="lazy" width="100" alt=""/><br /><sub><b>Roger Feese</b></sub></a></td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/Resource/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function _saveRelations(Mage_Core_Model_Abstract $user)

$adapter->delete($this->getTable('admin/role'), $conditions);
foreach ($rolesIds as $rid) {
$rid = intval($rid);
$rid = (int) $rid;
if ($rid > 0) {
$role = Mage::getModel('admin/role')->load($rid);
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Admin/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ protected function _beforeSave()
$this->cleanPasswordsValidationData();

if (!is_null($this->getIsActive())) {
$data['is_active'] = intval($this->getIsActive());
$data['is_active'] = (int) $this->getIsActive();
}

$this->addData($data);
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getSaveButtonHtml()

public function getDeleteButtonHtml()
{
if (intval($this->getRequest()->getParam('rid')) == 0) {
if ((int) $this->getRequest()->getParam('rid') == 0) {
return;
}
return $this->getChildHtml('deleteButton');
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Api/Editroles.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected function _beforeToHtml()
'content' => $this->getLayout()->createBlock('adminhtml/api_tab_rolesedit')->toHtml(),
]);

if (intval($roleId) > 0) {
if ((int) $roleId > 0) {
$this->addTab('roles', [
'label' => Mage::helper('adminhtml')->__('Role Users'),
'title' => Mage::helper('adminhtml')->__('Role Users'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ protected function _prepareForm()

protected function _getSetId()
{
return (intval($this->getRequest()->getParam('id')) > 0)
? intval($this->getRequest()->getParam('id'))
return ((int) $this->getRequest()->getParam('id') > 0)
? (int) $this->getRequest()->getParam('id')
: Mage::getModel('eav/entity_type')
->load(Mage::registry('entityType'))
->getDefaultAttributeSetId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function getFieldSuffix()
public function getStoreId()
{
$storeId = $this->getRequest()->getParam('store');
return intval($storeId);
return (int) $storeId;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/Adminhtml/Block/Permissions/Buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getSaveButtonHtml()

public function getDeleteButtonHtml()
{
if (intval($this->getRequest()->getParam('rid')) == 0) {
if ((int) $this->getRequest()->getParam('rid') == 0) {
return;
}
return $this->getChildHtml('deleteButton');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function render(Varien_Object $row)
return $data;
}

$data = floatval($data) * $this->_getRate($row);
$data = (float) $data * $this->_getRate($row);
$data = sprintf("%F", $data);
$data = Mage::app()->getLocale()->currency($currency_code)->toCurrency($data);
return $data;
Expand Down
Loading

0 comments on commit 3c278e3

Please sign in to comment.