mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 20:24:05 -06:00
handle posts:rebake_match task without type argument
This commit is contained in:
parent
054ee4dc55
commit
dc4799dda2
@ -30,14 +30,15 @@ desc 'Rebake all posts matching string/regex'
|
||||
task 'posts:rebake_match', [:pattern, :type] => [:environment] do |_,args|
|
||||
pattern = args[:pattern]
|
||||
type = args[:type]
|
||||
type = type.downcase if type
|
||||
if !pattern
|
||||
puts "ERROR: Expecting rake posts:rebake_match[pattern,type]"
|
||||
exit 1
|
||||
end
|
||||
|
||||
if type.downcase == "regex"
|
||||
if type == "regex"
|
||||
search = Post.where("raw ~ ?", pattern)
|
||||
elsif type.downcase == "string" || !type
|
||||
elsif type == "string" || !type
|
||||
search = Post.where("raw ILIKE ?", "%#{pattern}%")
|
||||
else
|
||||
puts "ERROR: Expecting rake posts:rebake_match[pattern,type] where type is string or regex"
|
||||
|
Loading…
Reference in New Issue
Block a user