Skip to content

Conversation

@Konamiman
Copy link
Contributor

@Konamiman Konamiman commented Dec 15, 2023

Changes proposed in this Pull Request:

This pull request introduces a transient files engine intended for registering files that have an expiration date and can be served via a public, unauthenticated HTTP URL. Initially, the only mechanism provided to create these files is providing the raw contents of the file via a input string; but additional mechanisms could be added in the future, such as directly providing the path of an existing file.

See the README file and the documentation comments in the TransientFilesEngine class for all the nitty-gritty details.

This pull request is a simplified version of #41055.

How to test the changes in this Pull Request:

Testing the code API

  1. Run the following:
wp eval "echo wc_get_container()->get(\Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine::class)->create_transient_file('foobar', '2024-01-01');"

You'll get a file name whose first 6 digits is the expiration date encoded in hexadecimal (so 7e8 1 01).

  1. Run the following to see the exact physical path of the generated file, where <file name> is the result from the previous call:
wp eval "echo wc_get_container()->get(\Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine::class)->get_transient_file_path('<file name>');"

You should have got <WordPress directory>/wp-content/uploads/woocommerce_transient_files/2024-01-01/<file name minus expiration date prefix>. Verify that the file actually exists and it contains the string foobar.

  1. Run the following to delete the generated file:
wp eval "var_export(wc_get_container()->get(\Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine::class)->delete_transient_file('<file name>'));"

You'll get true and the file (and also the 2024-01-01 directory) will have disappeared. If you repeat the call you'll get false.

Testing the expired files deletion

