Skip to content

Use SiteInfo to create WpService#1239

Merged
crazytonyli merged 4 commits into
trunkfrom
task/unifi-wp-service-constructor
May 4, 2026
Merged

Use SiteInfo to create WpService#1239
crazytonyli merged 4 commits into
trunkfrom
task/unifi-wp-service-constructor

Conversation

@crazytonyli
Copy link
Copy Markdown
Contributor

Description

There are two separate constructors to create WpService, based on the type of the site. This PR unifies them by using the existing SiteInfo.

I have also updated the Swift wrapper WordPressAPI to hold on to a SiteInfo instance, to simplify the creating WpService API.

@crazytonyli crazytonyli requested a review from jkmassel March 17, 2026 02:19
@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Mar 17, 2026

XCFramework Build

This PR's XCFramework is available for testing. Add to your Package.swift:

.package(url: "https://github.com/automattic/wordpress-rs", branch: "pr-build/1239")

Built from d3a6c53

@crazytonyli crazytonyli force-pushed the task/unifi-wp-service-constructor branch 3 times, most recently from 06327b7 to f95fe31 Compare March 17, 2026 06:35
@crazytonyli crazytonyli force-pushed the task/unifi-wp-service-constructor branch 2 times, most recently from 5ae04c5 to 77c19d3 Compare March 18, 2026 23:09
@crazytonyli crazytonyli force-pushed the task/unifi-wp-service-constructor branch from 77c19d3 to 28bc4ef Compare April 21, 2026 03:17
@crazytonyli crazytonyli requested a review from oguzkocer April 21, 2026 03:18
@crazytonyli
Copy link
Copy Markdown
Contributor Author

crazytonyli commented Apr 23, 2026

@oguzkocer Thanks for the review!

I'll merge this PR after the integration PR in the iOS app is approved. I want to merge these two PRs together to avoid blocking others.

@crazytonyli crazytonyli force-pushed the task/unifi-wp-service-constructor branch from 28bc4ef to 008af36 Compare April 30, 2026 21:17
@crazytonyli crazytonyli force-pushed the task/unifi-wp-service-constructor branch from 008af36 to d3a6c53 Compare May 1, 2026 09:24
@crazytonyli crazytonyli enabled auto-merge (squash) May 1, 2026 09:24
@crazytonyli crazytonyli merged commit 7fd4b84 into trunk May 4, 2026
34 checks passed
@crazytonyli crazytonyli deleted the task/unifi-wp-service-constructor branch May 4, 2026 01:50
crazytonyli added a commit that referenced this pull request May 4, 2026
* Tolerate URL normalization differences in cache lookups

Register a `urls_eq` SQLite scalar function that compares two URL
strings via `ParsedUrl` parsing (with raw-string fast path) and use it
in `WHERE urls_eq(url, ?)` for `self_hosted_sites.url` reads. Lookups
now match the same site whether it was stored as `http://localhost`
or `http://localhost/`, which fixes the trunk integration-test break
in `test_remove_site.rs` and removes the latent risk of duplicate rows
on devices upgrading across PR #1239.

Replaces the narrower `url_candidates` workaround (and the
`delete_self_hosted_site_by_url(&[String])` overload that consumed it),
so every URL-keyed read goes through one mechanism.

* Make WpApiCache::from(Connection) fallible

`register_url_functions` can fail at the SQLite layer; switch the
impl from `From<Connection>` to `TryFrom<Connection>` so callers
surface the error as `SqliteDbError` rather than panic. The four
existing call sites are unit-test setup, which now `.expect(...)`
the result.

* Add a change log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants