Menu

#3 Recursively Remove Directory, Not Individual Bookmarks

open
nobody
None
3
2003-10-21
2003-10-06
No

I noticed that bookmarks deletion was not working fine,
specially when folders were involved. So, I went through
CLIENT.PHP code and found that, for some reason,
bookmarks were not been physicaly excluded from
database but only set as expired. It should be ok but
the where clauses within the update commands were
wrong. So, basicaly I corrected them.

Here is the corrected code:

// delete it = set expiration
else if ($cmd == "D")
my_mysql_query("update link set expiration = now()
where path = '" . $path . "' and person_id = " . $ID);

------------------

// remove directory
else if ($cmd == "R")
my_mysql_query("update link set expiration = now()
where substring(path, 1, " . strlen($path) . ") = '" .
str_replace("\\", "\\\\", $path) .
"' and person_id = " . $ID);

Setting $debug = true and checking my_mysql.log, I also
noticed that when I deleted a folder, the SyncIT client
sended "D"commands for all bookmarks inside the folder.
If I'm correct, it should be possible to change client and
suppress all "D" commands and leave only the "R"
command which should expire the entire folder at once.

Att,
Eduardo Rodrigues
www.2go.com.br

Discussion

  • Morbus Iff

    Morbus Iff - 2003-10-06
    • labels: --> 572013
     
  • Morbus Iff

    Morbus Iff - 2003-10-06
    • assigned_to: nobody --> morbus
     
  • Morbus Iff

    Morbus Iff - 2003-10-06

    Logged In: YES
    user_id=69804

    The "D" bug has been fixed for a week or so in the minimal
    minimal server code located at http://disobey.com/d/code/
    bookmarksync/mm_client_php.txt, along with a number of other
    problems present in the original 0.1 server download. It also
    contains more in-depth debugging.

    As for the "R" suggestion, I'm not sure it's a better idea, though
    I'm willing to listen to reason. In this case, we're pushing the
    processing off to the client (ie. let the client figure out all the
    bookmarks that should be deleted from the folder), rather than
    telling the server to initiate a search query across a table that
    potentially had hundreds of thousands of items (at the original
    bookmarksync.com). Individual client machines will always have
    more processing power than a server responding to requests from
    hundreds of users (yes, yes, not everyone using the opensource
    code will have a hundred thousand bookmarks, but breaking
    original robustness doesn't seem to make sense). Again, convince
    me if I'm wrong.

     
  • Eduardo Ribeiro Rodrigues

    Logged In: YES
    user_id=876906

    I totally agree that the server should do only the strictly
    necessary work in order to increase its availability. That's why
    I think that when SyncIT.exe captures the deletion of a
    folder, instead of sending a "D" or a "R" command for each
    subfolder or bookmark inside the originally deleted folder, it
    would be much more economic and probably faster to send
    just one "R" command to delete the folder and all its contents
    at once.
    Based on my experience with databases I really doubt that
    submitting tens of DML commands to the SGBD would be
    faster than sending only one which "encapsulates" all the
    others.

    Att,
    Eduardo

     
  • Morbus Iff

    Morbus Iff - 2003-10-21
    • milestone: 338858 -->
    • assigned_to: morbus --> nobody
    • summary: Bookmarks deletion bug --> Recursively Remove Directory, Not Individual Bookmarks
    • labels: 572013 -->
    • priority: 5 --> 3
     

Log in to post a comment.