Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F115245789
20160715.event.03.allday.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 30, 16:45
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jun 1, 16:45 (2 d)
Engine
blob
Format
Raw Data
Handle
26445296
Attached To
rPH Phabricator
20160715.event.03.allday.php
View Options
<?php
$table
=
new
PhabricatorCalendarEvent
();
$conn
=
$table
->
establishConnection
(
'w'
);
// Previously, "All Day" events were stored with a start and end date set to
// the earliest possible start and end seconds for the corresponding days. We
// now store all day events with their "date" epochs as UTC, separate from
// individual event times.
$zone_min
=
new
DateTimeZone
(
'Pacific/Midway'
);
$zone_max
=
new
DateTimeZone
(
'Pacific/Kiritimati'
);
$zone_utc
=
new
DateTimeZone
(
'UTC'
);
foreach
(
new
LiskMigrationIterator
(
$table
)
as
$event
)
{
// If this event has already migrated, skip it.
if
(
$event
->
getAllDayDateFrom
())
{
continue
;
}
$is_all_day
=
$event
->
getIsAllDay
();
$epoch_min
=
$event
->
getDateFrom
();
$epoch_max
=
$event
->
getDateTo
();
$date_min
=
new
DateTime
(
'@'
.
$epoch_min
);
$date_max
=
new
DateTime
(
'@'
.
$epoch_max
);
if
(
$is_all_day
)
{
$date_min
->
setTimeZone
(
$zone_min
);
$date_min
->
modify
(
'+2 days'
);
$date_max
->
setTimeZone
(
$zone_max
);
$date_max
->
modify
(
'-2 days'
);
}
else
{
$date_min
->
setTimeZone
(
$zone_utc
);
$date_max
->
setTimeZone
(
$zone_utc
);
}
$string_min
=
$date_min
->
format
(
'Y-m-d'
);
$string_max
=
$date_max
->
format
(
'Y-m-d 23:59:00'
);
$allday_min
=
id
(
new
DateTime
(
$string_min
,
$zone_utc
))->
format
(
'U'
);
$allday_max
=
id
(
new
DateTime
(
$string_max
,
$zone_utc
))->
format
(
'U'
);
queryfx
(
$conn
,
'UPDATE %T SET allDayDateFrom = %d, allDayDateTo = %d
WHERE id = %d'
,
$table
->
getTableName
(),
$allday_min
,
$allday_max
,
$event
->
getID
());
}
Event Timeline
Log In to Comment