Merge pull request #246 from KestL/master

Google Reader Import plugin - right datetime in last_marked
This commit is contained in:
Andrew Dolgov 2013-07-06 00:47:21 -07:00
commit 28b474c3c2
1 changed files with 4 additions and 3 deletions

View File

@ -114,6 +114,7 @@ class GoogleReaderImport extends Plugin {
$guid = db_escape_string(mb_substr($item['id'], 0, 250)); $guid = db_escape_string(mb_substr($item['id'], 0, 250));
$title = db_escape_string($item['title']); $title = db_escape_string($item['title']);
$updated = date('Y-m-d h:i:s', $item['updated']); $updated = date('Y-m-d h:i:s', $item['updated']);
$last_marked = date('Y-m-d h:i:s', mb_substr($item['crawlTimeMsec'], 0, 10));
$link = ''; $link = '';
$content = ''; $content = '';
$author = db_escape_string($item['author']); $author = db_escape_string($item['author']);
@ -165,7 +166,7 @@ class GoogleReaderImport extends Plugin {
$imported += (int) $this->create_article($owner_uid, $guid, $title, $imported += (int) $this->create_article($owner_uid, $guid, $title,
$link, $updated, $content, $author, $sql_set_marked, $tags, $link, $updated, $content, $author, $sql_set_marked, $tags,
$orig_feed_data); $orig_feed_data, $last_marked);
if ($file && $processed % 25 == 0) { if ($file && $processed % 25 == 0) {
_debug("processed $processed articles..."); _debug("processed $processed articles...");
@ -196,7 +197,7 @@ class GoogleReaderImport extends Plugin {
} }
// expects ESCAPED data // expects ESCAPED data
private function create_article($owner_uid, $guid, $title, $link, $updated, $content, $author, $marked, $tags, $orig_feed_data) { private function create_article($owner_uid, $guid, $title, $link, $updated, $content, $author, $marked, $tags, $orig_feed_data, $last_marked) {
if (!$guid) $guid = sha1($link); if (!$guid) $guid = sha1($link);
@ -299,7 +300,7 @@ class GoogleReaderImport extends Plugin {
(ref_id, uuid, feed_id, orig_feed_id, owner_uid, marked, tag_cache, label_cache, (ref_id, uuid, feed_id, orig_feed_id, owner_uid, marked, tag_cache, label_cache,
last_read, note, unread, last_marked) last_read, note, unread, last_marked)
VALUES VALUES
('$ref_id', '', NULL, $orig_feed_id, $owner_uid, $marked, '', '', NOW(), '', false, NOW())"); ('$ref_id', '', NULL, $orig_feed_id, $owner_uid, $marked, '', '', '$last_marked', '', false, '$last_marked')");
$result = db_query("SELECT int_id FROM ttrss_user_entries, ttrss_entries $result = db_query("SELECT int_id FROM ttrss_user_entries, ttrss_entries
WHERE owner_uid = $owner_uid AND ref_id = id AND ref_id = $ref_id"); WHERE owner_uid = $owner_uid AND ref_id = id AND ref_id = $ref_id");