PluginProbe ʕ •ᴥ•ʔ
Presto Player / trunk
Presto Player vtrunk
4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.4 4.2.3 4.2.2 4.2.0 4.2.1 trunk 1.10.0 1.10.1 1.10.2 1.11.0 1.12.0 1.13.0 1.14.0 1.14.1 1.5.10 1.5.11 1.5.12 1.5.13 1.5.14 1.5.15 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.13 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 1.8.0 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.9.0 1.9.1 1.9.10 1.9.11 1.9.12 1.9.13 1.9.14 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.16 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3-beta1 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.0-beta1 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.1.0 3.1.1 3.1.2 3.1.3 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4
presto-player / inc / Deactivator.php
presto-player / inc Last commit date
Blocks 1 week ago Contracts 2 years ago Database 1 week ago Integrations 3 weeks ago Libraries 2 months ago Models 1 week ago Seeds 1 week ago Services 1 week ago Support 2 months ago config 1 week ago lib 3 months ago Activator.php 1 week ago Attachment.php 2 months ago Controller.php 2 years ago Core.php 2 years ago Deactivator.php 1 week ago Factory.php 1 week ago Files.php 2 months ago Playlist.php 2 years ago Plugin.php 3 months ago Requirements.php 2 years ago support.php 2 months ago
Deactivator.php
115 lines
1 <?php
2 /**
3 * Plugin deactivation and uninstall handler.
4 *
5 * @package PrestoPlayer
6 */
7
8 namespace PrestoPlayer;
9
10 use PrestoPlayer\Database\Table;
11 use PrestoPlayer\Database\Visits;
12 use PrestoPlayer\Database\Presets;
13 use PrestoPlayer\Database\Videos;
14 use PrestoPlayer\Database\AudioPresets;
15 use PrestoPlayer\Database\Webhooks;
16 use PrestoPlayer\Models\ReusableVideo;
17 use PrestoPlayer\Services\OAuth\Storage\Schema;
18 use PrestoPlayer\Services\Usage;
19
20 /**
21 * Class Deactivator
22 *
23 * Handles plugin data cleanup on uninstall.
24 */
25 class Deactivator {
26
27 /**
28 * Handle plugin uninstall based on user settings.
29 *
30 * @return void
31 */
32 public static function uninstall() {
33 // Get plugin settings.
34 $uninstall_settings = get_option( 'presto_player_uninstall' );
35
36 // Uninstall all data on delete if selected.
37 if ( isset( $uninstall_settings['uninstall_data'] ) && $uninstall_settings['uninstall_data'] ) {
38 self::delete_data_on_uninstall();
39 }
40 }
41
42 /**
43 * Delete all plugin data from the database.
44 *
45 * @return void
46 */
47 public static function delete_data_on_uninstall() {
48 // License.
49 delete_option( 'presto_player_license' );
50 delete_option( 'presto_player_license_data' );
51
52 // Settings.
53 delete_option( 'presto_player_analytics' );
54 delete_option( 'presto_player_google_analytics' );
55 delete_option( 'presto_player_branding' );
56 delete_option( 'presto_player_bunny_keys' );
57 delete_option( 'presto_player_bunny_storage_zones' );
58 delete_option( 'presto_player_bunny_pull_zones' );
59 delete_option( 'presto_player_bunny_uid' );
60 delete_option( 'presto_player_instant_video_width' );
61 delete_option( 'presto_player_media_hub_sync_default' );
62
63 // Notices.
64 delete_option( 'presto_player_dismissed_notice_nginx_rules' );
65 delete_option( 'presto_player_presto_player_bunny_uid' );
66 delete_option( 'presto_player_dismissed_notice_presto_player_reusable_notice' );
67
68 // Uninstall option.
69 delete_option( 'presto_player_uninstall' );
70
71 // Tables.
72 delete_option( 'presto_preset_seed_version' );
73 delete_option( 'presto_player_visits_database_version' );
74 delete_option( 'presto_player_videos_database_version' );
75 delete_option( 'presto_player_presets_database_version' );
76 delete_option( 'presto_zone_token' );
77 delete_option( 'presto_player_visits_upgrade_version' );
78 delete_option( 'presto_player_pro_update_performance' );
79 delete_option( 'presto_player_audio_presets_database_version' );
80 delete_option( 'presto_player_email_collection_database_version' );
81 delete_option( 'presto_audio_preset_seed_version' );
82
83 // AI abilities / MCP + the OAuth server behind it.
84 delete_option( 'presto_player_mcp' );
85 if ( class_exists( Schema::class ) ) {
86 Schema::uninstall();
87 }
88
89 // Delete our tables.
90 $table = new Table();
91 ( new Visits( $table ) )->uninstall();
92 ( new Presets( $table ) )->uninstall();
93 ( new AudioPresets( $table ) )->uninstall();
94 ( new Videos( $table ) )->uninstall();
95 ( new Webhooks( $table ) )->uninstall();
96
97 // Daily views KPI tracking.
98 delete_transient( Usage::DAILY_VIEWS_OPTION );
99 delete_transient( 'presto_player_state_events_checked' );
100
101 // BSF Analytics event tracking.
102 delete_option( 'presto_player_tracked_version' );
103 // BSF Analytics library prefixes options with the product slug (hyphenated).
104 delete_option( 'presto-player_usage_events_pending' );
105 delete_option( 'presto-player_usage_events_pushed' );
106
107 // Delete all reusable videos.
108 $videos = new ReusableVideo();
109 $all_videos = $videos->all( array( 'fields' => 'ids' ) );
110 foreach ( $all_videos as $video_id ) {
111 wp_delete_post( $video_id, true );
112 }
113 }
114 }
115