afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-08-05 03:53 am

[dw-free] strip unused functions from .pms in cgi-bin

[commit: http://hg.dwscoalition.org/dw-free/rev/855a16325ae3]

http://bugs.dwscoalition.org/show_bug.cgi?id=1379

Removing unused widgets.

Patch by [staff profile] denise.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/GraphicPreviews.pm
  • cgi-bin/LJ/User.pm
  • cgi-bin/LJ/Widget/CommsOfUser.pm
  • cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm
  • cgi-bin/LJ/Widget/TranslateLegal.pm
--------------------------------------------------------------------------------
diff -r 9b56de6b1222 -r 855a16325ae3 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Wed Aug 05 03:10:20 2009 +0000
+++ b/bin/upgrading/en.dat	Wed Aug 05 03:49:39 2009 +0000
@@ -3871,12 +3871,6 @@ widget.browse.findusers.school=School
 
 widget.browse.title=Browse [[sitenameabbrev]]
 
-widget.commsofuser.title=Communities [[user]] has added
-
-widget.commsofuser.viewfriendspage=View [[user]]'s Friends page
-
-widget.commsofuser.viewprofile=View [[user]]'s profile
-
 widget.communitymanagement.nopending=No communities require action.
 
 widget.communitymanagement.pending=Pending:
diff -r 9b56de6b1222 -r 855a16325ae3 cgi-bin/LJ/GraphicPreviews.pm
--- a/cgi-bin/LJ/GraphicPreviews.pm	Wed Aug 05 03:10:20 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-package LJ::GraphicPreviews;
-use strict;
-use Carp qw(croak);
-
-# loads a graphic preview object
-sub new {
-    my ($class) = @_;
-
-    my $self = {};
-
-    bless $self, $class;
-    return $self;
-}
-
-# returns the code for rendering a graphic preview
-sub render {
-    my $self = shift;
-    my $journalu = shift;
-
-    return "";
-}
-
-# returns whether the feature is enabled at all
-sub is_enabled {
-    my $self = shift;
-    my $journalu = shift;
-
-    return 0;
-}
-
-# returns whether the graphic preview should be rendered
-sub should_render {
-    my $self = shift;
-    my $journalu = shift;
-
-    return 0;
-}
-
-# need res stuff that needs to be included on journal pages
-sub need_res {
-    my $self = shift;
-    my $journalu = shift;
-
-    return undef;
-}
-
-1;
diff -r 9b56de6b1222 -r 855a16325ae3 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Aug 05 03:10:20 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Wed Aug 05 03:49:39 2009 +0000
@@ -4983,43 +4983,7 @@ sub is_minor {
 
 
 ########################################################################
-###  99B. Ad functions (FIXME: we shouldn't need these)
-
-
-# returns $n number of communities that $u is a member of, sorted by update time (most recent to least recent)
-# Probably ad-related; at any rate, it's broken.
-sub notable_communities {
-    my ($u, $n) = @_;
-    $n ||= 3;
-
-    confess 'horribly broken please fix';
-
-    my $friends = $u->friends;
-
-    my $fro_m = LJ::M::FriendsOf->new(
-        $u,
-        sloppy => 1, # approximate if no summary info
-        friends => { map {$_ => 1} keys %$friends },
-    );
-
-    my $update_times = LJ::get_timeupdate_multi( map { $_->id } $fro_m->member_of );
-
-    my @ret_commids;
-    my $count = 1;
-    foreach my $commid (sort {$update_times->{$b} <=> $update_times->{$a}} keys %$update_times) {
-        last if $count > $n;
-        push @ret_commids, $commid;
-        $count++;
-    }
-
-    my $us = LJ::load_userids(@ret_commids);
-
-    return map { $us->{$_} } @ret_commids;
-}
-
-
-########################################################################
-###  99C. Deprecated (FIXME: we shouldn't need these)
+###  99B. Deprecated (FIXME: we shouldn't need these)
 
 
 # THIS IS DEPRECATED DO NOT USE
diff -r 9b56de6b1222 -r 855a16325ae3 cgi-bin/LJ/Widget/CommsOfUser.pm
--- a/cgi-bin/LJ/Widget/CommsOfUser.pm	Wed Aug 05 03:10:20 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-package LJ::Widget::CommsOfUser;
-
-use strict;
-use base qw(LJ::Widget);
-use Carp qw(croak);
-
-sub render_body {
-    my $class = shift;
-    my %opts = @_;
-    my $ret;
-
-    return "" unless $opts{user};
-
-    my $u = LJ::isu($opts{user}) ? $opts{user} : LJ::load_user($opts{user});
-    return "" unless $u;
-
-    my $remote = LJ::get_remote();
-    return "" if $u->id == $remote->id;
-
-    my $max_comms = $opts{max_comms} || 3;
-    my @notable_comms = $u->notable_communities($max_comms);
-    return "" unless @notable_comms;
-
-    $ret .= "<h2>" . $class->ml('.widget.commsofuser.title', {user => $u->ljuser_display}) . "</h2>";
-    $ret .= "<ul class='nostyle'>";
-    foreach my $comm (@notable_comms) {
-        $ret .= "<li>" . $comm->ljuser_display . " - " . $comm->name_html  . "</li>";
-    }
-    $ret .= "</ul>";
-    $ret .= "<p class='detail' style='text-align: right;'>";
-    $ret .= "<a href='" . $u->profile_url . "' class='more-link'>" . $class->ml('.widget.commsofuser.viewprofile', {user => $u->display_username}) . "</a>";
-    $ret .= "<a href='" . $u->journal_base . "/read/' class='more-link' style='top: 22px;'>" . $class->ml('.widget.commsofuser.viewfriendspage', {user => $u->display_username}) . "</a>";
-    $ret .= "</p>";
-
-    return $ret;
-}
-
-1;
diff -r 9b56de6b1222 -r 855a16325ae3 cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm
--- a/cgi-bin/LJ/Widget/FindFriendsInExistingUsers.pm	Wed Aug 05 03:10:20 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-package LJ::Widget::FindFriendsInExistingUsers;
-
-use strict;
-use base qw(LJ::Widget);
-use Carp qw(croak);
-
-sub ajax { 1 }
-sub authas { 1 }
-
-sub need_res { qw( stc/widgets/search.css stc/widgets/friendsfinder.css js/jobstatus.js) }
-
-sub handle_post { }
-
-sub render_body {
-    my $class = shift;
-    my $ret;
-
-    my @search_opts = (
-        'user' => $class->ml('.widget.search.username'),
-        'email' => $class->ml('.widget.search.email'),
-        'aolim' => $class->ml('.widget.search.aim'),
-        'icq' => $class->ml('.widget.search.icq'),
-        'jabber' => $class->ml('.widget.search.jabber'),
-        'msn' => $class->ml('.widget.search.msn'),
-        'yahoo' => $class->ml('.widget.search.yahoo'),
-    );
-
-    $ret .= "<div class='mailfinder exists'>";
-    $ret .= "<h4>" . $class->ml('.widget.search.existingtitle') . "</h4>\n";
-    $ret .= $class->ml('widget.search.note');
-    $ret .= $class->start_form( id => $class->input_prefix . "_user_search" );
-    $ret .= "<fieldset><label for='existuser'>" . $class->ml('.widget.search.title') . "</label>";
-    $ret .= $class->html_text(name => 'q', 'class' => 'mailbox', 'size' => 30, id => 'existuser' ) . " ";
-    $ret .= $class->html_select({name => 'type', selected => 'int'}, @search_opts) . " </fieldset>";    
-    $ret .= "<div class='ffind'>" . $class->html_submit( button => $class->ml('.widget.search.submit'), { class => "btn" });
-    $ret .= "<span id='" . $class->input_prefix . "_errors' class='find_err'></span>";
-    $ret .= "</div>";
-    $ret .= $class->end_form;
-    $ret .= "<div id='" . $class->input_prefix . "_ajax_status'></div><br/>";
-    $ret .= "</div>";
-
-    return $ret;
-}
-
-sub js {
-    my $self = shift;
-
-    my $empty_query = $self->ml('widget.findfriendsinexistingusers.empty.query');
-    my $init_text = $self->ml('widget.findfriendsinexistingusers.init_text');
-    my $job_error = $self->ml('widget.findfriendsinexistingusers.job_error');
-
-    qq [
-        initWidget: function () {
-            var self = this;
-
-            DOM.addEventListener(\$("Widget[FindFriendsInExistingUsers]_user_search"), "submit", function (evt) { 
-                self.AskAddressBook(evt, \$("Widget[FindFriendsInExistingUsers]_user_search")) 
-            });
-        },
-        AskAddressBook: function (evt, form) {
-            var type  = form["Widget[FindFriendsInExistingUsers]_type"].value + "";
-            var query = form["Widget[FindFriendsInExistingUsers]_q"].value + "";
-
-            if (query == '') {
-                \$("Widget[FindFriendsInExistingUsers]_errors").innerHTML = "$empty_query";
-                Event.stop(evt);
-                return;
-            }
-
-            this.query = query;
-
-            \$("Widget[FindFriendsInExistingUsers]_errors").innerHTML = "";
-            \$("Widget[FindFriendsInExistingUsers]_ajax_status").innerHTML = "$init_text";
-
-            var req = { method : "POST",
-                        data : HTTPReq.formEncoded({ "q" : query, "type" : type }),
-                        url : LiveJournal.getAjaxUrl("multisearch"),
-                        onData : this.import_handle.bind(this),
-                        onError : this.import_error.bind(this)
-                      };
-
-            HTTPReq.getJSON(req);
-            Event.stop(evt);
-        },
-
-        import_error: function(msg) {
-            \$("Widget[FindFriendsInExistingUsers]_ajax_status").innerHTML = "";
-            \$("Widget[FindFriendsInExistingUsers]_errors").innerHTML = msg;
-        },
-
-        import_handle: function(info) {
-            if (info.error) {
-                return this.import_error(info.error);
-            }
-
-            if (info.status != "success") {
-                this.import_error("$job_error");
-                return;
-            }
-
-            \$("Widget[FindFriendsInExistingUsers]_ajax_status").innerHTML = info.result;
-        },
-
-        onRefresh: function (data) {
-            this.initWidget();
-        }
-    ];
-}
-
-1;
diff -r 9b56de6b1222 -r 855a16325ae3 cgi-bin/LJ/Widget/TranslateLegal.pm
--- a/cgi-bin/LJ/Widget/TranslateLegal.pm	Wed Aug 05 03:10:20 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-package LJ::Widget::TranslateLegal;
-
-use strict;
-use base qw(LJ::Widget);
-
-sub render {
-    my $class = shift;
-    my %opts = @_;
-    my $GET = $opts{'GET'};
-        
-    my $lang = $GET->{'uselang'} || BML::get_language() || "en";
-    my $file = $LJ::HOME . $opts{'file'};
-    return $opts{'file'} if $lang eq "debug";
-    
-    if (-e $file . "." . $lang) {
-        $file = $file . "." . $lang;
-    }else{
-        if (! -e $file){
-            return "Error include file!";
-        }
-    } 
-
-    open (my $fh, "<" . $file) or die "Can't open: $file\n";
-    local $/;
-    my $data = <$fh>;
-    close $fh;
-    
-    return $data;
-}
-
-
-1;
--------------------------------------------------------------------------------