wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17818: LJSUP-7476. Turn Landing pages off. Need...

Committer: gprochaev
LJSUP-7476. Turn Landing pages off. Need for 'suggest community' work fine w/o verticals.

U   trunk/cgi-bin/LJ/Browse.pm
U   trunk/cgi-bin/LJ/Vertical.pm
U   trunk/htdocs/community/directory.bml
Modified: trunk/cgi-bin/LJ/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Browse.pm	2010-11-29 10:50:06 UTC (rev 17817)
+++ trunk/cgi-bin/LJ/Browse.pm	2010-11-29 11:10:57 UTC (rev 17818)
@@ -859,7 +859,11 @@
 
     my $dbh = LJ::get_db_reader ();
     my $res = $dbh->do ("UPDATE category_recent_posts SET is_deleted = 1 WHERE journalid = ? AND jitemid = ?", undef, $commid, $jitemid);
-    return $res;
+
+    ## Need to delete linked keywords from key_map
+    $res = $dbh->do ("DELETE FROM vertical_keymap WHERE journalid = ? AND jitemid = ?", undef, $commid, $jitemid);
+
+    return 1;
 }
 
 sub search_posts {

Modified: trunk/cgi-bin/LJ/Vertical.pm
===================================================================
--- trunk/cgi-bin/LJ/Vertical.pm	2010-11-29 10:50:06 UTC (rev 17817)
+++ trunk/cgi-bin/LJ/Vertical.pm	2010-11-29 11:10:57 UTC (rev 17818)
@@ -676,22 +676,6 @@
     my $tags = $args{'tags'};
 
     my $dbh = LJ::get_db_writer();
-    ## Get the diff between old and new tags list to delete that diff from DB
-    my $old_tags = $self->load_tags(%args);
-    if ($old_tags) {
-        my %new_tags = map { $_->{'tag'} => 1 } @$tags;
-        my $to_del_tags = [ grep { !$new_tags{$_->{keyword}} } @$old_tags ];
-        ## Need to delete some tags?
-        if (@$to_del_tags) {
-            my @bind = map { '?' } @$to_del_tags;
-            my @bind_vals = map { $_->{kw_id} } @$to_del_tags;
-            my $del = $dbh->do(
-                "DELETE FROM vertical_keymap 
-                WHERE kw_id IN (".(join ",", @bind).")",
-                undef, $self->vert_id, @bind_vals
-            );
-        }
-    }
 
     foreach my $tag (@$tags) {
         my $res = $dbh->selectall_arrayref(
@@ -1217,6 +1201,10 @@
 
     my $dbh = LJ::get_db_writer();
     my $res = $dbh->do("DELETE FROM vertical_comms WHERE vert_id = ? AND journalid = ?", undef, $self->vert_id, $journalid);
+
+    ## Need to delete linked keywords from key_map
+    $res = $dbh->do ("DELETE FROM vertical_keymap WHERE journalid = ? AND jitemid = 0 AND vert_id = ?", undef, $journalid, $self->vert_id);
+
     return $res;
 }
 

Modified: trunk/htdocs/community/directory.bml
===================================================================
--- trunk/htdocs/community/directory.bml	2010-11-29 10:50:06 UTC (rev 17817)
+++ trunk/htdocs/community/directory.bml	2010-11-29 11:10:57 UTC (rev 17818)
@@ -144,6 +144,12 @@
 
         # Handle removes
         foreach my $pendid (@catrem) {
+            my $dbh = LJ::get_db_writer()
+                    or die "unable to contact global db master to create category";
+            my ($catid, $journalid) = $dbh->selectrow_array("SELECT catid, jid FROM categoryjournals_pending WHERE pendid = ?", undef, $pendid);
+            $dbh->do("DELETE FROM categoryjournals WHERE catid=? AND journalid=?", undef,
+                         $catid, $journalid);
+ 
             LJ::Browse->remove_community( comm      => $c,
                                           submitter => $remote,
                                           pendid    => $pendid, );

Tags: bml, livejournal, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments