Changeset 4981

Show
Ignore:
Timestamp:
11/04/09 07:00:19 (3 weeks ago)
Author:
takayama
Message:

* Added missing subroutine.

Location:
branches/greyhound-rc-1/lib/MT
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/greyhound-rc-1/lib/MT/Upgrade.pm

    r4847 r4981  
    1919use vars qw(%classes %functions %LegacyPerms $App $DryRun $Installing $SuperUser 
    2020            $CLI $MAX_TIME $MAX_ROWS @steps); 
     21 
     22sub app { 
     23    return $App; 
     24} 
     25 
     26sub superuser { 
     27    return $SuperUser; 
     28} 
    2129 
    2230sub max_rows { 
  • branches/greyhound-rc-1/lib/MT/Upgrade/v3.pm

    r4975 r4981  
    691691 
    692692sub core_set_superuser { 
    693 # TODO 
    694 #    my $self = shift; 
    695 # 
    696 #    local $SuperUser = $opt{SuperUser} || ''; 
    697 # 
    698 #    my $app = $App; 
    699 #    my $author; 
    700 #    if ((ref $app) && ($app->{author})) { 
    701 #        require MT::Author; 
    702 #        $self->progress($self->translate_escape("Setting your permissions to administrator.")); 
    703 #        $author = MT::Author->load($app->{author}->id); 
    704 #    } elsif ($SuperUser) { 
    705 #        require MT::Author; 
    706 #        $self->progress($self->translate_escape("Setting your permissions to administrator.")); 
    707 #        $author = MT::Author->load($SuperUser); 
    708 #    } 
    709 # 
    710 #    if ($author) { 
    711 #        $author->is_superuser(1); 
    712 #        $author->save or return $self->error($self->translate_escape("Error saving record: [_1].", $author->errstr)); 
    713 #    } 
    714 # 
     693    my $self = shift; 
     694 
     695    my $SuperUser = $self->superuser(); 
     696    my $app = $self->app(); 
     697    my $author; 
     698    if ( ( ref $app ) && ( $app->{author} ) ) { 
     699        require MT::Author; 
     700        $self->progress( 
     701            $self->translate_escape( 
     702                "Setting your permissions to administrator.") 
     703        ); 
     704        $author = MT::Author->load( $app->{author}->id ); 
     705    } 
     706    elsif ($SuperUser) { 
     707        require MT::Author; 
     708        $self->progress( 
     709            $self->translate_escape( 
     710                "Setting your permissions to administrator.") 
     711        ); 
     712        $author = MT::Author->load($SuperUser); 
     713    } 
     714 
     715    if ($author) { 
     716        $author->is_superuser(1); 
     717        $author->save 
     718            or return $self->error( 
     719            $self->translate_escape( 
     720                "Error saving record: [_1].", 
     721                $author->errstr 
     722            ) 
     723            ); 
     724    } 
     725 
    715726    1; 
    716727}