diff options
author | nicosomb <nicolas@loeuillet.org> | 2013-04-18 10:15:46 +0200 |
---|---|---|
committer | nicosomb <nicolas@loeuillet.org> | 2013-04-18 10:15:46 +0200 |
commit | d06f30ef931402a1e56aab841ce852b3b81a9697 (patch) | |
tree | c6250f8b0b2d2eb369f396bc31f6842a08d54c88 /import.php | |
parent | 64458521c36de87d10f1c726667faeaaa5126840 (diff) | |
download | wallabag-d06f30ef931402a1e56aab841ce852b3b81a9697.tar.gz wallabag-d06f30ef931402a1e56aab841ce852b3b81a9697.tar.zst wallabag-d06f30ef931402a1e56aab841ce852b3b81a9697.zip |
Fixed #54 - récupération de l'id améliorée et utilisation de action_to_do() pour l'insertion dans l'import pocket
Diffstat (limited to 'import.php')
-rw-r--r-- | import.php | 20 |
1 files changed, 1 insertions, 19 deletions
@@ -29,26 +29,8 @@ else { | |||
29 | $a = $li->find('a'); | 29 | $a = $li->find('a'); |
30 | $url = $a[0]->href; | 30 | $url = $a[0]->href; |
31 | 31 | ||
32 | # FIXME corriger cette génération d'ID | ||
33 | $req = $db->getHandle()->query("SELECT id FROM entries ORDER BY id DESC"); | ||
34 | $id = $req->fetchColumn()+1; | ||
35 | 32 | ||
36 | $parametres_url = prepare_url($url, $id); | 33 | action_to_do('add', $url, $token); |
37 | $sql_action = 'INSERT INTO entries ( url, title, content, is_read ) VALUES (?, ?, ?, ?)'; | ||
38 | $params_action = array($url, $parametres_url['title'], $parametres_url['content'], $read); | ||
39 | try | ||
40 | { | ||
41 | # action query | ||
42 | if (isset($sql_action)) | ||
43 | { | ||
44 | $query = $db->getHandle()->prepare($sql_action); | ||
45 | $query->execute($params_action); | ||
46 | } | ||
47 | } | ||
48 | catch (Exception $e) | ||
49 | { | ||
50 | logm('error during pocket import : ' . $e->getMessage()); | ||
51 | } | ||
52 | } | 34 | } |
53 | # Pocket génère un fichier HTML avec deux <ul> | 35 | # Pocket génère un fichier HTML avec deux <ul> |
54 | # Le premier concerne les éléments non lus | 36 | # Le premier concerne les éléments non lus |