Merge branch '4.6' into master
[civicrm-core.git] / CRM / Utils / Check / Env.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 *
30 * @package CRM
31 * @copyright CiviCRM LLC (c) 2004-2015
32 */
33 class CRM_Utils_Check_Env {
34
35 /**
36 * Run all checks in this class.
37 *
38 * @return array<CRM_Utils_Check_Message>
39 */
40 public function checkAll() {
41 $messages = array_merge(
42 $this->checkPhpVersion(),
43 $this->checkMysqlTime(),
44 $this->checkDebug(),
45 $this->checkOutboundMail(),
46 $this->checkDomainNameEmail(),
47 $this->checkDefaultMailbox(),
48 $this->checkLastCron(),
49 $this->checkVersion(),
50 $this->checkExtensions(),
51 $this->checkExtensionUpgrades(),
52 $this->checkDbVersion(),
53 $this->checkDbEngine()
54 );
55 return $messages;
56 }
57
58 /**
59 * @return array
60 */
61 public function checkPhpVersion() {
62 $messages = array();
63
64 if (version_compare(phpversion(), CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER) < 0) {
65 $messages[] = new CRM_Utils_Check_Message(
66 __FUNCTION__,
67 ts('This system uses PHP version %1. While this meets the minimum requirements for CiviCRM to function, upgrading to PHP version %2 or newer is recommended for maximum compatibility.',
68 array(
69 1 => phpversion(),
70 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER,
71 )),
72 ts('PHP Out-of-Date'),
73 \Psr\Log\LogLevel::NOTICE,
74 'fa-server'
75 );
76 }
77 else {
78 $messages[] = new CRM_Utils_Check_Message(
79 __FUNCTION__,
80 ts('This system uses PHP version %1 which meets or exceeds the minimum recommendation of %2.',
81 array(
82 1 => phpversion(),
83 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER,
84 )),
85 ts('PHP Up-to-Date'),
86 \Psr\Log\LogLevel::INFO,
87 'fa-server'
88 );
89 }
90
91 return $messages;
92 }
93
94 /**
95 * Check that the MySQL time settings match the PHP time settings.
96 *
97 * @return array<CRM_Utils_Check_Message> an empty array, or a list of warnings
98 */
99 public function checkMysqlTime() {
100 $messages = array();
101
102 $phpNow = date('Y-m-d H:i');
103 $sqlNow = CRM_Core_DAO::singleValueQuery("SELECT date_format(now(), '%Y-%m-%d %H:%i')");
104 if (!CRM_Utils_Time::isEqual($phpNow, $sqlNow, 2.5 * 60)) {
105 $messages[] = new CRM_Utils_Check_Message(
106 __FUNCTION__,
107 ts('Timestamps reported by MySQL (eg "%2") and PHP (eg "%3" ) are mismatched.<br /><a href="%1">Read more about this warning</a>', array(
108 1 => CRM_Utils_System::getWikiBaseURL() . 'checkMysqlTime',
109 2 => $sqlNow,
110 3 => $phpNow,
111 )),
112 ts('Timestamp Mismatch'),
113 \Psr\Log\LogLevel::ERROR,
114 'fa-server'
115 );
116 }
117
118 return $messages;
119 }
120
121 /**
122 * @return array
123 */
124 public function checkDebug() {
125 $messages = array();
126
127 $config = CRM_Core_Config::singleton();
128 if ($config->debug) {
129 $messages[] = new CRM_Utils_Check_Message(
130 __FUNCTION__,
131 ts('Warning: Debug is enabled in <a href="%1">system settings</a>. This should not be enabled on production servers.',
132 array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))),
133 ts('Debug Mode Enabled'),
134 \Psr\Log\LogLevel::WARNING,
135 'fa-bug'
136 );
137 }
138
139 return $messages;
140 }
141
142 /**
143 * @return array
144 */
145 public function checkOutboundMail() {
146 $messages = array();
147
148 $mailingInfo = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::MAILING_PREFERENCES_NAME, 'mailing_backend');
149 if (($mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_REDIRECT_TO_DB
150 || (defined('CIVICRM_MAIL_LOG') && CIVICRM_MAIL_LOG)
151 || $mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_DISABLED
152 || $mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MOCK)
153 ) {
154 $messages[] = new CRM_Utils_Check_Message(
155 __FUNCTION__,
156 ts('Warning: Outbound email is disabled in <a href="%1">system settings</a>. Proper settings should be enabled on production servers.',
157 array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))),
158 ts('Outbound Email Disabled'),
159 \Psr\Log\LogLevel::WARNING,
160 'fa-envelope'
161 );
162 }
163
164 return $messages;
165 }
166
167 /**
168 * Check that domain email and org name are set
169 * @return array
170 */
171 public function checkDomainNameEmail() {
172 $messages = array();
173
174 list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE);
175 $domain = CRM_Core_BAO_Domain::getDomain();
176 $domainName = $domain->name;
177 $fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1");
178
179 if (!$domainEmailAddress || $domainEmailAddress == 'info@EXAMPLE.ORG') {
180 if (!$domainName || $domainName == 'Default Domain Name') {
181 $msg = ts("Please enter your organization's <a href=\"%1\">name, primary address, and default FROM Email Address</a> (for system-generated emails).",
182 array(1 => $fixEmailUrl));
183 }
184 else {
185 $msg = ts('Please enter a <a href="%1">default FROM Email Address</a> (for system-generated emails).',
186 array(1 => $fixEmailUrl));
187 }
188 }
189 elseif (!$domainName || $domainName == 'Default Domain Name') {
190 $msg = ts("Please enter your organization's <a href=\"%1\">name and primary address</a>.",
191 array(1 => $fixEmailUrl));
192 }
193
194 if (!empty($msg)) {
195 $messages[] = new CRM_Utils_Check_Message(
196 __FUNCTION__,
197 $msg,
198 ts('Complete Setup'),
199 \Psr\Log\LogLevel::WARNING,
200 'fa-check-square-o'
201 );
202 }
203
204 return $messages;
205 }
206
207 /**
208 * Checks if a default bounce handling mailbox is set up
209 * @return array
210 */
211 public function checkDefaultMailbox() {
212 $messages = array();
213 $config = CRM_Core_Config::singleton();
214
215 if (in_array('CiviMail', $config->enableComponents) &&
216 CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG"
217 ) {
218 $message = new CRM_Utils_Check_Message(
219 __FUNCTION__,
220 ts('Please configure a <a href="%1">default mailbox</a> for CiviMail.',
221 array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1"))),
222 ts('Configure Default Mailbox'),
223 \Psr\Log\LogLevel::WARNING,
224 'fa-envelope'
225 );
226 $message->addHelp(ts('Learn more in the <a href="%1">user guide</a>', array(1 => 'http://book.civicrm.org/user/advanced-configuration/email-system-configuration/')));
227 $messages[] = $message;
228 }
229
230 return $messages;
231 }
232
233 /**
234 * Checks if cron has run in a reasonable amount of time
235 * @return array
236 */
237 public function checkLastCron() {
238 $messages = array();
239
240 $statusPreference = new CRM_Core_DAO_StatusPreference();
241 $statusPreference->domain_id = CRM_Core_Config::domainID();
242 $statusPreference->name = 'checkLastCron';
243
244 if ($statusPreference->find(TRUE) && !empty($statusPreference->check_info)) {
245 $lastCron = $statusPreference->check_info;
246 $msg = ts('Last cron run at %1.', array(1 => CRM_Utils_Date::customFormat(date('c', $lastCron))));
247 }
248 else {
249 $lastCron = 0;
250 $msg = ts('No cron runs have been recorded.');
251 }
252
253 if ($lastCron > gmdate('U') - 3600) {
254 $messages[] = new CRM_Utils_Check_Message(
255 __FUNCTION__,
256 $msg,
257 ts('Cron Running OK'),
258 \Psr\Log\LogLevel::INFO,
259 'fa-clock-o'
260 );
261 }
262 elseif ($lastCron > gmdate('U') - 86400) {
263 $message = new CRM_Utils_Check_Message(
264 __FUNCTION__,
265 $msg,
266 ts('Cron Not Running'),
267 \Psr\Log\LogLevel::WARNING,
268 'fa-clock-o'
269 );
270 $message->addHelp(ts('Learn more in the <a href="%1">Administrator\'s Guide supplement</a>', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs')));
271 $messages[] = $message;
272 }
273 else {
274 $message = new CRM_Utils_Check_Message(
275 __FUNCTION__,
276 $msg,
277 ts('Cron Not Running'),
278 \Psr\Log\LogLevel::ERROR,
279 'fa-clock-o'
280 );
281 $message->addHelp(ts('Learn more in the <a href="%1">Administrator\'s Guide supplement</a>', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs')));
282 $messages[] = $message;
283 }
284
285 return $messages;
286 }
287
288 /**
289 * Checks if new versions are available
290 * @return array
291 */
292 public function checkVersion() {
293 $messages = array();
294
295 if (Civi::settings()->get('versionCheck')) {
296 $vc = CRM_Utils_VersionCheck::singleton();
297 $newerVersion = $vc->isNewerVersionAvailable();
298
299 if ($newerVersion['version']) {
300 $vInfo = array(
301 1 => $newerVersion['version'],
302 2 => $vc->localVersion,
303 );
304 // LTS = long-term support version
305 if ($newerVersion['status'] == 'lts') {
306 $vInfo[1] .= ' ' . ts('(long-term support)');
307 }
308
309 if ($newerVersion['upgrade'] == 'security') {
310 // Security
311 $severity = \Psr\Log\LogLevel::CRITICAL;
312 $title = ts('CiviCRM Security Update Required');
313 $message = ts('New security release %1 is available. The site is currently running %2.', $vInfo);
314 }
315 elseif ($newerVersion['status'] == 'eol') {
316 // Warn about EOL
317 $severity = \Psr\Log\LogLevel::WARNING;
318 $title = ts('CiviCRM Update Needed');
319 $message = ts('New version %1 is available. The site is currently running %2, which has reached its end of life.', $vInfo);
320 }
321 else {
322 // For most new versions, just make them notice
323 $severity = \Psr\Log\LogLevel::NOTICE;
324 $title = ts('CiviCRM Update Available');
325 $message = ts('New version %1 is available. The site is currently running %2.', $vInfo);
326 }
327 }
328 else {
329 $vNum = $vc->localVersion;
330 // LTS = long-term support version
331 if ($newerVersion['status'] == 'lts') {
332 $vNum .= ' ' . ts('(long-term support)');
333 }
334
335 $severity = \Psr\Log\LogLevel::INFO;
336 $title = ts('CiviCRM Up-to-Date');
337 $message = ts('CiviCRM version %1 is up-to-date.', array(1 => $vNum));
338 }
339
340 $messages[] = new CRM_Utils_Check_Message(
341 __FUNCTION__,
342 $message,
343 $title,
344 $severity,
345 'fa-cloud-upload'
346 );
347 }
348 else {
349 $messages[] = new CRM_Utils_Check_Message(
350 __FUNCTION__,
351 ts('The check for new versions of CiviCRM has been disabled. <a %1>Re-enable the setting</a> to receive important security update notifications.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/misc', 'reset=1'))),
352 ts('Update Check Disabled'),
353 \Psr\Log\LogLevel::NOTICE,
354 'fa-times-circle-o'
355 );
356 }
357
358 return $messages;
359 }
360
361 /**
362 * Checks if extensions are set up properly
363 * @return array
364 */
365 public function checkExtensions() {
366 $messages = array();
367 $extensionSystem = CRM_Extension_System::singleton();
368 $mapper = $extensionSystem->getMapper();
369 $manager = $extensionSystem->getManager();
370
371 if ($extensionSystem->getDefaultContainer()) {
372 $basedir = $extensionSystem->getDefaultContainer()->baseDir;
373 }
374
375 if (empty($basedir)) {
376 // no extension directory
377 $messages[] = new CRM_Utils_Check_Message(
378 __FUNCTION__,
379 ts('Your extensions directory is not set. Click <a href="%1">here</a> to set the extensions directory.',
380 array(1 => CRM_Utils_System::url('civicrm/admin/setting/path', 'reset=1'))),
381 ts('Extensions directory not writable'),
382 \Psr\Log\LogLevel::NOTICE,
383 'fa-plug'
384 );
385 return $messages;
386 }
387
388 if (!is_dir($basedir)) {
389 $messages[] = new CRM_Utils_Check_Message(
390 __FUNCTION__,
391 ts('Your extensions directory path points to %1, which is not a directory. Please check your file system.',
392 array(1 => $basedir)),
393 ts('Extensions directory incorrect'),
394 \Psr\Log\LogLevel::ERROR,
395 'fa-plug'
396 );
397 return $messages;
398 }
399 elseif (!is_writable($basedir)) {
400 $messages[] = new CRM_Utils_Check_Message(
401 __FUNCTION__,
402 ts('Your extensions directory, %1, is not writable. Please change your file permissions.',
403 array(1 => $basedir)),
404 ts('Extensions directory not writable'),
405 \Psr\Log\LogLevel::ERROR,
406 'fa-plug'
407 );
408 return $messages;
409 }
410
411 if (empty($extensionSystem->getDefaultContainer()->baseUrl)) {
412 $messages[] = new CRM_Utils_Check_Message(
413 __FUNCTION__,
414 ts('The extensions URL is not properly set. Please go to the <a href="%1">URL setting page</a> and correct it.',
415 array(1 => CRM_Utils_System::url('civicrm/admin/setting/url', 'reset=1'))),
416 ts('Extensions url missing'),
417 \Psr\Log\LogLevel::ERROR,
418 'fa-plug'
419 );
420 return $messages;
421 }
422
423 if (!$extensionSystem->getBrowser()->isEnabled()) {
424 $messages[] = new CRM_Utils_Check_Message(
425 __FUNCTION__,
426 ts('Not checking remote URL for extensions since ext_repo_url is set to false.'),
427 ts('Extensions check disabled'),
428 \Psr\Log\LogLevel::NOTICE,
429 'fa-plug'
430 );
431 return $messages;
432 }
433
434 try {
435 $remotes = $extensionSystem->getBrowser()->getExtensions();
436 }
437 catch (CRM_Extension_Exception $e) {
438 $messages[] = new CRM_Utils_Check_Message(
439 __FUNCTION__,
440 $e->getMessage(),
441 ts('Extension download error'),
442 \Psr\Log\LogLevel::ERROR,
443 'fa-plug'
444 );
445 return $messages;
446 }
447
448 if (!$remotes) {
449 // CRM-13141 There may not be any compatible extensions available for the requested CiviCRM version + CMS. If so, $extdir is empty so just return a notice.
450 $messages[] = new CRM_Utils_Check_Message(
451 __FUNCTION__,
452 ts('There are currently no extensions on the CiviCRM public extension directory which are compatible with version %1. If you want to install an extension which is not marked as compatible, you may be able to <a %2>download and install extensions manually</a> (depending on access to your web server).', array(
453 1 => CRM_Utils_System::majorVersion(),
454 2 => 'href="http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions"',
455 )),
456 ts('No Extensions Available for this Version'),
457 \Psr\Log\LogLevel::NOTICE,
458 'fa-plug'
459 );
460 return $messages;
461 }
462
463 $keys = array_keys($manager->getStatuses());
464 sort($keys);
465 $updates = $errors = $okextensions = array();
466
467 foreach ($keys as $key) {
468 try {
469 $obj = $mapper->keyToInfo($key);
470 }
471 catch (CRM_Extension_Exception $ex) {
472 $errors[] = ts('Failed to read extension (%1). Please refresh the extension list.', array(1 => $key));
473 continue;
474 }
475 $row = CRM_Admin_Page_Extensions::createExtendedInfo($obj);
476 switch ($row['status']) {
477 case CRM_Extension_Manager::STATUS_INSTALLED_MISSING:
478 $errors[] = ts('%1 extension (%2) is installed but missing files.', array(1 => CRM_Utils_Array::value('label', $row), 2 => $key));
479 break;
480
481 case CRM_Extension_Manager::STATUS_INSTALLED:
482 if (!empty($remotes[$key]) && version_compare($row['version'], $remotes[$key]->version, '<')) {
483 $updates[] = ts('%1 (%2) version %3 is installed. <a %4>Upgrade to version %5</a>.', array(
484 1 => CRM_Utils_Array::value('label', $row),
485 2 => $key,
486 3 => $row['version'],
487 4 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id=$key&key=$key") . '"',
488 5 => $remotes[$key]->version,
489 ));
490 }
491 else {
492 if (empty($row['label'])) {
493 $okextensions[] = $key;
494 }
495 else {
496 $okextensions[] = ts('%1 (%2) version %3', array(
497 1 => $row['label'],
498 2 => $key,
499 3 => $row['version'],
500 ));
501 }
502 }
503 break;
504 }
505 }
506
507 if (!$okextensions && !$updates && !$errors) {
508 $messages[] = new CRM_Utils_Check_Message(
509 'extensionsOk',
510 ts('No extensions installed. <a %1>Browse available extensions</a>.', array(
511 1 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1') . '"',
512 )),
513 ts('Extensions'),
514 \Psr\Log\LogLevel::INFO,
515 'fa-plug'
516 );
517 }
518
519 if ($errors) {
520 $messages[] = new CRM_Utils_Check_Message(
521 __FUNCTION__,
522 '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>',
523 ts('Extension Error'),
524 \Psr\Log\LogLevel::ERROR,
525 'fa-plug'
526 );
527 }
528
529 if ($updates) {
530 $messages[] = new CRM_Utils_Check_Message(
531 'extensionUpdates',
532 '<ul><li>' . implode('</li><li>', $updates) . '</li></ul>',
533 ts('Extension Update Available', array('plural' => '%count Extension Updates Available', 'count' => count($updates))),
534 \Psr\Log\LogLevel::WARNING,
535 'fa-plug'
536 );
537 }
538
539 if ($okextensions) {
540 if ($updates || $errors) {
541 $message = ts('1 extension is up-to-date:', array('plural' => '%count extensions are up-to-date:', 'count' => count($okextensions)));
542 }
543 else {
544 $message = ts('All extensions are up-to-date:');
545 }
546 $messages[] = new CRM_Utils_Check_Message(
547 'extensionsOk',
548 $message . '<ul><li>' . implode('</li><li>', $okextensions) . '</li></ul>',
549 ts('Extensions'),
550 \Psr\Log\LogLevel::INFO,
551 'fa-plug'
552 );
553 }
554
555 return $messages;
556 }
557
558
559 /**
560 * Checks if extensions are set up properly
561 * @return array
562 */
563 public function checkExtensionUpgrades() {
564 $messages = array();
565
566 if (CRM_Extension_Upgrades::hasPending()) {
567 $messages[] = new CRM_Utils_Check_Message(
568 __FUNCTION__,
569 ts('Extension upgrades are pending. Please visit <a href="%1">the upgrade page</a> to run them.',
570 array(1 => CRM_Utils_System::url('civicrm/admin/extensions/upgrade', 'reset=1'))),
571 ts('Run Extension Upgrades'),
572 \Psr\Log\LogLevel::ERROR,
573 'fa-plug'
574 );
575 }
576 return $messages;
577 }
578
579 /**
580 * Checks if CiviCRM database version is up-to-date
581 * @return array
582 */
583 public function checkDbVersion() {
584 $messages = array();
585 $dbVersion = CRM_Core_BAO_Domain::version();
586 $upgradeUrl = CRM_Utils_System::url("civicrm/upgrade", "reset=1");
587
588 if (!$dbVersion) {
589 // if db.ver missing
590 $messages[] = new CRM_Utils_Check_Message(
591 __FUNCTION__,
592 ts('Version information found to be missing in database. You will need to determine the correct version corresponding to your current database state.'),
593 ts('Database Version Missing'),
594 \Psr\Log\LogLevel::ERROR,
595 'fa-database'
596 );
597 }
598 elseif (!CRM_Utils_System::isVersionFormatValid($dbVersion)) {
599 $messages[] = new CRM_Utils_Check_Message(
600 __FUNCTION__,
601 ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.'),
602 ts('Database Version Invalid'),
603 \Psr\Log\LogLevel::ERROR,
604 'fa-database'
605 );
606 }
607 elseif (stripos($dbVersion, 'upgrade')) {
608 // if db.ver indicates a partially upgraded db
609 $messages[] = new CRM_Utils_Check_Message(
610 __FUNCTION__,
611 ts('Database check failed - the database looks to have been partially upgraded. You must reload the database with the backup and try the <a href=\'%1\'>upgrade process</a> again.', array(1 => $upgradeUrl)),
612 ts('Database Partially Upgraded'),
613 \Psr\Log\LogLevel::ALERT,
614 'fa-database'
615 );
616 }
617 else {
618 $codeVersion = CRM_Utils_System::version();
619
620 // if db.ver < code.ver, time to upgrade
621 if (version_compare($dbVersion, $codeVersion) < 0) {
622 $messages[] = new CRM_Utils_Check_Message(
623 __FUNCTION__,
624 ts('New codebase version detected. You must visit <a href=\'%1\'>upgrade screen</a> to upgrade the database.', array(1 => $upgradeUrl)),
625 ts('Database Upgrade Required'),
626 \Psr\Log\LogLevel::ALERT,
627 'fa-database'
628 );
629 }
630
631 // if db.ver > code.ver, sth really wrong
632 if (version_compare($dbVersion, $codeVersion) > 0) {
633 $messages[] = new CRM_Utils_Check_Message(
634 __FUNCTION__,
635 ts('Your database is marked with an unexpected version number: %1. The v%2 codebase may not be compatible with your database state.
636 You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase
637 you were using until you resolve this problem.<br/>OR if this is a manual install from git, you might want to fix civicrm-version.php file.',
638 array(1 => $dbVersion, 2 => $codeVersion)
639 ),
640 ts('Database In Unexpected Version'),
641 \Psr\Log\LogLevel::ERROR,
642 'fa-database'
643 );
644 }
645 }
646
647 return $messages;
648 }
649
650 /**
651 * ensure that all CiviCRM tables are InnoDB
652 * @return array
653 */
654 public function checkDbEngine() {
655 $messages = array();
656
657 if (CRM_Core_DAO::isDBMyISAM(150)) {
658 $messages[] = new CRM_Utils_Check_Message(
659 __FUNCTION__,
660 ts('Your database is configured to use the MyISAM database engine. CiviCRM requires InnoDB. You will need to convert any MyISAM tables in your database to InnoDB. Using MyISAM tables will result in data integrity issues.'),
661 ts('MyISAM Database Engine'),
662 \Psr\Log\LogLevel::ERROR,
663 'fa-database'
664 );
665 }
666 return $messages;
667 }
668
669 }