To easily test the expired files deletion mechanism we need to be able to create transient files that have already expired. This is not possible out of the box, but can be achieved easily by manually altering the created directory name. So go ahead, create 10 files by repeating step 1 as many times and then rename the 2024-01-01 directory to 2023-01-01 (and now if you wanted to actually locate these files by using get_transient_file_path you'd have to change the first digits of the expiration date prefix from 7e8 to 7e7 in the passed file name).

Now run the following:

wp eval "var_export(wc_get_container()->get(\Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine::class)->delete_expired_files(7));"

The result will be:

array (
  'deleted_count' => 7,
  'files_remain' => true,
)

and there will be only 3 files remaining in the 2023-01-01 directory.

Running the same command again will yield the following:

array (
  'deleted_count' => 3,
  'files_remain' => false,
)

and the 2023-01-01 directory will have disappeared.

You can also try the scheduled action by going to WooCommerce - Status - Tools and re-scheduling the cleanup:

image

By rescheduling the cleanup the action will be scheduled to keep running immediately as long as there's still data to delete, and then every 24h. You can change that interval with a filter, e.g. every 10 seconds:

add_filter('woocommerce_delete_expired_transient_files_interval', fn($interval) => 10);

Note however that the scheduled action deletes 1000 files every time, so for testing you'll need to either create as many transient files or tweak the code to use a smaller batch (pass the batch size to the delete_expired_files call in TransientFilesEngine::handle_expired_files_cleanup_action).

Testing the HTTP endpoint

Generate a transient file by repeating step 1 and verify that you can access the rendered file in your browser (even from an incognito window) or using any tool able to perform HTTP requests (replace <filename> with the file name that you get from create_transient_file): http://localhost/wc/file/transient/<filename>.

If you rename the folder to 2023-01-01 and try to access the file replacing 7e8 with 7e7 at the beginning of its name, you'll get a 404 error, since the endpoint doesn't serve files that have expired (but you can still get the file path with get_transient_file_path).

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Dec 15, 2023
@github-actions
Copy link
Contributor

Hi @coreymckrill,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2023

Test Results Summary

Commit SHA: 131bd3b

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 37s
E2E Tests258003026115m 50s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@coreymckrill coreymckrill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Overall this looks really good! Clear testing instructions, and everything worked as described. I left a few wording suggestions and a couple of minor questions to discuss.

$container->get( FeaturesController::class );
$container->get( WebhookUtil::class );
$container->get( Marketplace::class );
$container->get(\Automattic\WooCommerce\Utilities\TimeUtil::class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth adding a use statement at the top so you don't have to include the full namespace here? It would be more consistent with the rest of the classes in this list.


$realpathed_transient_files_directory = $this->legacy_proxy->call_function( 'realpath', $transient_files_directory );
if ( false === $realpathed_transient_files_directory ) {
throw new Exception( "The base transient files directory doesn't exist: $transient_files_directory" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating the default directory in wc_update_850_create_transient_files_directory during the upgrade routine, could you just create it here if it doesn't exist? This way you could potentially avoid creating a directory that would never be used if the user adds a filter to customize the directory name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A different directory to hold the transient files can be specified via filter, and for security and robustness I'm leaving the responsibility to create that directory to the filterer and throwing an error if it doesn't exist. So for consistency I'm doing the same with the default directory, and this implies that it needs to be created "externally" at some point.

Comment on lines 166 to 168
if ( strlen( $filename ) < 7 ) {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was going through the testing instructions, I forgot to replace <file name> with the actual file name the first time I ran the command that calls this method. I got a couple of deprecation notices:

Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /var/www/html/wp-content/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php on line 172
Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /var/www/html/wp-content/plugins/woocommerce/src/Internal/TransientFiles/TransientFilesEngine.php on line 173

Just thinking it might be worth adding some more validation here to make sure the filename string only contains hex-compatible characters.


if ( $this->file_has_expired( $file_path ) ) {
$legacy_proxy->call_function( 'status_header', 404 );
$legacy_proxy->exit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I try getting a file that either doesn't exist or is expired, the browser screen is just blank (I can see the 404 status if I open the dev console). 🤔 I wonder if it would be helpful here to use a wp_die() with a message like "File expired." Or, to be ambiguous about whether the file ever existed, "File not found." What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files are (in principle) not intended for human consumption: for the receipts use case at least, the URL of the file will be handled to an automated printing service. So I think it's clearer to get no content at all than to get a (seemingly arbitrary) error message (taken to the extreme, a badly implemented printing service not printing anything at all is better than it printing the string "File not found").

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a badly implemented printing service not printing anything at all is better than it printing the string "File not found"

😄 It is all too easy to envision this exact thing happening, so you have a point well taken.

$filepath = $transient_files_directory . '/' . $filename;

// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_file_put_contents
if( false === $this->legacy_proxy->call_function( 'file_put_contents', $filepath, $file_contents ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use the $wp_filesystem method here, and avoid adding a linting exception?

$expiration_date = gmdate( 'Y-m-d', $expiration_date );
} elseif ( ! is_string( $expiration_date ) || ! TimeUtil::is_valid_date( $expiration_date, 'Y-m-d' ) ) {
$expiration_date = is_scalar( $expiration_date ) ? $expiration_date : gettype( $expiration_date );
throw new InvalidArgumentException( "$expiration_date is not a valid date, expected format: year-month-day" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new InvalidArgumentException( "$expiration_date is not a valid date, expected format: year-month-day" );
throw new InvalidArgumentException( "$expiration_date is not a valid date, expected format: YYYY-MM-DD" );

This seems a bit less ambiguous about the expected format.

Konamiman and others added 3 commits December 19, 2023 09:56
- Introduce using statement
- Use WP_Filesystem instead of file_put_contents
- Validate that filename contains only hex digits in get_transient_file_path
- Replace year-month-day with YYYY-MM-DD in error message
@Konamiman Konamiman self-assigned this Dec 19, 2023
@Konamiman
Copy link
Contributor Author

@coreymckrill There's a new commit that manually applies some of your suggestions, and another one that applied others directly from GitHub.

Copy link
Contributor

@coreymckrill coreymckrill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks great! I'm going to try re-running the tests to see if we can get them to pass this time, the failures don't look related to this at all. Might also need to do a rebase, though.

…migration.

If the woocommerce_transient_files_directory is used and the
directory it returns doesn't exist, an exception will be thrown.
If the filter is not used and the default base directory doesn't exist,
it will be created by get_transient_files_directory.
@Konamiman Konamiman merged commit a8b0f88 into trunk Dec 22, 2023
@Konamiman Konamiman deleted the add-transient-files-engine branch December 22, 2023 07:44
@github-actions github-actions bot added this to the 8.6.0 milestone Dec 22, 2023
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Dec 22, 2023
@veljkho veljkho added status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Dec 25, 2023
thealexandrelara pushed a commit that referenced this pull request Dec 26, 2023
thealexandrelara added a commit that referenced this pull request Dec 29, 2023
…s documentation (#43055)

* Update woocommerce.com URLs in documentation and code files

* Add changelog

* Fix github repository link in extend-rest-api-add-custom-fields.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Add github reporter (#42974)

* Add github reporter

* Add changelog

---------

Co-authored-by: Jon Lane <[email protected]>

* Fix product task redirect to support grouped and external products (#43051)

* Rearrange product redirection logic to better accept grouped and external produc types

* Add changelog

* Modify feedback modal actions (#43005)

* Adapt feedback modal actions

* Add changelogs

* Modify comments

* Fix tests

* Fix test

* Update class-wc-gateway-bacs.php (#43054)

* Update class-wc-gateway-bacs.php

Fix typo in textdomain

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* [Product Block Editor]: Add `Linked product` tab (#43009)

* add linked-products to group IDs

* add Linked Products tab

* tweak hideConditions condition

* changelog

* fix typo in doc comment

* Introduce a product type selection within the new experience (#41823)

* Create a relation between the product type and the product block template

* Add 'patterns' to name the kind of products that can be created for a specific template

* Resolve template using its id as a template query param

* Rename ProductEditPattern to ProductTemplate

* Rename get_patterns hook to woocommerce_product_editor_get_product_templates

* Return the list of templates to the client

* Set layout template events as array

* Register the layout template based on the product template or the post type in case of product variations

* Registering non supported product types

* Create and register the woocommerce/product-details-section-description block

* Add the product type to the section description

* Create product type selector

* Fix menu item style

* Highlight selected menu item

* Set the selected product template

* Set product template title to lowercase in the content description

* Rename blocks by blockTemplates under the AbstractBlockTemplate class

* Rename to woocommerce_product_editor_product_templates filter

* Remove product_template_ prefix from the supported_product_types map

* Rename get_formatted to to_JSON and convert the props to client side like

* Refactor get_product_templates

* Fix icon resolution

* Add a confirmation modal for unsupported product templates

* Add changelog files

* Remove product types using for testing

* Fix redirection when changing to a non supported product template

* Set the change button state to busy when it is saving the product

* Fix php linter errors

* Fix rebase conflict

* Move ProductTemplate to Automattic\WooCommerce\Admin\Features\ProductBlockEditor namespace

* Add the to_json definition to the BlockTemplateInterface

* Create default product template by custom product type if it does not have a template associated yet

* Fix some comments and product template creation validation

* Add support to load the product template icon from an external resource

* Fix php linter

* Fix the changelog description

* [Experimental] Interactivity Dropdown multi-select mode, ratings filter and introduce each directive (#42981)


---------
Co-authored-by: David Arenas <[email protected]>

* Introduce the transient files engine (#42877)

Co-authored-by: Corey McKrill <[email protected]>

* Change marketplace install API request to POST instead of GET (#43033)

* Change marketplace install API to using POST instead of GET
* Fix linting error
* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* Prep trunk for 8.6 cycle (#43021)

Prep trunk for 8.6 cycle with version bump to 8.6.0-dev

Co-authored-by: WooCommerce Bot <[email protected]>

* Add Playwright tests for All Reviews, Reviews by Product and Reviews by Category blocks (#42903)

* Remove Reviews blocks Puppeteer tests

* Minor code cleanup

* Typos

* Create publishAndVisitPost() editor util

* Fix subcategories when importing products in Playwright and add reviews

* Add Reviews blocks tests in Playwright

* More typos

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Create a 'reviews' object in data.ts so we can store reviews data in one single place

* Update test so instead of creating a new post in each test, we go to the already-created post

* Add source comments to reviews data to match it with the script

---------

Co-authored-by: github-actions <[email protected]>

* Release: Remove 8.5 change files (#43022)

Delete changelog files from 8.5 release

Co-authored-by: WooCommerce Bot <[email protected]>
Co-authored-by: Alex López <[email protected]>

* Delete changelog files based on PR 43033 (#43079)

Delete changelog files for 43033

Co-authored-by: WooCommerce Bot <[email protected]>

* Delete changelog files based on PR 43051 (#43081)

Delete changelog files for 43051

Co-authored-by: WooCommerce Bot <[email protected]>

* Interactive Price Filter: use `context` instead of `state` (#42980)

* feat: use context instead of state

* fix: temporary move the context to inner element for diffing to work

* fix: update context before navigation for optimistic UI

* Load google analytics gtag script asynchronously in WooCommerce Blocks (#43040)

Co-authored-by: github-actions <[email protected]>

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build (#43074)

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* Revert "Fix schedule sales error" (#43094)

Revert "Fix schedule sales error (#42700)"

This reverts commit 9b800aa.

* [Product Block Editor]: add Linked product sections. First approach. (#43013)

* add Linked products, Upsell section

* changelog

* add Cross-lens section

* add links to the Upsell sections

* changelog

* fix lint issues

* fix lint issus

* fix linting issue :-|

* check whether the linked product group is defined

* [Product Block Editor]: introduce ShoppingBags component (#43042)

* add ShoppingBags component

* Add ShoppingBag story

* changelog

* Fix: Collection data being leaked between Collection Filters blocks (#43044)

* fix: CYS - change heading color (#43076)

* fix: CYS - change heading color

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>
Co-authored-by: Patricia Hillebrandt <[email protected]>

* Delete changelog files based on PR 43074 (#43118)

Delete changelog files for 43074

Co-authored-by: WooCommerce Bot <[email protected]>

* [Product Block Editor]: fix feature flag to hide the Linked products (#43119)

* fix flag to hide/show product editor

* changelog

* Add changelog

---------

Co-authored-by: Albert Juhé Lluveras <[email protected]>
Co-authored-by: Jonathan Lane <[email protected]>
Co-authored-by: Jon Lane <[email protected]>
Co-authored-by: louwie17 <[email protected]>
Co-authored-by: Fernando Marichal <[email protected]>
Co-authored-by: Marc Guay <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Damián Suárez <[email protected]>
Co-authored-by: Maikel David Pérez Gómez <[email protected]>
Co-authored-by: Sam Seay <[email protected]>
Co-authored-by: Néstor Soriano <[email protected]>
Co-authored-by: Corey McKrill <[email protected]>
Co-authored-by: Kyle Nel <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <[email protected]>
Co-authored-by: Alex López <[email protected]>
Co-authored-by: Tung Du <[email protected]>
Co-authored-by: Thomas Roberts <[email protected]>
Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: Patricia Hillebrandt <[email protected]>
samueljseay added a commit that referenced this pull request Dec 30, 2023
…s documentation (#43055)

* Update woocommerce.com URLs in documentation and code files

* Add changelog

* Fix github repository link in extend-rest-api-add-custom-fields.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Add github reporter (#42974)

* Add github reporter

* Add changelog

---------

Co-authored-by: Jon Lane <[email protected]>

* Fix product task redirect to support grouped and external products (#43051)

* Rearrange product redirection logic to better accept grouped and external produc types

* Add changelog

* Modify feedback modal actions (#43005)

* Adapt feedback modal actions

* Add changelogs

* Modify comments

* Fix tests

* Fix test

* Update class-wc-gateway-bacs.php (#43054)

* Update class-wc-gateway-bacs.php

Fix typo in textdomain

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* [Product Block Editor]: Add `Linked product` tab (#43009)

* add linked-products to group IDs

* add Linked Products tab

* tweak hideConditions condition

* changelog

* fix typo in doc comment

* Introduce a product type selection within the new experience (#41823)

* Create a relation between the product type and the product block template

* Add 'patterns' to name the kind of products that can be created for a specific template

* Resolve template using its id as a template query param

* Rename ProductEditPattern to ProductTemplate

* Rename get_patterns hook to woocommerce_product_editor_get_product_templates

* Return the list of templates to the client

* Set layout template events as array

* Register the layout template based on the product template or the post type in case of product variations

* Registering non supported product types

* Create and register the woocommerce/product-details-section-description block

* Add the product type to the section description

* Create product type selector

* Fix menu item style

* Highlight selected menu item

* Set the selected product template

* Set product template title to lowercase in the content description

* Rename blocks by blockTemplates under the AbstractBlockTemplate class

* Rename to woocommerce_product_editor_product_templates filter

* Remove product_template_ prefix from the supported_product_types map

* Rename get_formatted to to_JSON and convert the props to client side like

* Refactor get_product_templates

* Fix icon resolution

* Add a confirmation modal for unsupported product templates

* Add changelog files

* Remove product types using for testing

* Fix redirection when changing to a non supported product template

* Set the change button state to busy when it is saving the product

* Fix php linter errors

* Fix rebase conflict

* Move ProductTemplate to Automattic\WooCommerce\Admin\Features\ProductBlockEditor namespace

* Add the to_json definition to the BlockTemplateInterface

* Create default product template by custom product type if it does not have a template associated yet

* Fix some comments and product template creation validation

* Add support to load the product template icon from an external resource

* Fix php linter

* Fix the changelog description

* [Experimental] Interactivity Dropdown multi-select mode, ratings filter and introduce each directive (#42981)

---------
Co-authored-by: David Arenas <[email protected]>

* Introduce the transient files engine (#42877)

Co-authored-by: Corey McKrill <[email protected]>

* Change marketplace install API request to POST instead of GET (#43033)

* Change marketplace install API to using POST instead of GET
* Fix linting error
* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* Prep trunk for 8.6 cycle (#43021)

Prep trunk for 8.6 cycle with version bump to 8.6.0-dev

Co-authored-by: WooCommerce Bot <[email protected]>

* Add Playwright tests for All Reviews, Reviews by Product and Reviews by Category blocks (#42903)

* Remove Reviews blocks Puppeteer tests

* Minor code cleanup

* Typos

* Create publishAndVisitPost() editor util

* Fix subcategories when importing products in Playwright and add reviews

* Add Reviews blocks tests in Playwright

* More typos

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Create a 'reviews' object in data.ts so we can store reviews data in one single place

* Update test so instead of creating a new post in each test, we go to the already-created post

* Add source comments to reviews data to match it with the script

---------

Co-authored-by: github-actions <[email protected]>

* Release: Remove 8.5 change files (#43022)

Delete changelog files from 8.5 release

Co-authored-by: WooCommerce Bot <[email protected]>
Co-authored-by: Alex López <[email protected]>

* Delete changelog files based on PR 43033 (#43079)

Delete changelog files for 43033

Co-authored-by: WooCommerce Bot <[email protected]>

* Delete changelog files based on PR 43051 (#43081)

Delete changelog files for 43051

Co-authored-by: WooCommerce Bot <[email protected]>

* Interactive Price Filter: use `context` instead of `state` (#42980)

* feat: use context instead of state

* fix: temporary move the context to inner element for diffing to work

* fix: update context before navigation for optimistic UI

* Load google analytics gtag script asynchronously in WooCommerce Blocks (#43040)

Co-authored-by: github-actions <[email protected]>

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build (#43074)

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* Revert "Fix schedule sales error" (#43094)

Revert "Fix schedule sales error (#42700)"

This reverts commit 9b800aa.

* [Product Block Editor]: add Linked product sections. First approach. (#43013)

* add Linked products, Upsell section

* changelog

* add Cross-lens section

* add links to the Upsell sections

* changelog

* fix lint issues

* fix lint issus

* fix linting issue :-|

* check whether the linked product group is defined

* [Product Block Editor]: introduce ShoppingBags component (#43042)

* add ShoppingBags component

* Add ShoppingBag story

* changelog

* Fix: Collection data being leaked between Collection Filters blocks (#43044)

* fix: CYS - change heading color (#43076)

* fix: CYS - change heading color

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>
Co-authored-by: Patricia Hillebrandt <[email protected]>

* Delete changelog files based on PR 43074 (#43118)

Delete changelog files for 43074

Co-authored-by: WooCommerce Bot <[email protected]>

* [Product Block Editor]: fix feature flag to hide the Linked products (#43119)

* fix flag to hide/show product editor

* changelog

* Add changelog

---------

Co-authored-by: Albert Juhé Lluveras <[email protected]>
Co-authored-by: Jonathan Lane <[email protected]>
Co-authored-by: Jon Lane <[email protected]>
Co-authored-by: louwie17 <[email protected]>
Co-authored-by: Fernando Marichal <[email protected]>
Co-authored-by: Marc Guay <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Damián Suárez <[email protected]>
Co-authored-by: Maikel David Pérez Gómez <[email protected]>
Co-authored-by: Sam Seay <[email protected]>
Co-authored-by: Néstor Soriano <[email protected]>
Co-authored-by: Corey McKrill <[email protected]>
Co-authored-by: Kyle Nel <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <[email protected]>
Co-authored-by: Alex López <[email protected]>
Co-authored-by: Tung Du <[email protected]>
Co-authored-by: Thomas Roberts <[email protected]>
Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: Patricia Hillebrandt <[email protected]>
opr added a commit that referenced this pull request Jan 3, 2024
…s documentation (#43055)

* Update woocommerce.com URLs in documentation and code files

* Add changelog

* Fix github repository link in extend-rest-api-add-custom-fields.md

Co-authored-by: Albert Juhé Lluveras <[email protected]>

* Add github reporter (#42974)

* Add github reporter

* Add changelog

---------

Co-authored-by: Jon Lane <[email protected]>

* Fix product task redirect to support grouped and external products (#43051)

* Rearrange product redirection logic to better accept grouped and external produc types

* Add changelog

* Modify feedback modal actions (#43005)

* Adapt feedback modal actions

* Add changelogs

* Modify comments

* Fix tests

* Fix test

* Update class-wc-gateway-bacs.php (#43054)

* Update class-wc-gateway-bacs.php

Fix typo in textdomain

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* [Product Block Editor]: Add `Linked product` tab (#43009)

* add linked-products to group IDs

* add Linked Products tab

* tweak hideConditions condition

* changelog

* fix typo in doc comment

* Introduce a product type selection within the new experience (#41823)

* Create a relation between the product type and the product block template

* Add 'patterns' to name the kind of products that can be created for a specific template

* Resolve template using its id as a template query param

* Rename ProductEditPattern to ProductTemplate

* Rename get_patterns hook to woocommerce_product_editor_get_product_templates

* Return the list of templates to the client

* Set layout template events as array

* Register the layout template based on the product template or the post type in case of product variations

* Registering non supported product types

* Create and register the woocommerce/product-details-section-description block

* Add the product type to the section description

* Create product type selector

* Fix menu item style

* Highlight selected menu item

* Set the selected product template

* Set product template title to lowercase in the content description

* Rename blocks by blockTemplates under the AbstractBlockTemplate class

* Rename to woocommerce_product_editor_product_templates filter

* Remove product_template_ prefix from the supported_product_types map

* Rename get_formatted to to_JSON and convert the props to client side like

* Refactor get_product_templates

* Fix icon resolution

* Add a confirmation modal for unsupported product templates

* Add changelog files

* Remove product types using for testing

* Fix redirection when changing to a non supported product template

* Set the change button state to busy when it is saving the product

* Fix php linter errors

* Fix rebase conflict

* Move ProductTemplate to Automattic\WooCommerce\Admin\Features\ProductBlockEditor namespace

* Add the to_json definition to the BlockTemplateInterface

* Create default product template by custom product type if it does not have a template associated yet

* Fix some comments and product template creation validation

* Add support to load the product template icon from an external resource

* Fix php linter

* Fix the changelog description

* [Experimental] Interactivity Dropdown multi-select mode, ratings filter and introduce each directive (#42981)


---------
Co-authored-by: David Arenas <[email protected]>

* Introduce the transient files engine (#42877)

Co-authored-by: Corey McKrill <[email protected]>

* Change marketplace install API request to POST instead of GET (#43033)

* Change marketplace install API to using POST instead of GET
* Fix linting error
* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* Prep trunk for 8.6 cycle (#43021)

Prep trunk for 8.6 cycle with version bump to 8.6.0-dev

Co-authored-by: WooCommerce Bot <[email protected]>

* Add Playwright tests for All Reviews, Reviews by Product and Reviews by Category blocks (#42903)

* Remove Reviews blocks Puppeteer tests

* Minor code cleanup

* Typos

* Create publishAndVisitPost() editor util

* Fix subcategories when importing products in Playwright and add reviews

* Add Reviews blocks tests in Playwright

* More typos

* Add changefile(s) from automation for the following project(s): woocommerce-blocks

* Create a 'reviews' object in data.ts so we can store reviews data in one single place

* Update test so instead of creating a new post in each test, we go to the already-created post

* Add source comments to reviews data to match it with the script

---------

Co-authored-by: github-actions <[email protected]>

* Release: Remove 8.5 change files (#43022)

Delete changelog files from 8.5 release

Co-authored-by: WooCommerce Bot <[email protected]>
Co-authored-by: Alex López <[email protected]>

* Delete changelog files based on PR 43033 (#43079)

Delete changelog files for 43033

Co-authored-by: WooCommerce Bot <[email protected]>

* Delete changelog files based on PR 43051 (#43081)

Delete changelog files for 43051

Co-authored-by: WooCommerce Bot <[email protected]>

* Interactive Price Filter: use `context` instead of `state` (#42980)

* feat: use context instead of state

* fix: temporary move the context to inner element for diffing to work

* fix: update context before navigation for optimistic UI

* Load google analytics gtag script asynchronously in WooCommerce Blocks (#43040)

Co-authored-by: github-actions <[email protected]>

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build (#43074)

* set WOOCOMMERCE_BLOCKS_PHASE to 1 for the production build

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>

* Revert "Fix schedule sales error" (#43094)

Revert "Fix schedule sales error (#42700)"

This reverts commit 9b800aa.

* [Product Block Editor]: add Linked product sections. First approach. (#43013)

* add Linked products, Upsell section

* changelog

* add Cross-lens section

* add links to the Upsell sections

* changelog

* fix lint issues

* fix lint issus

* fix linting issue :-|

* check whether the linked product group is defined

* [Product Block Editor]: introduce ShoppingBags component (#43042)

* add ShoppingBags component

* Add ShoppingBag story

* changelog

* Fix: Collection data being leaked between Collection Filters blocks (#43044)

* fix: CYS - change heading color (#43076)

* fix: CYS - change heading color

* Add changefile(s) from automation for the following project(s): woocommerce

---------

Co-authored-by: github-actions <[email protected]>
Co-authored-by: Patricia Hillebrandt <[email protected]>

* Delete changelog files based on PR 43074 (#43118)

Delete changelog files for 43074

Co-authored-by: WooCommerce Bot <[email protected]>

* [Product Block Editor]: fix feature flag to hide the Linked products (#43119)

* fix flag to hide/show product editor

* changelog

* Add changelog

---------

Co-authored-by: Albert Juhé Lluveras <[email protected]>
Co-authored-by: Jonathan Lane <[email protected]>
Co-authored-by: Jon Lane <[email protected]>
Co-authored-by: louwie17 <[email protected]>
Co-authored-by: Fernando Marichal <[email protected]>
Co-authored-by: Marc Guay <[email protected]>
Co-authored-by: github-actions <[email protected]>
Co-authored-by: Damián Suárez <[email protected]>
Co-authored-by: Maikel David Pérez Gómez <[email protected]>
Co-authored-by: Sam Seay <[email protected]>
Co-authored-by: Néstor Soriano <[email protected]>
Co-authored-by: Corey McKrill <[email protected]>
Co-authored-by: Kyle Nel <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: WooCommerce Bot <[email protected]>
Co-authored-by: Alex López <[email protected]>
Co-authored-by: Tung Du <[email protected]>
Co-authored-by: Thomas Roberts <[email protected]>
Co-authored-by: Luigi Teschio <[email protected]>
Co-authored-by: Patricia Hillebrandt <[email protected]>
@jazir555
Copy link

jazir555 commented Feb 16, 2024

Will the use of eval cause security issues?

@Konamiman
Copy link
Contributor Author

Will the use of eval cause security issues?

Sorry @jazir555, what are you referring to? eval is not used anywhere in the code introduced in this pull request.

@jazir555
Copy link

Will the use of eval cause security issues?

Sorry @jazir555, what are you referring to? eval is not used anywhere in the code introduced in this pull request.

"wp eval "echo wc_get_container()->get(\Automattic\WooCommerce\Internal\TransientFiles\TransientFilesEngine::class)->create_transient_file('foobar', '2024-01-01');"

This is in the opening comment of the post, is this just to test the feature functionality?

@Konamiman
Copy link
Contributor Author

This is in the opening comment of the post, is this just to test the feature functionality?

Yes, it's just a command line way to test the feature, the code itself is not using the eval function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants