Skip to content

Commit ee7a5c7

Browse files
Revert "Merge branch '2.4-develop' into ACQE-7751"
This reverts commit df9d00e, reversing changes made to 11c6742.
1 parent fdc555c commit ee7a5c7

File tree

11 files changed

+141
-231
lines changed

11 files changed

+141
-231
lines changed

app/code/Magento/Backend/Cron/CleanLocks.php

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright 2015 Adobe
5-
* All Rights Reserved.
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
99
<group id="default">
1010
<job name="backend_clean_cache" instance="Magento\Backend\Cron\CleanCache" method="execute">
1111
<schedule>30 2 * * *</schedule>
1212
</job>
13-
<job name="backend_clean_locks" instance="Magento\Backend\Cron\CleanLocks" method="execute">
14-
<schedule>20 2 * * *</schedule>
15-
</job>
1613
</group>
1714
</config>

app/code/Magento/ImportExport/Model/Import.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2011 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66

77
namespace Magento\ImportExport\Model;
@@ -79,7 +79,7 @@ class Import extends AbstractModel
7979
public const FIELD_NAME_ALLOWED_ERROR_COUNT = 'allowed_error_count';
8080

8181
/**
82-
* Validation strategy field name
82+
* Validation startegt field name
8383
*/
8484
public const FIELD_NAME_VALIDATION_STRATEGY = 'validation_strategy';
8585

@@ -904,7 +904,7 @@ protected function createHistoryReport($sourceFileRelative, $entity, $extension
904904
$this->_varDirectory->writeFile($copyFile, $content);
905905
}
906906
} catch (FileSystemException $e) {
907-
throw new LocalizedException(__('Source file copying failed'));
907+
throw new LocalizedException(__('Source file coping failed'));
908908
}
909909
$this->importHistoryModel->addReport($copyName);
910910
}

app/code/Magento/ImportExport/Test/Unit/Model/ImportTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2015 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

