- Issue created by @slucero
- 🇺🇸United States slucero Arkansas
For testing, any existing pattern content could be altered to register as needing an update using the following command:
drush sqlq "UPDATE pattern_revision AS revision SET revision.schema=NULL, revision.template=NULL, revision.hash=NULL WHERE revision.revision IN (SELECT revision FROM pattern_revision)"
After running this command, the new Drush update commands should find content to update during scans:
drush patternkit:batch-update
- Status changed to Needs review
about 1 year ago 6:38pm 18 September 2023 - last update
about 1 year ago 359 pass - @slucero opened merge request.
- 🇺🇸United States slucero Arkansas
I've documented the follow-up task for adding an administrative UI for these batch operations in ✨ Add Administrative UI for Batch Updating Postponed .
- last update
about 1 year ago 359 pass - 🇺🇸United States slucero Arkansas
After reviewing this further, I've determined that the query in #5 won't actually cause the pattern blocks to register an update being needed since the hash will get recalculated from the same schema and template and see no change. Instead, the query below should properly mark all pattern revisions in a way to trigger update detection:
drush sqlq "UPDATE pattern_revision AS revision SET revision.hash='ALTERED', revision.schema='', revision.template='', revision.version='OLD'"
- last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - last update
about 1 year ago 359 pass - 🇮🇳India minsharm India
Retested the issue and result looks good to me. Validated below scenarios on D9 as well as on D10.
Note : Before performing below scenarios, it is important to note that there are a total of 6 Patternkit blocks created on the website.
Scenario 1: Validate Bulk Pattern Update for All Patterns
In this scenario, the goal is to validate a bulk pattern update for all existing patterns. The following steps be followed:
1) Run the following command to update existing pattern content that can be altered and register them for an update:
drush sqlq "UPDATE pattern_revision AS revision SET revision.hash='ALTERED', revision.version='OLD'"
2) After executing this command, the next step is to run a Drush update command that should find content to update during scans. Use the following command:
drush patternkit:batch-update
Results:
- The bulk of patterns was updated successfully without encountering any errors during the process.
- After the update, it was observed that no updates are available for any of the nodes. In the debugger output, "update_available" was found to be set to "false" for all the nodes.
Scenario 2: Validate Bulk Pattern Update for All Patterns, Including Temporary (Draft) Versions of Layouts
In this scenario, the objective is to validate a bulk pattern update for all patterns, including temporary (draft) versions of layouts. The steps for this scenario are as follows:
1) Create Node 1 and Node 2.
2) Run the following SQL command to update existing pattern content that can be altered and register them for an update:
drush sqlq "UPDATE pattern_revision AS revision SET revision.hash='ALTERED', revision.version='OLD'"
3) Clear the cache.
4) Before running the batch command, navigate to the layout tab for Node 2. At this point, a temporary draft version of the layout is created.
5) In the layout tab for Node 2, add a new block that will not be available for update. This is expected because it was added after the pattern alteration command.
6) Run the batch-update command and clear the cache.
Results:
- A total of 7 blocks have been updated, including one temporary layout block for Node 2. Please note that the block added in step 4 is not updated since it was added after the pattern alteration command.
Check the JSON form for the Patternkit (PK) block for both nodes.
Results for JSON Form:
- All patterns, including temporary (draft) ones, have been updated for all nodes and none of the patterns are now outdated.
- The behavior is now consistent and the temporary layout blocks are being updated to match what is displayed in the logged message in the terminal.
- I am not seeing the "You have unsaved changes" message for all the nodes after using the new batch-update command, as long as I don't change anything in the PK Block or open the Layout tab for any of the nodes before using the batch-update command. In the above scenario, the popup will be displayed solely for node 2 because I had opened the Layout tab for node 2 prior to executing the batch update command.
Now, repeat the same process again to verify that the pattern added in step 4 above should be updated:
- Run the pattern alteration command.
- Run the batch update command.
Results:
- A total of 9 blocks have been updated.
- 6 were the blocks added initially.
- 1 was the block added in step 4 above.
- 2 were the blocks on temporary layouts for Node 2, as there are a total of 2 PK blocks present on Node 2's saved layout.
- Status changed to RTBC
about 1 year ago 2:23pm 16 October 2023 - last update
about 1 year ago 359 pass - Status changed to Fixed
about 1 year ago 2:24pm 16 October 2023 - 🇺🇸United States slucero Arkansas
Merged for inclusion in the Beta 8 release: 🌱 Patternkit Beta 8 Release Plan Active
Automatically closed - issue fixed for 2 weeks with no activity.