diff --git a/composer.json b/composer.json index e4db2ac..55625b8 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "files": [ "src/ErrorsToExceptions.php", "src/Arrays.php", + "src/DateTime.php", "src/Debugging.php", "src/Headers.php", "src/Strings.php" diff --git a/composer.lock b/composer.lock index d4de258..60e51be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "a7b9d92b8641d97fe45c1ebffa07f440", - "content-hash": "19e61080c065070bde1a905d1b15a650", + "hash": "6189f7143afce4ef5fbb0b4497872c1e", + "content-hash": "4e6e14d9eeee1647a2a6098db7aa4871", "packages": [ { "name": "monolog/monolog", diff --git a/src/DateTime.php b/src/DateTime.php new file mode 100644 index 0000000..d65214a --- /dev/null +++ b/src/DateTime.php @@ -0,0 +1,13 @@ +format('Y-m-d G:i:s u')), 0, 6); + self::$sThreadHash = substr(hash('sha1', notNowByRightNow()->format('Y-m-d G:i:s.u')), 0, 6); } return self::$sThreadHash; @@ -232,6 +232,13 @@ private static function getParentHash() { } } + /** + * @return string + */ + private static function getParentPath() { + return implode('.', self::$aHashHistory); + } + /** * @internal param bool $bForceReset * @return string @@ -241,10 +248,8 @@ private static function getRequestHash() { $sIP = get_ip(); $sAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; - $aMicroTime = explode(' ', microtime()); - $oNow = new DateTime(date('Y-m-d H:i:s.' . $aMicroTime[0] * 1000000, $aMicroTime[1])); $aRequest = array( - 'date' => $oNow->format('Y-m-d H:i:s.u') + 'date' => notNowByRightNow()->format('Y-m-d H:i:s.u') ); if (isset($_SERVER['HTTP_REFERER'])) { $aRequest['referrer'] = $_SERVER['HTTP_REFERER']; } @@ -253,7 +258,7 @@ private static function getRequestHash() { if (strlen($sAgent)) { $aRequest['agent'] = $sAgent; } if ($sIP != 'unknown') { $aRequest['ip'] = $sIP; } - self::$sRequestHash = substr(hash('sha1', json_encode($aRequest)), 0, 8); + self::$sRequestHash = self::getParentPath() . '.' . substr(hash('sha1', json_encode($aRequest)), 0, 6); $aMessage = array( 'action' => 'Log.Start',