From 99cd408f8163fdfd606d9cf93a48ceec062a1060 Mon Sep 17 00:00:00 2001 From: Andrew Davis Date: Mon, 15 Nov 2010 03:56:12 +0000 Subject: [PATCH] blog MDL-25217 now checking for null creation and modified timestamps when importing external blog entries --- blog/lib.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/blog/lib.php b/blog/lib.php index 614fbe6c6be..ec91cf01388 100755 --- a/blog/lib.php +++ b/blog/lib.php @@ -196,8 +196,16 @@ function blog_sync_external_entries($externalblog) { $newentry->format = FORMAT_HTML; $newentry->subject = $entry->get_title(); $newentry->summary = $entry->get_description(); - $newentry->created = $entry->get_date('U'); - $newentry->lastmodified = $entry->get_date('U'); + + //our DB doesnt allow null creation or modified timestamps so check the external blog didnt supply one + $entrydate = $entry->get_date('U'); + if (empty($entrydate)) { + $newentry->created = time(); + $newentry->lastmodified = time(); + } else { + $newentry->created = $entrydate; + $newentry->lastmodified = $entrydate; + } $textlib = textlib_get_instance(); if ($textlib->strlen($newentry->uniquehash) > 255) {