Skip to content

Commit

Permalink
Merge branch 'main' into patch-6
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano authored Sep 13, 2023
2 parents 64d143e + 18aab82 commit 6f6970e
Show file tree
Hide file tree
Showing 18 changed files with 87 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand All @@ -71,7 +71,7 @@ jobs:

- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v39
with:
files: |
composer.*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/composer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get composer cache directory
id: composer-cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: OpenMage/Testfield
path: ./
Expand All @@ -36,7 +36,7 @@ jobs:
run: composer install --prefer-dist --no-progress --ignore-platform-reqs

- name: Checkout OpenMage repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: openmage

Expand Down
54 changes: 27 additions & 27 deletions .github/workflows/security-php.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: PHP Security Check

on:
# Run automatically every Monday on midnight.
schedule:
- cron: '0 0 * * 1'
# Run on pull requests only when composer.lock has changed.
pull_request:
paths:
- 'composer.lock'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
check:
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

- uses: actions/cache@v3
id: cache-db
with:
path: ~/.symfony/cache
key: db

- uses: symfonycorp/security-checker-action@v5
name: PHP Security Check

on:
# Run automatically every Monday on midnight.
schedule:
- cron: '0 0 * * 1'
# Run on pull requests only when composer.lock has changed.
pull_request:
paths:
- 'composer.lock'
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
check:
runs-on: [ubuntu-latest]

steps:
- uses: actions/checkout@v4

- uses: actions/cache@v3
id: cache-db
with:
path: ~/.symfony/cache
key: db

- uses: symfonycorp/security-checker-action@v5
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
os: [ubuntu-latest]
php: ['7.4', '8.1']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/syntax-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/syntax-xml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Update APT repositories
run: "sudo apt update"
Expand Down
33 changes: 28 additions & 5 deletions app/code/core/Mage/Core/Block/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,28 @@ public function getShowTemplateHints()
return self::$_showTemplateHints;
}

/**
* Retrieve block cache status
*
* @return string
*/
private function _getCacheHintStatusColor(): string
{
if (!is_null($this->getCacheLifetime())) {
return 'green';
} else {
$currentParentBlock = $this;
$i = 0;
while ($i++ < 20 && $currentParentBlock instanceof Mage_Core_Block_Abstract) {
if (!is_null($currentParentBlock->getCacheLifetime())) {
return 'orange'; // not cached, but within cached
}
$currentParentBlock = $currentParentBlock->getParentBlock();
}
}
return 'red';
}

/**
* Retrieve block view from file (template)
*
Expand All @@ -226,17 +248,18 @@ public function fetchView($fileName)
ob_start();
}
if ($hints) {
$cacheHintStatusColor = $this->_getCacheHintStatusColor();
echo <<<HTML
<div style="position:relative; border:1px dotted red; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;">
<div style="position:absolute; left:0; top:0; padding:2px 5px; background:red; color:white; font:normal 11px Arial;
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'"
<div style="position:relative; border:1px dotted {$cacheHintStatusColor}; margin:6px 2px; padding:18px 2px 2px 2px; zoom:1;">
<div style="position:absolute; left:0; top:0; padding:2px 5px; background:{$cacheHintStatusColor}; color:white; font:normal 11px Arial;
text-align:left !important; z-index:998;text-transform: none;" onmouseover="this.style.zIndex='999'"
onmouseout="this.style.zIndex='998'" title="{$fileName}">{$fileName}</div>
HTML;
if (Mage::app()->getStore()->isAdmin() ? self::$_showTemplateHintsBlocksAdmin : self::$_showTemplateHintsBlocks) {
$thisClass = get_class($this);
echo <<<HTML
<div style="position:absolute; right:0; top:0; padding:2px 5px; background:red; color:blue; font:normal 11px Arial;
text-align:left !important; z-index:998;" onmouseover="this.style.zIndex='999'" onmouseout="this.style.zIndex='998'"
<div style="position:absolute; right:0; top:0; padding:2px 5px; background:{$cacheHintStatusColor}; color:blue; font:normal 11px Arial;
text-align:left !important; z-index:998;text-transform: none;" onmouseover="this.style.zIndex='999'" onmouseout="this.style.zIndex='998'"
title="{$thisClass}">{$thisClass}</div>
HTML;
}
Expand Down
13 changes: 9 additions & 4 deletions app/code/core/Mage/Core/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,17 +1002,21 @@ public function unEscapeCSVData($data)
}

/**
* Returns true if the rate limit of the current client is exceeded
* @param bool $setErrorMessage Adds a predefined error message to the 'core/session' object
* @return bool
* @param bool $recordRateLimitHit
* @return bool is rate limit exceeded
*/
public function isRateLimitExceeded($setErrorMessage = true, $recordRateLimitHit = true): bool
public function isRateLimitExceeded(bool $setErrorMessage = true, bool $recordRateLimitHit = true): bool
{
$active = Mage::getStoreConfigFlag('system/rate_limit/active');
if ($active && $remoteAddr = Mage::helper('core/http')->getRemoteAddr()) {
$cacheTag = 'rate_limit_' . $remoteAddr;
if (Mage::app()->testCache($cacheTag)) {
$errorMessage = "Too Soon: You are trying to perform this operation too frequently. Please wait a few seconds and try again.";
Mage::getSingleton('core/session')->addError($this->__($errorMessage));
if ($setErrorMessage) {
$errorMessage = $this->__("Too Soon: You are trying to perform this operation too frequently. Please wait a few seconds and try again.");
Mage::getSingleton('core/session')->addError($errorMessage);
}
return true;
}

Expand All @@ -1025,6 +1029,7 @@ public function isRateLimitExceeded($setErrorMessage = true, $recordRateLimitHit
}

/**
* Save the client rate limit hit to the cache
* @return void
*/
public function recordRateLimitHit(): void
Expand Down
22 changes: 11 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified skin/adminhtml/default/default/images/placeholder/thumbnail.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6f6970e

Please sign in to comment.