Committer: ssafronova
LJSUP-4203: Userpic Add-on - LJSUP-4457: move bulk code to class structure - cleaning unneeded codeU branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm U branches/shop/cgi-bin/paylib.pl U branches/shop/htdocs/admin/accounts/acctedit.bml
Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm =================================================================== --- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm 2009-08-05 07:01:46 UTC (rev 7540) +++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon.pm 2009-08-05 11:12:37 UTC (rev 7541) @@ -26,7 +26,6 @@ 'name' => 'pay.product.extrastorage', 'type' => 'sized', 'cap' => undef, # optional - 'apply_hook' => \&LJ::Pay::Payment::PayItem::Addon::diskquota_apply_hook, 'items' => { # 1024*10 = 10240 = 10GB 10240 => { @@ -50,43 +49,6 @@ delete $bonus{$itemname}; } -sub diskquota_apply_hook -{ - my ($u, $item) = @_; - - # RIP old business model: this is where used to enqueue a - # white-labeled-parent-site ping to update what a user's quota - # should be. for instance: deadjournal pinging LJ where LJ was - # hosting all of DJ's photo hosting under DJ's style. DJ ran this - # on their beta site for a bit, but we never went into business - # with it. (around time of SixApart acquistion, and 6a wasn't - # interested in FotoBilder code/services). now this code is - # removed because we're killing cmdbuffer usage now that all - # cmdbuffer is moving to using our new job queue system. -} - -sub get_bonus_exp { - my ($u, @items) = @_; - return undef unless @items && ! grep { ! LJ::Pay::is_bonus($_) } @items; - my $userid = LJ::want_userid($u); - return undef unless $userid; - - my $dbh = LJ::get_db_writer() - or return undef; - - my $bind = join(',', map { "?" } @items); - my $sth = $dbh->prepare - ("SELECT item, UNIX_TIMESTAMP(expdate) FROM paidexp WHERE userid=? AND item IN ($bind)"); - $sth->execute($userid, @items); - - my %ret = (); - while (my ($it, $exp) = $sth->fetchrow_array) { - $ret{$it} = $exp; - } - - return \%ret; -} - # upgrade or extend the length of a bonus item # qty - 0..98: number of months to add # 99: permanent account (historically) @@ -251,14 +213,6 @@ return undef if $dbh->err; } - # call any application hooks for this bonus feature - my $apply_hook = $LJ::Pay::bonus{$item}->{'apply_hook'}; - if ($apply_hook && ref $apply_hook eq 'CODE') { - # apply_hook needs a real $u object - $u = ref $u ? $u : LJ::load_userid($u); - $apply_hook->($u, $item); - } - # log this bonus feature activation { my $msg = "adding bonus feature: item=$item; "; @@ -281,9 +235,7 @@ sub expire_bonus { my ($u, $item, $force) = @_; - # allow u/payitem objects passed optionally my $userid = LJ::want_userid($u); - $item = $item->{'item'} if ref $item; return undef unless $userid; my $dbh = LJ::get_db_writer(); @@ -305,8 +257,6 @@ my @activated = (); while (my ($item) = $sth->fetchrow_array) { - next unless LJ::Pay::is_bonus($item); - # remove cap if there's one associated with this bonus item if (my $cap = $LJ::Pay::bonus{$item}->{'cap'}) { LJ::modify_caps($userid, [], [$cap]) Modified: branches/shop/cgi-bin/paylib.pl =================================================================== --- branches/shop/cgi-bin/paylib.pl 2009-08-05 07:01:46 UTC (rev 7540) +++ branches/shop/cgi-bin/paylib.pl 2009-08-05 11:12:37 UTC (rev 7541) @@ -73,7 +73,6 @@ sub add_paid_time { return LJ::Pay::Payment::PayItem::PaidAccount::add_paid_time(@_); } sub get_account_exp { return LJ::Pay::Payment::PayItem::PaidAccount::get_account_exp(@_); } -sub get_bonus_exp { return LJ::Pay::Payment::PayItem::Addon::get_bonus_exp(@_); } sub remove_paid_time { return LJ::Pay::Payment::PayItem::PaidAccount::remove_paid_time(@_); } sub new_rename_token { return LJ::Pay::Payment::PayItem::Rename::new_rename_token(@_); } sub clothing_availability { return LJ::Pay::Payment::PayItem::Clothes::clothing_availability(@_); } Modified: branches/shop/htdocs/admin/accounts/acctedit.bml =================================================================== --- branches/shop/htdocs/admin/accounts/acctedit.bml 2009-08-05 07:01:46 UTC (rev 7540) +++ branches/shop/htdocs/admin/accounts/acctedit.bml 2009-08-05 11:12:37 UTC (rev 7541) @@ -288,12 +288,6 @@ $logmsg .= "[insert] item: $itemname, expdate: $exp, size: $size, daysleft: $days\n"; } - - # call any necessary apply_hooks - my $apply_hook = $bitem->{apply_hook}; - if ($apply_hook && ref $apply_hook eq 'CODE') { - $apply_hook->($u, $itemname); - } } # note which caps were changed and log $logmsg to statushistory