Browse Source

Move DateTime::ATOM to DateTimeInterface::ATOM

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/27635/head
Christoph Wurst 5 years ago
parent
commit
770881d5d6
No known key found for this signature in database GPG Key ID: CC42AC2A7F0E56D8
  1. 4
      apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php
  2. 4
      apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php
  3. 6
      apps/dav/lib/CalDAV/Reminder/Notifier.php
  4. 4
      apps/dav/lib/CalDAV/Schedule/IMipPlugin.php
  5. 2
      apps/dav/lib/Files/FileSearchBackend.php
  6. 4
      apps/dav/lib/Search/EventsSearchProvider.php
  7. 4
      apps/dav/lib/Search/TasksSearchProvider.php
  8. 4
      core/Command/Security/ListCertificates.php
  9. 2
      core/Command/User/Info.php
  10. 2
      core/Command/User/ListCommand.php
  11. 2
      lib/private/Console/TimestampFormatter.php
  12. 2
      lib/private/Log/LogDetails.php
  13. 4
      tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php

4
apps/dav/lib/CalDAV/Reminder/NotificationProvider/EmailProvider.php

@ -390,8 +390,8 @@ class EmailProvider extends AbstractProvider {
$diff = $dtstartDt->diff($dtendDt); $diff = $dtstartDt->diff($dtendDt);
$dtstartDt = new \DateTime($dtstartDt->format(\DateTime::ATOM));
$dtendDt = new \DateTime($dtendDt->format(\DateTime::ATOM));
$dtstartDt = new \DateTime($dtstartDt->format(\DateTimeInterface::ATOM));
$dtendDt = new \DateTime($dtendDt->format(\DateTimeInterface::ATOM));
if ($isAllDay) { if ($isAllDay) {
// One day event // One day event

4
apps/dav/lib/CalDAV/Reminder/NotificationProvider/PushProvider.php

@ -137,10 +137,10 @@ class PushProvider extends AbstractProvider {
? ((string) $vevent->LOCATION) ? ((string) $vevent->LOCATION)
: null, : null,
'all_day' => $start instanceof Property\ICalendar\Date, 'all_day' => $start instanceof Property\ICalendar\Date,
'start_atom' => $start->getDateTime()->format(\DateTime::ATOM),
'start_atom' => $start->getDateTime()->format(\DateTimeInterface::ATOM),
'start_is_floating' => $start->isFloating(), 'start_is_floating' => $start->isFloating(),
'start_timezone' => $start->getDateTime()->getTimezone()->getName(), 'start_timezone' => $start->getDateTime()->getTimezone()->getName(),
'end_atom' => $end->getDateTime()->format(\DateTime::ATOM),
'end_atom' => $end->getDateTime()->format(\DateTimeInterface::ATOM),
'end_is_floating' => $end->isFloating(), 'end_is_floating' => $end->isFloating(),
'end_timezone' => $end->getDateTime()->getTimezone()->getName(), 'end_timezone' => $end->getDateTime()->getTimezone()->getName(),
]; ];

6
apps/dav/lib/CalDAV/Reminder/Notifier.php

@ -144,7 +144,7 @@ class Notifier implements INotifier {
private function prepareNotificationSubject(INotification $notification): void { private function prepareNotificationSubject(INotification $notification): void {
$parameters = $notification->getSubjectParameters(); $parameters = $notification->getSubjectParameters();
$startTime = \DateTime::createFromFormat(\DateTime::ATOM, $parameters['start_atom']);
$startTime = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $parameters['start_atom']);
$now = $this->timeFactory->getDateTime(); $now = $this->timeFactory->getDateTime();
$title = $this->getTitleFromParameters($parameters); $title = $this->getTitleFromParameters($parameters);
@ -221,8 +221,8 @@ class Notifier implements INotifier {
* @throws \Exception * @throws \Exception
*/ */
private function generateDateString(array $parameters):string { private function generateDateString(array $parameters):string {
$startDateTime = DateTime::createFromFormat(\DateTime::ATOM, $parameters['start_atom']);
$endDateTime = DateTime::createFromFormat(\DateTime::ATOM, $parameters['end_atom']);
$startDateTime = DateTime::createFromFormat(\DateTimeInterface::ATOM, $parameters['start_atom']);
$endDateTime = DateTime::createFromFormat(\DateTimeInterface::ATOM, $parameters['end_atom']);
// If the event has already ended, dismiss the notification // If the event has already ended, dismiss the notification
if ($endDateTime < $this->timeFactory->getDateTime()) { if ($endDateTime < $this->timeFactory->getDateTime()) {

4
apps/dav/lib/CalDAV/Schedule/IMipPlugin.php

@ -441,8 +441,8 @@ class IMipPlugin extends SabreIMipPlugin {
$diff = $dtstartDt->diff($dtendDt); $diff = $dtstartDt->diff($dtendDt);
$dtstartDt = new \DateTime($dtstartDt->format(\DateTime::ATOM));
$dtendDt = new \DateTime($dtendDt->format(\DateTime::ATOM));
$dtstartDt = new \DateTime($dtstartDt->format(\DateTimeInterface::ATOM));
$dtendDt = new \DateTime($dtendDt->format(\DateTimeInterface::ATOM));
if ($isAllDay) { if ($isAllDay) {
// One day event // One day event

2
apps/dav/lib/Files/FileSearchBackend.php

@ -378,7 +378,7 @@ class FileSearchBackend implements ISearchBackend {
if (is_numeric($value)) { if (is_numeric($value)) {
return max(0, 0 + $value); return max(0, 0 + $value);
} }
$date = \DateTime::createFromFormat(\DateTime::ATOM, $value);
$date = \DateTime::createFromFormat(\DateTimeInterface::ATOM, $value);
return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0; return ($date instanceof \DateTime && $date->getTimestamp() !== false) ? $date->getTimestamp() : 0;
default: default:
return $value; return $value;

4
apps/dav/lib/Search/EventsSearchProvider.php

@ -181,8 +181,8 @@ class EventsSearchProvider extends ACalendarSearchProvider {
$dtStart = $eventComponent->DTSTART; $dtStart = $eventComponent->DTSTART;
$dtEnd = $this->getDTEndForEvent($eventComponent); $dtEnd = $this->getDTEndForEvent($eventComponent);
$isAllDayEvent = $dtStart instanceof Property\ICalendar\Date; $isAllDayEvent = $dtStart instanceof Property\ICalendar\Date;
$startDateTime = new \DateTime($dtStart->getDateTime()->format(\DateTime::ATOM));
$endDateTime = new \DateTime($dtEnd->getDateTime()->format(\DateTime::ATOM));
$startDateTime = new \DateTime($dtStart->getDateTime()->format(\DateTimeInterface::ATOM));
$endDateTime = new \DateTime($dtEnd->getDateTime()->format(\DateTimeInterface::ATOM));
if ($isAllDayEvent) { if ($isAllDayEvent) {
$endDateTime->modify('-1 day'); $endDateTime->modify('-1 day');

4
apps/dav/lib/Search/TasksSearchProvider.php

@ -153,13 +153,13 @@ class TasksSearchProvider extends ACalendarSearchProvider {
*/ */
protected function generateSubline(Component $taskComponent): string { protected function generateSubline(Component $taskComponent): string {
if ($taskComponent->COMPLETED) { if ($taskComponent->COMPLETED) {
$completedDateTime = new \DateTime($taskComponent->COMPLETED->getDateTime()->format(\DateTime::ATOM));
$completedDateTime = new \DateTime($taskComponent->COMPLETED->getDateTime()->format(\DateTimeInterface::ATOM));
$formattedDate = $this->l10n->l('date', $completedDateTime, ['width' => 'medium']); $formattedDate = $this->l10n->l('date', $completedDateTime, ['width' => 'medium']);
return $this->l10n->t('Completed on %s', [$formattedDate]); return $this->l10n->t('Completed on %s', [$formattedDate]);
} }
if ($taskComponent->DUE) { if ($taskComponent->DUE) {
$dueDateTime = new \DateTime($taskComponent->DUE->getDateTime()->format(\DateTime::ATOM));
$dueDateTime = new \DateTime($taskComponent->DUE->getDateTime()->format(\DateTimeInterface::ATOM));
$formattedDate = $this->l10n->l('date', $dueDateTime, ['width' => 'medium']); $formattedDate = $this->l10n->l('date', $dueDateTime, ['width' => 'medium']);
if ($taskComponent->DUE->hasTime()) { if ($taskComponent->DUE->hasTime()) {

4
core/Command/Security/ListCertificates.php

@ -58,10 +58,10 @@ class ListCertificates extends Base {
'name' => $certificate->getName(), 'name' => $certificate->getName(),
'common_name' => $certificate->getCommonName(), 'common_name' => $certificate->getCommonName(),
'organization' => $certificate->getOrganization(), 'organization' => $certificate->getOrganization(),
'expire' => $certificate->getExpireDate()->format(\DateTime::ATOM),
'expire' => $certificate->getExpireDate()->format(\DateTimeInterface::ATOM),
'issuer' => $certificate->getIssuerName(), 'issuer' => $certificate->getIssuerName(),
'issuer_organization' => $certificate->getIssuerOrganization(), 'issuer_organization' => $certificate->getIssuerOrganization(),
'issue_date' => $certificate->getIssueDate()->format(\DateTime::ATOM)
'issue_date' => $certificate->getIssueDate()->format(\DateTimeInterface::ATOM)
]; ];
}, $this->certificateManager->listCertificates()); }, $this->certificateManager->listCertificates());
if ($outputType === self::OUTPUT_FORMAT_JSON) { if ($outputType === self::OUTPUT_FORMAT_JSON) {

2
core/Command/User/Info.php

@ -80,7 +80,7 @@ class Info extends Base {
'enabled' => $user->isEnabled(), 'enabled' => $user->isEnabled(),
'groups' => $groups, 'groups' => $groups,
'quota' => $user->getQuota(), 'quota' => $user->getQuota(),
'last_seen' => date(\DateTime::ATOM, $user->getLastLogin()), // ISO-8601
'last_seen' => date(\DateTimeInterface::ATOM, $user->getLastLogin()), // ISO-8601
'user_directory' => $user->getHome(), 'user_directory' => $user->getHome(),
'backend' => $user->getBackendClassName() 'backend' => $user->getBackendClassName()
]; ];

2
core/Command/User/ListCommand.php

@ -109,7 +109,7 @@ class ListCommand extends Base {
'enabled' => $user->isEnabled(), 'enabled' => $user->isEnabled(),
'groups' => $groups, 'groups' => $groups,
'quota' => $user->getQuota(), 'quota' => $user->getQuota(),
'last_seen' => date(\DateTime::ATOM, $user->getLastLogin()), // ISO-8601
'last_seen' => date(\DateTimeInterface::ATOM, $user->getLastLogin()), // ISO-8601
'user_directory' => $user->getHome(), 'user_directory' => $user->getHome(),
'backend' => $user->getBackendClassName() 'backend' => $user->getBackendClassName()
]; ];

2
lib/private/Console/TimestampFormatter.php

@ -103,7 +103,7 @@ class TimestampFormatter implements OutputFormatterInterface {
$timeZone = $timeZone !== null ? new \DateTimeZone($timeZone) : null; $timeZone = $timeZone !== null ? new \DateTimeZone($timeZone) : null;
$time = new \DateTime('now', $timeZone); $time = new \DateTime('now', $timeZone);
$timestampInfo = $time->format($this->config->getSystemValue('logdateformat', \DateTime::ATOM));
$timestampInfo = $time->format($this->config->getSystemValue('logdateformat', \DateTimeInterface::ATOM));
return $timestampInfo . ' ' . $this->formatter->format($message); return $timestampInfo . ' ' . $this->formatter->format($message);
} }

2
lib/private/Log/LogDetails.php

@ -37,7 +37,7 @@ abstract class LogDetails {
public function logDetails(string $app, $message, int $level): array { public function logDetails(string $app, $message, int $level): array {
// default to ISO8601 // default to ISO8601
$format = $this->config->getValue('logdateformat', \DateTime::ATOM);
$format = $this->config->getValue('logdateformat', \DateTimeInterface::ATOM);
$logTimeZone = $this->config->getValue('logtimezone', 'UTC'); $logTimeZone = $this->config->getValue('logtimezone', 'UTC');
try { try {
$timezone = new \DateTimeZone($logTimeZone); $timezone = new \DateTimeZone($logTimeZone);

4
tests/lib/AppFramework/Middleware/NotModifiedMiddlewareTest.php

@ -62,11 +62,11 @@ class NotModifiedMiddlewareTest extends \Test\TestCase {
['etag', '"etag"', null, '', true], ['etag', '"etag"', null, '', true],
[null, '', $now, $now->format(\DateTime::RFC2822), true], [null, '', $now, $now->format(\DateTime::RFC2822), true],
[null, '', $now, $now->format(\DateTime::ATOM), false],
[null, '', $now, $now->format(\DateTimeInterface::ATOM), false],
[null, '', null, $now->format(\DateTime::RFC2822), false], [null, '', null, $now->format(\DateTime::RFC2822), false],
[null, '', $now, '', false], [null, '', $now, '', false],
['etag', '"etag"', $now, $now->format(\DateTime::ATOM), true],
['etag', '"etag"', $now, $now->format(\DateTimeInterface::ATOM), true],
['etag', '"etag"', $now, $now->format(\DateTime::RFC2822), true], ['etag', '"etag"', $now, $now->format(\DateTime::RFC2822), true],
]; ];
} }

Loading…
Cancel
Save