Skip to content

Commit

Permalink
Merge branch 'develop' into introduce-objectModel-comparator
Browse files Browse the repository at this point in the history
  • Loading branch information
PululuK committed Oct 24, 2024
2 parents 20e4352 + 327e0af commit 87633f4
Show file tree
Hide file tree
Showing 1,068 changed files with 5,414 additions and 3,354 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ https://devdocs.prestashop-project.org/9/contribute/contribution-guidelines/pull

| Questions | Answers
| ----------------- | -------------------------------------------------------
| Branch? | develop / 8.2.x
| Branch? | develop / 9.0.x / 8.2.x
| Description? | Please be specific when describing the PR. <br> Every detail helps: versions, browser/server configuration, specific module/theme, etc. Feel free to add more information below this table.
| Type? | bug fix / improvement / new feature / refacto
| Category? | FO / BO / CO / IN / WS / TE / LO / ME / PM / see explanations at https://devdocs.prestashop-project.org/9/contribute/contribution-guidelines/pull-requests/#type--category
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/cron_js_routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ jobs:
matrix:
BRANCH:
- develop
- 9.0.x
- 8.2.x
- 8.1.x
- 8.0.x
include:
- BRANCH: develop
node: 16
- BRANCH: 8.1.x
node: 16
- BRANCH: 8.0.x
node: 20
- BRANCH: 9.0.x
node: 20
- BRANCH: 8.2.x
node: 16

env:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/cron_nightly_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ jobs:
matrix:
BRANCH:
- develop
- 9.0.x
- 8.2.x
- 8.1.x
- 8.0.x
- 1.7.8.x
include:
- BRANCH: develop
node: 16
node: 20
- BRANCH: 9.0.x
node: 20
- BRANCH: 8.2.x
node: 16
- BRANCH: 8.1.x
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/cron_nightly_tests_9.0.x_mariadb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This workflow aim to run all UI tests on active branches
# and upload the report on Google cloud platform storage
name: Nightly tests and report - 9.0.x

on:
workflow_run:
workflows: [ 'Nightly Build' ]
types:
- requested

jobs:
test_9_0_x:
uses: ./.github/workflows/cron_nightly_tests_reusable.yml
with:
BRANCH: 9.0.x
PHP_VERSION: '8.1'
NODE_VERSION: '20'
DB_SERVER: 'mariadb'
secrets:
GC_PROJECT_ID: ${{ secrets.GC_PROJECT_ID }}
GC_SERVICE_KEY: ${{ secrets.GC_SERVICE_KEY }}
21 changes: 21 additions & 0 deletions .github/workflows/cron_nightly_tests_9.0.x_mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This workflow aim to run all UI tests on active branches
# and upload the report on Google cloud platform storage
name: Nightly tests and report - 9.0.x

on:
workflow_run:
workflows: [ 'Nightly Build' ]
types:
- requested

