'attachment', 'post_status' => 'inherit', 'posts_per_page' => -1, 'fields' => 'ids', 'meta_key' => '_volixta_task_manager_task_id', ]); // phpcs:enable WordPress.DB.SlowDBQuery.slow_db_query_meta_key foreach ($attached as $aid) wp_delete_attachment((int)$aid, true); // Encrypted files are confined to a dedicated private directory. require_once __DIR__ . '/includes/class-volixta-task-manager-files.php'; Volixta_Task_Manager_Files::remove_all_files(); foreach (['notifications', 'files', 'activity', 'checks', 'tasks', 'stages', 'members', 'boards'] as $table) { // phpcs:ignore WordPress.DB.DirectDatabaseQuery.SchemaChange -- Only during uninstall, removes one of this plugin's own tables. $wpdb->query($wpdb->prepare('DROP TABLE IF EXISTS %i', $wpdb->prefix . 'volixta_task_manager_' . $table)); } $wpdb->query($wpdb->prepare('DELETE FROM %i WHERE option_name LIKE %s', $wpdb->options, $wpdb->esc_like('volixta_task_manager_') . '%')); } if (is_multisite()) { $volixta_task_manager_offset = 0; do { $volixta_task_manager_site_ids = get_sites(['fields'=>'ids', 'number'=>100, 'offset'=>$volixta_task_manager_offset, 'orderby'=>'id', 'order'=>'ASC']); foreach ($volixta_task_manager_site_ids as $volixta_task_manager_site_id) { switch_to_blog((int)$volixta_task_manager_site_id); volixta_task_manager_uninstall_site(); restore_current_blog(); } $volixta_task_manager_offset += count($volixta_task_manager_site_ids); } while (count($volixta_task_manager_site_ids) === 100); } else { volixta_task_manager_uninstall_site(); } // phpcs:enable WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching