001
014
015 package com.liferay.portal.verify;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.PropsKeys;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.kernel.util.StringUtil;
022 import com.liferay.portal.kernel.util.SystemProperties;
023 import com.liferay.portal.kernel.util.UnicodeProperties;
024 import com.liferay.portal.security.ldap.LDAPSettingsUtil;
025 import com.liferay.portal.service.CompanyLocalServiceUtil;
026 import com.liferay.portal.util.PortalInstances;
027 import com.liferay.portal.util.PrefsPropsUtil;
028 import com.liferay.portal.util.PropsUtil;
029 import com.liferay.portlet.documentlibrary.store.StoreFactory;
030
031
034 public class VerifyProperties extends VerifyProcess {
035
036 @Override
037 protected void doVerify() throws Exception {
038
039
040
041 for (String[] keys : _MIGRATED_SYSTEM_KEYS) {
042 String oldKey = keys[0];
043 String newKey = keys[1];
044
045 verifyMigratedSystemProperty(oldKey, newKey);
046 }
047
048 for (String[] keys : _RENAMED_SYSTEM_KEYS) {
049 String oldKey = keys[0];
050 String newKey = keys[1];
051
052 verifyRenamedSystemProperty(oldKey, newKey);
053 }
054
055 for (String key : _OBSOLETE_SYSTEM_KEYS) {
056 verifyObsoleteSystemProperty(key);
057 }
058
059
060
061 for (String[] keys : _MIGRATED_PORTAL_KEYS) {
062 String oldKey = keys[0];
063 String newKey = keys[1];
064
065 verifyMigratedPortalProperty(oldKey, newKey);
066 }
067
068 for (String[] keys : _RENAMED_PORTAL_KEYS) {
069 String oldKey = keys[0];
070 String newKey = keys[1];
071
072 verifyRenamedPortalProperty(oldKey, newKey);
073 }
074
075 for (String key : _OBSOLETE_PORTAL_KEYS) {
076 verifyObsoletePortalProperty(key);
077 }
078
079 for (String[] keys : _MODULARIZED_PORTAL_KEYS) {
080 String oldKey = keys[0];
081 String newKey = keys[1];
082 String moduleName = keys[2];
083
084 verifyModularizedPortalProperty(oldKey, newKey, moduleName);
085 }
086
087
088
089 StoreFactory.checkProperties();
090
091
092
093 verifyLDAPProperties();
094 }
095
096 protected boolean isPortalProperty(String key) {
097 String value = PropsUtil.get(key);
098
099 if (value != null) {
100 return true;
101 }
102
103 return false;
104 }
105
106 protected void verifyLDAPProperties() throws Exception {
107 long[] companyIds = PortalInstances.getCompanyIdsBySQL();
108
109 for (long companyId : companyIds) {
110 UnicodeProperties properties = new UnicodeProperties();
111
112 long[] ldapServerIds = StringUtil.split(
113 PrefsPropsUtil.getString(companyId, "ldap.server.ids"), 0L);
114
115 for (long ldapServerId : ldapServerIds) {
116 String postfix = LDAPSettingsUtil.getPropertyPostfix(
117 ldapServerId);
118
119 for (String key : _LDAP_KEYS) {
120 String value = PrefsPropsUtil.getString(
121 companyId, key + postfix, null);
122
123 if (value == null) {
124 properties.put(key + postfix, StringPool.BLANK);
125 }
126 }
127 }
128
129 if (!properties.isEmpty()) {
130 CompanyLocalServiceUtil.updatePreferences(
131 companyId, properties);
132 }
133 }
134 }
135
136 protected void verifyMigratedPortalProperty(String oldKey, String newKey)
137 throws Exception {
138
139 if (isPortalProperty(oldKey)) {
140 _log.error(
141 "Portal property \"" + oldKey +
142 "\" was migrated to the system property \"" + newKey +
143 "\"");
144 }
145 }
146
147 protected void verifyMigratedSystemProperty(String oldKey, String newKey)
148 throws Exception {
149
150 String value = SystemProperties.get(oldKey);
151
152 if (value != null) {
153 _log.error(
154 "System property \"" + oldKey +
155 "\" was migrated to the portal property \"" + newKey +
156 "\"");
157 }
158 }
159
160 protected void verifyModularizedPortalProperty(
161 String oldKey, String newKey, String moduleName)
162 throws Exception {
163
164 if (isPortalProperty(oldKey)) {
165 _log.error(
166 "Portal property \"" + oldKey + "\" was modularized to " +
167 moduleName + " as \"" + newKey);
168 }
169 }
170
171 protected void verifyObsoletePortalProperty(String key) throws Exception {
172 if (isPortalProperty(key)) {
173 _log.error("Portal property \"" + key + "\" is obsolete");
174 }
175 }
176
177 protected void verifyObsoleteSystemProperty(String key) throws Exception {
178 String value = SystemProperties.get(key);
179
180 if (value != null) {
181 _log.error("System property \"" + key + "\" is obsolete");
182 }
183 }
184
185 protected void verifyRenamedPortalProperty(String oldKey, String newKey)
186 throws Exception {
187
188 if (isPortalProperty(oldKey)) {
189 _log.error(
190 "Portal property \"" + oldKey + "\" was renamed to \"" +
191 newKey + "\"");
192 }
193 }
194
195 protected void verifyRenamedSystemProperty(String oldKey, String newKey)
196 throws Exception {
197
198 String value = SystemProperties.get(oldKey);
199
200 if (value != null) {
201 _log.error(
202 "System property \"" + oldKey + "\" was renamed to \"" +
203 newKey + "\"");
204 }
205 }
206
207 private static final String[] _LDAP_KEYS = {
208 PropsKeys.LDAP_CONTACT_CUSTOM_MAPPINGS, PropsKeys.LDAP_CONTACT_MAPPINGS,
209 PropsKeys.LDAP_USER_CUSTOM_MAPPINGS
210 };
211
212 private static final String[][] _MIGRATED_PORTAL_KEYS = new String[][] {
213 new String[] {
214 "finalize.manager.thread.enabled",
215 "com.liferay.portal.kernel.memory.FinalizeManager.thread.enabled"
216 }
217 };
218
219 private static final String[][] _MIGRATED_SYSTEM_KEYS = new String[][] {
220 new String[] {
221 "com.liferay.filters.compression.CompressionFilter",
222 "com.liferay.portal.servlet.filters.gzip.GZipFilter"
223 },
224 new String[] {
225 "com.liferay.filters.strip.StripFilter",
226 "com.liferay.portal.servlet.filters.strip.StripFilter"
227 },
228 new String[] {
229 "com.liferay.util.Http.max.connections.per.host",
230 "com.liferay.portal.util.HttpImpl.max.connections.per.host"
231 },
232 new String[] {
233 "com.liferay.util.Http.max.total.connections",
234 "com.liferay.portal.util.HttpImpl.max.total.connections"
235 },
236 new String[] {
237 "com.liferay.util.Http.proxy.auth.type",
238 "com.liferay.portal.util.HttpImpl.proxy.auth.type"
239 },
240 new String[] {
241 "com.liferay.util.Http.proxy.ntlm.domain",
242 "com.liferay.portal.util.HttpImpl.proxy.ntlm.domain"
243 },
244 new String[] {
245 "com.liferay.util.Http.proxy.ntlm.host",
246 "com.liferay.portal.util.HttpImpl.proxy.ntlm.host"
247 },
248 new String[] {
249 "com.liferay.util.Http.proxy.password",
250 "com.liferay.portal.util.HttpImpl.proxy.password"
251 },
252 new String[] {
253 "com.liferay.util.Http.proxy.username",
254 "com.liferay.portal.util.HttpImpl.proxy.username"
255 },
256 new String[] {
257 "com.liferay.util.Http.timeout",
258 "com.liferay.portal.util.HttpImpl.timeout"
259 },
260 new String[] {
261 "com.liferay.util.format.PhoneNumberFormat",
262 "phone.number.format.impl"
263 },
264 new String[] {
265 "com.liferay.util.servlet.UploadServletRequest.max.size",
266 "com.liferay.portal.upload.UploadServletRequestImpl.max.size"
267 },
268 new String[] {
269 "com.liferay.util.servlet.UploadServletRequest.temp.dir",
270 "com.liferay.portal.upload.UploadServletRequestImpl.temp.dir"
271 },
272 new String[] {
273 "com.liferay.util.servlet.fileupload.LiferayFileItem." +
274 "threshold.size",
275 "com.liferay.portal.upload.LiferayFileItem.threshold.size"
276 },
277 new String[] {
278 "com.liferay.util.servlet.fileupload.LiferayInputStream." +
279 "threshold.size",
280 "com.liferay.portal.upload.LiferayInputStream.threshold.size"
281 }
282 };
283
284 private static final String[][] _MODULARIZED_PORTAL_KEYS = {
285
286
287
288 new String[] {
289 "bookmarks.email.entry.added.body", "email.entry.added.body",
290 "com.liferay.bookmarks.service"
291 },
292 new String[] {
293 "bookmarks.email.entry.added.enabled", "email.entry.added.enabled",
294 "com.liferay.bookmarks.service"
295 },
296 new String[] {
297 "bookmarks.email.entry.added.subject", "email.entry.added.subject",
298 "com.liferay.bookmarks.service"
299 },
300 new String[] {
301 "bookmarks.email.entry.updated.body", "email.entry.updated.body",
302 "com.liferay.bookmarks.service"
303 },
304 new String[] {
305 "bookmarks.email.entry.updated.enabled",
306 "email.entry.updated.enabled", "com.liferay.bookmarks.service"
307 },
308 new String[] {
309 "bookmarks.email.entry.updated.subject",
310 "email.entry.updated.subject", "com.liferay.bookmarks.service"
311 },
312 new String[] {
313 "bookmarks.email.from.address", "email.from.address",
314 "com.liferay.bookmarks.service"
315 },
316 new String[] {
317 "bookmarks.email.from.name", "email.from.name",
318 "com.liferay.bookmarks.service"
319 },
320 new String[] {
321 "bookmarks.entry.columns", "entry.columns",
322 "com.liferay.bookmarks.service"
323 },
324 new String[] {
325 "bookmarks.folder.columns", "folder.columns",
326 "com.liferay.bookmarks.service"
327 },
328 new String[] {
329 "bookmarks.folders.search.visible", "folders.search.visible",
330 "com.liferay.bookmarks.service"
331 },
332 new String[] {
333 "bookmarks.related.assets.enabled", "related.assets.enabled",
334 "com.liferay.bookmarks.service"
335 },
336 new String[] {
337 "bookmarks.subfolders.visible", "subfolders.visible",
338 "com.liferay.bookmarks.service"
339 },
340
341
342
343 new String[] {
344 "journal.content.publish.to.live.by.default",
345 "publish.to.live.by.default", "com.liferay.journal.content.web"
346 },
347
348
349
350 new String[] {
351 "polls.publish.to.live.by.default", "publish.to.live.by.default",
352 "com.liferay.polls.service"
353 },
354
355
356
357 new String[] {
358 "rss.display.templates.config", "display.templates.config",
359 "com.liferay.rss.web"
360 },
361
362
363
364 new String[] {
365 "xsl.content.xml.doctype.declaration.allowed",
366 "xml.doctype.declaration.allowed", "com.liferay.xsl.content.web"
367 },
368 new String[] {
369 "xsl.content.xml.external.general.entities.allowed",
370 "xml.external.general.entities.allowed",
371 "com.liferay.xsl.content.web"
372 },
373 new String[] {
374 "xsl.content.xml.external.parameter.entities.allowed",
375 "xml.external.parameter.entities.allowed",
376 "com.liferay.xsl.content.web"
377 },
378 new String[] {
379 "xsl.content.xsl.secure.processing.enabled",
380 "xsl.secure.processing.enabled", "com.liferay.xsl.content.web"
381 }
382 };
383
384 private static final String[] _OBSOLETE_PORTAL_KEYS = new String[] {
385 "amazon.access.key.id", "amazon.associate.tag",
386 "amazon.secret.access.key",
387 "asset.entry.increment.view.counter.enabled", "auth.max.failures.limit",
388 "buffered.increment.parallel.queue.size",
389 "buffered.increment.serial.queue.size", "cas.validate.url",
390 "cluster.executor.heartbeat.interval",
391 "com.liferay.filters.doubleclick.DoubleClickFilter",
392 "com.liferay.portal.servlet.filters.doubleclick.DoubleClickFilter",
393 "com.liferay.portal.servlet.filters.validhtml.ValidHtmlFilter",
394 "commons.pool.enabled", "convert.processes",
395 "dl.file.entry.read.count.enabled",
396 "dynamic.data.lists.template.language.parser[ftl]",
397 "dynamic.data.lists.template.language.parser[vm]",
398 "dynamic.data.lists.template.language.parser[xsl]",
399 "dynamic.data.mapping.template.language.types",
400 "editor.wysiwyg.portal-web.docroot.html.portlet.asset_publisher." +
401 "configuration.jsp",
402 "editor.wysiwyg.portal-web.docroot.html.portlet.blogs.configuration." +
403 "jsp",
404 "editor.wysiwyg.portal-web.docroot.html.portlet.bookmarks." +
405 "configuration.jsp",
406 "editor.wysiwyg.portal-web.docroot.html.portlet.document_library." +
407 "editor.wysiwyg.portal-web.docroot.html.portlet.invitation." +
408 "configuration.jsp",
409 "editor.wysiwyg.portal-web.docroot.html.portlet.journal." +
410 "configuration.jsp",
411 "editor.wysiwyg.portal-web.docroot.html.portlet.login.configuration." +
412 "jsp",
413 "editor.wysiwyg.portal-web.docroot.html.portlet.message_boards." +
414 "configuration.jsp",
415 "editor.wysiwyg.portal-web.docroot.html.portlet.portal_settings." +
416 "email_notifications.jsp",
417 "ehcache.statistics.enabled", "index.filter.search.limit",
418 "invitation.email.max.recipients", "invitation.email.message.body",
419 "invitation.email.message.subject", "javax.persistence.validation.mode",
420 "jbi.workflow.url", "json.deserializer.strict.mode",
421 "journal.article.form.translate", "journal.article.types",
422 "journal.articles.page.delta.values",
423 "journal.template.language.parser[css]",
424 "journal.template.language.parser[ftl]",
425 "journal.template.language.parser[vm]",
426 "journal.template.language.parser[xsl]",
427 "journal.template.language.types", "jpa.configs",
428 "jpa.database.platform", "jpa.database.type", "jpa.load.time.weaver",
429 "jpa.provider", "jpa.provider.property.eclipselink.allow-zero-id",
430 "jpa.provider.property.eclipselink.logging.level",
431 "jpa.provider.property.eclipselink.logging.timestamp", "layout.types",
432 "lucene.analyzer", "lucene.store.jdbc.auto.clean.up",
433 "lucene.store.jdbc.auto.clean.up.enabled",
434 "lucene.store.jdbc.auto.clean.up.interval",
435 "lucene.store.jdbc.dialect.db2", "lucene.store.jdbc.dialect.derby",
436 "lucene.store.jdbc.dialect.hsqldb", "lucene.store.jdbc.dialect.jtds",
437 "lucene.store.jdbc.dialect.microsoft",
438 "lucene.store.jdbc.dialect.mysql", "lucene.store.jdbc.dialect.oracle",
439 "lucene.store.jdbc.dialect.postgresql",
440 "memory.cluster.scheduler.lock.cache.enabled",
441 "message.boards.email.message.added.signature",
442 "message.boards.email.message.updated.signature",
443 "message.boards.thread.locking.enabled",
444 "nested.portlets.layout.template.default",
445 "nested.portlets.layout.template.unsupported", "portal.ctx",
446 "portal.security.manager.enable", "permissions.list.filter",
447 "permissions.thread.local.cache.max.size",
448 "permissions.user.check.algorithm", "persistence.provider",
449 "ratings.max.score", "ratings.min.score", "scheduler.classes",
450 "schema.run.minimal", "shard.available.names",
451 "velocity.engine.resource.manager",
452 "velocity.engine.resource.manager.cache.enabled",
453 "webdav.storage.class", "webdav.storage.show.edit.url",
454 "webdav.storage.show.view.url", "webdav.storage.tokens",
455 "wiki.email.page.added.signature", "wiki.email.page.updated.signature",
456 "xss.allow"
457 };
458
459 private static final String[] _OBSOLETE_SYSTEM_KEYS = new String[] {
460 "com.liferay.util.Http.proxy.host", "com.liferay.util.Http.proxy.port",
461 "com.liferay.util.XSSUtil.regexp.pattern"
462 };
463
464 private static final String[][] _RENAMED_PORTAL_KEYS = new String[][] {
465 new String[] {
466 "amazon.license.0", "amazon.access.key.id"
467 },
468 new String[] {
469 "amazon.license.1", "amazon.access.key.id"
470 },
471 new String[] {
472 "amazon.license.2", "amazon.access.key.id"
473 },
474 new String[] {
475 "amazon.license.3", "amazon.access.key.id"
476 },
477 new String[] {
478 "cdn.host", "cdn.host.http"
479 },
480 new String[] {
481 "com.liferay.portal.servlet.filters.compression.CompressionFilter",
482 "com.liferay.portal.servlet.filters.gzip.GZipFilter"
483 },
484 new String[] {
485 "default.guest.friendly.url",
486 "default.guest.public.layout.friendly.url"
487 },
488 new String[] {
489 "default.guest.layout.column", "default.guest.public.layout.column"
490 },
491 new String[] {
492 "default.guest.layout.name", "default.guest.public.layout.name"
493 },
494 new String[] {
495 "default.guest.layout.template.id",
496 "default.guest.public.layout.template.id"
497 },
498 new String[] {
499 "default.user.layout.column", "default.user.public.layout.column"
500 },
501 new String[] {
502 "default.user.layout.name", "default.user.public.layout.name"
503 },
504 new String[] {
505 "default.user.layout.template.id",
506 "default.user.public.layout.template.id"
507 },
508 new String[] {
509 "default.user.private.layout.lar",
510 "default.user.private.layouts.lar"
511 },
512 new String[] {
513 "default.user.public.layout.lar", "default.user.public.layouts.lar"
514 },
515 new String[] {
516 "dl.hook.cmis.credentials.password",
517 "dl.store.cmis.credentials.password"
518 },
519 new String[] {
520 "dl.hook.cmis.credentials.username",
521 "dl.store.cmis.credentials.username"
522 },
523 new String[] {
524 "dl.hook.cmis.repository.url", "dl.store.cmis.repository.url"
525 },
526 new String[] {
527 "dl.hook.cmis.system.root.dir", "dl.store.cmis.system.root.dir"
528 },
529 new String[] {
530 "dl.hook.file.system.root.dir", "dl.store.file.system.root.dir"
531 },
532 new String[] {
533 "dl.hook.impl", "dl.store.impl"
534 },
535 new String[] {
536 "dl.hook.jcr.fetch.delay", "dl.store.jcr.fetch.delay"
537 },
538 new String[] {
539 "dl.hook.jcr.fetch.max.failures", "dl.store.jcr.fetch.max.failures"
540 },
541 new String[] {
542 "dl.hook.jcr.move.version.labels",
543 "dl.store.jcr.move.version.labels"
544 },
545 new String[] {
546 "dl.hook.s3.access.key", "dl.store.s3.access.key"
547 },
548 new String[] {
549 "dl.hook.s3.bucket.name", "dl.store.s3.bucket.name"
550 },
551 new String[] {
552 "dl.hook.s3.secret.key", "dl.store.s3.secret.key"
553 },
554 new String[] {
555 "editor.wysiwyg.portal-web.docroot.html.portlet.calendar." +
556 "edit_configuration.jsp",
557 "editor.wysiwyg.portal-web.docroot.html.portlet.calendar." +
558 "configuration.jsp"
559 },
560 new String[] {
561 "editor.wysiwyg.portal-web.docroot.html.portlet.invitation." +
562 "edit_configuration.jsp",
563 "editor.wysiwyg.portal-web.docroot.html.portlet.invitation." +
564 "configuration.jsp"
565 },
566 new String[] {
567 "editor.wysiwyg.portal-web.docroot.html.portlet.journal." +
568 "edit_configuration.jsp",
569 "editor.wysiwyg.portal-web.docroot.html.portlet.journal." +
570 "configuration.jsp"
571 },
572 new String[] {
573 "editor.wysiwyg.portal-web.docroot.html.portlet.message_boards." +
574 "edit_configuration.jsp",
575 "editor.wysiwyg.portal-web.docroot.html.portlet.message_boards." +
576 "configuration.jsp"
577 },
578 new String[] {
579 "editor.wysiwyg.portal-web.docroot.html.portlet.shopping." +
580 "edit_configuration.jsp",
581 "editor.wysiwyg.portal-web.docroot.html.portlet.shopping." +
582 "configuration.jsp"
583 },
584 new String[] {
585 "field.editable.com.liferay.portal.model.User.emailAddress",
586 "field.editable.user.types"
587 },
588 new String[] {
589 "field.editable.com.liferay.portal.model.User.screenName",
590 "field.editable.user.types"
591 },
592 new String[] {
593 "icon.menu.max.display.items", "menu.max.display.items"
594 },
595 new String[] {
596 "journal.error.template.freemarker", "journal.error.template[ftl]"
597 },
598 new String[] {
599 "journal.error.template.velocity", "journal.error.template[vm]"
600 },
601 new String[] {
602 "journal.error.template.xsl", "journal.error.template[xsl]"
603 },
604 new String[] {
605 "journal.template.freemarker.restricted.variables",
606 "freemarker.engine.restricted.variables"
607 },
608 new String[] {
609 "journal.template.velocity.restricted.variables",
610 "velocity.engine.restricted.variables"
611 },
612 new String[] {
613 "portal.instance.http.port",
614 "portal.instance.http.inet.socket.address"
615 },
616 new String[] {
617 "portal.instance.https.port",
618 "portal.instance.https.inet.socket.address"
619 },
620 new String[] {
621 "referer.url.domains.allowed", "redirect.url.domains.allowed"
622 },
623 new String[] {
624 "referer.url.ips.allowed", "redirect.url.ips.allowed"
625 },
626 new String[] {
627 "referer.url.security.mode", "redirect.url.security.mode"
628 },
629 new String[] {
630 "tags.asset.increment.view.counter.enabled",
631 "asset.entry.increment.view.counter.enabled"
632 }
633 };
634
635 private static final String[][] _RENAMED_SYSTEM_KEYS = new String[][] {
636 new String[] {
637 "com.liferay.portal.kernel.util.StringBundler.unsafe.create." +
638 "threshold",
639 "com.liferay.portal.kernel.util.StringBundler.threadlocal.buffer." +
640 "limit",
641 }
642 };
643
644 private static final Log _log = LogFactoryUtil.getLog(
645 VerifyProperties.class);
646
647 }