-
Notifications
You must be signed in to change notification settings - Fork 164
integrate last change time into external_update_time calculation #3577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rithikb24
wants to merge
4
commits into
facebook:main
Choose a base branch
from
rithikb24:export-D81231380
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This pull request was exported from Phabricator. Differential Revision: D81231380 |
rithikb24
added a commit
to rithikb24/facebook-for-woocommerce
that referenced
this pull request
Aug 29, 2025
…ebook#3577) Summary: Rollback Plan: Differential Revision: D81231380
861c739
to
16ca009
Compare
This pull request was exported from Phabricator. Differential Revision: D81231380 |
rithikb24
added a commit
to rithikb24/facebook-for-woocommerce
that referenced
this pull request
Sep 1, 2025
…ebook#3577) Summary: Rollback Plan: Differential Revision: D81231380
16ca009
to
f548f67
Compare
This pull request was exported from Phabricator. Differential Revision: D81231380 |
f548f67
to
0857003
Compare
This pull request was exported from Phabricator. Differential Revision: D81231380 |
…mit them (facebook#3578) Summary: ## Changes to Facebook for WooCommerce Plugin ### Summary This diff introduces helper functions for tracking product meta change times and rate limiting updates. Specifically, it adds a new function `is_last_change_time_update_rate_limited` to the `facebook-commerce.php` file. This function checks if the last change time update is rate limited for a given product ID. ### Key Features * Checks for rate limiting based on a cached time for each product ID * Uses the WordPress cache to store the last change time for each product * Returns a boolean value indicating whether the update is rate limited or not ### Version History * Since 3.5.7 ### Example Use Case ```php $product_id = 123; $is_rate_limited = $facebook-commerce->is_last_change_time_update_rate_limited($product_id); if (!$is_rate_limited) { // Proceed with updating the product meta change time } else { // Update is rate limited, skip or reschedule the update } ``` Reviewed By: devbodaghe, vinkmeta Differential Revision: D81231381
…ok#3575) Summary: Here is a summary of the diff in markdown format: **Main Decision Function based on Meta Key & Product Validation** ================================================================= **Overview** ----------- This diff introduces a new function `is_meta_key_sync_relevant` in the `facebook-commerce.php` file. The function checks if a given meta key affects Facebook sync and should trigger a last change time update. ** Changes ** ------------ * Added a new function `is_meta_key_sync_relevant` to check if a meta key is relevant to Facebook sync. * The function skips the plugin's own meta keys to prevent infinite loops. **Function Details** ------------------- ### `is_meta_key_sync_relevant` * **Purpose:** Checks if a meta key affects Facebook sync and should trigger a last change time update. * **Parameters:** `$meta_key` (string) - the meta key to check. * **Return Value:** `true` if the meta key is relevant to Facebook sync, `false` otherwise. * **Since:** 3.5.7 **Example Use Case** ------------------- ```php $meta_key = '_last_change_time'; if ( $this->is_meta_key_sync_relevant( $meta_key ) ) { // Trigger last change time update } ``` Reviewed By: devbodaghe Differential Revision: D81231384
Summary: Changes Made - 1. Added is_updating_last_change_time flag to be protect from infinite loop of update_post_meta hook 2. Added hook for updated_post_meta 3. Added update_last_change_time - It validates & performs the update on _last_change_time 4. Added perform_last_change_time_update to actually perform the update Reviewed By: devbodaghe Differential Revision: D81231383
…ebook#3577) Summary: Comparing _last_modified_time field in wp_post & custom _last_change_time in wp_postmeta & choosing the latest timestamp for the most accurate depiction of latest change on a post Reviewed By: vinkmeta Differential Revision: D81231380
0857003
to
3fa2db7
Compare
This pull request was exported from Phabricator. Differential Revision: D81231380 |
rithikb24
added a commit
to rithikb24/facebook-for-woocommerce
that referenced
this pull request
Sep 4, 2025
* add helper functions for tracking product meta change times & rate limit them (facebook#3578) Summary: ## Changes to Facebook for WooCommerce Plugin ### Summary This diff introduces helper functions for tracking product meta change times and rate limiting updates. Specifically, it adds a new function `is_last_change_time_update_rate_limited` to the `facebook-commerce.php` file. This function checks if the last change time update is rate limited for a given product ID. ### Key Features * Checks for rate limiting based on a cached time for each product ID * Uses the WordPress cache to store the last change time for each product * Returns a boolean value indicating whether the update is rate limited or not ### Version History * Since 3.5.7 ### Example Use Case ```php $product_id = 123; $is_rate_limited = $facebook-commerce->is_last_change_time_update_rate_limited($product_id); if (!$is_rate_limited) { // Proceed with updating the product meta change time } else { // Update is rate limited, skip or reschedule the update } ``` Reviewed By: devbodaghe, vinkmeta Differential Revision: D81231381 * main decision function based on meta key & product validation (facebook#3575) Summary: Here is a summary of the diff in markdown format: **Main Decision Function based on Meta Key & Product Validation** ================================================================= **Overview** ----------- This diff introduces a new function `is_meta_key_sync_relevant` in the `facebook-commerce.php` file. The function checks if a given meta key affects Facebook sync and should trigger a last change time update. ** Changes ** ------------ * Added a new function `is_meta_key_sync_relevant` to check if a meta key is relevant to Facebook sync. * The function skips the plugin's own meta keys to prevent infinite loops. **Function Details** ------------------- ### `is_meta_key_sync_relevant` * **Purpose:** Checks if a meta key affects Facebook sync and should trigger a last change time update. * **Parameters:** `$meta_key` (string) - the meta key to check. * **Return Value:** `true` if the meta key is relevant to Facebook sync, `false` otherwise. * **Since:** 3.5.7 **Example Use Case** ------------------- ```php $meta_key = '_last_change_time'; if ( $this->is_meta_key_sync_relevant( $meta_key ) ) { // Trigger last change time update } ``` Reviewed By: devbodaghe Differential Revision: D81231384 * add product meta change_time handler (facebook#3576) Summary: Changes Made - 1. Added is_updating_last_change_time flag to be protect from infinite loop of update_post_meta hook 2. Added hook for updated_post_meta 3. Added update_last_change_time - It validates & performs the update on _last_change_time 4. Added perform_last_change_time_update to actually perform the update Reviewed By: devbodaghe Differential Revision: D81231383 * integrate last change time into external_update_time calculation (facebook#3577) Summary: Comparing _last_modified_time field in wp_post & custom _last_change_time in wp_postmeta & choosing the latest timestamp for the most accurate depiction of latest change on a post Reviewed By: vinkmeta Differential Revision: D81231380
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Differential Revision: D81231380