Committer: ailyin
LJSV-1350 (Cannot edit contact information in profile page)U trunk/cgi-bin/LJ/User/PropStorage/DB.pm U trunk/cgi-bin/LJ/User/PropStorage.pm
Modified: trunk/cgi-bin/LJ/User/PropStorage/DB.pm =================================================================== --- trunk/cgi-bin/LJ/User/PropStorage/DB.pm 2011-01-11 05:41:59 UTC (rev 18007) +++ trunk/cgi-bin/LJ/User/PropStorage/DB.pm 2011-01-11 10:40:17 UTC (rev 18008) @@ -47,6 +47,13 @@ foreach my $row (@$res) { my $propname = $propid_map{ $row->{'upropid'} }->{'name'}; + + # filter out spurious data; we need this because multihomed + # userprops used to be stored on user clusters as well, but we + # don't store them on user clusters anymore, and the data + # that still sits there got outdated. + next unless $class->get_handler($propname) eq $class; + $ret{$propname} = $row->{'value'}; } Modified: trunk/cgi-bin/LJ/User/PropStorage.pm =================================================================== --- trunk/cgi-bin/LJ/User/PropStorage.pm 2011-01-11 05:41:59 UTC (rev 18007) +++ trunk/cgi-bin/LJ/User/PropStorage.pm 2011-01-11 10:40:17 UTC (rev 18008) @@ -13,12 +13,16 @@ Carp::confess "Error loading module '$class': $@" if $@; } +my %handlers_map; + sub get_handler { my ($class, $propname) = @_; + return $handlers_map{$propname} if $handlers_map{$propname}; + foreach my $class (@SUBCLASSES) { next unless $class->can_handle($propname); - return $class; + return ( $handlers_map{$propname} = $class ); } Carp::croak 'cannot get a handler for prop=' . $propname;