WordPress.org

Ready to get started?Download WordPress

Forums

WP-Filebase Download Manager
File dates converted to UTC when added via sync? (3 posts)

  1. Josh Nankivel
    Member
    Posted 1 year ago #

    I noticed a discrepancy in the file dates - I've checked the file server, mySQL, php, and the WordPress settings - they are all set to local time.

    And yet, when I run a sync in filebase to pull in new files, the times being inserted into the database are 7 hours ahead, as if they are being converted from my local time to UTC when the sync happens.

    Any ideas?

    http://wordpress.org/extend/plugins/wp-filebase/

  2. Josh Nankivel
    Member
    Posted 1 year ago #

    Update: I have a dev sandbox running on my laptop and just confirmed the same behavior happens there as well.

    So if the file's actual creation time is 15:00 for example (in the metadata of the file itself), it shows up as 22:00.

    I started to dig around and when I use a text editor to view a sample PDF file, I can see that the UTC value is in the PDF metadata itself:

    (D:20130321215958Z00'00')

    The 2159 there is 21:59, when the date created shown everywhere else (Adobe Reader, on the file server, etc.) shows 14:59. And I just created this PDF myself, so I know I actually created it at 14:59 local time.

    This leads me to believe that the standard for PDF is for this piece of metadata to be converted to UTC upon file save.

    WP-Filebase is *likely* pulling file_date from this metadata field for PDF files, since the dates I'm seeing in Filebase are all UTC.

    Perhaps for PDF files, WP-Filebase should be pulling file_date from another field in the metadata?

  3. Josh Nankivel
    Member
    Posted 1 year ago #

    I'm not too good with php, but I can see that getID3 doesn't support PDFs at the moment. I haven't been able to find where to modify the plugin code, but I know this is due to my lack of php knowledge.

    I know this is a band-aid, but since I'm a database guy, I've confirmed this is happening with PDFs from all sources, and all I care about are PDF files, for now I've just created triggers on the table to convert the file_date back to PDT:

    CREATE TRIGGER BeforeInsertUtcToPdt
    BEFORE INSERT ON wp_wpfb_files
    FOR EACH ROW
    SET NEW.file_date = CONVERT_TZ(NEW.file_date,'+00:00','-7:00');

    CREATE TRIGGER BeforeUpdateUtcToPdt
    BEFORE UPDATE ON wp_wpfb_files
    FOR EACH ROW
    SET NEW.file_date = CONVERT_TZ(NEW.file_date,'+00:00','-7:00');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic