|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @package midcom |
|
4
|
|
|
* @author CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
5
|
|
|
* @copyright CONTENT CONTROL http://www.contentcontrol-berlin.de/ |
|
6
|
|
|
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Core configuration defaults. |
|
13
|
|
|
* |
|
14
|
|
|
* As always, you must not change this file. Instead, you have two levels of customization, |
|
15
|
|
|
* merged in the order listed here: |
|
16
|
|
|
* |
|
17
|
|
|
* <b>Site-specific configuration:</b> |
|
18
|
|
|
* |
|
19
|
|
|
* MidCOM will include the file <i>midcom::get()->config->get('midcom_config_basedir') . /midcom.conf</i> which must be a regular |
|
20
|
|
|
* PHP file. You may populate the global array $midcom_config_site in this file. It should |
|
21
|
|
|
* list all options that apply to all installations (like the Cache backend selection |
|
22
|
|
|
* or the indexer host). |
|
23
|
|
|
* |
|
24
|
|
|
* Example: |
|
25
|
|
|
* |
|
26
|
|
|
* <code> |
|
27
|
|
|
* $GLOBALS['midcom_config_site']['cache_module_content_backend'] = |
|
28
|
|
|
* ['directory' => 'content/', 'driver' => 'sqlite']; |
|
29
|
|
|
* </code> |
|
30
|
|
|
* |
|
31
|
|
|
* <b>Instance-specific configuration:</b> |
|
32
|
|
|
* |
|
33
|
|
|
* After including the site itself, MidCOM also merges the contents of the global array |
|
34
|
|
|
* $midcom_config_local, which may hold configuration data for the website itself. |
|
35
|
|
|
* |
|
36
|
|
|
* These settings must be set for all sites: |
|
37
|
|
|
* - midcom_root_topic_guid |
|
38
|
|
|
* |
|
39
|
|
|
* You will usually include these lines somewhere before actually including MidCOM. |
|
40
|
|
|
* |
|
41
|
|
|
* <code> |
|
42
|
|
|
* $GLOBALS['midcom_config_local']['midcom_root_topic_guid'] = '123456789...'; |
|
43
|
|
|
* </code> |
|
44
|
|
|
* |
|
45
|
|
|
* <b>Configuration setting overview:</b> |
|
46
|
|
|
* |
|
47
|
|
|
* The following configuration options are available for the MidCOM core along |
|
48
|
|
|
* with their defaults, shown in alphabetical order: |
|
49
|
|
|
* |
|
50
|
|
|
* <b>Authentication configuration</b> |
|
51
|
|
|
* |
|
52
|
|
|
* - <b>boolean allow_sudo:</b> Set this to true (the default) to allow components to |
|
53
|
|
|
* request super user privileges for certain operations. This is mainly used to allow |
|
54
|
|
|
* anonymous access to the system without having to store a user account everywhere. |
|
55
|
|
|
* - <b>string auth_backend:</b> The authentication backend to use, the "simple" |
|
56
|
|
|
* backend is used as a default. |
|
57
|
|
|
* - <b>boolean auth_check_client_ip:</b> Control whether to check the client IP address |
|
58
|
|
|
* on each subsequent request when authentication a user. This is enabled by default |
|
59
|
|
|
* as it will make session hijacking much harder. You should not turn it off unless |
|
60
|
|
|
* you have very good reasons to do. |
|
61
|
|
|
* - <b>int auth_login_session_timeout:</b> The login session timeout to use, this |
|
62
|
|
|
* defaults to 3600 seconds (1 hour). Use 0 to have the session stay active until manual logout |
|
63
|
|
|
* - <b>string auth_frontend:</b> The authentication frontend to use, the "form" frontend |
|
64
|
|
|
* is used by default. |
|
65
|
|
|
* - <b>int auth_login_form_httpcode</b>: HTTP return code used in MidCOM login screens, |
|
66
|
|
|
* either 403 (403 Forbidden) or 200 (200 OK), defaulting to 403. |
|
67
|
|
|
* |
|
68
|
|
|
* <b>Authentication Backend configuration: "simple"</b> |
|
69
|
|
|
* |
|
70
|
|
|
* - <b>auth_backend_simple_cookie_secure:</b> Set the "secure" flag on cookie, defaults to true, applies only when actually using SSL/TLS |
|
71
|
|
|
* - <b>auth_backend_simple_cookie_id:</b> The ID appended to the cookie prefix, separating |
|
72
|
|
|
* auth cookies for different sites. Defaults to 1. |
|
73
|
|
|
* |
|
74
|
|
|
* <b>Cache configuration</b> |
|
75
|
|
|
* |
|
76
|
|
|
* - <b>array cache_autoload_queue:</b> The cache module loading queue during startup, you |
|
77
|
|
|
* should normally have no need to change this (unless you want to add your own caching modules, |
|
78
|
|
|
* in which case you have to ensure that the loading queue of MidCOM itself (as seen in this |
|
79
|
|
|
* file) is not changed. |
|
80
|
|
|
* - <b>string cache_base_directory:</b> The directory where to place cache files for MidCOM. |
|
81
|
|
|
* This defaults to {project_dir}/var/cache |
|
82
|
|
|
* |
|
83
|
|
|
* - <b>Array cache_module_content_backend:</b> The configuration of the content cache backend. |
|
84
|
|
|
* Check the documentation of midcom_services_cache_backend of what options are available here. |
|
85
|
|
|
* In general, you should use this only to change the backend driver. |
|
86
|
|
|
* In all other cases you should leave this option untouched. The defaults are to store all |
|
87
|
|
|
* cache databases into the 'content/' subdirectory of the cache base directory. |
|
88
|
|
|
* - <b>string cache_module_content_name:</b> The identifier, the content cache should use for |
|
89
|
|
|
* naming the files/directories it creates. This defaults to a string constructed out of the |
|
90
|
|
|
* host's name, port and prefix. You should only change this if you run multiple MidCOM |
|
91
|
|
|
* sites on the same host. |
|
92
|
|
|
* - <b>boolean cache_module_content_uncached:</b> Set this to true if you want the site to run in an uncached |
|
93
|
|
|
* mode. This is different from cache_disable in that the regular header preprocessing is |
|
94
|
|
|
* done anyway, allowing for browser side caching. Essentially, the computing order is the |
|
95
|
|
|
* same (no_cache for example is considered like usual), but the cache file is not stored. |
|
96
|
|
|
* This defaults to false. |
|
97
|
|
|
* - <b>string cache_module_content_headers_strategy:</b> Valid values are<br/> |
|
98
|
|
|
* 'no-cache' activates no-cache mode that actively tries to circumvent all caching<br/> |
|
99
|
|
|
* 'revalidate' is the default which sets 'must-revalidate'. Expires defaults to the current time, so this behaves like 'no-cache' unless expires() is called<br/> |
|
100
|
|
|
* 'public' and 'private' enable caching with the cache-control header of the same name, default expiry timestamps are generated using the cache_module_content_default_lifetime |
|
101
|
|
|
* - <b>int cache_module_content_default_lifetime:</b> How many seconds from now to set the default Expires header to, defaults to 15 minutes. Also used as default expiry time for content-cache entries that have no expiry set. |
|
102
|
|
|
* - <b>string cache_module_content_headers_strategy_authenticated:</b> Defaults to 'private', this is equivalent to cache_module_content_headers_strategy but applies when we have authenticated user. |
|
103
|
|
|
* - <b>int cache_module_content_default_lifetime_authenticated:</b> defaults to 0, equivalent to cache_module_content_default_lifetime but applies to authenticated users (except this does not set content-cache expiry). These two options are added to combat braindead proxies. |
|
104
|
|
|
* - <b>string cache_module_content_caching_strategy:</b> Valid values are<br/> |
|
105
|
|
|
* 'user' the "classic" mode, per user content-cache, default<br/> |
|
106
|
|
|
* 'memberships' cache per group memberships (users that have same memberships share same cache), for many cases this should offer more performance and smaller cache but if you use per-user privileges or other user specific processing this will cause hard-to-debug issues<br/> |
|
107
|
|
|
* 'public' everything goes to single public cache, disabling logins altogether will likely be safer. |
|
108
|
|
|
* - <b>string cache_module_memcache_backend:</b> The cache backend to use for the memcache caching |
|
109
|
|
|
* module. The default is null, which disables the module entirely. This is the default. If you |
|
110
|
|
|
* have both memcached and the memcached PHP extension installed, set this to 'memcached', to enable |
|
111
|
|
|
* the cache. |
|
112
|
|
|
* - <b>Array cache_module_memcache_backend_config:</b> The backend configuration to use if a backend |
|
113
|
|
|
* was specified. See the individual backend documentations for more information about the allowed |
|
114
|
|
|
* option set. This defaults to an empty array. |
|
115
|
|
|
* - <b>Array cache_module_memcache_data_groups:</b> The data groups available for the memcache module. |
|
116
|
|
|
* You should normally not have to touch this, see the memcache module documentation for details. |
|
117
|
|
|
* This defaults to ['ACL', 'PARENT']. |
|
118
|
|
|
* |
|
119
|
|
|
* See also midcom_services_cache, the midcom_services_cache_backend class hierarchy and |
|
120
|
|
|
* the midcom_services_cache_module class hierarchy. |
|
121
|
|
|
* |
|
122
|
|
|
* <b>Indexer configuration</b> |
|
123
|
|
|
* |
|
124
|
|
|
* - <b>string indexer_index_name:</b> The default Index to use when indexing the website. This defaults to |
|
125
|
|
|
* a string constructed out of the host's name, port and prefix. You should only change this if you run |
|
126
|
|
|
* the same MidCOM site across multiple hosts. |
|
127
|
|
|
* - <b>string indexer_backend:</b> The default indexer backend to use. This defaults to the false, |
|
128
|
|
|
* indicating that <i>no</i> indexing should be done. Right now, the SOLR backend is recommended. |
|
129
|
|
|
* - <b>indexer_reindex_allowed_ips:</b> Array of IPs that don't need to basic authenticate themselves |
|
130
|
|
|
* to run MidCOM reindexing or cron. |
|
131
|
|
|
* |
|
132
|
|
|
* <b>Indexer backend configuration: SOLR module</b> |
|
133
|
|
|
* |
|
134
|
|
|
* - <b>string indexer_xmltcp_host:</b> The host name or IP address where the indexer daemon is running. |
|
135
|
|
|
* This defaults to "tcp://127.0.0.1", which is the default bind address of the daemon. |
|
136
|
|
|
* - <b>int indexer_xmltcp_port:</b> The port to which to connect. This defaults to 8983, which is the |
|
137
|
|
|
* default port of the daemon. |
|
138
|
|
|
* |
|
139
|
|
|
* <b>Logging configuration</b> |
|
140
|
|
|
* |
|
141
|
|
|
* - <b>string log_filename:</b> The filename to dump logging messages to, this |
|
142
|
|
|
* defaults to {kernel.logs_dir}/midcom.log. |
|
143
|
|
|
* - <b>int log_level:</b> The logging level to use when starting up the logger, set to |
|
144
|
|
|
* MIDCOM_LOG_ERROR by default. You cannot use the MIDCOM* constants when setting |
|
145
|
|
|
* micdom_config_local, as they are not defined at that point. Use 0 for CRITICAL, |
|
146
|
|
|
* 1 for ERROR, 2 for WARNING, 3 for INFO and 4 for DEBUG level logging. |
|
147
|
|
|
* - <b>array error_actions:</b> Actions to run when a specific error code is produced. This can |
|
148
|
|
|
* be used for saving logs about 404 errors from broken links, or sending an error 500 to |
|
149
|
|
|
* webmaster for analysis. |
|
150
|
|
|
* |
|
151
|
|
|
* Configuration example: |
|
152
|
|
|
* |
|
153
|
|
|
* <code> |
|
154
|
|
|
* $GLOBALS['midcom_config_local']['error_actions'] = array |
|
155
|
|
|
* ( |
|
156
|
|
|
* 500 => array |
|
157
|
|
|
* ( |
|
158
|
|
|
* 'action' => 'email', |
|
159
|
|
|
* 'email' => '[email protected]', |
|
160
|
|
|
* ), |
|
161
|
|
|
* 404 => array |
|
162
|
|
|
* ( |
|
163
|
|
|
* 'action' => 'log', |
|
164
|
|
|
* 'filename' => '/var/log/broken_links.log', |
|
165
|
|
|
* ), |
|
166
|
|
|
* ); |
|
167
|
|
|
* </code> |
|
168
|
|
|
* |
|
169
|
|
|
* <b>MidCOM Core configuration</b> |
|
170
|
|
|
* |
|
171
|
|
|
* - <b>GUID midcom_root_topic_guid:</b> This is the GUID of the topic we should handle. |
|
172
|
|
|
* This must be set on a per-site basis, otherwise MidCOM won't start up. |
|
173
|
|
|
* - <b>string midcom_sgconfig_basedir:</b> The base snippetdir where the current |
|
174
|
|
|
* sites' configuration is stored. This defaults to "/sitegroup-config" which will |
|
175
|
|
|
* result in the original default shared sitegroup-wide configuration. |
|
176
|
|
|
* - <b>string midcom_site_url:</b> The fully qualified URL to the Website. A trailing |
|
177
|
|
|
* slash is required. It defaults to '/'. |
|
178
|
|
|
* If an absolute local URL is given to this value, the full URL of the current host |
|
179
|
|
|
* is prefixed to its value, so that this configuration key can be used for Location |
|
180
|
|
|
* headers. You must not use a relative URL. This key will be completed by the MidCOM |
|
181
|
|
|
* Application constructor, before that, it might contain a URL which is not suitable |
|
182
|
|
|
* for relocations. |
|
183
|
|
|
* - <b>string midcom_tempdir:</b> A temporary directory that can be used when components |
|
184
|
|
|
* need to write out files. Defaults to '/tmp'. |
|
185
|
|
|
* - <b>mixed midcom_max_memory:</b> The maximum memory limit to use doing resource-intensive tasks |
|
186
|
|
|
* like when reindexing the entire site, which can require quite some amount of memory, as the complete NAP |
|
187
|
|
|
* cache has to be loaded and binary indexing can take some memory, too. Defaults to -1. |
|
188
|
|
|
* - <b>mixed midcom_max_execution_time:</b> The maximum execution time for resource-intensive tasks |
|
189
|
|
|
* - <b>array midcom_components:</b> Additional out-of-tree components as name => path pairs |
|
190
|
|
|
* |
|
191
|
|
|
* <b>RCS system</b> |
|
192
|
|
|
* |
|
193
|
|
|
* <b>string midcom_services_rcs_bin_dir</b>: the prefix for the rcs utilities (default: /usr/bin) |
|
194
|
|
|
* <b>string midcom_services_rcs_root </b>: the directory where the rcs files get placed. (default: must be set!) |
|
195
|
|
|
* <b>boolean midcom_services_rcs_enable</b>: if set, midcom will fail hard if the rcs service is not operational. (default: false) |
|
196
|
|
|
* |
|
197
|
|
|
* <b>Style Engine</b> |
|
198
|
|
|
* |
|
199
|
|
|
* - <b>Array styleengine_default_styles:</b> Use this array to set site-wide default |
|
200
|
|
|
* styles to be used for the components. This is an array indexing component name to |
|
201
|
|
|
* style path. Components not present in this array use the default style delivered |
|
202
|
|
|
* with the component. Any style set directly on a topic or inherited to it will |
|
203
|
|
|
* override these settings. This defaults to an empty Array. |
|
204
|
|
|
* |
|
205
|
|
|
* <b>Toolbars System</b> |
|
206
|
|
|
* |
|
207
|
|
|
* The CSS classes and IDs used by the toolbars service can be configured using these |
|
208
|
|
|
* options: |
|
209
|
|
|
* |
|
210
|
|
|
* - <b>string toolbars_host_style_class:</b> defaults to "midcom_toolbar host_toolbar" |
|
211
|
|
|
* - <b>string toolbars_host_style_id:</b> defaults to "" |
|
212
|
|
|
* - <b>string toolbars_node_style_class:</b> defaults to "midcom_toolbar node_toolbar" |
|
213
|
|
|
* - <b>string toolbars_node_style_id:</b> defaults to "" |
|
214
|
|
|
* - <b>string toolbars_view_style_class:</b> defaults to midcom_toolbar view_toolbar |
|
215
|
|
|
* - <b>string toolbars_view_style_id:</b> defaults to "" |
|
216
|
|
|
* - <b>string toolbars_object_style_class:</b> defaults to midcom_toolbar object_toolbar |
|
217
|
|
|
* - <b>string toolbars_simple_css_path:</b> this defaults to MIDCOM_STATIC_URL/midcom.services.toolbars/simple.css |
|
218
|
|
|
* and is used to set the css for the toolbars used with onsite editing. |
|
219
|
|
|
* - <b>boolean toolbars_enable_centralized:</b> defaults to true, whether to enable the centralized, |
|
220
|
|
|
* javascript-floating MidCOM toolbar that users can display with midcom::get()->toolbars->show(); |
|
221
|
|
|
* |
|
222
|
|
|
* <b>Utility Programs</b> |
|
223
|
|
|
* |
|
224
|
|
|
* The various paths set here lead to the utility programs required by MidCOM, both |
|
225
|
|
|
* mandatory and optional applications are listed here. To indicate that a certain |
|
226
|
|
|
* application is unavailable, set it to null. The defaults assume that the files are within the |
|
227
|
|
|
* $PATH of the Apache user and should be sufficient in most cases. Package maintainers |
|
228
|
|
|
* are encouraged to make the paths explicit. |
|
229
|
|
|
* |
|
230
|
|
|
* - <b>string utility_imagemagick_base:</b> The base path of the ImageMagick executables, |
|
231
|
|
|
* the tools <i>mogrify</i>, <i>identify</i> and <i>convert</i> are needed for almost |
|
232
|
|
|
* all kinds of image operations in MidCOM and have to be present therefore. The path |
|
233
|
|
|
* entered here requires a trailing slash. |
|
234
|
|
|
* - <b>string utility_jpegtran:</b> JPEGTran is used to do lossless rotation of JPEG |
|
235
|
|
|
* images for automatic EXIF rotation in n.s.photos for example. If unavailable, |
|
236
|
|
|
* there is an automatic fallback to imagemagick. |
|
237
|
|
|
* - <b>string utility_catdoc:</b> Transforms Word Documents into text for indexing. |
|
238
|
|
|
* - <b>string utility_pdftotext:</b> Transforms PDF Documents into text for indexing. |
|
239
|
|
|
* - <b>string utility_unrtf:</b> Transforms RTF Documents into text files for indexing. |
|
240
|
|
|
* |
|
241
|
|
|
* <b>Visibility settings (NAP and DBA)</b> |
|
242
|
|
|
* |
|
243
|
|
|
* - <b>boolean show_hidden_objects:</b> This flag indicates whether objects that are |
|
244
|
|
|
* invisible either by explicit hiding or by their scheduling should be shown anyway. |
|
245
|
|
|
* This defaults to true at this time |
|
246
|
|
|
* - <b>boolean show_unapproved_objects:</b> This flag indicates whether objects should be |
|
247
|
|
|
* shown even if they are not approved. This defaults to true. |
|
248
|
|
|
* |
|
249
|
|
|
* @package midcom |
|
250
|
|
|
*/ |
|
251
|
|
|
class midcom_config implements ArrayAccess |
|
252
|
|
|
{ |
|
253
|
|
|
private $_default_config = [ |
|
254
|
|
|
// Authentication configuration |
|
255
|
|
|
'auth_type' => 'Legacy', |
|
256
|
|
|
'auth_backend' => 'simple', |
|
257
|
|
|
'auth_backend_simple_cookie_id' => 1, |
|
258
|
|
|
'auth_login_session_timeout' => 3600, |
|
259
|
|
|
'auth_login_session_update_interval' => 300, |
|
260
|
|
|
'auth_frontend' => 'form', |
|
261
|
|
|
'auth_check_client_ip' => true, |
|
262
|
|
|
'auth_allow_sudo' => true, |
|
263
|
|
|
'auth_login_form_httpcode' => 403, |
|
264
|
|
|
'auth_save_prev_login' => false, |
|
265
|
|
|
'auth_allow_trusted' => false, |
|
266
|
|
|
'person_class' => 'openpsa_person', |
|
267
|
|
|
|
|
268
|
|
|
// set secure flag on cookie (applies only when using SSL) |
|
269
|
|
|
'auth_backend_simple_cookie_secure' => true, |
|
270
|
|
|
|
|
271
|
|
|
// Cache configuration |
|
272
|
|
|
'cache_base_directory' => '', |
|
273
|
|
|
'cache_autoload_queue' => ['content', 'nap', 'memcache'], |
|
274
|
|
|
|
|
275
|
|
|
// Content Cache |
|
276
|
|
|
'cache_module_content_name' => 'auto', |
|
277
|
|
|
|
|
278
|
|
|
//Memory Caching Daemon |
|
279
|
|
|
'cache_module_memcache_backend' => 'flatfile', |
|
280
|
|
|
'cache_module_memcache_backend_config' => [], |
|
281
|
|
|
'cache_module_memcache_data_groups' => ['ACL', 'PARENT', 'L10N', 'MISC'], |
|
282
|
|
|
|
|
283
|
|
|
// Defaults: |
|
284
|
|
|
'cache_module_content_backend' => ['driver' => 'flatfile'], |
|
285
|
|
|
'cache_module_content_uncached' => true, |
|
286
|
|
|
'cache_module_content_headers_strategy' => 'revalidate', |
|
287
|
|
|
'cache_module_content_headers_strategy_authenticated' => 'private', |
|
288
|
|
|
// Seconds, added to gmdate() for expiry timestamp (in case no other expiry is set), |
|
289
|
|
|
// also used as default expiry for content-cache entries that have no expiry set |
|
290
|
|
|
'cache_module_content_default_lifetime' => 900, |
|
291
|
|
|
// as above but concerns only authenticated state |
|
292
|
|
|
'cache_module_content_default_lifetime_authenticated' => 0, |
|
293
|
|
|
// Valid options are 'user' (default), 'memberships' and 'public' |
|
294
|
|
|
'cache_module_content_caching_strategy' => 'user', |
|
295
|
|
|
|
|
296
|
|
|
// CRON Service configuration |
|
297
|
|
|
'cron_day_hours' => 0, |
|
298
|
|
|
'cron_day_minutes' => 0, |
|
299
|
|
|
'cron_hour_minutes' => 30, |
|
300
|
|
|
|
|
301
|
|
|
// I18n Subsystem configuration |
|
302
|
|
|
'i18n_available_languages' => null, |
|
303
|
|
|
'i18n_fallback_language' => 'en', |
|
304
|
|
|
|
|
305
|
|
|
// Indexer Configuration |
|
306
|
|
|
'indexer_backend' => false, |
|
307
|
|
|
'indexer_index_name' => 'auto', |
|
308
|
|
|
'indexer_reindex_allowed_ips' => ['127.0.0.1'], |
|
309
|
|
|
|
|
310
|
|
|
'indexer_config_options' => ['fl' => '*,score', 'rows' => 1000, 'defType' => 'dismax', 'qf' => 'content'], |
|
311
|
|
|
|
|
312
|
|
|
// XMLTCP indexer backend |
|
313
|
|
|
'indexer_xmltcp_host' => "127.0.0.1", |
|
314
|
|
|
'indexer_xmltcp_port' => 8983, |
|
315
|
|
|
'indexer_xmltcp_core' => null, |
|
316
|
|
|
|
|
317
|
|
|
// Logging Configuration |
|
318
|
|
|
'log_filename' => null, |
|
319
|
|
|
'log_level' => MIDCOM_LOG_ERROR, |
|
320
|
|
|
'error_actions' => [], |
|
321
|
|
|
|
|
322
|
|
|
// Core configuration |
|
323
|
|
|
'midcom_root_topic_guid' => '', |
|
324
|
|
|
'midcom_config_basedir' => '/etc/midgard/', |
|
325
|
|
|
'midcom_sgconfig_basedir' => '/sitegroup-config', |
|
326
|
|
|
'midcom_site_url' => '/', |
|
327
|
|
|
'midcom_site_title' => '', |
|
328
|
|
|
'midcom_tempdir' => '/tmp', |
|
329
|
|
|
'midcom_max_memory' => -1, |
|
330
|
|
|
'midcom_max_execution_time' => 0, |
|
331
|
|
|
'midcom_components' => [], |
|
332
|
|
|
|
|
333
|
|
|
// Visibility settings (NAP) |
|
334
|
|
|
'show_hidden_objects' => true, |
|
335
|
|
|
'show_unapproved_objects' => true, |
|
336
|
|
|
// Style Engine defaults |
|
337
|
|
|
'styleengine_default_styles' => [], |
|
338
|
|
|
|
|
339
|
|
|
// Toolbars service |
|
340
|
|
|
'toolbars_host_style_class' => 'midcom_toolbar host_toolbar', |
|
341
|
|
|
'toolbars_host_style_id' => null, |
|
342
|
|
|
'toolbars_node_style_class' => 'midcom_toolbar node_toolbar', |
|
343
|
|
|
'toolbars_node_style_id' => null, |
|
344
|
|
|
'toolbars_view_style_class' => 'midcom_toolbar view_toolbar', |
|
345
|
|
|
'toolbars_view_style_id' => null, |
|
346
|
|
|
'toolbars_help_style_class' => 'midcom_toolbar help_toolbar', |
|
347
|
|
|
'toolbars_help_style_id' => null, |
|
348
|
|
|
'toolbars_simple_css_path' => null, |
|
349
|
|
|
'toolbars_enable_centralized' => true, |
|
350
|
|
|
|
|
351
|
|
|
// Public attachment caching directives |
|
352
|
|
|
'attachment_cache_enabled' => false, |
|
353
|
|
|
'attachment_cache_root' => '/var/lib/midgard/vhosts/example.net/80/midcom-static/blobs', |
|
354
|
|
|
'attachment_cache_url' => '/midcom-static/blobs', |
|
355
|
|
|
|
|
356
|
|
|
//X-sendfile support |
|
357
|
|
|
'attachment_xsendfile_enable' => false, |
|
358
|
|
|
|
|
359
|
|
|
// Utilities |
|
360
|
|
|
'utility_imagemagick_base' => '', |
|
361
|
|
|
'utility_jpegtran' => 'jpegtran', |
|
362
|
|
|
'utility_catdoc' => 'catdoc', |
|
363
|
|
|
'utility_pdftotext' => 'pdftotext', |
|
364
|
|
|
'utility_unrtf' => 'unrtf', |
|
365
|
|
|
|
|
366
|
|
|
'midcom_services_rcs_bin_dir' => '/usr/bin', |
|
367
|
|
|
'midcom_services_rcs_backend_class' => midcom_services_rcs_backend_rcs::class, |
|
368
|
|
|
'midcom_services_rcs_root' => '', |
|
369
|
|
|
'midcom_services_rcs_enable' => true, |
|
370
|
|
|
|
|
371
|
|
|
// Metadata system |
|
372
|
|
|
|
|
373
|
|
|
// Enables approval/scheduling controls (does not influence visibility checks using |
|
374
|
|
|
// show_unapproved_objects). Disabled by default. Unsafe to Link Prefetching! |
|
375
|
|
|
'metadata_approval' => false, |
|
376
|
|
|
'metadata_scheduling' => false, |
|
377
|
|
|
'metadata_lock_timeout' => 60, // Time in minutes |
|
378
|
|
|
'staging2live_staging' => false, |
|
379
|
|
|
|
|
380
|
|
|
// Set the datamanager schema used by the Metadata Service |
|
381
|
|
|
'metadata_schema' => 'file:/midcom/config/metadata_default.inc', |
|
382
|
|
|
|
|
383
|
|
|
// Map MidCOM metadata properties to HTML meta tags |
|
384
|
|
|
'metadata_head_elements' => [ |
|
385
|
|
|
'published' => 'DC.date', |
|
386
|
|
|
'description' => 'description', |
|
387
|
|
|
], |
|
388
|
|
|
|
|
389
|
|
|
// Whether to gather and display Open Graph Protocol metadata for Midgard pages |
|
390
|
|
|
'metadata_opengraph' => false, |
|
391
|
|
|
|
|
392
|
|
|
// Component system |
|
393
|
|
|
// Show only these components when creating or editing |
|
394
|
|
|
'component_listing_allowed' => null, |
|
395
|
|
|
'component_listing_excluded' => null, |
|
396
|
|
|
|
|
397
|
|
|
// Page class (body class) |
|
398
|
|
|
// If this argument is set to true, sanitized name of the component is added to the page class string. |
|
399
|
|
|
'page_class_include_component' => true, |
|
400
|
|
|
|
|
401
|
|
|
// If this argument is set to true, All midcom_show_style calls wrap the style with HTML comments defining the style path |
|
402
|
|
|
'wrap_style_show_with_name' => false, |
|
403
|
|
|
|
|
404
|
|
|
// Related to JavaScript libraries |
|
405
|
|
|
'jquery_version' => '3.4.1.min', |
|
406
|
|
|
'jquery_ui_version' => '1.12.1', |
|
407
|
|
|
'jquery_ui_theme' => null, |
|
408
|
|
|
'jquery_load_from_google' => false, |
|
409
|
|
|
|
|
410
|
|
|
/** |
|
411
|
|
|
* Sessioning service, disabling the service will help with external caches. |
|
412
|
|
|
* The second option is to allow logged in users to benefit from the service |
|
413
|
|
|
*/ |
|
414
|
|
|
'sessioning_service_enable' => true, |
|
415
|
|
|
'sessioning_service_always_enable_for_users' => true, |
|
416
|
|
|
|
|
417
|
|
|
/** |
|
418
|
|
|
* Trash cleanup, purge deleted objects after X days |
|
419
|
|
|
*/ |
|
420
|
|
|
'cron_purge_deleted_after' => 25, |
|
421
|
|
|
|
|
422
|
|
|
/** |
|
423
|
|
|
* Theme support |
|
424
|
|
|
*/ |
|
425
|
|
|
'theme' => '', |
|
426
|
|
|
]; |
|
427
|
|
|
|
|
428
|
|
|
private $_merged_config = []; |
|
429
|
|
|
|
|
430
|
8 |
|
public function __construct() |
|
431
|
|
|
{ |
|
432
|
8 |
|
$this->_complete_defaults(); |
|
433
|
|
|
|
|
434
|
8 |
|
$this->_merged_config = array_merge( |
|
435
|
8 |
|
$this->_default_config, |
|
436
|
8 |
|
$GLOBALS['midcom_config_site'] ?? [], |
|
437
|
8 |
|
$GLOBALS['midcom_config_local'] ?? [] |
|
438
|
|
|
); |
|
439
|
8 |
|
} |
|
440
|
|
|
|
|
441
|
8 |
|
private function _complete_defaults() |
|
442
|
|
|
{ |
|
443
|
8 |
|
if (class_exists('Memcached')) { |
|
444
|
8 |
|
$this->_default_config['cache_module_content_backend'] = ['driver' => 'memcached']; |
|
445
|
8 |
|
$this->_default_config['cache_module_memcache_backend'] = 'memcached'; |
|
446
|
|
|
} |
|
447
|
8 |
|
if (isset($_SERVER['SERVER_ADDR'])) { |
|
448
|
|
|
$this->_default_config['indexer_reindex_allowed_ips'][] = $_SERVER['SERVER_ADDR']; |
|
449
|
|
|
} |
|
450
|
8 |
|
if (!empty($_SERVER['SERVER_NAME'])) { |
|
451
|
8 |
|
$this->_default_config['midcom_site_title'] = $_SERVER['SERVER_NAME']; |
|
452
|
|
|
} |
|
453
|
8 |
|
} |
|
454
|
|
|
|
|
455
|
662 |
|
public function get(string $key, $default = null) |
|
456
|
|
|
{ |
|
457
|
662 |
|
if (!$this->offsetExists($key)) { |
|
458
|
342 |
|
return $default; |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
661 |
|
if ( $key === 'auth_type' |
|
462
|
661 |
|
&& !in_array($this->_merged_config[$key], ['Plaintext', 'Legacy', 'SHA256'])) { |
|
463
|
|
|
throw new midcom_error('Unsupported authentication type'); |
|
464
|
|
|
} |
|
465
|
|
|
// Check the midcom_config site prefix for absolute local urls |
|
466
|
661 |
|
if ( $key === 'midcom_site_url' |
|
467
|
661 |
|
&& str_starts_with($this->_merged_config[$key], '/')) { |
|
468
|
|
|
$this->_merged_config[$key] = midcom::get()->get_page_prefix() . substr($this->_merged_config[$key], 1); |
|
469
|
|
|
} |
|
470
|
|
|
|
|
471
|
661 |
|
return $this->_merged_config[$key]; |
|
472
|
|
|
} |
|
473
|
|
|
|
|
474
|
3 |
|
public function get_array(string $key) : array |
|
475
|
|
|
{ |
|
476
|
3 |
|
if ($value = $this->get($key)) { |
|
477
|
|
|
if (!is_array($value)) { |
|
478
|
|
|
throw new midcom_error('Config key "' . $key . '" is not an array'); |
|
479
|
|
|
} |
|
480
|
|
|
return $value; |
|
481
|
|
|
} |
|
482
|
3 |
|
return []; |
|
483
|
|
|
} |
|
484
|
|
|
|
|
485
|
|
|
public function export_to(ContainerBuilder $builder) |
|
486
|
|
|
{ |
|
487
|
|
|
foreach ($this->_merged_config as $key => $value) { |
|
488
|
|
|
$builder->setParameter('midcom.' . $key, $value); |
|
489
|
|
|
} |
|
490
|
|
|
} |
|
491
|
|
|
|
|
492
|
10 |
|
public function set(string $key, $value) |
|
493
|
|
|
{ |
|
494
|
10 |
|
$this->_merged_config[$key] = $value; |
|
495
|
10 |
|
} |
|
496
|
|
|
|
|
497
|
5 |
|
public function offsetSet($offset, $value) |
|
498
|
|
|
{ |
|
499
|
5 |
|
$this->set($offset, $value); |
|
500
|
5 |
|
} |
|
501
|
|
|
|
|
502
|
662 |
|
public function offsetExists($offset) |
|
503
|
|
|
{ |
|
504
|
662 |
|
return isset($this->_merged_config[$offset]); |
|
505
|
|
|
} |
|
506
|
|
|
|
|
507
|
|
|
public function offsetUnset($offset) |
|
508
|
|
|
{ |
|
509
|
|
|
unset($this->_merged_config[$offset]); |
|
510
|
|
|
} |
|
511
|
|
|
|
|
512
|
86 |
|
public function offsetGet($offset) |
|
513
|
|
|
{ |
|
514
|
86 |
|
return $this->get($offset); |
|
515
|
|
|
} |
|
516
|
|
|
} |
|
517
|
|
|
|