Skip to content

Commit

Permalink
TAFIDaily, TAFIWeekly: update follow recent page moves
Browse files Browse the repository at this point in the history
  • Loading branch information
MusikAnimal committed Nov 22, 2020
1 parent 92a1fbb commit fb58a42
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions tasks/tafi_daily.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def self.archive_nominations(entries, approved, unapproved)

# create links on archives index
if new_month
index_page = "Wikipedia:Today's articles for improvement/Nominations/Archives"
index_page = "Wikipedia:Articles for improvement/Nominations/Archives"
index_content = @mb.get(index_page, rvsection: 1)
year_line = index_content.scan(/\n'''#{@mb.today.year}''':.*?$/).flatten.first || "\n'''#{@mb.today.year}''': "
index_content.sub!(year_line, '')
Expand All @@ -165,7 +165,7 @@ def self.nominations_board_page_name
end

def self.archive_page_name
"Wikipedia:Today's articles for improvement/Nominations/Archives/#{@mb.today.year}/#{@mb.today.month}"
"Wikipedia:Articles for improvement/Nominations/Archives/#{@mb.today.year}/#{@mb.today.month}"
end
end

Expand Down
36 changes: 18 additions & 18 deletions tasks/tafi_weekly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.run
end

def self.add_new_scheduled_selection(throttle = 0)
page = "Wikipedia talk:Today's articles for improvement"
page = "Wikipedia talk:Articles for improvement"
old_content = @mb.get_page_props(page, rvsection: 2)
new_content = old_content + "\n\n{{subst:TAFI scheduled selection" \
"|week=#{new_schedule_date.cweek}|year=#{new_schedule_date.cwyear}|date=#{new_schedule_date.strftime('%d %B %Y')}}}"
Expand Down Expand Up @@ -65,22 +65,22 @@ def self.remove_entry_from_afi(article)

@mb.edit(page,
content: new_content,
summary: "Removing [[#{article}]] as the new [[Wikipedia:Today's articles for improvement|article for improvement]]"
summary: "Removing [[#{article}]] as the new [[Wikipedia:Articles for improvement|article for improvement]]"
)
end

def self.create_schedule_page(article)
page = "Wikipedia:Today's articles for improvement/#{new_schedule_date.cwyear}/#{new_schedule_date.cweek}"
content = "{{subst:Wikipedia:Today's articles for improvement/Schedule/Preload}}"
page = "Wikipedia:Articles for improvement/#{new_schedule_date.cwyear}/#{new_schedule_date.cweek}"
content = "{{subst:Wikipedia:Articles for improvement/Schedule/Preload}}"
@mb.edit(page + '/1', content: "[[#{article}]]")
@mb.edit(page, content: content)
@mb.gateway.purge("Wikipedia:Today's articles for improvement")
@mb.gateway.purge("Wikipedia:Today's articles for improvement/Schedule")
@mb.gateway.purge("Wikipedia talk:Today's articles for improvement")
@mb.gateway.purge("Wikipedia:Articles for improvement")
@mb.gateway.purge("Wikipedia:Articles for improvement/Schedule")
@mb.gateway.purge("Wikipedia talk:Articles for improvement")
end

def self.archive_schedule
page = "Wikipedia:Today's articles for improvement/Archives/Schedule"
page = "Wikipedia:Articles for improvement/Archives/Schedule"
identifier = '<!-- mb-break -->'
content = @mb.get(page, rvsection: 1)

Expand All @@ -91,7 +91,7 @@ def self.archive_schedule
end

entry = "'''Week #{new_schedule_date.cweek}'''\n" \
"#\{\{Wikipedia:Today's articles for improvement/#{new_schedule_date.cwyear}/#{new_schedule_date.cweek}/1}}"
"#\{\{Wikipedia:Articles for improvement/#{new_schedule_date.cwyear}/#{new_schedule_date.cweek}/1}}"
content.sub!(identifier, "#{entry}\n\n#{identifier}")

