Committer: vtroitsky
LJSUP-13467: Selfpromo/CommPromo model refactoring required for Journal Promo. Early commented code was removed.U trunk/cgi-bin/LJ/Pay/SelfPromo.pm
Modified: trunk/cgi-bin/LJ/Pay/SelfPromo.pm =================================================================== --- trunk/cgi-bin/LJ/Pay/SelfPromo.pm 2012-09-14 13:06:57 UTC (rev 12650) +++ trunk/cgi-bin/LJ/Pay/SelfPromo.pm 2012-09-14 13:51:50 UTC (rev 12651) @@ -1154,124 +1154,6 @@ $class->SUPER::raise_error($code, %args); } - -# TODO: Candidate to move it to PromotionSlot -#sub was_promoted { -# my ($class, $slot, $object) = @_; -# return undef unless ($object->type eq PROMO_OBJECT_TYPE_ENTRY); -# return LJ::MemCache::get_or_set( -# $slot->was_promoted_key($object->ownerid, $object->ditemid), sub { -# my $res = LJ::Pay::Promotion->find_promotions({ slot => $slot, ditemid => $object->ditemid, posterid => $object->ownerid }); -# return @$res? 1 : 0; -# }, 7200 -# ); -#} - -#sub raise_error { -# my ( $class, @args ) = @_; -# LJ::Pay::SelfPromo::Error->raise(@args); -#} - -#sub lock { -# my ($class, $slot) = @_; -# return LJ::Pay::SelfPromo::Lock->new($slot ? $slot->slot_id : $class->class()); -#} - -#sub lock_taken { -# my ($class, $slot) = @_; -# return LJ::Pay::SelfPromo::Lock->taken($slot ? $slot->slot_id : $class->class()); -#} - -#sub lock_taken_elsewhere { -# my ($class, $slot) = @_; -# return LJ::Pay::SelfPromo::Lock->taken_elsewhere($slot ? $slot->slot_id : $class->class()); -#} - -#sub debug_msg { -# my ( $class, @args ) = @_; -# -# return unless LJ::is_enabled('selfpromo_debug'); -# -# my $hostname = Sys::Hostname::hostname(); -# my $time = localtime; - -# my $msg = join( '', -# "[shop/selfpromo, pid=$$, host=$hostname, time=$time] ", @args ); - -# my ( $package, $filename, $line, $sub ) = caller(1); -# warn "$msg in sub ${package}::${sub} at $filename line $line\n"; -#} - -#package LJ::Pay::SelfPromo::Error; -# -#sub raise { -# my ( $class, $type, $details ) = @_; -# die bless { 'type' => $type, 'details' => $details }, $class; -#} - -#sub type { shift->{'type'} } -#sub details { shift->{'details'} } - -#package LJ::Pay::SelfPromo::Lock; - -#my $locked; - -#sub new { -# my ($class, @names) = @_; - -# LJ::Pay::SelfPromo->debug_msg("trying to acquire lock"); - -# my $name = join('_', 'selfpromo', @names); - -# if ( $LJ::REQ_GLOBAL{$name} ) { -# LJ::Pay::SelfPromo->debug_msg("... already got it, skipping"); -# return; -# } - -# my $lock_result = LJ::get_lock( LJ::get_db_writer(), 'global', $name ); - -# unless ($lock_result) { -# LJ::Pay::SelfPromo->debug_msg( -# "LJ::get_lock returned false, throwing an exception" ); -# die "Can't get lock"; -# } - -# LJ::Pay::SelfPromo->debug_msg("locked successfully"); - -# $LJ::REQ_GLOBAL{$name} = 1; -# $locked = $name; -# return bless {}, $class; -#} - -#sub DESTROY { -# my ($self) = @_; - -# LJ::Pay::SelfPromo->debug_msg("releasing the lock"); - - ## warning: this code may be called during exception "stack unwind" step. - ## if original exception ($@) is not saved, it will be lost. -# local $@; - -# LJ::release_lock( LJ::get_db_writer(), 'global', $locked ) unless $locked eq ''; -# $LJ::REQ_GLOBAL{$locked} = 0; -# $locked = ''; -#} - -#sub taken { -# my ($class, @names) = @_; -# my $name = join('_', 'selfpromo', @names); -# my $result = LJ::lock_taken( LJ::get_db_writer(), 'global', $name ); -# LJ::Pay::SelfPromo->debug_msg("lock taken => $result"); -# return $result; -#} - -#sub taken_elsewhere { -# my ($class, @names) = @_; -# my $result = ! $locked && $class->taken(@names); -# LJ::Pay::SelfPromo->debug_msg("lock taken elsewhere => $result"); -# return $result; -#} - 1; __END__