Puppet Class: role::mediainfo

Defined in:
puppet/modules/role/manifests/mediainfo.pp

Overview

Class: role::mediainfo

This role sets up a Wikibase repo with the WikibaseMediaInfo extension enabled.

THIS IS A PROTOTYPE!

Parameters:

  • central_repo_domain (Any)
  • multimedia_domain (Any)


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
# File 'puppet/modules/role/manifests/mediainfo.pp', line 7

class role::mediainfo (
    $central_repo_domain,
    $multimedia_domain,
) {
    include ::role::commons
    include ::role::wikidata
    include ::role::wikibasecirrussearch
    include ::role::uls

    # Global settings/extension loads always precede per-wiki ones
    # in Vagrant so we have to pretend this is a global one and use
    # hackier means to bind to a specific wiki.
    mediawiki::settings { 'Wikibase-WikibaseMediaInfo':
      priority => $::load_early, # before Wikibase
      header   => 'if ( $wgDBname === "commonswiki" ) {',
      values   => {
          wgWBCSUseCirrus      => true,
          wgEnableWikibaseRepo => true,
      },
      footer   => '}',
    }

    mediawiki::extension { 'WikibaseMediaInfo':
        wiki         => 'commons',
        composer     => true,
        needs_update => true,
        settings     => template('role/mediainfo/settings.php.erb'),
    }

    # This is probably not the right way to create Wikibase entities...
    ['P1', 'P2'].each |String $id| {
        mediawiki::import::text { "Property:${id}":
            wiki    => 'wikidata',
            db_name => 'wikidatawiki',
            content => template("role/mediainfo/${id}.json.erb"),
        }
    }
    ['Q1', 'Q2', 'Q3', 'Q4'].each |String $id| {
        mediawiki::import::text { $id:
            wiki    => 'wikidata',
            db_name => 'wikidatawiki',
            content => template("role/mediainfo/${id}.json.erb"),
        }
    }

    mediawiki::settings { 'WikibaseMediaInfo-UploadWizard':
        wiki     => 'commons',
        priority => $::load_later,
        values   => [
            '$wgUploadWizardConfig["wikibase"]["enabled"] = true;',
            '$wgUploadWizardConfig["wikibase"]["statements"] = true;',
        ],
    }
}