Skip to content
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

fix(dev-env): detection of URLs to replace for multisites #2081

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

sjinks
Copy link
Member

@sjinks sjinks commented Nov 1, 2024

Description

This PR fixes the generation of a map of domains to replace for a multisite environment.

Previously, if a site URL contained a path (e.g., https://domain.com/path), such an URL would be replaced with slug.vipdev.site because the system compared domain.com/path to domain.com and ignored it because the strings are not equal.

This PR fixes the procedure by comparing domains instead.

Pull request checklist

New release checklist

Steps to Test

See the ticket.

Copy link
Contributor

github-actions bot commented Nov 1, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@sjinks sjinks self-assigned this Nov 1, 2024
@sjinks sjinks added [Type] Bug Something isn't working [Status] Needs Review labels Nov 1, 2024
@sjinks sjinks requested a review from rinatkhaziev November 1, 2024 23:35
@sjinks sjinks marked this pull request as ready for review November 1, 2024 23:35
Comment on lines +50 to +55
try {
new URL( url );
return url;
} catch {
return null;
}
Copy link
Member Author

@sjinks sjinks Nov 6, 2024

Choose a reason for hiding this comment

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

Node 18.17.0 has URL.canParse(); hopefully, we can use it instead of this code someday.

: this.landoDomain;

queries.push(
`UPDATE wp_blogs SET domain = '${ newDomain }' WHERE blog_id = ${ Number( site.blogId ) };`
Copy link
Contributor

Choose a reason for hiding this comment

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

custom prefixes is what gives me a pause here.

Copy link

sonarqubecloud bot commented Nov 7, 2024

Copy link
Contributor

@rinatkhaziev rinatkhaziev left a comment

Choose a reason for hiding this comment

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

Tested, an it works.

Looks like we're enforcing wp_ for core tables during imports, so it shouldn't be a problem.

@rinatkhaziev rinatkhaziev merged commit 653934c into trunk Nov 8, 2024
16 checks passed
@rinatkhaziev rinatkhaziev deleted the z-193695 branch November 8, 2024 21:24
luiztiago added a commit that referenced this pull request Nov 13, 2024
* trunk:
  Revert "New package release: v3.9.0"
  chore: bump package version to v3.9.0
  Add comment explaining the reason why the limit default value is set manually
  Remove setImmediate
  Validate logs limit argument
  Update socket error handler
  build(deps): bump uuid from 11.0.2 to 11.0.3
  build(deps-dev): bump nock from 13.5.5 to 13.5.6
  fix(dev-env): detection of URLs to replace for multisites (#2081)
yolih pushed a commit that referenced this pull request Nov 18, 2024
* fix(dev-env): detection of URLs to replace for multisites

* fix: replacement takes paths into consideration

* refactor: simplify `replaceDomain()`

* fix: update `wp_blogs`

* Fix test cases - we don't have id's anymore

---------

Co-authored-by: Rinat Khaziev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants