2121 pointsLike some sort of WPMU DEV God"Mindblowingly helpful memberLifetime member
Ovidiu
Member
—
3rd May 2011 12:43
I've been doing some spring cleaning and have archived plenty of unused blogs.
I'll give them a few weeks but if nobody complains, I'd like to delete all archived blogs in one swoop via a SQL command. can someone help me out here?
I've been doing some spring cleaning and have archived plenty of unused blogs.
I'll give them a few weeks but if nobody complains, I'd like to delete all archived blogs in one swoop via a SQL command. can someone help me out here?
Not sure how you'd do that tbh. My first thought is to track down the core WP functions that do the blog deletion and copy out the SQL code, then stick in appropriate WHERE statements (if that will suffice).
It's not been updated for 3.1 - you just drop the file in mu-plugins and then go to Tools>Power Tools on your main site. I believe the plugin still works.
maybe I can raid the former script for some resources, the second one is only useful for executing scripts, which I need ;-) so if I have the SQL statement I can execute it via phpmyadmin or power tools...
power tools by itself does not clean archived blogs only spammed and deleted ones.
thx mason. I have to correct myself too: powertools offers an option to input some php that executes sql to do your bidding, I am sure some of your developers can easily help out.
SQL is not enough, you have to calculate the blogs table names to drop them, as well as delete the appropriate files directory, as well as unlink any users attached to them.
wpmu_delete_blog( $blog_id, $drop = false )
Is the function you want. Basically select all archived blog_ids from wp_blogs table, then call this function for each.
Responses (7)
Sales & Support Pro — 3rd May 2011 13:30 #
Hiya,
Not sure how you'd do that tbh. My first thought is to track down the core WP functions that do the blog deletion and copy out the SQL code, then stick in appropriate WHERE statements (if that will suffice).
Phil
Sales & Support Lead — 3rd May 2011 18:46 #
I looked at scripts ages ago for this and never found anything I liked:
http://www.studinski.dk/wpmu-cleanup.txt
So that's the not helpful one. Perhaps Power Tools?
http://plugins.paidtoblog.com/wpmu-power-tools/
It's not been updated for 3.1 - you just drop the file in mu-plugins and then go to Tools>Power Tools on your main site. I believe the plugin still works.
Thanks!
Member — 3rd May 2011 19:09 #
maybe I can raid the former script for some resources, the second one is only useful for executing scripts, which I need ;-) so if I have the SQL statement I can execute it via phpmyadmin or power tools...
power tools by itself does not clean archived blogs only spammed and deleted ones.
Sales & Support Lead — 9th May 2011 23:36 #
Ah, thanks. Didn't realize that.
Let me see if we've got a dev or two around that can provide a hint as to the SQL query. Whatcha got fellas? Is there an easy way to crank this out?
Thanks!
Member — 10th May 2011 05:44 #
thx mason. I have to correct myself too: powertools offers an option to input some php that executes sql to do your bidding, I am sure some of your developers can easily help out.
Member — 16th May 2011 12:58 #
any news here?
Lead Developer — 16th May 2011 15:28 #
SQL is not enough, you have to calculate the blogs table names to drop them, as well as delete the appropriate files directory, as well as unlink any users attached to them.
wpmu_delete_blog( $blog_id, $drop = false )Is the function you want. Basically select all archived blog_ids from wp_blogs table, then call this function for each.
Become a member