The MU forums have moved to WordPress.org

wpmu_delete_blog BUG (2 posts)

  1. alfresco.resco
    Member
    Posted 15 years ago #

    Hi,

    We found a big bug in this function. It deletes 11 blogs instead just one.

    The error is located here:


    ...
    if ( $drop ) {
    $drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "_%'", ARRAY_A);
    $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );

    reset( $drop_tables );
    ...

    For example, if the blog_id is 3, the show tables match the tables
    wp_3ANY CHARACTERand any characters

    This match wp_3..., wp_31..., wp_32...

    The problem is the "_" in the LIKE clause, it must be escaped...


    ...
    if ( $drop ) {
    $drop_tables = $wpdb->get_results("show tables LIKE '". $wpdb->base_prefix . $blog_id . "\_%'", ARRAY_A);
    $drop_tables = apply_filters( 'wpmu_drop_tables', $drop_tables );

    reset( $drop_tables );
    ...

    Best regards.

  2. beatbox433
    Member
    Posted 15 years ago #

    Hi,
    That seems to be fixed already in WPMU 2.6.2
    What version are you using?

About this Topic

  • Started 15 years ago by alfresco.resco
  • Latest reply from beatbox433