]> CyberLeo.Net >> Repos - Github/YOURLS.git/commit
Use same timestamp in redirect than in new link
authorozh <ozh@ozh.org>
Thu, 16 Apr 2015 18:04:04 +0000 (20:04 +0200)
committerozh <ozh@ozh.org>
Thu, 16 Apr 2015 18:04:04 +0000 (20:04 +0200)
commit59382e55c188ec859c8ad79d4eae028691362495
treeaf0ec07b3237351ff776f7725a1a8800ccd33b95
parent168622417d93f21745fce848a8cc6f18c4d5a5ac
Use same timestamp in redirect than in new link

Ozh,

I found a problem in Yourls.  It's not necessarily a problem with the code, but a problem none the less.

In functions.php, the timestamp is being written to the yourls_log and yourls_url db's differently, and depending on how the server is set up, it can cause a problem.

function yourls_log_redirect() writes the time with MySQL's NOW() keyword, while function yourls_insert_link_in_db() writes it with PHP's date('Y-m-d H:i:s').  On the webhost that I'm using, MySQL is using the server's time, not UTC, so it's 4 hours different than PHP's time, since PHP is being set with date_default_timezone_set( 'UTC' );

This drove me nuts for quite awhile until I realized what was going on.  Once I switched from NOW() to date('Y-m-d H:i:s') the problem went away and all my times are now the same. I believe both functions should use the same system for time so as to avoid this scenario.

BTW, great script!  I know I probably shouldn't ask ;) but... any idea when the next version will be released?  I read something about version 2.0 awhile back, but haven't heard anything since.

Thanks,
Frank
includes/functions.php