Changeset 14070 for trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm
- Timestamp:
- 07/23/08 23:30:03 (5 years ago)
- Files:
-
- 1 modified
-
trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/cgi-bin/LJ/Console/Command/Unsuspend.pm
r12444 r14070 7 7 sub cmd { "unsuspend" } 8 8 9 sub desc { "Unsuspend an account ." }9 sub desc { "Unsuspend an account or entry." } 10 10 11 11 sub args_desc { [ 12 'username or email address ' => "The username of the account to unsuspend, or an email address to unsuspend all accounts at that address.",13 'reason' => "Why you're unsuspending the account .",12 'username or email address or entry url' => "The username of the account to unsuspend, or an email address to unsuspend all accounts at that address, or an entry URL to unsuspend a single entry within an account", 13 'reason' => "Why you're unsuspending the account or entry", 14 14 ] } 15 15 16 sub usage { '<username or email address > <reason>' }16 sub usage { '<username or email address or entry url> <reason>' } 17 17 18 18 sub can_execute { … … 26 26 return $self->error("This command takes two arguments. Consult the reference.") 27 27 unless $user && $reason && scalar(@args) == 0; 28 29 my $remote = LJ::get_remote(); 30 my $entry = LJ::Entry->new_from_url($user); 31 if ($entry) { 32 my $poster = $entry->poster; 33 my $journal = $entry->journal; 34 35 return $self->error("Invalid entry.") 36 unless $entry->valid; 37 38 return $self->error("Journal and/or poster is purged; cannot unsuspend entry.") 39 if $poster->is_expunged || $journal->is_expunged; 40 41 return $self->error("Entry is not currently suspended.") 42 if $entry->is_visible; 43 44 $entry->set_prop( statusvis => "V" ); 45 $entry->set_prop( unsuspend_supportid => 0 ) 46 if $entry->prop("unsuspend_supportid"); 47 48 $reason = "entry: " . $entry->url . "; reason: $reason"; 49 LJ::statushistory_add($journal, $remote, "unsuspend", $reason); 50 LJ::statushistory_add($poster, $remote, "unsuspend", $reason) 51 unless $journal->equals($poster); 52 53 return $self->print("Entry " . $entry->url . " unsuspended."); 54 } 28 55 29 56 my @users; … … 72 99 $u->{statusvis} = 'V'; 73 100 74 my $remote = LJ::get_remote();75 101 LJ::statushistory_add($u, $remote, "unsuspend", $reason); 76 102 eval { $u->fb_push }; 77 103 warn "Error running fb_push: $@\n" if $@ && $LJ::IS_DEV_SERVER; 78 104 79 $self-> info("User '$username' unsuspended.");105 $self->print("User '$username' unsuspended."); 80 106 } 81 107
