Remove unused functions (round 1).
Patch by denise.
diffs (201 lines):
diff -r fd9f9a2a1ed4 -r 95cbf3152cf5 cgi-bin/cleanhtml.pl
--- a/cgi-bin/cleanhtml.pl Mon Aug 03 15:24:55 2009 +0000
+++ b/cgi-bin/cleanhtml.pl Mon Aug 03 12:31:29 2009 -0500
@@ -13,25 +13,6 @@ LJ::Config->load;
LJ::Config->load;
package LJ;
-
-# <LJFUNC>
-# name: LJ::strip_bad_code
-# class: security
-# des: Removes malicious/annoying HTML.
-# info: This is just a wrapper function around [func[LJ::CleanHTML::clean]].
-# args: textref
-# des-textref: Scalar reference to text to be cleaned.
-# returns: Nothing.
-# </LJFUNC>
-sub strip_bad_code
-{
- my $data = shift;
- LJ::CleanHTML::clean($data, {
- 'eat' => [qw[layer iframe script object embed]],
- 'mode' => 'allow',
- 'keepcomments' => 1, # Allows CSS to work
- });
-}
# attempt to mangle an email address for printing out to HTML. this is
# kind of futile, but we try anyway.
diff -r fd9f9a2a1ed4 -r 95cbf3152cf5 cgi-bin/ljdb.pl
--- a/cgi-bin/ljdb.pl Mon Aug 03 15:24:55 2009 +0000
+++ b/cgi-bin/ljdb.pl Mon Aug 03 12:31:29 2009 -0500
@@ -149,11 +149,6 @@ sub dbh_by_name {
return $LJ::DBIRole->get_dbh_conn($fdsn);
-}
-
-sub dbh_by_fdsn {
- my $fdsn = shift;
- return $LJ::DBIRole->get_dbh_conn($fdsn);
}
sub root_dbh_by_name {
@@ -431,31 +426,6 @@ sub get_lock
}
# <LJFUNC>
-# name: LJ::may_lock
-# des: see if we <strong>could</strong> get a MySQL lock on
-# a given key/dbrole combination, but don't actually get it.
-# returns: undef if called improperly, true on success, die() on failure
-# args: db, dbrole
-# des-dbrole: the role this lock should be gotten on, either 'global' or
'user'.
-# </LJFUNC>
-sub may_lock
-{
- my ($db, $dbrole) = @_;
- return undef unless $db && ($dbrole eq 'global' || $dbrole eq 'user');
-
- # die if somebody already has a lock
- if ($LJ::LOCK_OUT{$dbrole}) {
- my $curr_sub = (caller 1)[3]; # caller of current sub
- die "LOCK ERROR: $curr_sub; can't get lock from
$LJ::LOCK_OUT{$dbrole}\n";
- }
-
- # see if a lock is already out
- return undef if exists $LJ::LOCK_OUT{$dbrole};
-
- return 1;
-}
-
-# <LJFUNC>
# name: LJ::release_lock
# des: release a MySQL lock on a given key/dbrole combination.
# returns: undef if called improperly, true on success, die() on failure
diff -r fd9f9a2a1ed4 -r 95cbf3152cf5 cgi-bin/ljhooks.pl
--- a/cgi-bin/ljhooks.pl Mon Aug 03 15:24:55 2009 +0000
+++ b/cgi-bin/ljhooks.pl Mon Aug 03 12:31:29 2009 -0500
@@ -17,16 +17,6 @@ sub are_hooks
my $hookname = shift;
load_hooks_dir() unless $hooks_dir_scanned;
return defined $LJ::HOOKS{$hookname};
-}
-
-# <LJFUNC>
-# name: LJ::clear_hooks
-# des: Removes all hooks.
-# </LJFUNC>
-sub clear_hooks
-{
- %LJ::HOOKS = ();
- $hooks_dir_scanned = 0;
}
# <LJFUNC>
diff -r fd9f9a2a1ed4 -r 95cbf3152cf5 cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl Mon Aug 03 15:24:55 2009 +0000
+++ b/cgi-bin/ljprotocol.pl Mon Aug 03 12:31:29 2009 -0500
@@ -129,17 +129,6 @@ sub error_class
my $code = shift;
$code = $1 if $code =~ /^(\d\d\d):(.+)/;
return $e{$code} && ref $e{$code} ? $e{$code}->[0] : undef;
-}
-
-sub error_is_transient
-{
- my $class = error_class($_[0]);
- return defined $class ? ! $class+0 : undef;
-}
-
-sub error_is_permanent
-{
- return error_class($_[0]);
}
sub error_message
diff -r fd9f9a2a1ed4 -r 95cbf3152cf5 cgi-bin/ljtextutil.pl
--- a/cgi-bin/ljtextutil.pl Mon Aug 03 15:24:55 2009 +0000
+++ b/cgi-bin/ljtextutil.pl Mon Aug 03 12:31:29 2009 -0500
@@ -566,49 +566,5 @@ sub html_newlines
return $text;
}
-# given HTML, returns an arrayref of URLs to images that are in the HTML
-sub html_get_img_urls {
- my $htmlref = shift;
- my %opts = @_;
-
- my $exclude_site_imgs = $opts{exclude_site_imgs} || 0;
-
- my @image_urls;
- my $p = HTML::TokeParser->new($htmlref);
-
- while (my $token = $p->get_token) {
- if ($token->[1] eq "img") {
- my $attrs = $token->[2];
- foreach my $attr (keys %$attrs) {
- push @image_urls, $attrs->{$attr} if
- $attr eq "src" &&
- ($exclude_site_imgs ? $attrs->{$attr} !~ /^$LJ::IMGPREFIX/
: 1);
- }
- }
- }
-
- return \...@image_urls;
-}
-
-# given HTML, returns an arrayref of link URLs that are in the HTML
-sub html_get_link_urls {
- my $htmlref = shift;
- my %opts = @_;
-
- my @link_urls;
- my $p = HTML::TokeParser->new($htmlref);
-
- while (my $token = $p->get_token) {
- if ($token->[0] eq "S" && $token->[1] eq "a") {
- my $attrs = $token->[2];
- foreach my $attr (keys %$attrs) {
- push @link_urls, $attrs->{$attr} if $attr eq "href";
- }
- }
- }
-
- return \...@link_urls;
-}
-
1;
diff -r fd9f9a2a1ed4 -r 95cbf3152cf5 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Mon Aug 03 15:24:55 2009 +0000
+++ b/cgi-bin/weblib.pl Mon Aug 03 12:31:29 2009 -0500
@@ -3585,27 +3585,6 @@ sub site_schemes {
return @schemes;
}
-# returns a random value between 0 and $num_choices-1 for a particular uniq
-# if no uniq available, just returns a random value between 0 and
$num_choices-1
-sub ab_testing_value {
- my %opts = @_;
-
- return $LJ::DEBUG{ab_testing_value} if defined
$LJ::DEBUG{ab_testing_value};
-
- my $num_choices = $opts{num_choices} || 2;
- my $uniq = LJ::UniqCookie->current_uniq;
-
- my $val;
- if ($uniq) {
- $val = unpack("I", $uniq);
- $val %= $num_choices;
- } else {
- $val = int(rand($num_choices));
- }
-
- return $val;
-}
-
# sets up appropriate js for journals that need a special statusvis message at
the top
# returns some js that must be added onto the journal page's head
sub statusvis_message_js {
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog