OpenInteract2/Manage/Website/InstallPackageStructure.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« OpenInteract2/Manage/Website/InstallPackageSecurity.pm ↑ Summary OpenInteract2/Manage/Website/CreateSuperuserPassword.pm »
1 package OpenInteract2::Manage::Website::InstallPackageStructure;
2  
3 # $Id: InstallPackageStructure.pm,v 1.15 2005/03/17 14:58:04 sjn Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use base qw( OpenInteract2::Manage::Website );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use OpenInteract2::Context qw( CTX );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 0 ▶use OpenInteract2::SQLInstall;
Subroutine BEGIN: called CC=1 SCAR=2.6
9  
10 $OpenInteract2::Manage::Website::InstallPackageStructure::VERSION = sprintf("%d.%02d", q$Revision: 1.15 $ =~ /(\d+)\.(\d+)/);
11  
12 sub get_name {
13 return 'install_sql_structure';
14 }
15  
16 sub get_brief_description {
17 return 'Install the data structures for one or more packages to a website';
18 }
19  
20 sub get_parameters {
21 my ( $self ) = @_;
22 return {
23 website_dir => $self->_get_website_dir_param,
24 package => $self->_get_package_param,
25 file => {
26 description => 'Process only the listed structure file(s); if unspecified all are processed',
27 is_required => 'no',
28 is_multivalued => 'yes',
29 },
30 };
31 }
32  
33 sub setup_task {
34 my ( $self ) = @_;
35 $self->_setup_context( { skip => 'activate spops' } );
36 }
37  
38 sub run_task {
39 my ( $self ) = @_;
40 my $repository = CTX->repository;
41  
42 PACKAGE:
43 foreach my $package_name ( @{ $self->param( 'package' ) } ) {
44 my $action = 'install SQL structure';
45 my $installer = $self->_get_package_installer(
46 $action, $repository, $package_name );
47 next PACKAGE unless ( $installer );
48 my @restrict_to = grep { $_ } $self->param( 'file' );
49 $installer->install_structure( @restrict_to );
50 my @install_status = $installer->get_status;
51 for ( @install_status ) {
52 $_->{action} = $action;
53 $_->{package} = $package_name;
54 }
55 $self->_add_status( @install_status );
56 }
57 }
58  
59 OpenInteract2::Manage->register_factory_type( get_name() => __PACKAGE__ );
60  
61 1;
62  
63 __END__
« OpenInteract2/Manage/Website/InstallPackageSecurity.pm ↑ Summary OpenInteract2/Manage/Website/CreateSuperuserPassword.pm »