OSDN Git Service

Initial version.
[mtpm/PluginManager.git] / lib / PluginManager / Installed.pm
1 package PluginManager::Installed;
2 use strict;
3
4 use MT::Object;
5 use base qw( MT::Object );
6 @PluginManager::Installed::ISA = qw( MT::Object );
7 __PACKAGE__->install_properties({
8                 column_defs => {
9                         'id' => 'integer not null auto_increment',
10                         'signature' => 'string(255) not null',
11                         'version' => 'string(255) not null',
12                         'files' => 'text not null',
13                         'control' => 'text not null',
14                         'script' => 'blob not null',
15                 },
16                 indexes => {
17                         signature => 1,
18                         version => 1,
19                 },
20                 primary_key => 'id',
21                 datasource => 'pm_installed',
22                 audit => 1,
23         });
24 1;
25
26 sub make_control_locale {
27         my $self = shift;
28         my ($locale) = @_;
29
30         require YAML::Tiny;
31         my $yaml = YAML::Tiny->read_string($self->control);
32
33         $yaml->[0]{$locale} || $yaml->[0]{'en-us'};
34 }