[dw-free] provide user methods for check_rel usage
[commit: http://hg.dwscoalition.org/dw-free/rev/ecb4f977c4a1]
http://bugs.dwscoalition.org/show_bug.cgi?id=2739
We used to pass in db handles; then it shifted to maybe we were passing in
db handles (or maybe not). And now we don't pass in db handles at all -- so
remove the code which used to take care of the maybe case. It's no longer
needed.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2739
We used to pass in db handles; then it shifted to maybe we were passing in
db handles (or maybe not). And now we don't pass in db handles at all -- so
remove the code which used to take care of the maybe case. It's no longer
needed.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/ljrelation.pl
-------------------------------------------------------------------------------- diff -r 44a1463f4850 -r ecb4f977c4a1 cgi-bin/ljrelation.pl --- a/cgi-bin/ljrelation.pl Mon Jun 28 18:00:21 2010 +0800 +++ b/cgi-bin/ljrelation.pl Mon Jun 28 18:07:33 2010 +0800 @@ -244,15 +244,13 @@ sub _set_rel_memcache { # <LJFUNC> # name: LJ::check_rel # des: Checks whether two users are in a specified relationship to each other. -# args: db?, userid, targetid, type +# args: userid, targetid, type # des-userid: source userid, nonzero; may also be a user hash. # des-targetid: target userid, nonzero; may also be a user hash. # des-type: type of the relationship # returns: 1 if the relationship exists, 0 otherwise # </LJFUNC> -sub check_rel -{ - my $db = isdb($_[0]) ? shift : undef; +sub check_rel { my ($userid, $targetid, $type) = @_; return undef unless $type && $userid && $targetid; @@ -271,14 +269,14 @@ sub check_rel return $memval if defined $memval; # are we working on reluser or reluser2? - my $table; + my ( $db, $table ); if ($typeid) { # clustered reluser2 table $db = LJ::get_cluster_reader($u); $table = "reluser2"; } else { # non-clustered reluser table - $db ||= LJ::get_db_reader(); + $db = LJ::get_db_reader(); $table = "reluser"; } --------------------------------------------------------------------------------