This file is indexed.

/usr/share/perl5/MojoMojo/Schema.pm is in libmojomojo-perl 1.10+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package MojoMojo::Schema;
use Moose;

our $VERSION = '1';

has 'attachment_dir' => ( is => 'rw', isa => 'Str' );

use parent 'DBIx::Class::Schema';

__PACKAGE__->load_namespaces( default_resultset_class => '+MojoMojo::Schema::Base::ResultSet' );

=head1 NAME

MojoMojo::Schema - DBIC Schema

=head1 METHODS

=head2 create_initial_data

Creates initial set of data in the database which is necessary to run MojoMojo.

=cut

sub create_initial_data {
    my ($schema, $config, $custom_values) = @_;

    my $file = __PACKAGE__ . ".pm";
    $file =~ s{::}{/}g;
    my $path = $INC{$file};
    $path =~ s{Schema\.pm$}{I18N};

    require Locale::Maketext::Simple;
    Locale::Maketext::Simple->import(
        Decode => 1,
        Class  => 'MojoMojo',
        Path   => $path,
    );
    my $lang = $config->{'default_lang'} || 'en';
    $lang =~ s/\..*$//;
    loc_lang($lang);

    my $default_user = $ENV{USER} || 'admin';

    $custom_values ||= {
        wiki_name       => 'MojoMojo',
        admin_username  => 'admin',
        admin_password  => 'admin',
        admin_fullname  => $default_user,
        admin_email     => "$default_user\@localhost",
        anonymous_email => 'anonymous.coward@localhost',
    };

    print "Creating initial data\n";

    my @people = $schema->populate(
        'Person',
        [
            [
                qw/ active views photo login name email pass timezone born gender occupation industry interests movies music /
            ],
            [
                1, 0, 0, loc('anonymouscoward'), loc('Anonymous Coward'), $custom_values->{anonymous_email},
                '', '', undef, '', '', '', '', '', ''
            ],
            [
                1, 0, 0, $custom_values->{admin_username}, $custom_values->{admin_fullname}, $custom_values->{admin_email},
                $custom_values->{admin_password}, '', undef, '', '', '', '', '', ''
            ],
        ]
    );

    my @roles = $schema->populate(
        'Role',
        [
            [ qw/ name active / ],
            [ loc('Admins'), 1 ],
            [ loc('Users'),  1 ],
            [ loc('Anonymous'),  1 ]
        ]
    );

    my @role_members = $schema->populate(
        'RoleMember',
        [
            [ qw/role person admin/ ],
            [ $roles[0]->id, $people[1]->id, 1 ],
            [ $roles[2]->id, $people[0]->id, 0 ]
        ]
    );

     my @path_permissions = $schema->populate(
         'PathPermissions',
         [
             [ qw/path role apply_to_subpages create_allowed delete_allowed edit_allowed view_allowed attachment_allowed / ],
             [ '/', $roles[0]->id, qw/ no yes yes yes yes yes / ],
             [ '/', $roles[0]->id, qw/yes yes yes yes yes yes / ],
             [ '/', $roles[1]->id, qw/ no yes no  yes yes yes / ],
             [ '/', $roles[1]->id, qw/yes yes no  yes yes yes / ],
             [ '/', $roles[2]->id, qw/ no yes no  yes yes no / ],
             [ '/', $roles[2]->id, qw/yes yes no  yes yes no / ]
         ]
     );


    my @prefs = $schema->populate(
        'Preference',
        [
            [qw/ prefkey prefvalue /],
            [ 'name', $custom_values->{wiki_name} ],
            [ 'admins', $custom_values->{admin_username} ],
            [ 'theme',  $config->{'theme'} || 'default' ],
            [ 'open_registration', $config->{'open_registration'} || 1 ],
            [ 'anonymous_user', 'anonymouscoward' ],
        ]
    );

    my @pages = $schema->populate(
        'Page',
        [
            [qw/ version parent name name_orig depth lft rgt content_version /],
            [ undef, undef, '/',     '/',     0, 1, 5, undef ],
            [ undef, 1,     'help',  loc('Help'),  1, 2, 3, undef ],
            [ undef, 1,     'admin', 'Admin', 1, 4, 5, undef ],
        ]
    );

    my @pageversions = $schema->populate(
        'PageVersion',
        [
            [
                qw/page version parent parent_version name name_orig depth
                    content_version_first content_version_last creator status created
                    release_date remove_date comments/
            ],
            [
                1, 1, undef, undef, '/', '/', 0, undef, undef, $people[1]->id, '', 0, '', '', ''
            ],
            [
                2, 1, 1, undef, 'help', 'Help', 0, undef, undef, $people[1]->id, '', 0, '', '',
                ''
            ],
            [
                3, 1, 1, undef, 'admin', 'Admin', 0, undef, undef, $people[1]->id, '', 0, '',
                '', ''
            ],
        ]
    );

    my @content = $schema->populate(
        'Content',
        [
            [
                qw/ page version creator created body status release_date remove_date type abstract comments
                    precompiled /
            ],
            [
                1, 1, $people[1]->id, 0, loc('welcome message', "test"),
                'released', 1, 1, '', '', '', ''
            ],
            [
                2, 1, $people[1]->id, 0, loc('help message'),
                'released', 1, 1, '', '', '', ''
            ],
            [
                3, 1, $people[1]->id, 0, loc('admin home page'),
                'released', 1, 1, '', '', ''
            ],
        ]
    );

    $schema->resultset('Page')->update( { version         => 1 } );
    $schema->resultset('Page')->update( { content_version => 1 } );
    $schema->resultset('PageVersion')->update( { content_version_first => 1 } );
    $schema->resultset('PageVersion')->update( { content_version_last  => 1 } );

    print "Success!\n";
}

=head1 AUTHOR

Marcus Ramberg <mramberg@cpan.org>

=head1 LICENSE

This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;