-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathuninstall.php
31 lines (26 loc) · 919 Bytes
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
* LifterLMS REST API Uninstall
*
* @package LifterLMS_REST/Uninstall
*
* @since 1.0.0-beta.1
* @version 1.0.0-beta.1
*/
// If uninstall not called from WordPress exit.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit();
}
/**
* Only actually delete LifterLMS and Related Data when constant is defined
* This will prevent data loss when a plugin is deactivated
*/
if ( ! defined( 'LLMS_REMOVE_ALL_DATA' ) || true !== LLMS_REMOVE_ALL_DATA ) {
exit();
}
global $wpdb;
// Delete options.
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'lifterlms\_rest\_%';" ); // no-cache ok.
$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE 'llms\_rest\_%';" ); // no-cache ok.
// Drop tables.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}lifterms_api_keys" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching