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

Hide / show only current site's tables by prefix #72

Open
ooksanen opened this issue Feb 10, 2021 · 0 comments
Open

Hide / show only current site's tables by prefix #72

ooksanen opened this issue Feb 10, 2021 · 0 comments

Comments

@ooksanen
Copy link

ooksanen commented Feb 10, 2021

I think it would be a good idea if the plugin only showed tables related to current site in the multiselect by default. Maybe with a checkbox option to show all tables. That could prevent or at least reduce the possibility to accidentally doing a replace on another site's tables when you have multiple sites using the same database.

Here's a quick mockup:
image

I can try to make a pull request if you think this is a good idea. I've now done a really quick and dirty test by changing the get_tables SQL in class BSR_DB, line 64 from

$tables = $wpdb->get_col( 'SHOW TABLES' );
to
$tables = $wpdb->get_col( "SHOW TABLES LIKE '{$wpdb->base_prefix}_%'" );

and that seems to do the trick for single sites at least. Didn't have the time to see what needs to be done for the checkbox yet.

EDIT: Looked into it a bit more and it (surprisingly) wasn't quite as straightforward as I first thought. The table filtering should probably be done by editing the returned table list (maybe add a data-attribute to check if a table is for current site?) and some javascript to show / hide the options, but still shouldn't be too hard to implement.

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

No branches or pull requests

1 participant