diff mgtool.php @ 130:f825d644cf7a

Implement new config setting "timezone" for specifying the timezone used for date/timestamp interpretation.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 01 Sep 2017 00:44:52 +0300
parents eac2cf04261a
children b010c763a1fc
line wrap: on
line diff
--- a/mgtool.php	Fri Sep 01 00:44:03 2017 +0300
+++ b/mgtool.php	Fri Sep 01 00:44:52 2017 +0300
@@ -668,10 +668,6 @@
 {
   global $galTNPath;
 
-  // Fetch the settings we need
-  if (mgReadSettings() === FALSE)
-    die("MGallery not configured.\n");
-
   // Check validity of some settings
   $galPath = mgGetSetting("base_path");
   $galTNPath = mgCleanPath(TRUE, mgGetSetting("tn_path"));
@@ -783,6 +779,11 @@
 pcntl_signal(SIGQUIT, "mgSigHandler");
 pcntl_signal(SIGINT,  "mgSigHandler");
 
+if (mgReadSettings() === FALSE)
+  die("MGallery is not configured, failed to find a configuration file.\n");
+
+if (($pageTimeZone = mgGetSetting("timezone")) !== NULL)
+  date_default_timezone_set($pageTimeZone);
 
 $cmd = mgCArgLC(1);
 switch ($cmd)
@@ -848,8 +849,6 @@
 
   case "config":
   case "dump":
-    if (mgReadSettings() === FALSE)
-      die("MGallery not configured.\n");
 
     foreach ($mgDefaults as $key => $dval)
     {