Import_export plugin

Looks like there are problem with fields marked and published. I have pgsql installation and trying to import my starred/archived entities, so I got error that postgres can’t convert 1/0 to boolean.

Query INSERT INTO ttrss_user_entries (ref_id, owner_uid, feed_id, unread, last_read, marked, published, score, tag_cache, label_cache, uuid, note) VALUES (5568, 1, 116, false, NULL, 1, 0, 0, 'kotlin', '', '', '') failed: ERROR: column "marked" is of type boolean but expression is of type integer LINE 5: NULL, 1, 0, 0, 'kotlin', ^ HINT: You will need to rewrite or cast the expression.1. classes/db/pgsql.php(48): user_error(Query INSERT INTO ttrss_user_entries
(ref_id, owner_uid, feed_id, unread, last_read, marked,
published, score, tag_cache, label_cache, uuid, note)
VALUES (5568, 1, 116, false,
NULL, 1, 0, 0, 'kotlin',
'', '', '') failed: ERROR: column "marked" is of type boolean but expression is of type integer
LINE 5: NULL, 1, 0, 0, 'kotlin',
^
HINT: You will need to rewrite or cast the expression., 256)
2. include/db.php(8): query(INSERT INTO ttrss_user_entries
(ref_id, owner_uid, feed_id, unread, last_read, marked,
published, score, tag_cache, label_cache, uuid, note)
VALUES (5568, 1, 116, false,
NULL, 1, 0, 0, 'kotlin',
'', '', ''), 1)
3. plugins/import_export/init.php(374): db_query(INSERT INTO ttrss_user_entries
(ref_id, owner_uid, feed_id, unread, last_read, marked,
published, score, tag_cache, label_cache, uuid, note)
VALUES (5568, 1, 116, false,
NULL, 1, 0, 0, 'kotlin',
'', '', ''))
4. plugins/import_export/init.php(457): perform_data_import(/home/rick/nginx/files/ibragimov.by/root/tsreader/cache/upload/export6rAO8r, 1)
5. classes/pluginhandler.php(12): dataImport()
6. backend.php(126): catchall(dataimport)

I quick fixed plugins/import_export/init.php:357 1/0 → true/false, and this error disappears. But I doesn’t see any starred/archive articles either. Also looks like all imported articles purged after update.

[06:15:18/17988] All done.
[06:15:18/17988] cache/simplepie: removed 0 files.
[06:15:18/17988] cache/feeds: removed 0 files.
[06:15:18/17988] cache/images: removed 0 files.
[06:15:18/17988] cache/export: removed 0 files.
[06:15:18/17988] cache/upload: removed 0 files.
[06:15:18/17988] Removed 0 old lock files.
[06:15:18/17988] Removing old error log entries...
[06:15:18/17988] Feedbrowser updated, 155 feeds processed.
[06:15:19/17988] Purged 5568 orphaned posts. <-- number of imported articles
[06:15:19/17988] Removed 0 (feeds) 0 (cats) orphaned counter cache entries.

My steps:

  1. export data
  2. export opml
  3. import opml
  4. import data

You can use https://ibragimov.by/tsreader/ with default admin password.

yep, integer values are accepted by PDO but import_export plugin is using legacy database api.

does this fix it? https://git.tt-rss.org/fox/tt-rss/commit/365f5c8b53e949fe02c41dde7b313195ac1171ec

Yes, on fresh install it fixes my issue. I also have instance that I installed yesterday(and already star articles, mark as read them, etc) and there are few articles not imported (about 200 from 5000+), and I got following error:

E_USER_NOTICE (1024)
classes/db.php:22	

Legacy connect requested to pgsql1. classes/db.php(22): user_error(Legacy connect requested to pgsql, 1024)
2. classes/db.php(89): legacy_connect()
3. include/db.php(4): get()
4. plugins/import_export/init.php(259): db_escape_string(SHA1:b1a3a09942bc7502e60ab889ba2470dbbcba27e2)
5. plugins/import_export/init.php(461): perform_data_import(/home/rick/nginx/files/ibragimov.by/root/reader/cache/upload/exportuPxMRN, 2)
6. classes/pluginhandler.php(12): dataImport()
7. backend.php(126): catchall(dataimport)

E_DEPRECATED (8192)
plugins/import_export/init.php:220	

Non-static method DOMDocument::loadXML() should not be called statically1. plugins/import_export/init.php(220): ttrss_error_handler(8192, Non-static method DOMDocument::loadXML() should not be called statically, plugins/import_export/init.php, 220, Array)
2. plugins/import_export/init.php(461): perform_data_import(/home/rick/nginx/files/ibragimov.by/root/reader/cache/upload/exportuPxMRN, 2)
3. classes/pluginhandler.php(12): dataImport()
4. backend.php(126): catchall(dataimport)

But for me it’s acceptable, so I’ll use new instance. Thanks again!

the DOMDocument error shouldn’t break things (still it’s an easy fix - https://git.tt-rss.org/fox/tt-rss/commit/1ddf3a28e56d64fa8e80868e731cdde8b2abefa8).

was there any pattern with the not imported articles? are they actually not imported, as opposed to not exported, i.e. they are in the XML but haven’t appeared in the database on import?

e: thanks for the donation btw

Actually latest commit introduce new error when importing:

E_ERROR (1)	
plugins/import_export/init.php:227	

Uncaught TypeError: Argument 1 passed to DOMXPath::__construct() must be an instance of DOMDocument, boolean given in /home/rick/nginx/files/ibragimov.by/root/oreader/plugins/import_export/init.php:227 Stack trace: 
#0 /home/rick/nginx/files/ibragimov.by/root/oreader/plugins/import_export/init.php(227): DOMXPath->__construct(true) 
#1 /home/rick/nginx/files/ibragimov.by/root/oreader/plugins/import_export/init.php(461): Import_Export->perform_data_import('/home/rick/ngin...', 1) 
#2 /home/rick/nginx/files/ibragimov.by/root/oreader/classes/pluginhandler.php(12): Import_Export->dataImport() 
#3 /home/rick/nginx/files/ibragimov.by/root/oreader/backend.php(126): PluginHandler->catchall('dataimport')
#4 {main} thrown

was there any pattern with the not imported articles?

hard to figure out, i’m trying reproduce on fresh install

are they actually not imported, as opposed to not exported, i.e. they are in the XML but haven’t appeared in the database on import?

for all imports I use same exported data, so same data file imported successfully and not

i’ll revert the above for the time being, static context warning is not that bad