For many many blogs, I have these tables created from the Counterize Stat Plugin that we no longer use and I want to drop them:
Example of a single blog:
What is the MySql execution I could run to effectively drop any table with the word "Counterize" in the name of the table??? Sorry, I am not a MySql expert by any means.
For many many blogs, I have these tables created from the Counterize Stat Plugin that we no longer use and I want to drop them:
Example of a single blog:
What is the MySql execution I could run to effectively drop any table with the word "Counterize" in the name of the table??? Sorry, I am not a MySql expert by any means.
7430 pointsLike some sort of WPMU DEV GodMindblowingly helpful memberLifetime member
Erstwhile founder
—
23rd April 2009 (3 years ago)
#
I'm not sure if you can use a wildcard when dropping tables. However, I know you can use a wildcard with "show tables". So I'd do that to grab the tables and then loop through the results dropping the tables.
I think wpmu uses this technique to drop blog tables. Have a look in wp-admin/includes/mu.php for the code.
6593 pointsLike some sort of WPMU DEV GodExceptionally helpfulLifetime member
Keeper of the Dark Chocolate
—
23rd April 2009 (3 years ago)
#
Um, actually I recall a while ago a trac ticket about setting up a wildcard delete when a blog was deleted. I thought this was done and in there.
I'm not in a position to code this but easiest method I would think would be a check to see that if the wp_#_Counterize table exists but wp_#_comments does not, go ahead and delete those extra tables. If the core tables aren't there but the add ons are, that means the blog is deleted and go ahead and get rid of the add ones.
I'd have a backup done though before doing that of course. :)
6593 pointsLike some sort of WPMU DEV GodExceptionally helpfulLifetime member
Keeper of the Dark Chocolate
—
23rd April 2009 (3 years ago)
#
Oh sorry. I thought it was just deleted blogs.
If it is all of them, I'd just create a loop from 1 to whatever blog is the last to have the tables and delete them. I would setup a check "if found, then delete."
Responses (7)
Erstwhile founder — 23rd April 2009 (3 years ago) #
I'm not sure if you can use a wildcard when dropping tables. However, I know you can use a wildcard with "show tables". So I'd do that to grab the tables and then loop through the results dropping the tables.
I think wpmu uses this technique to drop blog tables. Have a look in wp-admin/includes/mu.php for the code.
Thanks,
Andrew
Keeper of the Dark Chocolate — 23rd April 2009 (3 years ago) #
Um, actually I recall a while ago a trac ticket about setting up a wildcard delete when a blog was deleted. I thought this was done and in there.
I'm not in a position to code this but easiest method I would think would be a check to see that if the wp_#_Counterize table exists but wp_#_comments does not, go ahead and delete those extra tables. If the core tables aren't there but the add ons are, that means the blog is deleted and go ahead and get rid of the add ones.
I'd have a backup done though before doing that of course. :)
Keeper of the Dark Chocolate — 23rd April 2009 (3 years ago) #
Here they are:
http://trac.mu.wordpress.org/ticket/669
With this fix:
http://trac.mu.wordpress.org/ticket/727
Erstwhile founder — 23rd April 2009 (3 years ago) #
I think I'm confused. I thought the issue at hand was removing the tables from for both existing and deleted blogs?
Thanks,
Andrew
Keeper of the Dark Chocolate — 23rd April 2009 (3 years ago) #
Oh sorry. I thought it was just deleted blogs.
If it is all of them, I'd just create a loop from 1 to whatever blog is the last to have the tables and delete them. I would setup a check "if found, then delete."
Member — 24th April 2009 (3 years ago) #
why not search with phpmyadmin for %counterize% then mark the results and delete them all?
Erstwhile founder — 24th April 2009 (3 years ago) #
Didn't think of that. Good idea :)
Thanks,
Andrew
Become a member