/** * @return bool * @since 1.0 */ public function delete_folder() { $service = new Google_Service_Drive($this->_google_drive_cdn->get_google_client()); // get the folder id $folder_id = WPB_Google_Drive_Cdn_Settings::get_setting('folder_id', 'wpbgdc_folders'); try { $service->files->trash($folder_id); // deleting the files directly will result in a bug @see http://stackoverflow.com/questions/16573970/google-drive-api-delete-method-bug // $service->files->delete( $folder_id ); } catch (Exception $e) { $this->_google_drive_cdn->set_error($e->getMessage() . '(wpbgdc: delete_folder 1)', false); return false; } return true; }