Changeset 41 for server/trunk
- Timestamp:
- 11/27/10 20:15:04 (14 years ago)
- Location:
- server/trunk/web/lib/Sophie
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Base/Result/Medias.pm
r5 r41 7 7 __PACKAGE__->table('d_media'); 8 8 __PACKAGE__->add_columns( 9 qw/d_media_key label comment group_label d_arch dist_label/9 qw/d_media_key label comment group_label d_arch/ 10 10 ); 11 11 __PACKAGE__->set_primary_key('d_media_key'); 12 12 __PACKAGE__->belongs_to(Arch => 'Sophie::Base::Result::Arch', 'd_arch'); 13 13 __PACKAGE__->has_many(MediasPaths => 'Sophie::Base::Result::MediasPaths', 'd_media'); 14 __PACKAGE__->add_unique_constraint('label' => [ 'label', 'd_arch' ]); 14 15 15 16 1; -
server/trunk/web/lib/Sophie/Controller/Admin.pm
r32 r41 60 60 ->search_related('Arch', arch => $distribspec->{arch})->next; 61 61 if ($d) { 62 my $new = my $rs = $c->model('Base')->resultset('Medias')->new({ 62 my $new = my $rs = $c->model('Base')->resultset('Medias') 63 ->update_or_create({ 63 64 %{ $mediaspec }, 64 65 Arch => $d, 65 }); 66 if ($new->insert) { 66 }, 67 { key => 'label' } 68 ); 69 if ($new) { 67 70 $c->stash->{xmlrpc} = 'OK'; 68 71 $c->model('Base')->storage->dbh->commit; … … 132 135 } 133 136 137 sub media_remove_path :XMLRPC { 138 my ( $self, $c, $distribution, $version, $arch, $label, $path ) = @_; 139 140 if (ref $distribution) { 141 ($distribution, $version, $arch, $label, $path) = 142 ( 143 $distribution->{distribution}, 144 $distribution->{release}, 145 $distribution->{arch}, 146 $version, 147 $arch, 148 ); 149 } 150 151 $path =~ s/\/*$//; 152 $path =~ s/\/+/\//g; 153 154 my $med = $c->model('Base')->resultset('Distribution') 155 ->search(name => $distribution) 156 ->search_related('Release', version => $version) 157 ->search_related('Arch', arch => $arch) 158 ->search_related('Medias', label => $label)->next or return; 159 160 my $rspath = $c->model('Base')->resultset('Paths') 161 ->find({ path => $path }) or do { 162 return; 163 }; 164 my $new = $c->model('Base')->resultset('MediasPaths')->new({ 165 Medias => $med, 166 Paths => $rspath, 167 }); 168 $new->delete; 169 170 $c->model('Base')->storage->dbh->commit; 171 } 172 173 sub ls_local : XMLRPC { 174 my ($self, $c, $path) = @_; 175 176 $c->stash->{xmlrpc} = [ <$path*> ]; 177 } 134 178 135 179 =head1 AUTHOR -
server/trunk/web/lib/Sophie/Controller/Distrib.pm
r27 r41 69 69 ->search_related('Release', { version => $release }) 70 70 ->search_related('Arch', { arch => $arch }) 71 ->search_related('Medias') ;72 @{$c->stash->{xmlrpc}} =map {71 ->search_related('Medias')->search({}, { order_by => 'label' }); 72 $c->stash->{xmlrpc} = [ map { 73 73 { 74 dist_label => $_->dist_label,75 74 label => $_->label, 76 75 group_label => $_->group_label, 77 76 key => $_->d_media_key, 78 77 } 79 } $rs->all ;78 } $rs->all ]; 80 79 } 81 80 -
server/trunk/web/lib/Sophie/Controller/Root.pm
r23 r41 88 88 } 89 89 $c->stash->{data} = $c->stash->{xmlrpc}; 90 $c->model('Base')->storage->dbh-> rollback;90 $c->model('Base')->storage->dbh->commit; 91 91 } 92 92 -
server/trunk/web/lib/Sophie/Model/Base.pm
r35 r41 9 9 dsn => 'toto', 10 10 }, 11 12 11 ); 13 12
Note: See TracChangeset
for help on using the changeset viewer.