mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 12:56:47 +08:00
Merge pull request #4009 from ebernhardson/export_category_filename
Take filename to write to as optional parameter to export_category
This commit is contained in:
commit
c33a6ddfed
|
@ -6,8 +6,8 @@ require "json"
|
|||
|
||||
module ImportExport
|
||||
|
||||
def self.export_category(category_id)
|
||||
ImportExport::CategoryExporter.new(category_id).perform.save_to_file
|
||||
def self.export_category(category_id, filename=nil)
|
||||
ImportExport::CategoryExporter.new(category_id).perform.save_to_file(filename)
|
||||
end
|
||||
|
||||
def self.import_category(filename)
|
||||
|
|
|
@ -135,12 +135,12 @@ class DiscourseCLI < Thor
|
|||
end
|
||||
|
||||
desc "export_category", "Export a category, all its topics, and all users who posted in those topics"
|
||||
def export_category(category_id)
|
||||
def export_category(category_id, filename=nil)
|
||||
raise "Category id argument is missing!" unless category_id
|
||||
|
||||
load_rails
|
||||
load_import_export
|
||||
ImportExport.export_category(category_id)
|
||||
ImportExport.export_category(category_id, filename)
|
||||
puts "", "Done", ""
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user