Changeset 185


Ignore:
Timestamp:
12/24/10 21:20:04 (13 years ago)
Author:
nanardon
Message:
  • add admin functions
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Admin.pm

    r104 r185  
    7777} 
    7878 
     79sub remove_media :XMLRPC { 
     80    my ( $self, $c, $distribspec, $medianame) = @_; 
     81 
     82    my $med = $c->model('Base::Medias')->find( 
     83        { 
     84            label => $medianame, 
     85            d_arch => $c->model('Base')->resultset('Distribution') 
     86                ->search(name => $distribspec->{distribution}) 
     87                ->search_related('Release', version => $distribspec->{release}) 
     88                ->search_related('Arch', arch => 
     89                    $distribspec->{arch})->next->d_arch_key, 
     90        } 
     91    ); 
     92 
     93    if ($med->delete) { 
     94            $c->stash->{xmlrpc} = 'OK'; 
     95            $c->model('Base')->storage->dbh->commit; 
     96    } else { 
     97            $c->stash->{xmlrpc} = "Cannot delete $medianame"; 
     98    } 
     99} 
     100 
    79101sub list_path :XMLRPC { 
    80102    my ($self, $c, $distribution, $version, $arch, $media) = @_; 
     
    197219} 
    198220 
     221sub remove_path : XMLRPC { 
     222    my ($self, $c, $path) = @_; 
     223 
     224    my $dpath = $c->model('Base::Paths')->find({ 
     225        path => $path, 
     226    }) or do { 
     227        return $c->stash->{xmlrpc} = 'Path not found'; 
     228    }; 
     229 
     230 
     231    $dpath->delete and $c->model('Base')->storage->dbh->commit; 
     232    return $c->stash->{xmlrpc} = 'OK'; 
     233} 
     234 
     235 
    199236sub dump_distrib : XMLRPC { 
    200237    my ($self, $c, $distribution, $version, $arch) = @_; 
Note: See TracChangeset for help on using the changeset viewer.