keyring
keyring copied to clipboard
Where can I find multistore.php file?
Hello,
In singlestore.php
https://github.com/beaulebens/keyring/blob/master/includes/stores/singlestore.php#L5 it says to look at multistore.php
for multisite install. However, I can't find that file. Could you give me some tips please?
Thank you!
Hi Dasha,
Unfortunately, that was me being a little bit too optimistic about how much time I'd be able to spend on writing generic/portable code for Keyring.
There's not currently a version of "multistore" available, since the closest I have is a completely custom one, that uses custom tables and everything.
The original idea here was that you'd somehow be able to define a specific site (constant?) that would become the storage engine for a shared token store for multi-site installs, and then Keyring would always look in that specific WP DB for tokens, but that's never been specifically pursued/written. Failing a specifically-defined site like that, the default would probably be the main/core (blog_id=1) site on a multisite install.
If you ended up writing something along those lines, I think it'd make a valuable addition to the Keyring bundle though, and would like to add it.
Thanks @beaulebens for explaining. Oh I see what you mean. I haven't written anything specific to multisite install. Using the singlestore is working fine storing the tokens in a site of a user. Are there any disadvantages of that?
The main idea behind a multistore
was going to be in allowing users to use their tokens across all sites within a multi-site install. If your individual sites are quite separate, and you want to keep tokens isolated to each site, then the singlestore
should (I think!) work fine for that.
Oh I see, now it makes more sense! Thank you for explaining.
Now that site objects have pretty good caching, this would work OK by using switch_to_blog()
to the site ID where connections and tokens are stored.
We do similar with BuddyPress for certain API items now, and it works well without much in the way of snags that would affect Keyring (mostly: permalinks.)
If there's any real need for this from anyone still, I'm happy to whip up a proof-of-concept, even based on @beaulebens's approach if he's willing to share his cobbled together version.
I've been playing around with this a little bit. If y'all still have opinions on what multisite Keyring might look like, and how it could work, I'd appreciate comments on #65. 🙂