# HG changeset patch # User Matti Hamalainen # Date 1501501689 -10800 # Node ID eac2cf04261aec7fe8d383636f009b900818dd40 # Parent 956cafa61b91cfb3713d0dce7209b20e980b9244 Change how date timestamps are stored and handled. This breaks cache file backward/forward compatibility. diff -r 956cafa61b91 -r eac2cf04261a mgallery.inc.php --- a/mgallery.inc.php Wed May 10 20:12:40 2017 +0300 +++ b/mgallery.inc.php Mon Jul 31 14:48:09 2017 +0300 @@ -27,6 +27,7 @@ define("MG_DVA", 3); define("MG_BOOL", 4); define("MG_FLAGS", 5); +define("MG_DATE", 6); define("yes", 1); diff -r 956cafa61b91 -r eac2cf04261a mgallery.php --- a/mgallery.php Wed May 10 20:12:40 2017 +0300 +++ b/mgallery.php Mon Jul 31 14:48:09 2017 +0300 @@ -376,10 +376,10 @@ } -function mgTimeStr($str) +function mgTimeStr($stamp) { - $tmp = date_create_from_format("Y:m:d H:i:s", $str); - return date_format($tmp, "d M Y (H:i:s)"); +// return date_format($stamp, "d M Y (H:i:s)"); + return date("d M Y (H:i:s)", $stamp); } diff -r 956cafa61b91 -r eac2cf04261a mgtool.php --- a/mgtool.php Wed May 10 20:12:40 2017 +0300 +++ b/mgtool.php Mon Jul 31 14:48:09 2017 +0300 @@ -14,19 +14,19 @@ // $galExifConversions = [ - [ MG_STR, "caption" , "ImageDescription" ], - [ MG_STR, "copyright" , "Copyright" ], - [ MG_STR, "model" , "Model" ], - [ MG_INT, "width" , ["COMPUTED", "Width"] ], - [ MG_INT, "height" , ["COMPUTED", "Height"] ], - [ MG_DVA, "fnumber" , "FNumber" ], - [ MG_DVA, "exposure" , "ExposureTime" ], - [ MG_INT, "iso" , "ISOSpeedRatings" ], - [ MG_STR, "lensmodel" , "UndefinedTag:0xA434" ], - [ MG_DVA, "focallength" , "FocalLength" ], - [ MG_STR, "datetime" , "DateTimeOriginal" ], - [ MG_STR, "datetime" , "DateTimeDigitized" ], - [ MG_INT, "filesize" , "FileSize" ], + [ MG_STR, "caption" , "ImageDescription" ], + [ MG_STR, "copyright" , "Copyright" ], + [ MG_STR, "model" , "Model" ], + [ MG_INT, "width" , ["COMPUTED", "Width"] ], + [ MG_INT, "height" , ["COMPUTED", "Height"] ], + [ MG_DVA, "fnumber" , "FNumber" ], + [ MG_DVA, "exposure" , "ExposureTime" ], + [ MG_INT, "iso" , "ISOSpeedRatings" ], + [ MG_STR, "lensmodel" , "UndefinedTag:0xA434" ], + [ MG_DVA, "focallength" , "FocalLength" ], + [ MG_DATE, "datetime" , "DateTimeOriginal" ], + [ MG_DATE, "datetime" , "DateTimeDigitized" ], + [ MG_INT, "filesize" , "FileSize" ], ]; define("GCMD_UPDATE" , 1); @@ -146,6 +146,9 @@ else return $val; + case MG_DATE: + return date_timestamp_get(date_create_from_format("Y:m:d H:i:s", $val)); + default: return $val; } @@ -356,7 +359,7 @@ function mgSortFunc($a, $b) { if (isset($a["datetime"]) && isset($b["datetime"])) - return strcmp($b["datetime"], $a["datetime"]); + return $b["datetime"] - $a["datetime"]; else if (isset($a["base"]) && isset($b["base"])) return strcmp($b["base"], $a["base"]);