Skip to content

Commit ce96357

Browse files
authored
Merge pull request from GHSA-wqq8-mqj9-697f
Release 4.10.1 - removal of vendor/phpunit in upgrade steps
2 parents 1302047 + 6e99057 commit ce96357

File tree

4 files changed

+76
-3
lines changed

4 files changed

+76
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ nbproject
33
/tests/E2E/
44
/vendor/
55

6-
.php_cs.cache
6+
.php_cs.cache
7+
.idea

autoupgrade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __construct()
3131
$this->name = 'autoupgrade';
3232
$this->tab = 'administration';
3333
$this->author = 'PrestaShop';
34-
$this->version = '4.10.0';
34+
$this->version = '4.10.1';
3535
$this->need_instance = 1;
3636

3737
$this->bootstrap = true;

config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<module>
33
<name>autoupgrade</name>
44
<displayName><![CDATA[1-Click Upgrade]]></displayName>
5-
<version><![CDATA[4.10.0]]></version>
5+
<version><![CDATA[4.10.1]]></version>
66
<description><![CDATA[Provides an automated method to upgrade your shop to the latest version of PrestaShop.]]></description>
77
<author><![CDATA[PrestaShop]]></author>
88
<tab><![CDATA[administration]]></tab>

upgrade/install-4.10.1.php

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?php
2+
/**
3+
* 2007-2020 PrestaShop.
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Academic Free License 3.0 (AFL-3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* https://opensource.org/licenses/AFL-3.0
11+
* If you did not receive a copy of the license and are unable to
12+
* obtain it through the world-wide-web, please send an email
13+
* to [email protected] so we can send you a copy immediately.
14+
*
15+
* DISCLAIMER
16+
*
17+
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18+
* versions in the future. If you wish to customize PrestaShop for your
19+
* needs please refer to http://www.prestashop.com for more information.
20+
*
21+
* @author PrestaShop SA <[email protected]>
22+
* @copyright 2007-2020 PrestaShop SA
23+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
24+
* International Registered Trademark & Property of PrestaShop SA
25+
*/
26+
if (!defined('_PS_VERSION_')) {
27+
exit;
28+
}
29+
30+
/**
31+
* Removes files or directories.
32+
*
33+
* @param array $files An array of files to remove
34+
*
35+
* @return true|string True if everything goes fine, error details otherwise
36+
*/
37+
function removeFromFsDuringUpgrade(array $files)
38+
{
39+
$files = array_reverse($files);
40+
foreach ($files as $file) {
41+
if (is_dir($file)) {
42+
$iterator = new FilesystemIterator($file, FilesystemIterator::CURRENT_AS_PATHNAME | FilesystemIterator::SKIP_DOTS);
43+
removeFromFsDuringUpgrade(iterator_to_array($iterator));
44+
if (!rmdir($file) && file_exists($file)) {
45+
return 'Deletion of directory ' . $file . 'failed';
46+
}
47+
} elseif (!unlink($file) && file_exists($file)) {
48+
return 'Deletion of file ' . $file . 'failed';
49+
}
50+
}
51+
52+
return true;
53+
}
54+
/**
55+
* This upgrade file removes the folder vendor/phpunit, when added from a previous release installed on the shop.
56+
*
57+
* @return true|array
58+
*/
59+
function upgrade_module_4_10_1($module)
60+
{
61+
$path = __DIR__ . '/../vendor/phpunit';
62+
if (file_exists($path)) {
63+
$result = removeFromFsDuringUpgrade(array($path));
64+
if ($result !== true) {
65+
PrestaShopLogger::addLog('Could not delete PHPUnit from module. ' . $result, 3);
66+
67+
return false;
68+
}
69+
}
70+
71+
return true;
72+
}

0 commit comments

Comments
 (0)