Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/issue 1429 (Zeitzone Cronjobs) #1430

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Conversation

hansmorb
Copy link
Contributor

@hansmorb hansmorb commented Nov 27, 2023

Habe jetzt doch nicht wie geplant die get_gmt_from_date ( https://developer.wordpress.org/reference/functions/get_gmt_from_date/ ) genutzt sondern nur die Implementierung kopiert und dafür ein DateTime Objekt statt eines formatierten Strings zurückgegeben. Das hat jetzt bei mir wie erwartet funktioniert. Das ist hier für den einen Case nicht so spannend, aber mit der #1423 kommen zwei neue E-Mails hinzu die diese Funktion nutzen, da wird das schon semi relevant.

closes #1429

@hansmorb hansmorb added bug Something isn't working php Pull requests that update Php code labels Nov 27, 2023
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (b9ace9a) 39.76% compared to head (0b87e65) 39.86%.

Files Patch % Lines
src/Helper/Wordpress.php 83.33% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1430      +/-   ##
============================================
+ Coverage     39.76%   39.86%   +0.10%     
- Complexity     2324     2326       +2     
============================================
  Files            91       91              
  Lines          9602     9609       +7     
============================================
+ Hits           3818     3831      +13     
+ Misses         5784     5778       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/Service/Scheduler.php Show resolved Hide resolved
src/Helper/Wordpress.php Show resolved Hide resolved
src/Helper/Wordpress.php Show resolved Hide resolved
$datetime = date_create( $localDateString, wp_timezone() );

if ( $datetime === false ) {
//use this as fallback if date_create fails
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wieso der fallback? Und für welche Fälle? Wieso nicht einfach auch false zurückgeben, anstatt potentiell eine falsche Zeit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das ist aus der WordPress Funktion übernommen, ich dachte mir das ist schon gut getestet also übernehme ich das :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Und wenn wir eine falsche Zeit zurückgeben wird zumindest der Job geschedulet, sonst führt das ganze vielleicht zu Fehlern.

*
* @return DateTime
* @throws \Exception
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hansmorb hast du zufällig geschaut ob die Verwendung dieser Methode denn in einer korrekten Umfeld stattfindet? Das Umfeld also nicht annimmt das hier eine umgewandelte UTC-Zeit einer lokalen Zeit rauskommt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich denke mal die Methode hat so wie sie existiert schon ihre Berechtigung, schließlich speichern wir ja alle timestamps in lokaler Zeit und nicht in UTC. Mit dieser Methode wird einfach nur ein DateTime Objekt erzeugt. Das ist dann zwar immer noch nicht in UTC aber hat zumindest eine Zeitzone (das war glaube ich für den iCalendar relevant).

@hansmorb hansmorb added this to the 2.10 milestone May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cronjobs nur nach GMT konfigurierbar
2 participants