|
Server IP : 10.131.40.8 / Your IP : 216.73.216.15 Web Server : Apache System : Linux webd008.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : ludmqhh ( 137773) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/ludmqhh/www/hotel-forum/wp-content/plugins/wp-hotelier/assets/../ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* Hotelier Uninstall
*
* Uninstalling Hotelier deletes user roles, pages, tables, and options.
*
* @author Benito Lopez <hello@lopezb.com>
* @category Core
* @package HTL/Uninstaller
* @version 2.6.0
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
$hotelier_options = get_option( 'hotelier_settings' );
if ( ! empty( $hotelier_options[ 'remove_data_uninstall' ] ) ) {
// Roles + caps
include_once( 'includes/class-htl-roles.php' );
$roles = new HTL_Roles;
$roles->remove_roles();
global $wpdb;
// Pages.
wp_trash_post( get_option( 'hotelier_booking_page_id' ) );
wp_trash_post( get_option( 'hotelier_listing_page_id' ) );
// Tables.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_bookings" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_reservation_itemmeta" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_reservation_items" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_rooms_bookings" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_sessions" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_bookings" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}hotelier_bookings" );
// Delete options
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'hotelier\_%';");
// Delete posts + meta.
$wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'room', 'room_reservation', 'coupon', 'extra' );" );
$wpdb->query( "DELETE meta FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE posts.ID IS NULL;" );
// Delete cron jobs when uninstalling
wp_clear_scheduled_hook( 'hotelier_cancel_pending_reservations' );
wp_clear_scheduled_hook( 'hotelier_process_completed_reservations' );
wp_clear_scheduled_hook( 'hotelier_cleanup_sessions' );
wp_clear_scheduled_hook( 'hotelier_check_license_cron' );
}
