Repository navigation
Prevented database errors when renaming image URLs - #1209
Conversation
There was a problem hiding this comment.
🟡 Changes requested
Fix the port and escaped-video gaps in URL replacement, and add a test for the JSON-escaped search.
Question for the author: $skip_tables holds unprefixed names, so it never matches. The new term description test needs term_taxonomy processed. Should the skip list be removed, or fixed without term_taxonomy?
Validation details
- Files reviewed: 3/3 changed files. The narrowed-input checks (rejected values, base, failure guarded, sources) stayed unchecked.
- PHPUnit 9.6.22 on WordPress 7.1.4, PHP 8.3.36:
rm /var/www/html/wp-content/plugins/optimole-wp && cd /repo && set -o pipefail; timeout 280 vendor/bin/phpunit --do-not-…printedOK (24 tests, 68 assertions)(run R5) - The base tree with HEAD tests fails nine added tests on assertions:
rm /var/www/html/wp-content/plugins/optimole-wp && cd /repo && set -o pipefail; timeout 280 vendor/bin/phpunit --do-not-…printedFailures: 9(run R5) - The security pass found no new trust-boundary issue.
Untested areas
- The narrowed-input checks (rejected values, base, failure guarded, sources) were not settled. No source of a pathless attachment URL was found.
- PHPStan did not run. CI owns it.
🤖 Automated review · run code-review-agent_6ae2ec4c91b679.69256087.
🤖 Review agent — review posted ✅ on 3e634829 · changes requested · 3 findings · 25 min
Run code-review-agent_6ae2ec4c91b679.69256087 · trail
Keeping |
There was a problem hiding this comment.
🟢 Approved
The PR passes. The port, escaped-URL and escaped-video fixes work, and each has a test that fails without it.
Validation details
- Files reviewed: 3/3 changed files. These rows stayed unchecked: the consumer of the changed
replace_urls_in_value()return, and the narrowed-input checks (rejected values, base, failure guarded, sources). - PHPUnit 9.6.22, WordPress 7.1.4, PHP 8.3.36:
Test_Attachment_Db_RenamerprintedOK (27 tests, 71 assertions)at HEAD. - With pr-base code, all three new tests fail on their assertions.
- With 3e63482 code, the port and no-sizes video tests fail.
- Security and requirements checks are reused from run code-review-agent_6ae2ec4c91b679.69256087, not rerun.
Untested areas
- The consumer of the
replace_urls_in_value()return and the narrowed-input checks were not settled. - Same-stem serialized rows are rewritten when
serialize_precisiondiffers from the stored float precision. Production reachability was not traced. - The earlier
$skip_tablesquestion has no answer yet. - PHPStan did not run. CI owns it.
🤖 Automated review · run code-review-agent_6ae2f7d9423b55.32752775.
🤖 Review agent — review posted ✅ on 5b22686c · approved · 0 findings · 9 min
Run code-review-agent_6ae2f7d9423b55.32752775 · trail
All Submissions:
Changes proposed in this Pull Request:
Fixed attachment URL rewriting after file renames by updating rows through each table’s actual primary key in both plain-text and serialized-data paths, and counting replacements only when updates succeed. The serialized path now searches the column itself, matches base filenames consistently with the plain-text path - including
-300x200and-scaledvariants - and processes all matching rows without the previous 100-row limit. Both paths preserve the port in searched URLs and use a shared helper, with duplicate rows detected by primary key.Closes #1199
Other information: