mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-30 12:52:24 -05:00
remove duplicates by import, code changes: tabs replaced with spaces
This commit is contained in:
parent
d7ee9f986b
commit
86da39886d
@ -872,10 +872,10 @@ class Poche
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$i = 0; //counter for articles inserted
|
$urlsInserted = array(); //urls of articles inserted
|
||||||
foreach ($data as $record) {
|
foreach ($data as $record) {
|
||||||
$url = trim( isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '') );
|
$url = trim( isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '') );
|
||||||
if ( $url ) {
|
if ( $url and !in_array($url, $urlsInserted) ) {
|
||||||
$title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ').'</a> <a href="./?import">'._('click to finish import').'</a><a>');
|
$title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ').'</a> <a href="./?import">'._('click to finish import').'</a><a>');
|
||||||
$body = (isset($record['content']) ? $record['content'] : '');
|
$body = (isset($record['content']) ? $record['content'] : '');
|
||||||
$isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive'])?intval($record['archive']):0));
|
$isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive'])?intval($record['archive']):0));
|
||||||
@ -883,8 +883,8 @@ class Poche
|
|||||||
//insert new record
|
//insert new record
|
||||||
$id = $this->store->add($url, $title, $body, $this->user->getId(), $isFavorite, $isRead);
|
$id = $this->store->add($url, $title, $body, $this->user->getId(), $isFavorite, $isRead);
|
||||||
if ( $id ) {
|
if ( $id ) {
|
||||||
//increment no of records inserted
|
$urlsInserted[] = $url; //add
|
||||||
$i++;
|
|
||||||
if ( isset($record['tags']) && trim($record['tags']) ) {
|
if ( isset($record['tags']) && trim($record['tags']) ) {
|
||||||
//@TODO: set tags
|
//@TODO: set tags
|
||||||
|
|
||||||
@ -893,6 +893,7 @@ class Poche
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$i = sizeof($urlsInserted);
|
||||||
if ( $i > 0 ) {
|
if ( $i > 0 ) {
|
||||||
$this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".'));
|
$this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user