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