Changeset 346
- Timestamp:
- 01/25/11 00:48:32 (13 years ago)
- Location:
- server/trunk/web/lib/Sophie
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Base/Result/Arch.pm
r4 r346 10 10 __PACKAGE__->belongs_to(Release => 'Sophie::Base::Result::Release', 'd_release'); 11 11 __PACKAGE__->has_many(Medias => 'Sophie::Base::Result::Medias', 'd_arch'); 12 __PACKAGE__->has_many(MetaPaths => 'Sophie::Base::Result::MetaPaths', 'd_arch'); 12 13 13 14 1; -
server/trunk/web/lib/Sophie/Base/Result/MetaPaths.pm
r333 r346 10 10 __PACKAGE__->belongs_to(Archs => 'Sophie::Base::Result::Arch', 'd_arch'); 11 11 __PACKAGE__->has_many(Paths => 'Sophie::Base::Result::Paths', 'meta_path'); 12 __PACKAGE__->add_unique_constraint('upath' => [ 'd_arch', 'path', 'type' ]); 12 13 13 14 1; -
server/trunk/web/lib/Sophie/Controller/Admin.pm
r316 r346 129 129 ->search_related('Medias', $media ? (label => $media) : ()) 130 130 ->search_related('MediasPaths') 131 ->search_related('Paths' )->get_column('path')131 ->search_related('Paths', { meta_path => undef })->get_column('path') 132 132 ->all ]; 133 } 134 135 sub list_meta_path :XMLRPC { 136 my ($self, $c, $distribution, $version, $arch, $media) = @_; 137 138 if (ref $distribution) { 139 ($distribution, $version, $arch, $media) = 140 ( 141 $distribution->{distribution}, 142 $distribution->{release}, 143 $distribution->{arch}, 144 $version, 145 ); 146 } 147 148 $c->stash->{xmlrpc} = [ 149 $c->model('Base')->resultset('Distribution') 150 ->search($distribution ? (name => $distribution) : ()) 151 ->search_related('Release', $version ? (version => $version) : ()) 152 ->search_related('Arch', $arch ? (arch => $arch) : ()) 153 ->search_related('MetaPaths') 154 ->get_column('path')->all ]; 133 155 } 134 156 … … 272 294 } 273 295 296 $ref->{metapath} = [ map { { $_->get_columns } } 297 $c->model('Base')->resultset('Distribution') 298 ->search({ name => $distribution->{distribution} }) 299 ->search_related('Release', { version => $distribution->{release} }) 300 ->search_related('Arch', { arch => $distribution->{arch} }) 301 ->search_related('MetaPaths') 302 ->search({}, 303 { 304 'select' => [ qw(path type) ], 305 'as' => [ qw(path type) ] , 306 } 307 )->all ]; 308 274 309 $c->stash->{xmlrpc} = freeze($ref); 310 } 311 312 sub add_meta_path : XMLRPC { 313 my ($self, $c, $distrib, $meta, $type) = @_; 314 315 my ($dist) = 316 $c->model('Base')->resultset('Distribution') 317 ->search(name => $distrib->{distribution}) 318 ->search_related('Release', version => $distrib->{release}) 319 ->search_related('Arch', arch => $distrib->{arch}) 320 ->get_column('d_arch_key')->all or do { 321 return $c->stash->{xmlrpc} = "No such distrib"; 322 }; 323 324 if ($c->model('Base::MetaPaths')->find_or_create( 325 { 326 d_arch => $dist, 327 type => $type, 328 path => $meta, 329 }, 330 { key => 'upath' }, 331 )) { 332 return $c->stash->{xmlrpc} = 'OK'; 333 } else { 334 return; 335 } 336 275 337 } 276 338 … … 323 385 } 324 386 } 387 foreach my $meta (@{ $ref->{metapath} || []}) { 388 $c->forward('add_meta_path', 389 [ $ref->{distrib}, $meta->{path}, $meta->{type} ]); 390 } 325 391 326 392 #$c->model('Base')->storage->dbh->rollback;
Note: See TracChangeset
for help on using the changeset viewer.