Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/diffusion/config/PhabricatorDiffusionConfigOptions.php
12242 views
1
<?php
2
3
final class PhabricatorDiffusionConfigOptions
4
extends PhabricatorApplicationConfigOptions {
5
6
public function getName() {
7
return pht('Diffusion');
8
}
9
10
public function getDescription() {
11
return pht('Configure Diffusion repository browsing.');
12
}
13
14
public function getIcon() {
15
return 'fa-code';
16
}
17
18
public function getGroup() {
19
return 'apps';
20
}
21
22
public function getOptions() {
23
$custom_field_type = 'custom:PhabricatorCustomFieldConfigOptionType';
24
25
$fields = array(
26
new PhabricatorCommitRepositoryField(),
27
new PhabricatorCommitBranchesField(),
28
new PhabricatorCommitTagsField(),
29
new PhabricatorCommitMergedCommitsField(),
30
);
31
32
$default_fields = array();
33
foreach ($fields as $field) {
34
$default_fields[$field->getFieldKey()] = array(
35
'disabled' => $field->shouldDisableByDefault(),
36
);
37
}
38
39
return array(
40
$this->newOption(
41
'metamta.diffusion.attach-patches',
42
'bool',
43
false)
44
->setBoolOptions(
45
array(
46
pht('Attach Patches'),
47
pht('Do Not Attach Patches'),
48
))
49
->setDescription(
50
pht(
51
'Set this to true if you want patches to be attached to commit '.
52
'notifications from Diffusion.')),
53
$this->newOption('metamta.diffusion.inline-patches', 'int', 0)
54
->setSummary(pht('Include patches in Diffusion mail as body text.'))
55
->setDescription(
56
pht(
57
'To include patches in Diffusion email bodies, set this to a '.
58
'positive integer. Patches will be inlined if they are at most '.
59
'that many lines. By default, patches are not inlined.')),
60
$this->newOption('metamta.diffusion.byte-limit', 'int', 1024 * 1024)
61
->setDescription(pht('Hard byte limit on including patches in email.')),
62
$this->newOption('metamta.diffusion.time-limit', 'int', 60)
63
->setDescription(pht('Hard time limit on generating patches.')),
64
65
$this->newOption(
66
'audit.can-author-close-audit',
67
'bool',
68
false)
69
->setBoolOptions(
70
array(
71
pht('Enable Self-Accept'),
72
pht('Disable Self-Accept'),
73
))
74
->setDescription(
75
pht(
76
'Allows the author of a commit to be an auditor and accept their '.
77
'own commits. Note that this behavior is different from the '.
78
'behavior implied by the name of the option: long ago, it did '.
79
'something else.')),
80
81
$this->newOption('bugtraq.url', 'string', null)
82
->addExample('https://bugs.php.net/%BUGID%', pht('PHP bugs'))
83
->addExample('/%BUGID%', pht('Local Maniphest URL'))
84
->setDescription(
85
pht(
86
'URL of external bug tracker used by Diffusion. %s will be '.
87
'substituted by the bug ID.',
88
'%BUGID%')),
89
$this->newOption('bugtraq.logregex', 'list<regex>', array())
90
->addExample(array('/\B#([1-9]\d*)\b/'), pht('Issue #123'))
91
->addExample(
92
array('/[Ii]ssues?:?(\s*,?\s*#\d+)+/', '/(\d+)/'),
93
pht('Issue #123, #456'))
94
->addExample(array('/(?<!#)\b(T[1-9]\d*)\b/'), pht('Task T123'))
95
->addExample('/[A-Z]{2,}-\d+/', pht('JIRA-1234'))
96
->setDescription(
97
pht(
98
'Regular expression to link external bug tracker. See '.
99
'http://tortoisesvn.net/docs/release/TortoiseSVN_en/'.
100
'tsvn-dug-bugtracker.html for further explanation.')),
101
$this->newOption('diffusion.allow-http-auth', 'bool', false)
102
->setBoolOptions(
103
array(
104
pht('Allow HTTP Basic Auth'),
105
pht('Disallow HTTP Basic Auth'),
106
))
107
->setSummary(pht('Enable HTTP Basic Auth for repositories.'))
108
->setDescription(
109
pht(
110
"This server can serve repositories over HTTP, using HTTP basic ".
111
"auth.\n\n".
112
"Because HTTP basic auth is less secure than SSH auth, it is ".
113
"disabled by default. You can enable it here if you'd like to use ".
114
"it anyway. There's nothing fundamentally insecure about it as ".
115
"long as this server uses HTTPS, but it presents a much lower ".
116
"barrier to attackers than SSH does.\n\n".
117
"Consider using SSH for authenticated access to repositories ".
118
"instead of HTTP.")),
119
$this->newOption('diffusion.allow-git-lfs', 'bool', false)
120
->setBoolOptions(
121
array(
122
pht('Allow Git LFS'),
123
pht('Disallow Git LFS'),
124
))
125
->setLocked(true)
126
->setSummary(pht('Allow Git Large File Storage (LFS).'))
127
->setDescription(
128
pht(
129
'This server supports Git LFS, a Git extension for storing large '.
130
'files alongside a repository. Activate this setting to allow '.
131
'the extension to store file data.')),
132
$this->newOption('diffusion.ssh-user', 'string', null)
133
->setLocked(true)
134
->setSummary(pht('Login username for SSH connections to repositories.'))
135
->setDescription(
136
pht(
137
'When constructing clone URIs to show to users, Diffusion will '.
138
'fill in this login username. If you have configured a VCS user '.
139
'like `git`, you should provide it here.')),
140
$this->newOption('diffusion.ssh-port', 'int', null)
141
->setLocked(true)
142
->setSummary(pht('Port for SSH connections to repositories.'))
143
->setDescription(
144
pht(
145
'When constructing clone URIs to show to users, Diffusion by '.
146
'default will not display a port assuming the default for your '.
147
'VCS. Explicitly declare when running on a non-standard port.')),
148
$this->newOption('diffusion.ssh-host', 'string', null)
149
->setLocked(true)
150
->setSummary(pht('Host for SSH connections to repositories.'))
151
->setDescription(
152
pht(
153
'If you accept SSH traffic on a different host from web traffic '.
154
'(for example, if you use different SSH and web load balancers), '.
155
'you can set the SSH hostname here. This is an advanced option.')),
156
$this->newOption('diffusion.fields', $custom_field_type, $default_fields)
157
->setCustomData(
158
id(new PhabricatorRepositoryCommit())
159
->getCustomFieldBaseClass())
160
->setDescription(
161
pht('Select and reorder Diffusion fields.')),
162
);
163
}
164
165
}
166
167