raw('SET FOREIGN_KEY_CHECKS = 0'); try { foreach ([Naming::TEMP, Naming::BACKUP, Naming::IMPORT] as $prefix) { foreach ($db->col($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($prefix) . '%')) as $table) { $db->raw('DROP TABLE IF EXISTS ' . Db::ident($table)); } } foreach (Schema::tables() as $table) { $db->raw('DROP TABLE IF EXISTS ' . Db::ident($table)); } } finally { $db->raw('SET FOREIGN_KEY_CHECKS = 1'); } delete_site_option('relay_settings'); delete_site_option('relay_schema_version'); delete_site_option('relay_mode'); delete_site_option('relay_auto_lock'); delete_site_option('relay_compat_whitelist'); delete_site_option('relay_notifications'); delete_site_option(Paths::FOLDERS_OPTION); // What Relay's GitHub updater (0.9.x) stored: the encrypted key, the last check and the cached release. delete_site_option('relay_update_key'); delete_site_option('relay_update_status'); delete_site_transient('relay_update_release'); CompatPlugin::remove(); wp_clear_scheduled_hook('relay_daily'); wp_clear_scheduled_hook(\Relay\Files\PointArchive::HOOK); // Exports, backups, restore staging and file restore points (uploads/siterelay, or a folder an earlier version // set up), under the names of this version or an earlier one. $uploads = wp_upload_dir(null, false); foreach (Paths::NAMES as $name) { Fs::remove_tree(trailingslashit($uploads['basedir']) . $name); Fs::remove_tree(Paths::work_dir() . '/' . $name . '-staging'); Fs::remove_tree(Paths::work_dir() . '/' . $name . '-backups'); } } }