Changeset 104


Ignore:
Timestamp:
12/09/10 23:58:25 (13 years ago)
Author:
nanardon
Message:
  • add admin/replace_path function
Location:
server/trunk/web/lib/Sophie
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Base/Result/Paths.pm

    r6 r104  
    88__PACKAGE__->add_columns(qw/d_path_key path added updated/); 
    99__PACKAGE__->set_primary_key('d_path_key'); 
     10__PACKAGE__->add_unique_constraint('path' => [ 'path' ]); 
    1011#__PACKAGE__->belongs_to(media => 'Sophie::Base::Result::Medias', 'media'); 
    1112__PACKAGE__->has_many(MediasPaths => 'Sophie::Base::Result::MediasPaths', 'd_path'); 
  • server/trunk/web/lib/Sophie/Controller/Admin.pm

    r68 r104  
    177177} 
    178178 
     179sub replace_path : XMLRPC { 
     180    my ($self, $c, $path, $newpath) = @_; 
     181 
     182    my $dpath = $c->model('Base::Paths')->find({ 
     183        path => $path, 
     184    }) or do { 
     185        return $c->stash->{xmlrpc} = 'Path not found'; 
     186    }; 
     187 
     188    $newpath =~ s/\/*$//; 
     189 
     190    $dpath->update( 
     191        { 
     192            updated => undef, 
     193            path => $newpath, 
     194        } 
     195    ) and $c->model('Base')->storage->dbh->commit; 
     196    return $c->stash->{xmlrpc} = 'OK'; 
     197} 
     198 
    179199sub dump_distrib : XMLRPC { 
    180200    my ($self, $c, $distribution, $version, $arch) = @_; 
Note: See TracChangeset for help on using the changeset viewer.