[dw-free] migrate LJ::load_user_props -> $u->preload_props
[commit: http://hg.dwscoalition.org/dw-free/rev/1b271ebde64c]
http://bugs.dwscoalition.org/show_bug.cgi?id=2653
Code cleanup -- call the method on the user instead of using a class method,
add error-checking
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2653
Code cleanup -- call the method on the user instead of using a class method,
add error-checking
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- bin/maint/generic.pl
- bin/renameuser.pl
- cgi-bin/Apache/LiveJournal.pm
- cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm
- cgi-bin/Apache/LiveJournal/Interface/Blogger.pm
- cgi-bin/DW/Controller/Misc.pm
- cgi-bin/LJ/Blob.pm
- cgi-bin/LJ/S2.pm
- cgi-bin/LJ/SynSuck.pm
- cgi-bin/LJ/Tags.pm
- cgi-bin/LJ/Talk.pm
- cgi-bin/ljemailgateway-web.pl
- cgi-bin/ljemailgateway.pl
- cgi-bin/ljfeed.pl
- cgi-bin/ljprotocol.pl
- cgi-bin/weblib.pl
- htdocs/allpics.bml
- htdocs/community/members.bml
- htdocs/community/sentinvites.bml
- htdocs/community/settings.bml
- htdocs/customize/advanced/styles.bml
- htdocs/customize/viewuser.bml
- htdocs/feeds/index.bml
- htdocs/login.bml
- htdocs/manage/domain.bml
- htdocs/manage/emailpost.bml
- htdocs/manage/index.bml
- htdocs/manage/profile/index.bml
- htdocs/manage/pubkey.bml
- htdocs/preview/entry.bml
- htdocs/support/see_request.bml
- htdocs/talkpost.bml
- htdocs/talkread.bml
- htdocs/tools/memories.bml
- htdocs/view/index.bml
-------------------------------------------------------------------------------- diff -r e12b62f047d5 -r 1b271ebde64c bin/maint/generic.pl --- a/bin/maint/generic.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/bin/maint/generic.pl Mon Jun 07 10:19:38 2010 +0800 @@ -51,8 +51,9 @@ my %email; # see who we emailed on this comm foreach my $mid (@{$maints{$row->[0]}}) { print "$mid "; + next unless $mus->{$mid}; next if $email{$mus->{$mid}{email}}++; - LJ::load_user_props($mus->{$mid}, 'opt_communityjoinemail'); + $mus->{$mid}->preload_props( 'opt_communityjoinemail' ); next unless $mus->{$mid}{opt_communityjoinemail} eq 'D'; # Daily or Digest my $body = "Dear $mus->{$mid}{user},\n\n" . diff -r e12b62f047d5 -r 1b271ebde64c bin/renameuser.pl --- a/bin/renameuser.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/bin/renameuser.pl Mon Jun 07 10:19:38 2010 +0800 @@ -98,7 +98,7 @@ unless (rename_user("lj_swap_$swapnum", # if the fromuser had redirection on, make sure it points to the new $to user my $fromu = LJ::load_user($from, 'force'); - LJ::load_user_props($fromu, 'renamedto'); + $fromu->preload_props( 'renamedto' ) if $fromu; if ($fromu->{renamedto} && $fromu->{renamedto} ne $to) { print "Setting redirection: $from => $to\n"; unless (LJ::set_userprop($fromu, 'renamedto' => $to)) { @@ -109,7 +109,7 @@ unless (rename_user("lj_swap_$swapnum", # if the $to user had redirection, they shouldn't anymore my $tou = LJ::load_user($to, 'force'); - LJ::load_user_props($tou, 'renamedto'); + $tou->preload_props( 'renamedto' ) if $tou; if ($tou->{renamedto}) { print "Removing redirection for user: $to\n"; unless (LJ::set_userprop($tou, 'renamedto' => undef)) { diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/Apache/LiveJournal.pm --- a/cgi-bin/Apache/LiveJournal.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/Apache/LiveJournal.pm Mon Jun 07 10:19:38 2010 +0800 @@ -792,7 +792,7 @@ sub trans # under a given username, without sprinkling redirects everywhere. my $u = LJ::load_user($user); if ( $u && $u->is_redirect && $u->is_renamed ) { - LJ::load_user_props($u, 'renamedto'); + $u->preload_props( 'renamedto' ); my $renamedto = $u->{'renamedto'}; if ($renamedto ne '') { my $redirect_url = ($renamedto =~ m!^https?://!) ? $renamedto : LJ::journal_base($renamedto, $vhost) . $uuri . $args_wq; diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm --- a/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/Apache/LiveJournal/Interface/AtomAPI.pm Mon Jun 07 10:19:38 2010 +0800 @@ -519,7 +519,7 @@ sub handle { # TODO: Add communities? my $method = $r->method; if ( $method eq 'GET' && ! $action ) { - LJ::load_user_props( $u, 'journaltitle' ); + $u->preload_props( 'journaltitle' ); my $title = $u->{journaltitle} || $u->{user}; my $feed = XML::Atom::Feed->new(); diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/Apache/LiveJournal/Interface/Blogger.pm --- a/cgi-bin/Apache/LiveJournal/Interface/Blogger.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/Apache/LiveJournal/Interface/Blogger.pm Mon Jun 07 10:19:38 2010 +0800 @@ -235,7 +235,7 @@ sub getUserInfo { my $u = LJ::load_user($user) or die "Invalid login\n"; die "Invalid login\n" unless LJ::auth_okay($u, $password); - LJ::load_user_props($u, "url"); + $u->preload_props( "url" ); return { 'userid' => $u->{'userid'}, diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/DW/Controller/Misc.pm --- a/cgi-bin/DW/Controller/Misc.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/DW/Controller/Misc.pm Mon Jun 07 10:19:38 2010 +0800 @@ -47,7 +47,7 @@ sub pubkey_handler { my ( $ok, $rv ) = controller( anonymous => 1, specify_user => 1 ); return $rv unless $ok; - LJ::load_user_props( $rv->{u}, 'public_key' ); + $rv->{u}->preload_props( 'public_key' ) if $rv->{u}; return DW::Template->render_template( 'misc/pubkey.tt', $rv ); } diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/LJ/Blob.pm --- a/cgi-bin/LJ/Blob.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/LJ/Blob.pm Mon Jun 07 10:19:38 2010 +0800 @@ -58,10 +58,10 @@ sub _bc_from_path { # given a $u, returns that user's blob_clusterid, conditionally loading it sub _load_bcid { my $u = shift; - die "No user" unless $u; + die "No user" unless LJ::isu( $u ); return $u->{blob_clusterid} if $u->{blob_clusterid}; - LJ::load_user_props($u, "blob_clusterid"); + $u->preload_props( "blob_clusterid" ); return $u->{blob_clusterid} if $u->{blob_clusterid}; die "Couldn't find user $u->{user}'s blob_clusterid\n"; } diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/LJ/S2.pm Mon Jun 07 10:19:38 2010 +0800 @@ -3293,7 +3293,7 @@ sub _print_quickreply_link my $page = get_page(); my $remote = LJ::get_remote(); - LJ::load_user_props($remote, "opt_no_quickreply"); + $remote->preload_props( "opt_no_quickreply" ) if $remote; my $onclick = ""; unless ($remote->{'opt_no_quickreply'}) { my $pid = (int($target)&&$page->{'_type'} eq 'EntryPage') ? int($target /256) : 0; diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/LJ/SynSuck.pm --- a/cgi-bin/LJ/SynSuck.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/LJ/SynSuck.pm Mon Jun 07 10:19:38 2010 +0800 @@ -427,7 +427,7 @@ sub process_content { } # update syndicated account's userinfo if necessary - LJ::load_user_props($su, "url", "urlname"); + $su->preload_props( "url", "urlname" ); { my $title = $feed->{'title'}; $title = $su->{'user'} unless LJ::is_utf8($title); diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/LJ/Tags.pm --- a/cgi-bin/LJ/Tags.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/LJ/Tags.pm Mon Jun 07 10:19:38 2010 +0800 @@ -588,7 +588,7 @@ sub get_permission_levels { return undef unless $u; # get the prop - LJ::load_user_props($u, 'opt_tagpermissions'); + $u->preload_props( 'opt_tagpermissions' ); # return defaults for accounts unless ($u->{opt_tagpermissions}) { diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/LJ/Talk.pm --- a/cgi-bin/LJ/Talk.pm Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/LJ/Talk.pm Mon Jun 07 10:19:38 2010 +0800 @@ -367,7 +367,7 @@ sub screening_level { return $val if $val; # now return userprop, as it's our last chance - LJ::load_user_props($journalu, 'opt_whoscreened'); + $journalu->preload_props( 'opt_whoscreened' ); return if $journalu->{opt_whoscreened} eq 'N'; return $journalu->{opt_whoscreened}; } @@ -2463,7 +2463,7 @@ sub mail_comments { !$entryu->gets_notified(journal => $journalu, arg1 => $ditemid, arg2 => $comment->{talkid}) ) { - LJ::load_user_props($entryu, 'mailencoding'); + $entryu->preload_props( 'mailencoding' ); my $part; # Now we going to send email to '$entryu'. @@ -2532,7 +2532,7 @@ sub mail_comments { # they couldn't have posted if they were. (and if they did somehow, we're just emailing # them, so it shouldn't matter.) my $u = $comment->{u}; - LJ::load_user_props($u, 'opt_getselfemail') if $u; + $u->preload_props( 'opt_getselfemail' ) if $u; if ($u && $u->{'opt_getselfemail'} && $u->can_get_self_email && !$u->gets_notified(journal => $journalu, arg1 => $ditemid, arg2 => $comment->{talkid})) { my $part; diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/ljemailgateway-web.pl --- a/cgi-bin/ljemailgateway-web.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/ljemailgateway-web.pl Mon Jun 07 10:19:38 2010 +0800 @@ -23,9 +23,10 @@ use strict; # Used for ljemailgateway and manage/emailpost.bml sub get_allowed_senders { my $u = shift; + return undef unless LJ::isu( $u ); my (%addr, @address); - LJ::load_user_props($u, 'emailpost_allowfrom'); + $u->preload_props( 'emailpost_allowfrom' ); @address = split(/\s*,\s*/, $u->{emailpost_allowfrom}); return undef unless scalar(@address) > 0; diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/ljemailgateway.pl --- a/cgi-bin/ljemailgateway.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/ljemailgateway.pl Mon Jun 07 10:19:38 2010 +0800 @@ -72,7 +72,8 @@ sub process { $u = LJ::load_user($user); return unless $u && $u->is_visible; - LJ::load_user_props($u, 'emailpost_pin') unless (lc($pin) eq 'pgp' && $LJ::USE_PGP); + $u->preload_props( 'emailpost_pin' ) + unless lc( $pin ) eq 'pgp' && $LJ::USE_PGP; # Pick what address to send potential errors to. $addrlist = LJ::Emailpost::get_allowed_senders($u); @@ -419,8 +420,7 @@ sub process { # TZ is parsed into seconds, we want something more like -0800 $zone = defined $zone ? sprintf( '%+05d', $zone / 36 ) : 'guess'; - LJ::load_user_props( - $u, + $u->preload_props( qw/ emailpost_userpic emailpost_security emailpost_comments emailpost_gallery @@ -607,7 +607,7 @@ sub check_sig { sub check_sig { my ($u, $entity, $gpg_err) = @_; - LJ::load_user_props($u, 'public_key'); + $u->preload_props( 'public_key' ) if LJ::isu( $u ); my $key = $u->{public_key}; return 'no_key' unless $key; diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/ljfeed.pl --- a/cgi-bin/ljfeed.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/ljfeed.pl Mon Jun 07 10:19:38 2010 +0800 @@ -38,7 +38,7 @@ sub make_feed my $feedtype = $1; my $viewfunc = $feedtypes{$feedtype}; - unless ($viewfunc) { + unless ( $viewfunc && LJ::isu( $u ) ) { $opts->{'handler_return'} = 404; return undef; } @@ -49,7 +49,7 @@ sub make_feed my $user = $u->{'user'}; - LJ::load_user_props($u, qw/ journaltitle journalsubtitle opt_synlevel /); + $u->preload_props( qw/ journaltitle journalsubtitle opt_synlevel / ); LJ::text_out(\$u->{$_}) foreach ("name", "url", "urlname"); @@ -630,9 +630,9 @@ sub create_view_foaf { $opts->{contenttype} = 'application/rdf+xml; charset=' . $opts->{saycharset}; # setup userprops we will need - LJ::load_user_props($u, qw{ + $u->preload_props( qw{ aolim icq yahoo jabber msn icbm url urlname external_foaf_url country city journaltitle - }); + } ); # create bare foaf document, for now $ret = "<?xml version='1.0'?>\n"; diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/ljprotocol.pl --- a/cgi-bin/ljprotocol.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/ljprotocol.pl Mon Jun 07 10:19:38 2010 +0800 @@ -135,7 +135,8 @@ sub translate { my ($u, $msg, $vars) = @_; - LJ::load_user_props($u, "browselang") unless $u->{'browselang'}; + $u->preload_props( "browselang" ) + unless $u->{'browselang'} || ! LJ::isu( $u ); return LJ::Lang::get_text($u->{'browselang'}, "protocol.$msg", undef, $vars); } @@ -1166,11 +1167,11 @@ sub postevent my @poster_props = qw(newesteventtime dupsig_post); my @owner_props = qw(newpost_minsecurity moderated); - LJ::load_user_props($u, @poster_props, @owner_props); + $u->preload_props( @poster_props, @owner_props ); if ($uowner->{'userid'} == $u->{'userid'}) { $uowner->{$_} = $u->{$_} foreach (@owner_props); } else { - LJ::load_user_props($uowner, @owner_props); + $uowner->preload_props( @owner_props ); } # are they trying to post back in time? @@ -1355,7 +1356,7 @@ sub postevent next unless $mod->is_visible; - LJ::load_user_props($mod, 'opt_nomodemail'); + $mod->preload_props( 'opt_nomodemail' ); next if $mod->{opt_nomodemail}; next if $mod->{status} ne "A"; @@ -1756,7 +1757,7 @@ sub editevent # if their newesteventtime prop equals the time of the one they're deleting # then delete their newesteventtime. if ($u->{'userid'} == $uowner->{'userid'}) { - LJ::load_user_props($u, { use_master => 1 }, "newesteventtime"); + $u->preload_props( { use_master => 1 }, "newesteventtime" ); if ($u->{'newesteventtime'} eq $oldevent->{'eventtime'}) { LJ::set_userprop($u, "newesteventtime", undef); } @@ -1877,7 +1878,7 @@ sub editevent $qallowmask != $oldevent->{'allowmask'}) { # are they changing their most recent post? - LJ::load_user_props($u, "newesteventtime"); + $u->preload_props( "newesteventtime" ); if ($u->{userid} == $uowner->{userid} && $u->{newesteventtime} eq $oldevent->{eventtime}) { # did they change the time? @@ -2156,7 +2157,7 @@ sub getevents # broken client loop prevention if ($req->{'lastsync'}) { my $pname = "rl_syncitems_getevents_loop"; - LJ::load_user_props($u, $pname); + $u->preload_props( $pname ); # format is: time/date/time/date/time/date/... so split # it into a hash, then delete pairs that are older than an hour my %reqs = split(m!/!, $u->{$pname}); diff -r e12b62f047d5 -r 1b271ebde64c cgi-bin/weblib.pl --- a/cgi-bin/weblib.pl Sun Jun 06 20:14:56 2010 -0500 +++ b/cgi-bin/weblib.pl Mon Jun 07 10:19:38 2010 +0800 @@ -676,7 +676,7 @@ sub create_qr_div { my $qrhtml; - LJ::load_user_props($remote, "opt_no_quickreply"); + $remote->preload_props( "opt_no_quickreply" ); return undef if $remote->{'opt_no_quickreply'}; $qrhtml .= "<div id='qrformdiv'><form id='qrform' name='qrform' method='POST' action='$LJ::SITEROOT/talkpost_do'>"; @@ -936,7 +936,7 @@ sub make_qr_link return undef unless defined $dtid && $linktext && $replyurl; my $remote = LJ::get_remote(); - LJ::load_user_props($remote, "opt_no_quickreply"); + $remote->preload_props( "opt_no_quickreply" ) if $remote; unless ($remote->{'opt_no_quickreply'}) { my $pid = int($dtid / 256); diff -r e12b62f047d5 -r 1b271ebde64c htdocs/allpics.bml --- a/htdocs/allpics.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/allpics.bml Mon Jun 07 10:19:38 2010 +0800 @@ -92,7 +92,7 @@ _c?> # redirect renamed users if ( $u->is_redirect ) { - LJ::load_user_props($u, "renamedto"); + $u->preload_props( "renamedto" ); return BML::redirect("$LJ::SITEROOT/allpics?user=$u->{'renamedto'}") if $u->{'renamedto'}; } diff -r e12b62f047d5 -r 1b271ebde64c htdocs/community/members.bml --- a/htdocs/community/members.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/community/members.bml Mon Jun 07 10:19:38 2010 +0800 @@ -478,7 +478,7 @@ body<= # columns of our table, excluding username my @attribs = ('member', 'post'); - LJ::load_user_props($c, 'moderated'); + $c->preload_props( 'moderated' ); push @attribs, ('preapprove') if $c->{'moderated'} || $count{'N'}; push @attribs, ('moderate') diff -r e12b62f047d5 -r 1b271ebde64c htdocs/community/sentinvites.bml --- a/htdocs/community/sentinvites.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/community/sentinvites.bml Mon Jun 07 10:19:38 2010 +0800 @@ -93,7 +93,7 @@ body<= # columns of our table, excluding username my @attribs = ('post'); my @titleattribs = ('P'); - LJ::load_user_props($c, 'moderated'); + $c->preload_props( 'moderated' ); if ($c->{moderated}) { push @attribs, ('preapprove', 'moderate'); push @titleattribs, ('U', 'M'); diff -r e12b62f047d5 -r 1b271ebde64c htdocs/community/settings.bml --- a/htdocs/community/settings.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/community/settings.bml Mon Jun 07 10:19:38 2010 +0800 @@ -240,7 +240,7 @@ body<= my $dbr = LJ::get_db_reader(); ($info{'membership'},$info{'postlevel'}) = $dbr->selectrow_array("SELECT membership, postlevel FROM community WHERE userid=$c->{'userid'}"); - LJ::load_user_props($c, "nonmember_posting", "moderated", "hide_join_post_link", "posting_guidelines_entry"); + $c->preload_props( qw/ nonmember_posting moderated hide_join_post_link posting_guidelines_entry / ); $info{'nonmember_posting'} = $c->{'nonmember_posting'} ? 1 : 0; $info{'moderated'} = $c->{'moderated'} ? 1 : 0; $info{'hide_join_post_link'} = $c->{'hide_join_post_link'} ? 1 : 0; diff -r e12b62f047d5 -r 1b271ebde64c htdocs/customize/advanced/styles.bml --- a/htdocs/customize/advanced/styles.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/customize/advanced/styles.bml Mon Jun 07 10:19:38 2010 +0800 @@ -294,7 +294,7 @@ _c?> } # load style currently in use - LJ::load_user_props($u, 's2_style'); + $u->preload_props( 's2_style' ); # set up page header $authasform->() unless $noactions; diff -r e12b62f047d5 -r 1b271ebde64c htdocs/customize/viewuser.bml --- a/htdocs/customize/viewuser.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/customize/viewuser.bml Mon Jun 07 10:19:38 2010 +0800 @@ -30,7 +30,7 @@ _c?> my $userid = $u->{'userid'}; - LJ::load_user_props($u, "stylesys", "s2_style"); + $u->preload_props( "stylesys", "s2_style" ) if $u; $body = ""; $title = $ML{".user.layer2"}; diff -r e12b62f047d5 -r 1b271ebde64c htdocs/feeds/index.bml --- a/htdocs/feeds/index.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/feeds/index.bml Mon Jun 07 10:19:38 2010 +0800 @@ -184,8 +184,8 @@ body<= my ($user, $name, $suserid, $url, $count) = @{ $popsyn->[$_] }; $names{$user} = $name; - my $suser = LJ::load_userid($suserid); - LJ::load_user_props($suser, 'url'); + my $suser = LJ::load_userid( $suserid ) or next; + $suser->preload_props( 'url' ); $urls{$user} = $suser->{url}; # skip suspended/deleted accounts, already watched feeds diff -r e12b62f047d5 -r 1b271ebde64c htdocs/login.bml --- a/htdocs/login.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/login.bml Mon Jun 07 10:19:38 2010 +0800 @@ -342,7 +342,8 @@ _c?> return; } - LJ::load_user_props($u, "browselang", "schemepref", "legal_tosagree"); + # at this point, $u is known good + $u->preload_props( "browselang", "schemepref", "legal_tosagree" ); unless ($u->tosagree_verify) { if ($POST{agree_tos}) { diff -r e12b62f047d5 -r 1b271ebde64c htdocs/manage/domain.bml --- a/htdocs/manage/domain.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/manage/domain.bml Mon Jun 07 10:19:38 2010 +0800 @@ -44,7 +44,7 @@ body<= my $dbr = LJ::get_db_reader(); my $sth; - LJ::load_user_props($u, "journaldomain"); + $u->preload_props( "journaldomain" ); # if a POST, update their info if (LJ::did_post()) { diff -r e12b62f047d5 -r 1b271ebde64c htdocs/manage/emailpost.bml --- a/htdocs/manage/emailpost.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/manage/emailpost.bml Mon Jun 07 10:19:38 2010 +0800 @@ -63,7 +63,7 @@ body<= my ($mode, $type) = ($GET{mode}, $GET{type}); if ($u) { - LJ::load_user_props( $u, @props ); + $u->preload_props( @props ); } else { $mode = 'help'; } diff -r e12b62f047d5 -r 1b271ebde64c htdocs/manage/index.bml --- a/htdocs/manage/index.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/manage/index.bml Mon Jun 07 10:19:38 2010 +0800 @@ -26,8 +26,8 @@ _c?> my $authas = $GET{'authas'} || $remote->{'user'}; my $u = LJ::get_authas_user($authas); - if ($u) { - LJ::load_user_props($u, "stylesys"); + if ( $u ) { + $u->preload_props( "stylesys" ); $u->{'stylesys'} ||= 2; } diff -r e12b62f047d5 -r 1b271ebde64c htdocs/manage/profile/index.bml --- a/htdocs/manage/profile/index.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/manage/profile/index.bml Mon Jun 07 10:19:38 2010 +0800 @@ -51,8 +51,7 @@ body<= my $sth; # load user props - LJ::load_user_props( - $u, { use_master => 1 }, + $u->preload_props( { use_master => 1 }, qw/ country state city zip timezone icq aolim yahoo msn url jabber google_talk skype gizmo diff -r e12b62f047d5 -r 1b271ebde64c htdocs/manage/pubkey.bml --- a/htdocs/manage/pubkey.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/manage/pubkey.bml Mon Jun 07 10:19:38 2010 +0800 @@ -76,7 +76,7 @@ body<= } # Initial page - LJ::load_user_props($u, qw(public_key)); + $u->preload_props( qw( public_key ) ); my $ret; $ret .= "<?p "; diff -r e12b62f047d5 -r 1b271ebde64c htdocs/preview/entry.bml --- a/htdocs/preview/entry.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/preview/entry.bml Mon Jun 07 10:19:38 2010 +0800 @@ -62,10 +62,11 @@ _c?> $r->notes->{journalid} = $u->{userid}; ### Load necessary props - my @needed_props = ("stylesys", "s2_style", "url", "urlname", - "opt_usesharedpic", "journaltitle", "journalsubtitle",); + my @needed_props = qw( stylesys s2_style url urlname + opt_usesharedpic journaltitle + journalsubtitle ); - LJ::load_user_props($u, @needed_props); + $u->preload_props( @needed_props ); ### Determine style system to preview with my $get_styleinfo = sub { diff -r e12b62f047d5 -r 1b271ebde64c htdocs/support/see_request.bml --- a/htdocs/support/see_request.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/support/see_request.bml Mon Jun 07 10:19:38 2010 +0800 @@ -249,7 +249,7 @@ body<= $clusterdown = 1 unless $dbr; $email = $u->email_raw if $u->email_raw; - LJ::load_user_props($u, "stylesys", "s2_style", "browselang", "schemepref" ) + $u->preload_props( "stylesys", "s2_style", "browselang", "schemepref" ) unless $clusterdown; } diff -r e12b62f047d5 -r 1b271ebde64c htdocs/talkpost.bml --- a/htdocs/talkpost.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/talkpost.bml Mon Jun 07 10:19:38 2010 +0800 @@ -72,7 +72,7 @@ body<= # redirect if account was renamed if ( $u->is_redirect ) { - LJ::load_user_props($u, "renamedto"); + $u->preload_props( "renamedto" ); if ($u->{'renamedto'} ne "") { my $id = $FORM{'itemid'}+0; return BML::redirect(LJ::journal_base($u->{'renamedto'}) . "/$id.html?mode=reply"); diff -r e12b62f047d5 -r 1b271ebde64c htdocs/talkread.bml --- a/htdocs/talkread.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/talkread.bml Mon Jun 07 10:19:38 2010 +0800 @@ -95,7 +95,7 @@ body<= # redirect if account was renamed if ( $u->is_redirect ) { - LJ::load_user_props($u, "renamedto"); + $u->preload_props( "renamedto" ); if ($u->{'renamedto'} ne "") { return BML::redirect(LJ::journal_base($u->{'renamedto'}) . "/$ditemid.html"); } @@ -203,7 +203,7 @@ body<= # # See if we should inject QuickReply javascript - LJ::load_user_props($remote, "opt_no_quickreply"); + $remote->preload_props( "opt_no_quickreply" ) if $remote; LJ::Hooks::run_hooks("need_res_for_journals", $u); LJ::need_res( qw( js/thread_expander.js stc/talkpage.css ) ); diff -r e12b62f047d5 -r 1b271ebde64c htdocs/tools/memories.bml --- a/htdocs/tools/memories.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/tools/memories.bml Mon Jun 07 10:19:38 2010 +0800 @@ -91,7 +91,7 @@ _c?> my $userid = $u->{'userid'}; if ( $u->is_redirect ) { - LJ::load_user_props($u, "renamedto"); + $u->preload_props( "renamedto" ); return BML::redirect("/tools/memories?user=$u->{'renamedto'}$authasarg"); } diff -r e12b62f047d5 -r 1b271ebde64c htdocs/view/index.bml --- a/htdocs/view/index.bml Sun Jun 06 20:14:56 2010 -0500 +++ b/htdocs/view/index.bml Mon Jun 07 10:19:38 2010 +0800 @@ -59,9 +59,10 @@ _c?> } if ( $u->is_redirect ) { - LJ::load_user_props($u, "renamedto"); - if ($u->{'renamedto'}) { - return BML::redirect(sprintf(LJ::journal_base($u->{'renamedto'}) . "/%04d/%02d/", $FORM{'y'}, $FORM{'m'})); + $u->preload_props( "renamedto" ); + if ( $u->{'renamedto'} ) { + return BML::redirect( sprintf( LJ::journal_base( $u->{'renamedto'} ) + . "/%04d/%02d/", $FORM{'y'}, $FORM{'m'} ) ); } } --------------------------------------------------------------------------------