jobs:
test_9_0_x:
uses: ./.github/workflows/cron_nightly_tests_reusable.yml
with:
BRANCH: 9.0.x
PHP_VERSION: '8.1'
NODE_VERSION: '20'
DB_SERVER: 'mysql'
secrets:
GC_PROJECT_ID: ${{ secrets.GC_PROJECT_ID }}
GC_SERVICE_KEY: ${{ secrets.GC_SERVICE_KEY }}
4 changes: 4 additions & 0 deletions .github/workflows/cron_nightly_tests_reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ jobs:
database: mysql
- branch: 8.2.x
database: mysql
- branch: 9.0.x
database: mysql
- branch: 9.0.x
database: mariadb
- branch: develop
database: mysql
- branch: develop
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/cron_nightly_tests_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,17 @@ jobs:
CAMPAIGN: 'functional:FO:hummingbird:04-07'
- BRANCH: 8.2.x
CAMPAIGN: 'functional:FO:hummingbird:08-12'
## 9.0.x
- BRANCH: 9.0.x
CAMPAIGN: 'functional:FO:01-03'
- BRANCH: 9.0.x
CAMPAIGN: 'functional:FO:04-07'
- BRANCH: 9.0.x
CAMPAIGN: 'functional:FO:08-12'
- BRANCH: 9.0.x
CAMPAIGN: 'sanity:productV2'
- BRANCH: 9.0.x
CAMPAIGN: 'functional:productV2'
## develop
- BRANCH: develop
CAMPAIGN: 'functional:FO:01-03'
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cron_php_update_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
matrix:
BRANCH:
- develop
- 9.0.x
- 8.2.x
env:
GH_BRANCH: ${{ matrix.BRANCH }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sanity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ jobs:

- name: Run Tests
uses: ./.github/actions/ui-test
env:
## Improve Webkit stability
## Link : https://github.com/microsoft/playwright/issues/23899
GDK_BACKEND: x11
with:
TEST_CAMPAIGN: ${{ env.TEST_CAMPAIGN }}
BROWSER: ${{ matrix.browser }}
Expand Down
8 changes: 1 addition & 7 deletions classes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/

use PrestaShop\PrestaShop\Adapter\ServiceLocator;
use PrestaShop\PrestaShop\Adapter\SymfonyContainer;
use PrestaShop\PrestaShop\Core\Exception\InvalidArgumentException;
use PrestaShop\PrestaShop\Core\Image\ImageFormatConfiguration;
Expand Down Expand Up @@ -632,13 +631,8 @@ public function deleteImage($forceDelete = false)

// Delete auto-generated images
$image_types = ImageType::getImagesTypes();

// Get image formats we will be deleting. It would probably be easier to use ImageFormatConfiguration::SUPPORTED_FORMATS,
// but we want to avoid any behavior change in minor/patch version.
$configuredImageFormats = ServiceLocator::get(ImageFormatConfiguration::class)->getGenerationFormats();

foreach ($image_types as $imageType) {
foreach ($configuredImageFormats as $imageFormat) {
foreach (ImageFormatConfiguration::SUPPORTED_FORMATS as $imageFormat) {
$filesToDelete = $this->deleteAutoGeneratedImage($imageType, $imageFormat, $filesToDelete);
}
}
Expand Down
6 changes: 1 addition & 5 deletions classes/ObjectModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -1854,18 +1854,14 @@ public function deleteImage($force_delete = false)
return false;
}

// Get image formats we will be deleting. It would probably be easier to use ImageFormatConfiguration::SUPPORTED_FORMATS,
// but we want to avoid any behavior change in minor/patch version.
$configuredImageFormats = ServiceLocator::get(ImageFormatConfiguration::class)->getGenerationFormats();
$types = ImageType::getImagesTypes();

foreach ($types as $image_type) {
if (file_exists($this->image_dir . $this->id . '-' . stripslashes($image_type['name']) . '.' . $this->image_format)
&& !unlink($this->image_dir . $this->id . '-' . stripslashes($image_type['name']) . '.' . $this->image_format)) {
return false;
}

foreach ($configuredImageFormats as $imageFormat) {
foreach (ImageFormatConfiguration::SUPPORTED_FORMATS as $imageFormat) {
$file = $this->image_dir . $this->id . '-' . stripslashes($image_type['name']) . '.' . $imageFormat;
if (file_exists($file)) {
unlink($file);
Expand Down
10 changes: 6 additions & 4 deletions classes/Tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -2282,7 +2282,7 @@ public static function generateHtaccess($path = null, $rewrite_settings = null,

if ($rewrite_settings) {
// Compatibility with the old image filesystem
fwrite($write_fd, "# Images\n");
fwrite($write_fd, "# Rewrites for product images (support up to < 10 million images)\n");

// Rewrite product images < 10 millions
$path_components = [];
Expand All @@ -2293,12 +2293,14 @@ public static function generateHtaccess($path = null, $rewrite_settings = null,
fwrite($write_fd, $domain_rewrite_cond);
fwrite($write_fd, 'RewriteRule ^(' . str_repeat('([\d])', $i) . '(?:\-[\w-]*)?)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/p/' . $path . '/$1$' . ($i + 2) . " [L]\n");
}

fwrite($write_fd, "# Rewrites for category images\n");
fwrite($write_fd, $media_domains);
fwrite($write_fd, $domain_rewrite_cond);
fwrite($write_fd, 'RewriteRule ^c/([\d]+)(\-[\.*\w-]*)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3 [L]' . PHP_EOL);
fwrite($write_fd, 'RewriteRule ^c/([\d]+)(|_thumb)(\-[\.*\w-]*)/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3$4 [L]' . PHP_EOL);
fwrite($write_fd, $media_domains);
fwrite($write_fd, $domain_rewrite_cond);
fwrite($write_fd, 'RewriteRule ^c/([a-zA-Z_-]+)(-[\d]+)?/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3 [L]' . PHP_EOL);
fwrite($write_fd, 'RewriteRule ^c/([a-zA-Z_-]+)(|_thumb)(-[\d]+)?/.+(\.(?:jpe?g|webp|png|avif))$ %{ENV:REWRITEBASE}img/c/$1$2$3$4 [L]' . PHP_EOL);
}

fwrite($write_fd, "# AlphaImageLoader for IE and fancybox\n");
Expand All @@ -2309,7 +2311,7 @@ public static function generateHtaccess($path = null, $rewrite_settings = null,
}
// Redirections to dispatcher
if ($rewrite_settings) {
fwrite($write_fd, "\n# Dispatcher\n");
fwrite($write_fd, "\n# Send all other traffic to dispatcher\n");
fwrite($write_fd, "RewriteCond %{REQUEST_FILENAME} -s [OR]\n");
fwrite($write_fd, "RewriteCond %{REQUEST_FILENAME} -l [OR]\n");
fwrite($write_fd, "RewriteCond %{REQUEST_FILENAME} -d\n");
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"prestashop/hummingbird": "dev-develop",
"prestashop/pagesnotfound": "^2",
"prestashop/productcomments": "^7.0",
"prestashop/ps_apiresources": "dev-update-module",
"prestashop/ps_apiresources": "dev-reset-module",
"prestashop/ps_banner": "^2",
"prestashop/ps_bestsellers": "^1.0",
"prestashop/ps_brandlist": "^1.0",
Expand Down Expand Up @@ -257,7 +257,7 @@
"repositories": {
"ps_apiresources": {
"type": "vcs",
"url": "https://github.com/jolelievre/ps_apiresources.git"
"url": "https://github.com/jinpresta/ps_apiresources.git"
}
},
"minimum-stability": "dev",
Expand Down
30 changes: 15 additions & 15 deletions composer.lock

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

2 changes: 1 addition & 1 deletion install-dev/controllers/http/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public function display(): void
$this->database_login = $parameters['parameters']['database_user'];
$this->database_password = $parameters['parameters']['database_password'];
$this->database_engine = $parameters['parameters']['database_engine'];
$this->database_prefix = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1,10))), 0, 5).'_';
$this->database_prefix = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyz', mt_rand(1,10))), 0, 5).'_';

$this->database_clear = true;
$this->use_smtp = false;
Expand Down
3 changes: 3 additions & 0 deletions install-dev/data/xml/configuration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -897,5 +897,8 @@ Country</value>
<configuration id="PS_ADMIN_API_FORCE_DEBUG_SECURED" name="PS_ADMIN_API_FORCE_DEBUG_SECURED">
<value>1</value>
</configuration>
<configuration id="PS_SEPARATOR_FILE_MANAGER_SQL" name="PS_SEPARATOR_FILE_MANAGER_SQL">
<value>;</value>
</configuration>
</entities>
</entity_configuration>
2 changes: 2 additions & 0 deletions phpstan-disallowed-calls.neon
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ parameters:
- src/PrestaShopBundle/Controller/Admin/Configure/ShopParameters/OrderStateController.php
- src/PrestaShopBundle/Controller/Admin/Improve/Design/CmsPageController.php
- src/PrestaShopBundle/Controller/Admin/Improve/Design/MailThemeController.php
- src/PrestaShopBundle/Controller/Admin/Improve/International/LanguageController.php
- src/PrestaShopBundle/Controller/Admin/Improve/International/CurrencyController.php
disallowedConstants:
-
constant:
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/Backup/BackupRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class BackupRemover implements BackupRemoverInterface
/**
* {@inheritdoc}
*/
public function remove(BackupInterface $backup)
public function remove(BackupInterface $backup): bool
{
$legacyBackup = new PrestaShopBackup($backup->getFileName());

Expand Down
3 changes: 2 additions & 1 deletion src/Adapter/Backup/DatabaseBackupCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
namespace PrestaShop\PrestaShop\Adapter\Backup;

use PrestaShop\PrestaShop\Adapter\Entity\PrestaShopBackup;
use PrestaShop\PrestaShop\Core\Backup\BackupInterface;
use PrestaShop\PrestaShop\Core\Backup\Exception\BackupException;
use PrestaShop\PrestaShop\Core\Backup\Exception\DirectoryIsNotWritableException;
use PrestaShop\PrestaShop\Core\Backup\Manager\BackupCreatorInterface;
Expand All @@ -41,7 +42,7 @@ final class DatabaseBackupCreator implements BackupCreatorInterface
/**
* {@inheritdoc}
*/
public function createBackup()
public function createBackup(): BackupInterface
{
ini_set('max_execution_time', '0');

Expand Down
Loading

0 comments on commit 87633f4

Please sign in to comment.