@@ -1011,7 +1011,7 @@ public function testCreateHistoryReportExtensionIsSet()
10111011
public function testCreateHistoryReportThrowException()
10121012
{
10131013
$this->expectException(LocalizedException::class);
1014-
$this->expectExceptionMessage('Source file copying failed');
1014+
$this->expectExceptionMessage('Source file coping failed');
10151015
$sourceFileRelative = null;
10161016
$entity = '';
10171017
$extension = '';

app/code/Magento/ImportExport/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Status,Status
9090
"Import data validation is complete.","Import data validation is complete."
9191
"The behavior token for %1 is invalid.","The behavior token for %1 is invalid."
9292
"Please enter a correct entity model","Please enter a correct entity model"
93-
"Source file copying failed","Source file copying failed"
93+
"Source file coping failed","Source file coping failed"
9494
"The source is not set.","The source is not set."
9595
"The adapter type must be a non-empty string.","The adapter type must be a non-empty string."
9696
"'%1' file extension is not supported","'%1' file extension is not supported"

app/code/Magento/Theme/view/frontend/templates/html/title.phtml

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,28 @@
11
<?php
22
/**
3-
* Copyright 2015 Adobe
4-
* All Rights Reserved.
5-
*/
6-
/**
7-
* Escaper
8-
*
9-
* @var \Magento\Framework\Escaper
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
105
*/
6+
117
/**
128
* @var $block \Magento\Theme\Block\Html\Title
139
*/
1410
$cssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : '';
1511
$titleHtml = '';
16-
17-
$pageHeading = $block->getPageHeading() ? trim($block->getPageHeading()) : '';
18-
19-
if ($pageHeading) {
12+
if (trim($block->getPageHeading())) {
2013
$titleHtml = '<span class="base" data-ui-id="page-title-wrapper" '
2114
. $block->getAddBaseAttribute()
2215
. '>'
23-
. $escaper->escapeHtml($pageHeading)
16+
. $block->escapeHtml($block->getPageHeading())
2417
. '</span>';
2518
}
2619
?>
27-
28-
<?php if ($titleHtml): ?>
29-
<div class="page-title-wrapper<?= $escaper->escapeHtmlAttr($cssClass) ?>">
20+
<?php if ($titleHtml) : ?>
21+
<div class="page-title-wrapper<?= $block->escapeHtmlAttr($cssClass) ?>">
3022
<h1 class="page-title"
31-
<?php if ($block->getId()): ?> id="<?= $escaper->escapeHtmlAttr($block->getId()) ?>" <?php endif; ?>
32-
<?php if ($block->getAddBaseAttributeAria()): ?>
33-
aria-labelledby="<?= $escaper->escapeHtmlAttr($block->getAddBaseAttributeAria()) ?>"
23+
<?php if ($block->getId()) : ?> id="<?= $block->escapeHtmlAttr($block->getId()) ?>" <?php endif; ?>
24+
<?php if ($block->getAddBaseAttributeAria()) : ?>
25+
aria-labelledby="<?= $block->escapeHtmlAttr($block->getAddBaseAttributeAria()) ?>"
3426
<?php endif; ?>>
3527
<?= /* @noEscape */ $titleHtml ?>
3628
</h1>

app/code/Magento/User/view/adminhtml/web/js/roles-tree.js

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
define([
1010
'jquery',
1111
'jquery/ui',
12-
'jquery/jstree/jquery.jstree',
13-
'mage/translate'
12+
'jquery/jstree/jquery.jstree'
1413
], function ($) {
1514
'use strict';
1615

17-
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
1816
$.widget('mage.rolesTree', {
1917
options: {
2018
treeInitData: {},
@@ -28,7 +26,9 @@ define([
2826
this.element.jstree({
2927
plugins: ['checkbox'],
3028
checkbox: {
29+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
3130
three_state: false,
31+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
3232
visible: this.options.checkboxVisible,
3333
cascade: 'undetermined'
3434
},
@@ -40,66 +40,13 @@ define([
4040
}
4141
});
4242
this._bind();
43-
this._createButtons();
44-
},
45-
46-
_createButtons: function () {
47-
const $tree = $.jstree.reference(this.element),
48-
collapseAllButton = document.createElement('button'),
49-
expandAllButton = document.createElement('button'),
50-
expandUsedButton = document.createElement('button'),
51-
parent = this.element[0],
52-
ul = this.element.find('ul')[0];
53-
54-
collapseAllButton.innerText = $.mage.__('Collapse all');
55-
collapseAllButton.addEventListener('click', function () {
56-
$tree.close_all();
57-
});
58-
59-
expandAllButton.innerText = $.mage.__('Expand all');
60-
expandAllButton.addEventListener('click', function () {
61-
$tree.open_all();
62-
});
63-
64-
expandUsedButton.innerText = $.mage.__('Expand selected');
65-
expandUsedButton.addEventListener('click', function () {
66-
const hasOpened = [];
67-
68-
$tree.get_checked(true).forEach(function (node) {
69-
$tree.open_node(node);
70-
hasOpened.push(node.id);
71-
for (let i = 0; i < node.parents.length - 1; i++) {
72-
const id = node.parents[i];
73-
74-
if (!hasOpened.includes(id)) {
75-
$tree.open_node($tree.get_node(id));
76-
hasOpened.push(id);
77-
}
78-
}
79-
});
80-
});
81-
82-
this.buttons = [
83-
collapseAllButton,
84-
expandAllButton,
85-
expandUsedButton
86-
];
87-
88-
this.buttons.forEach(function (button) {
89-
button.type = 'button';
90-
parent.insertBefore(button, ul);
91-
});
9243
},
9344

9445
/**
9546
* @private
9647
*/
9748
_destroy: function () {
9849
this.element.jstree('destroy');
99-
100-
this.buttons.forEach(function (element) {
101-
element.parentNode.removeChild(element);
102-
});
10350
},
10451

10552
/**
@@ -117,6 +64,7 @@ define([
11764
* @private
11865
*/
11966
_selectChildNodes: function (event, selected) {
67+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
12068
selected.instance.open_node(selected.node);
12169
selected.node.children.each(function (id) {
12270
var selector = '[id="' + id + '"]';
@@ -125,6 +73,7 @@ define([
12573
selected.instance.get_node($(selector), false)
12674
);
12775
});
76+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
12877
},
12978

13079
/**
Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2019 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

@@ -22,16 +22,12 @@ class FileLockTest extends \PHPUnit\Framework\TestCase
2222
*/
2323
private $objectManager;
2424

25-
/** @var string */
26-
private string $lockPath;
27-
2825
protected function setUp(): void
2926
{
30-
$this->lockPath = '/tmp/magento-test-locks';
3127
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
3228
$this->model = $this->objectManager->create(
3329
\Magento\Framework\Lock\Backend\FileLock::class,
34-
['path' => $this->lockPath]
30+
['path' => '/tmp']
3531
);
3632
}
3733

@@ -56,28 +52,4 @@ public function testUnlockWithoutExistingLock()
5652
$this->assertFalse($this->model->isLocked($name));
5753
$this->assertFalse($this->model->unlock($name));
5854
}
59-
60-
public function testCleanupOldFile()
61-
{
62-
$name = 'test_lock';
63-
64-
$this->assertTrue($this->model->lock($name));
65-
$this->assertTrue($this->model->unlock($name));
66-
67-
touch(sprintf('%s/%s', $this->lockPath, $name), strtotime('30 hours ago'));
68-
69-
$this->assertEquals(1, $this->model->cleanupOldLocks());
70-
}
71-
72-
public function testDontCleanupNewFile()
73-
{
74-
$name = 'test_lock';
75-
76-
$this->assertTrue($this->model->lock($name));
77-
$this->assertTrue($this->model->unlock($name));
78-
79-
touch(sprintf('%s/%s', $this->lockPath, $name), strtotime('1 hour ago'));
80-
81-
$this->assertEquals(0, $this->model->cleanupOldLocks());
82-
}
8355
}

lib/internal/Magento/Framework/Lock/Backend/FileLock.php

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright 2019 Adobe
4-
* All Rights Reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
55
*/
66
declare(strict_types=1);
77

@@ -42,7 +42,7 @@ class FileLock implements LockManagerInterface
4242
/**
4343
* The mapping list of the path lock with the file resource
4444
*
45-
* @var array<string, resource>
45+
* @var array
4646
*/
4747
private $locks = [];
4848

@@ -105,49 +105,6 @@ public function lock(string $name, int $timeout = -1): bool
105105
return true;
106106
}
107107

108-
/**
109-
* Find lock files that haven't been touched in the last 24 hours, are 0 bytes and are unlocked, then delete those
110-
*/
111-
public function cleanupOldLocks(): int
112-
{
113-
if (!$this->fileDriver->isExists($this->path)) {
114-
return 0;
115-
}
116-
117-
$numberOfLocksDeleted = 0;
118-
$timestamp24HoursAgo = strtotime('24 hours ago');
119-
120-
$lockFiles = $this->fileDriver->readDirectory($this->path);
121-
foreach ($lockFiles as $lockFile) {
122-
if (!$this->fileDriver->isFile($lockFile)) {
123-
continue;
124-
}
125-
126-
$modifiedTimestamp = filemtime($lockFile);
127-
if ($timestamp24HoursAgo < $modifiedTimestamp) {
128-
continue;
129-
}
130-
131-
$filesize = filesize($lockFile);
132-
if ($filesize !== 0) {
133-
continue;
134-
}
135-
136-
if ($this->isLocked(basename($lockFile))) {
137-
continue;
138-
}
139-
140-
try {
141-
$this->fileDriver->deleteFile($lockFile);
142-
++$numberOfLocksDeleted;
143-
} catch (FileSystemException $exception) { // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock.DetectedCatch
144-
// do nothing
145-
}
146-
}
147-
148-
return $numberOfLocksDeleted;
149-
}
150-
151108
/**
152109
* Checks if a lock exists by name
153110
*

0 commit comments

Comments
 (0)