Skip to content

pkp/pkp-lib#11532 set database time zone during installation #11543

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

Open
wants to merge 1 commit into
base: stable-3_5_0
Choose a base branch
from

Conversation

kaitlinnewson
Copy link
Member

No description provided.

@kaitlinnewson kaitlinnewson requested review from jonasraoni and removed request for jonasraoni June 19, 2025 17:31
@kaitlinnewson
Copy link
Member Author

Hi @jonasraoni, please ignore the review request for now - I see tests failing so I've got more investigating to do

@kaitlinnewson
Copy link
Member Author

kaitlinnewson commented Jun 23, 2025

Hi @jonasraoni, can you give this an initial review? Tests are now mostly passing in OJS except for one unrelated test failure, and I'm going to set up OMP/OPS tests soon.


// Get the current offset for this timezone
$dateTime = new DateTime('now', new DateTimeZone($timeZoneName));
$offset = $dateTime->format('P');
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe to use date_default_timezone_set (the next line below) first, before getting the offset, and then to use $offset = (new DateTime())->format('P'); (to get offset for the current time zone).
Because we say: $timeZone ?: ini_get('date.timezone') ?: 'UTC' in date_default_timezone_set -- The timeZone will probably be correctly/successfully constructed, because it comes from the install form where it is also validated, but if for some reason the timeZone is not successfully created, then other time zone will be set in PHP. So maybe it is better to calculate offset based on that, on the actually set time zone?

$result = parent::preInstall();

if ($result && $this->getParam('timeZone')) {
$this->initializeDatabaseTimeZone($this->getParam('timeZone'));
Copy link
Contributor

@bozana bozana Jun 24, 2025

Choose a reason for hiding this comment

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

Do we need to consider the return value here -- if the time zone could not be set correctly in the DB, when the function returns false? Shell the installation proceed however? 🤔

@bozana
Copy link
Contributor

bozana commented Jun 24, 2025

Hi @kaitlinnewson, just two questions :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants