Changeset 654 for trunk/lib/DB.inc.php


Ignore:
Timestamp:
Jan 24, 2019 7:13:52 PM (5 years ago)
Author:
anonymous
Message:

Add timezone support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/DB.inc.php

    r630 r654  
    201201        }
    202202
     203        // Set timezone.
     204        $tz = date_default_timezone_get();
     205        // Check that PHP is configured with a valid timezone name, e.g., "UTC" or "America/Chicago".
     206        if ($app->getParam('timezone') && $app->getParam('timezone') == $tz && preg_match('![A-Z]{3,}|\w+/\w+!', $tz)) {
     207            $this->query(sprintf("SET SESSION time_zone = '%s'", $tz));
     208        }
     209
    203210        return true;
    204211    }
Note: See TracChangeset for help on using the changeset viewer.