importX icon indicating copy to clipboard operation
importX copied to clipboard

Issue importing pub_date values

Open Mark-H opened this issue 11 years ago • 1 comments

I decided to upload a bunch of resources with defined pub_date. Pub_dates were in unix format and were set as “future dates”. I mean I expected the resources to be published later on this month. But when I finished importing, all of the resources were published))))

Reported by Ivan B


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Mark-H avatar Aug 02 '14 11:08 Mark-H

resource/create processor:

        $now = time();
        if (isset($scriptProperties['pub_date'])) {
            if (empty($scriptProperties['pub_date'])) {
                $scriptProperties['pub_date'] = 0;
            } else {
                $scriptProperties['pub_date'] = strtotime($scriptProperties['pub_date']);
                if ($scriptProperties['pub_date'] < $now) $scriptProperties['published'] = 1;
                if ($scriptProperties['pub_date'] > $now) $scriptProperties['published'] = 0;
            }
        }

The core expects it to be a time string as indicated by the strtotime function call

Mark-H avatar Aug 02 '14 11:08 Mark-H