@mb.edit(page,
Expand All @@ -107,7 +107,7 @@ def self.tag_new_tafi(throttle = 0)
new_content = "{{TAFI}}\n" + old_content

@mb.edit(new_tafi,
summary: "Tagging as the current [[Wikipedia:Today's articles for improvement|article for improvement]]",
summary: "Tagging as the current [[Wikipedia:Articles for improvement|article for improvement]]",
content: new_content,
section: 0,
conflicts: true
Expand Down Expand Up @@ -136,7 +136,7 @@ def self.detag_old_tafi(throttle = 0)

if old_content.length != new_content.length
@mb.edit(old_tafi,
summary: "Removing {{TAFI}}, [[Wikipedia:Today's articles for improvement|article for improvement]] period has concluded",
summary: "Removing {{TAFI}}, [[Wikipedia:Articles for improvement|article for improvement]] period has concluded",
content: new_content,
section: 0,
conflicts: true
Expand All @@ -163,7 +163,7 @@ def self.add_former_tafi(throttle = 0)

talk_content = @mb.get_page_props("Talk:#{old_tafi}", rvsection: 0)
@mb.edit("Talk:#{old_tafi}",
summary: "Adding {{Former TAFI}} as previous [[Wikipedia:Today's articles for improvement|article for improvement]]",
summary: "Adding {{Former TAFI}} as previous [[Wikipedia:Articles for improvement|article for improvement]]",
content: "#{talk_content}\n#{content}",
section: 0,
conflicts: true
Expand All @@ -179,8 +179,8 @@ def self.add_former_tafi(throttle = 0)
end

def self.message_project_members
spamlist = "Wikipedia:Today's articles for improvement/Members/Notifications"
subject = "This week's [[Wikipedia:Today's articles for improvement|article for improvement]] (week #{@mb.today.cweek}, #{@mb.today.cwyear})"
spamlist = "Wikipedia:Articles for improvement/Members/Notifications"
subject = "This week's [[Wikipedia:Articles for improvement|article for improvement]] (week #{@mb.today.cweek}, #{@mb.today.cwyear})"
sig = "<span style=\"font-family:sans-serif\"><b>[[User:MusikBot|<span style=\"color:black; font-style:italic\">MusikBot</span>]] " \
"<sup>[[User talk:MusikAnimal|<span style=\"color:green\">talk</span>]]</sup></b></span>"
message = "{{subst:TAFI weekly selection notice|1=#{sig} ~~~~~ using ~~~ on behalf of WikiProject TAFI}}"
Expand Down Expand Up @@ -229,7 +229,7 @@ def self.add_accomplishments
revision: old_tafi_old_rev_id
)

entry = "{{Wikipedia:Today's articles for improvement/Accomplishments/row" \
entry = "{{Wikipedia:Articles for improvement/Accomplishments/row" \
"|YYYY = #{last_week.cwyear}" \
"|WW = #{last_week.cweek}" \
"|oldid = #{old_tafi_old_rev_id}" \
Expand All @@ -253,7 +253,7 @@ def self.add_accomplishments
end

def self.update_accomplishments_page(entry, throttle = 0)
page = "Wikipedia:Today's articles for improvement/Accomplishments"
page = "Wikipedia:Articles for improvement/Accomplishments"
content = @mb.get_page_props(page)

identifier = '<!-- mb-break -->'
Expand Down Expand Up @@ -326,13 +326,13 @@ def self.old_tafi_new_class

def self.old_tafi
return @old_tafi if @old_tafi
old_tafi_page_name = "Wikipedia:Today's articles for improvement/#{last_week.cwyear}/#{last_week.cweek}/1"
old_tafi_page_name = "Wikipedia:Articles for improvement/#{last_week.cwyear}/#{last_week.cweek}/1"
@old_tafi = resolve_redirect(@mb.get(old_tafi_page_name).scan(/\[\[(.*)\]\]/).flatten[0])
end

def self.new_tafi
@new_tafi ||= resolve_redirect(
@mb.get("Wikipedia:Today's articles for improvement/#{@mb.today.cwyear}/#{@mb.today.cweek}/1").scan(/\[\[(.*)\]\]/).flatten[0]
@mb.get("Wikipedia:Articles for improvement/#{@mb.today.cwyear}/#{@mb.today.cweek}/1").scan(/\[\[(.*)\]\]/).flatten[0]
)
end

Expand Down

0 comments on commit fb58a42

Please sign in to comment.