From 6982bded7124dd6f7cf4662aa5d3f97d96736ccb Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 1 Nov 2016 15:47:52 -0700 Subject: [PATCH] Remove ancient "Holiday" storage Summary: Ref T11809. This came out of Facebook many years ago for computing the number of business days that revisions had been stale. We removed the little staleness marker a few months ago and haven't seen complaints about it. If we did holidays now it would make sense to integrate them more directly with Calendar as real events, but I have no plans to pursue this anytime soon. It's easy enough to add the federal holidays manually (~5 minutes of work per year?) if you want them, and they're commentable/editable and you can add local holidays if you're not in the US. Test Plan: - Ran `bin/storage upgrade -f`. - Grepped for `CalendarHoliday`. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11809 Differential Revision: https://secure.phabricator.com/D16788 --- .../20161101.calendar.01.noholiday.sql | 1 + scripts/calendar/import_us_holidays.php | 62 ------------------- src/__phutil_library_map__.php | 4 -- .../storage/PhabricatorCalendarHoliday.php | 24 ------- .../PhabricatorCalendarHolidayTestCase.php | 19 ------ 5 files changed, 1 insertion(+), 109 deletions(-) create mode 100644 resources/sql/autopatches/20161101.calendar.01.noholiday.sql delete mode 100755 scripts/calendar/import_us_holidays.php delete mode 100644 src/applications/calendar/storage/PhabricatorCalendarHoliday.php delete mode 100644 src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php diff --git a/resources/sql/autopatches/20161101.calendar.01.noholiday.sql b/resources/sql/autopatches/20161101.calendar.01.noholiday.sql new file mode 100644 index 0000000000..bfbabfd926 --- /dev/null +++ b/resources/sql/autopatches/20161101.calendar.01.noholiday.sql @@ -0,0 +1 @@ +DROP TABLE {$NAMESPACE}_calendar.calendar_holiday; diff --git a/scripts/calendar/import_us_holidays.php b/scripts/calendar/import_us_holidays.php deleted file mode 100755 index 78d1d50c39..0000000000 --- a/scripts/calendar/import_us_holidays.php +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env php - "New Year's Day", - '2014-01-20' => 'Birthday of Martin Luther King, Jr.', - '2014-02-17' => "Washington's Birthday", - '2014-05-26' => 'Memorial Day', - '2014-07-04' => 'Independence Day', - '2014-09-01' => 'Labor Day', - '2014-10-13' => 'Columbus Day', - '2014-11-11' => 'Veterans Day', - '2014-11-27' => 'Thanksgiving Day', - '2014-12-25' => 'Christmas Day', - '2015-01-01' => "New Year's Day", - '2015-01-19' => 'Birthday of Martin Luther King, Jr.', - '2015-02-16' => "Washington's Birthday", - '2015-05-25' => 'Memorial Day', - '2015-07-03' => 'Independence Day', - '2015-09-07' => 'Labor Day', - '2015-10-12' => 'Columbus Day', - '2015-11-11' => 'Veterans Day', - '2015-11-26' => 'Thanksgiving Day', - '2015-12-25' => 'Christmas Day', - '2016-01-01' => "New Year's Day", - '2016-01-18' => 'Birthday of Martin Luther King, Jr.', - '2016-02-15' => "Washington's Birthday", - '2016-05-30' => 'Memorial Day', - '2016-07-04' => 'Independence Day', - '2016-09-05' => 'Labor Day', - '2016-10-10' => 'Columbus Day', - '2016-11-11' => 'Veterans Day', - '2016-11-24' => 'Thanksgiving Day', - '2016-12-26' => 'Christmas Day', - '2017-01-02' => "New Year's Day", - '2017-01-16' => 'Birthday of Martin Luther King, Jr.', - '2017-02-10' => "Washington's Birthday", - '2017-05-29' => 'Memorial Day', - '2017-07-04' => 'Independence Day', - '2017-09-04' => 'Labor Day', - '2017-10-09' => 'Columbus Day', - '2017-11-10' => 'Veterans Day', - '2017-11-23' => 'Thanksgiving Day', - '2017-12-25' => 'Christmas Day', -); - -$table = new PhabricatorCalendarHoliday(); -$conn_w = $table->establishConnection('w'); -$table_name = $table->getTableName(); - -foreach ($holidays as $day => $name) { - queryfx( - $conn_w, - 'INSERT IGNORE INTO %T (day, name) VALUES (%s, %s)', - $table_name, - $day, - $name); -} diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 121d3e2de3..8353c66603 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2103,8 +2103,6 @@ phutil_register_library_map(array( 'PhabricatorCalendarExternalInvitee' => 'applications/calendar/storage/PhabricatorCalendarExternalInvitee.php', 'PhabricatorCalendarExternalInviteePHIDType' => 'applications/calendar/phid/PhabricatorCalendarExternalInviteePHIDType.php', 'PhabricatorCalendarExternalInviteeQuery' => 'applications/calendar/query/PhabricatorCalendarExternalInviteeQuery.php', - 'PhabricatorCalendarHoliday' => 'applications/calendar/storage/PhabricatorCalendarHoliday.php', - 'PhabricatorCalendarHolidayTestCase' => 'applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php', 'PhabricatorCalendarICSFileImportEngine' => 'applications/calendar/import/PhabricatorCalendarICSFileImportEngine.php', 'PhabricatorCalendarICSImportEngine' => 'applications/calendar/import/PhabricatorCalendarICSImportEngine.php', 'PhabricatorCalendarICSURIImportEngine' => 'applications/calendar/import/PhabricatorCalendarICSURIImportEngine.php', @@ -6960,8 +6958,6 @@ phutil_register_library_map(array( ), 'PhabricatorCalendarExternalInviteePHIDType' => 'PhabricatorPHIDType', 'PhabricatorCalendarExternalInviteeQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', - 'PhabricatorCalendarHoliday' => 'PhabricatorCalendarDAO', - 'PhabricatorCalendarHolidayTestCase' => 'PhabricatorTestCase', 'PhabricatorCalendarICSFileImportEngine' => 'PhabricatorCalendarICSImportEngine', 'PhabricatorCalendarICSImportEngine' => 'PhabricatorCalendarImportEngine', 'PhabricatorCalendarICSURIImportEngine' => 'PhabricatorCalendarICSImportEngine', diff --git a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php b/src/applications/calendar/storage/PhabricatorCalendarHoliday.php deleted file mode 100644 index be6dde58f5..0000000000 --- a/src/applications/calendar/storage/PhabricatorCalendarHoliday.php +++ /dev/null @@ -1,24 +0,0 @@ - false, - self::CONFIG_COLUMN_SCHEMA => array( - 'day' => 'date', - 'name' => 'text64', - ), - self::CONFIG_KEY_SCHEMA => array( - 'day' => array( - 'columns' => array('day'), - 'unique' => true, - ), - ), - ) + parent::getConfiguration(); - } - -} diff --git a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php b/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php deleted file mode 100644 index de9a4cddd8..0000000000 --- a/src/applications/calendar/storage/__tests__/PhabricatorCalendarHolidayTestCase.php +++ /dev/null @@ -1,19 +0,0 @@ - true, - ); - } - - protected function willRunTests() { - parent::willRunTests(); - id(new PhabricatorCalendarHoliday()) - ->setDay('2012-01-02') - ->setName(pht('International Testing Day')) - ->save(); - } - -}