1 |
dpavlin |
139 |
use strict; |
2 |
|
|
use warnings; |
3 |
|
|
|
4 |
dpavlin |
174 |
package A3C::Model::StrixInstance; |
5 |
dpavlin |
139 |
use Jifty::DBI::Schema; |
6 |
|
|
|
7 |
|
|
use A3C::Record schema { |
8 |
|
|
|
9 |
dpavlin |
174 |
column instance => |
10 |
|
|
label is _('Instance identifier'), |
11 |
dpavlin |
139 |
is mandatory, |
12 |
|
|
is disctinct, |
13 |
|
|
is immutable, |
14 |
|
|
is indexed; |
15 |
|
|
|
16 |
|
|
# same as Strix's conf.php variables |
17 |
|
|
|
18 |
|
|
column _site_name => |
19 |
|
|
label is _('Descriptive name'), |
20 |
|
|
is indexed, |
21 |
|
|
is distinct; |
22 |
|
|
|
23 |
|
|
column _site_admin => |
24 |
|
|
label is _('Admin e-mail'); |
25 |
|
|
|
26 |
|
|
column _site_is_root => |
27 |
|
|
type is 'boolean'; |
28 |
|
|
|
29 |
|
|
column _dbserver => |
30 |
|
|
is mandatory; |
31 |
|
|
|
32 |
|
|
column _dbname => |
33 |
|
|
is mandatory; |
34 |
|
|
|
35 |
|
|
column _skole_external_uid => |
36 |
|
|
type is 'int'; |
37 |
|
|
|
38 |
|
|
column _mail_on_error => |
39 |
|
|
type is 'boolean'; |
40 |
|
|
|
41 |
|
|
column _auth_type_name => |
42 |
|
|
label is _('Auth type'); |
43 |
|
|
|
44 |
|
|
column __arhiva => |
45 |
|
|
type is 'boolean', |
46 |
|
|
default is 0; |
47 |
|
|
|
48 |
|
|
column _force_nossl => |
49 |
|
|
label is _('Disable SSL'), |
50 |
|
|
type is 'boolean', |
51 |
|
|
default is 0; |
52 |
|
|
|
53 |
|
|
}; |
54 |
|
|
|
55 |
|
|
sub since { '0.0.3' }; |
56 |
|
|
|
57 |
|
|
# Your model-specific methods go here. |
58 |
|
|
|
59 |
|
|
use A3C::DefaultACL; |
60 |
|
|
|
61 |
dpavlin |
191 |
=head2 has_sites |
62 |
|
|
|
63 |
|
|
my $collection = A3C::Model::StrixInstance->has_sites; |
64 |
|
|
|
65 |
|
|
=cut |
66 |
|
|
|
67 |
|
|
sub has_sites { |
68 |
|
|
my $self = shift; |
69 |
|
|
|
70 |
|
|
my $collection = A3C::Model::StrixSiteCollection->new; |
71 |
|
|
$collection->limit( column => 'instance', value => $self->instance ); |
72 |
|
|
Jifty->log->debug("Instance ", $self->instance, " has ", $collection->count, " sites"); |
73 |
|
|
return $collection; |
74 |
|
|
} |
75 |
|
|
|
76 |
dpavlin |
194 |
|
77 |
dpavlin |
139 |
1; |