--- ljsync.install 2009-10-27 15:42:00.000000000 +0300 +++ ljsync.install 2009-11-02 09:48:40.000000000 +0300 @@ -83,6 +83,9 @@ 'anum' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11'), 'ditemid' => array('type' => 'int', 'not null' => TRUE, 'disp-width' => '11')), 'primary key' => array('nid'), + 'indexes' => array( + 'jitemid' => array('jitemid'), + ), ); $schema['ljsync_comments'] = array( 'fields' => array( --- ljsync_parser.cls.php 2009-10-27 15:42:00.000000000 +0300 +++ ljsync_parser.cls.php 2009-11-02 09:46:16.000000000 +0300 @@ -111,9 +111,9 @@ $node_exists = false; // If this was created locally and crossposted by ljxp, make sure it has an entry in our table. - $query = db_query('SELECT x.nid from {ljxp_node} x INNER JOIN ljsync_node s ON x.ljid = s.jitemid WHERE x.ljid = %d and s.jitemid <> %d', $jitemid); + $query = db_query('SELECT x.nid, s.jitemid from {ljxp_node} x LEFT JOIN {ljsync_node} s ON x.ljid = s.jitemid WHERE x.ljid = %d', $jitemid); // Entries from different users may have the same id, so we must load each node and check the user. - while ($result = db_fetch_array($query)) { + while ($result = db_fetch_array($query) and $jitemid!=$result['jitemid']) { $nid = $result['nid']; $node = node_load($nid); if ($node->uid == $this->uid) {