The MU forums have moved to WordPress.org

CleanUP Database/User and blog.dir after removing blog (11 posts)

  1. Mattz
    Member
    Posted 16 years ago #

    Hi,

    I have seen that not everything is really cleaned up that well when you remove a blog.

    For example:

    In the database still exist:

    wp_2_
    wp_2_menubar
    wp_2_terms
    wp_2_term_relationships
    wp_2_term_taxonomy

    The rest is gone there

    - In the blogg.dir, still directory 2 exists.

    - The username what has been added during the setup, with the name exactly the same as the blogname also still exists.

    Is there no script/plugin or cronjob to clean this mess up ?

  2. MrBrian
    Member
    Posted 16 years ago #

    I'm curious about this also. After deleting about 100 splogs, i noticed that there was tables being leftover. I'd be willing to write a conjob script or code hack if someone can confirm why these things are leftover after a blog/user is deleted?

  3. lunabyte
    Member
    Posted 16 years ago #

    No need for anything like that.

    Hook into the function that drops the tables, and add the additional table names.

    Specifically, the action hook delete_blog.

  4. MrBrian
    Member
    Posted 16 years ago #

    Any reason this is not the default behavior?

  5. lunabyte
    Member
    Posted 16 years ago #

    Because MU doesn't know what additional tables you may add?

  6. andrea_r
    Moderator
    Posted 16 years ago #

    "wp_2_terms
    wp_2_term_relationships
    wp_2_term_taxonomy"

    I gotta say, if it's leaving these ones, it's a bug as these are new tables since tags were added to the core.

  7. andrewbillits
    Member
    Posted 16 years ago #

    I've actually noticed this on a few of our test installs.

    Thanks,
    Andrew

  8. amnesiak
    Member
    Posted 15 years ago #

    was there a solution to this?

    I've got a HUUUUGE db that I need to clear and it would take forever to go into it and delete one by one.

    Is there any automated way to leave the databases being used and delete those that do not have a blog?

  9. webmaestro
    Member
    Posted 15 years ago #

    You can get rid of the RSS cache files (which I found to be a *huge* sucker of resources in my wp_NNN_options database tables) using a shell script

    for table in ^mysql -uYYYY -pXXXX ZZZZ -Bse "show tables like 'wp_%_options'"^; do
    mysql -uYYYY -pXXXX ZZZZ -Bse "DELETE from $table where option_name like "rss\_____________________________"
    done

    NOTE: I used '^' where a backtick should go, uYYYY -pXXXX ZZZZ with your user, password & WPMU database name respectively, and you may need to replace mysql with the path to the binary....

    You could also use the Clean Options plugin, although I don't know if I'd trust it to run wild on my WPMU database.

  10. andrea_r
    Moderator
    Posted 15 years ago #

    If they are users with no blog and you're SURE they aren't legit, you can always look at Site Admin -> Users and sort that list. Then check all & delete.

  11. jamescollins
    Member
    Posted 15 years ago #

    Which version of WPMU are you running?

    7 months ago the code was changed to delete all wp_x_* tables when a blog is deleted (previously any table created by plugins etc wouldn't be deleted).

    A fix was made to this 5 months ago too.

    So if you're using a recent version of WPMU, there should be no left over db tables for blogs that have been deleted since then.

    However there will probably still be old left over tables from before that fix was applied. To do this, you'd have to run a "show tables" on your database, and look for these left over tables and drop them.

About this Topic

  • Started 16 years ago by Mattz
  • Latest reply from jamescollins