Beispiel #1
0
/**
 * Uninstalls the dc plugin.
 */
function dc_uninstall()
{
    global $wpdb;
    // Delete wordpress options
    delete_option('dc_zip_location');
    delete_option('dc_max_attempts');
    delete_option('dc_header_content_type');
    delete_option('dc_msg_code_enter');
    delete_option('dc_msg_code_valid');
    delete_option('dc_msg_code_invalid');
    delete_option('dc_msg_max_downloads_reached');
    delete_option('dc_msg_max_attempts_reached');
    delete_option('dc_file_location');
    delete_option('dc_file_types');
    delete_option('dc_version');
    // Delete database tables
    $wpdb->query("DROP TABLE " . dc_tbl_downloads());
    $wpdb->query("DROP TABLE " . dc_tbl_codes());
    $wpdb->query("DROP TABLE " . dc_tbl_code_groups());
    $wpdb->query("DROP TABLE " . dc_tbl_releases());
}
Beispiel #2
0
/**
 * Delete a release
 */
function dc_delete_release($release_id)
{
    global $wpdb;
    $result = 0;
    // Delete release
    $result += $wpdb->query($wpdb->prepare("DELETE FROM " . dc_tbl_releases() . " WHERE `ID` = %d", array(intval($release_id))));
    // Delete code groups
    $result += $wpdb->query($wpdb->prepare("DELETE FROM " . dc_tbl_code_groups() . " WHERE `release` = %d", array(intval($release_id))));
    // Delete codes
    $result += $wpdb->query($wpdb->prepare("DELETE FROM " . dc_tbl_codes() . " WHERE `release` = %d", array(intval($release_id))));
    return $result;
}