Merge pull request #8766 from totten/4.7.10-rc-mysqli
[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 * @return array
73 */
74 public function checkPhpMysqli() {
75 $messages = array();
76
77 if (!extension_loaded('mysqli')) {
78 $messages[] = new CRM_Utils_Check_Message(
79 __FUNCTION__,
80 ts('Future versions of CiviCRM may require the PHP extension "%2". To ensure that your system will be compatible, please install it in advance. For more explanation, see <a href="%1">the announcement</a>.',
81 array(
82 1 => 'https://civicrm.org/blog/totten/psa-please-verify-php-extension-mysqli',
83 2 => 'mysqli',
84 )),
85 ts('Forward Compatibility: Enable "mysqli"'),
86 \Psr\Log\LogLevel::WARNING,
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 = Civi::settings()->get('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 $docUrl = 'target="_blank" href="' . CRM_Utils_System::docURL(array('page' => 'user/advanced-configuration/email-system-configuration/', 'URLonly' => TRUE)) . '""';
227 $message->addHelp(
228 ts('A default mailbox must be configured for email bounce processing.') . '<br />' .
229 ts("Learn more in the <a %1>online documentation</a>.", array(1 => $docUrl))
230 );
231 $messages[] = $message;
232 }
233
234 return $messages;
235 }
236
237 /**
238 * Checks if cron has run in a reasonable amount of time
239 * @return array
240 */
241 public function checkLastCron() {
242 $messages = array();
243
244 $statusPreference = new CRM_Core_DAO_StatusPreference();
245 $statusPreference->domain_id = CRM_Core_Config::domainID();
246 $statusPreference->name = 'checkLastCron';
247
248 if ($statusPreference->find(TRUE) && !empty($statusPreference->check_info)) {
249 $lastCron = $statusPreference->check_info;
250 $msg = ts('Last cron run at %1.', array(1 => CRM_Utils_Date::customFormat(date('c', $lastCron))));
251 }
252 else {
253 $lastCron = 0;
254 $msg = ts('No cron runs have been recorded.');
255 }
256
257 if ($lastCron > gmdate('U') - 3600) {
258 $messages[] = new CRM_Utils_Check_Message(
259 __FUNCTION__,
260 $msg,
261 ts('Cron Running OK'),
262 \Psr\Log\LogLevel::INFO,
263 'fa-clock-o'
264 );
265 }
266 else {
267 $message = new CRM_Utils_Check_Message(
268 __FUNCTION__,
269 $msg,
270 ts('Cron Not Running'),
271 ($lastCron > gmdate('U') - 86400) ? \Psr\Log\LogLevel::WARNING : \Psr\Log\LogLevel::ERROR,
272 'fa-clock-o'
273 );
274 $docUrl = 'target="_blank" href="' . CRM_Utils_System::docURL(array('resource' => 'wiki', 'page' => 'Managing Scheduled Jobs', 'URLonly' => TRUE)) . '""';
275 $message->addHelp(
276 ts('Configuring cron on your server is necessary for running scheduled jobs such as sending mail and scheduled reminders.') . '<br />' .
277 ts("Learn more in the <a %1>online documentation</a>.", array(1 => $docUrl))
278 );
279 $messages[] = $message;
280 }
281
282 return $messages;
283 }
284
285 /**
286 * Checks if new versions are available
287 * @return array
288 */
289 public function checkVersion() {
290 $messages = array();
291 try {
292 $vc = new CRM_Utils_VersionCheck();
293 $vc->initialize();
294 }
295 catch (Exception $e) {
296 $messages[] = new CRM_Utils_Check_Message(
297 'checkVersionError',
298 ts('Directory %1 is not writable. Please change your file permissions.',
299 array(1 => dirname($vc->cacheFile))),
300 ts('Directory not writable'),
301 \Psr\Log\LogLevel::ERROR,
302 'fa-times-circle-o'
303 );
304 return $messages;
305 }
306
307 // Show a notice if the version_check job is disabled
308 if (empty($vc->cronJob['is_active'])) {
309 $args = empty($vc->cronJob['id']) ? array('reset' => 1) : array('reset' => 1, 'action' => 'update', 'id' => $vc->cronJob['id']);
310 $messages[] = new CRM_Utils_Check_Message(
311 'checkVersionDisabled',
312 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) . '"')),
313 ts('Update Check Disabled'),
314 \Psr\Log\LogLevel::NOTICE,
315 'fa-times-circle-o'
316 );
317 }
318
319 if ($vc->isInfoAvailable) {
320 $newerVersion = $vc->isNewerVersionAvailable();
321 if ($newerVersion['version']) {
322 $vInfo = array(
323 1 => $newerVersion['version'],
324 2 => $vc->localVersion,
325 );
326 // LTS = long-term support version
327 if ($newerVersion['status'] == 'lts') {
328 $vInfo[1] .= ' ' . ts('(long-term support)');
329 }
330
331 if ($newerVersion['upgrade'] == 'security') {
332 // Security
333 $severity = \Psr\Log\LogLevel::CRITICAL;
334 $title = ts('CiviCRM Security Update Required');
335 $message = ts('New security release %1 is available. The site is currently running %2.', $vInfo);
336 }
337 elseif ($newerVersion['status'] == 'eol') {
338 // Warn about EOL
339 $severity = \Psr\Log\LogLevel::WARNING;
340 $title = ts('CiviCRM Update Needed');
341 $message = ts('New version %1 is available. The site is currently running %2, which has reached its end of life.', $vInfo);
342 }
343 else {
344 // For most new versions, just make them notice
345 $severity = \Psr\Log\LogLevel::NOTICE;
346 $title = ts('CiviCRM Update Available');
347 $message = ts('New version %1 is available. The site is currently running %2.', $vInfo);
348 }
349 }
350 elseif (!empty($vc->cronJob['is_active'])) {
351 $vNum = $vc->localVersion;
352 // LTS = long-term support version
353 if ($newerVersion['status'] == 'lts') {
354 $vNum .= ' ' . ts('(long-term support)');
355 }
356
357 $severity = \Psr\Log\LogLevel::INFO;
358 $title = ts('CiviCRM Up-to-Date');
359 $message = ts('CiviCRM version %1 is up-to-date.', array(1 => $vNum));
360 }
361
362 if (!empty($message)) {
363 $messages[] = new CRM_Utils_Check_Message(
364 __FUNCTION__,
365 $message,
366 $title,
367 $severity,
368 'fa-cloud-upload'
369 );
370 }
371 }
372
373 return $messages;
374 }
375
376 /**
377 * Checks if extensions are set up properly
378 * @return array
379 */
380 public function checkExtensions() {
381 $messages = array();
382 $extensionSystem = CRM_Extension_System::singleton();
383 $mapper = $extensionSystem->getMapper();
384 $manager = $extensionSystem->getManager();
385
386 if ($extensionSystem->getDefaultContainer()) {
387 $basedir = $extensionSystem->getDefaultContainer()->baseDir;
388 }
389
390 if (empty($basedir)) {
391 // no extension directory
392 $messages[] = new CRM_Utils_Check_Message(
393 __FUNCTION__,
394 ts('Your extensions directory is not set. Click <a href="%1">here</a> to set the extensions directory.',
395 array(1 => CRM_Utils_System::url('civicrm/admin/setting/path', 'reset=1'))),
396 ts('Directory not writable'),
397 \Psr\Log\LogLevel::NOTICE,
398 'fa-plug'
399 );
400 return $messages;
401 }
402
403 if (!is_dir($basedir)) {
404 $messages[] = new CRM_Utils_Check_Message(
405 __FUNCTION__,
406 ts('Your extensions directory path points to %1, which is not a directory. Please check your file system.',
407 array(1 => $basedir)),
408 ts('Extensions directory incorrect'),
409 \Psr\Log\LogLevel::ERROR,
410 'fa-plug'
411 );
412 return $messages;
413 }
414 elseif (!is_writable($basedir)) {
415 $messages[] = new CRM_Utils_Check_Message(
416 __FUNCTION__,
417 ts('Directory %1 is not writable. Please change your file permissions.',
418 array(1 => $basedir)),
419 ts('Directory not writable'),
420 \Psr\Log\LogLevel::ERROR,
421 'fa-plug'
422 );
423 return $messages;
424 }
425
426 if (empty($extensionSystem->getDefaultContainer()->baseUrl)) {
427 $messages[] = new CRM_Utils_Check_Message(
428 __FUNCTION__,
429 ts('The extensions URL is not properly set. Please go to the <a href="%1">URL setting page</a> and correct it.',
430 array(1 => CRM_Utils_System::url('civicrm/admin/setting/url', 'reset=1'))),
431 ts('Extensions url missing'),
432 \Psr\Log\LogLevel::ERROR,
433 'fa-plug'
434 );
435 return $messages;
436 }
437
438 if (!$extensionSystem->getBrowser()->isEnabled()) {
439 $messages[] = new CRM_Utils_Check_Message(
440 __FUNCTION__,
441 ts('Not checking remote URL for extensions since ext_repo_url is set to false.'),
442 ts('Extensions check disabled'),
443 \Psr\Log\LogLevel::NOTICE,
444 'fa-plug'
445 );
446 return $messages;
447 }
448
449 try {
450 $remotes = $extensionSystem->getBrowser()->getExtensions();
451 }
452 catch (CRM_Extension_Exception $e) {
453 $messages[] = new CRM_Utils_Check_Message(
454 __FUNCTION__,
455 $e->getMessage(),
456 ts('Extension download error'),
457 \Psr\Log\LogLevel::ERROR,
458 'fa-plug'
459 );
460 return $messages;
461 }
462
463 if (!$remotes) {
464 // 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.
465 $messages[] = new CRM_Utils_Check_Message(
466 __FUNCTION__,
467 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(
468 1 => CRM_Utils_System::majorVersion(),
469 2 => 'href="http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions"',
470 )),
471 ts('No Extensions Available for this Version'),
472 \Psr\Log\LogLevel::NOTICE,
473 'fa-plug'
474 );
475 return $messages;
476 }
477
478 $keys = array_keys($manager->getStatuses());
479 sort($keys);
480 $updates = $errors = $okextensions = array();
481
482 foreach ($keys as $key) {
483 try {
484 $obj = $mapper->keyToInfo($key);
485 }
486 catch (CRM_Extension_Exception $ex) {
487 $errors[] = ts('Failed to read extension (%1). Please refresh the extension list.', array(1 => $key));
488 continue;
489 }
490 $row = CRM_Admin_Page_Extensions::createExtendedInfo($obj);
491 switch ($row['status']) {
492 case CRM_Extension_Manager::STATUS_INSTALLED_MISSING:
493 $errors[] = ts('%1 extension (%2) is installed but missing files.', array(1 => CRM_Utils_Array::value('label', $row), 2 => $key));
494 break;
495
496 case CRM_Extension_Manager::STATUS_INSTALLED:
497 if (!empty($remotes[$key]) && version_compare($row['version'], $remotes[$key]->version, '<')) {
498 $updates[] = ts('%1 (%2) version %3 is installed. <a %4>Upgrade to version %5</a>.', array(
499 1 => CRM_Utils_Array::value('label', $row),
500 2 => $key,
501 3 => $row['version'],
502 4 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id=$key&key=$key") . '"',
503 5 => $remotes[$key]->version,
504 ));
505 }
506 else {
507 if (empty($row['label'])) {
508 $okextensions[] = $key;
509 }
510 else {
511 $okextensions[] = ts('%1 (%2) version %3', array(
512 1 => $row['label'],
513 2 => $key,
514 3 => $row['version'],
515 ));
516 }
517 }
518 break;
519 }
520 }
521
522 if (!$okextensions && !$updates && !$errors) {
523 $messages[] = new CRM_Utils_Check_Message(
524 'extensionsOk',
525 ts('No extensions installed. <a %1>Browse available extensions</a>.', array(
526 1 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', 'reset=1') . '"',
527 )),
528 ts('Extensions'),
529 \Psr\Log\LogLevel::INFO,
530 'fa-plug'
531 );
532 }
533
534 if ($errors) {
535 $messages[] = new CRM_Utils_Check_Message(
536 __FUNCTION__,
537 '<ul><li>' . implode('</li><li>', $errors) . '</li></ul>',
538 ts('Extension Error'),
539 \Psr\Log\LogLevel::ERROR,
540 'fa-plug'
541 );
542 }
543
544 if ($updates) {
545 $messages[] = new CRM_Utils_Check_Message(
546 'extensionUpdates',
547 '<ul><li>' . implode('</li><li>', $updates) . '</li></ul>',
548 ts('Extension Update Available', array('plural' => '%count Extension Updates Available', 'count' => count($updates))),
549 \Psr\Log\LogLevel::WARNING,
550 'fa-plug'
551 );
552 }
553
554 if ($okextensions) {
555 if ($updates || $errors) {
556 $message = ts('1 extension is up-to-date:', array('plural' => '%count extensions are up-to-date:', 'count' => count($okextensions)));
557 }
558 else {
559 $message = ts('All extensions are up-to-date:');
560 }
561 $messages[] = new CRM_Utils_Check_Message(
562 'extensionsOk',
563 $message . '<ul><li>' . implode('</li><li>', $okextensions) . '</li></ul>',
564 ts('Extensions'),
565 \Psr\Log\LogLevel::INFO,
566 'fa-plug'
567 );
568 }
569
570 return $messages;
571 }
572
573
574 /**
575 * Checks if extensions are set up properly
576 * @return array
577 */
578 public function checkExtensionUpgrades() {
579 $messages = array();
580
581 if (CRM_Extension_Upgrades::hasPending()) {
582 $messages[] = new CRM_Utils_Check_Message(
583 __FUNCTION__,
584 ts('Extension upgrades are pending. Please visit <a href="%1">the upgrade page</a> to run them.',
585 array(1 => CRM_Utils_System::url('civicrm/admin/extensions/upgrade', 'reset=1'))),
586 ts('Run Extension Upgrades'),
587 \Psr\Log\LogLevel::ERROR,
588 'fa-plug'
589 );
590 }
591 return $messages;
592 }
593
594 /**
595 * Checks if CiviCRM database version is up-to-date
596 * @return array
597 */
598 public function checkDbVersion() {
599 $messages = array();
600 $dbVersion = CRM_Core_BAO_Domain::version();
601 $upgradeUrl = CRM_Utils_System::url("civicrm/upgrade", "reset=1");
602
603 if (!$dbVersion) {
604 // if db.ver missing
605 $messages[] = new CRM_Utils_Check_Message(
606 __FUNCTION__,
607 ts('Version information found to be missing in database. You will need to determine the correct version corresponding to your current database state.'),
608 ts('Database Version Missing'),
609 \Psr\Log\LogLevel::ERROR,
610 'fa-database'
611 );
612 }
613 elseif (!CRM_Utils_System::isVersionFormatValid($dbVersion)) {
614 $messages[] = new CRM_Utils_Check_Message(
615 __FUNCTION__,
616 ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.'),
617 ts('Database Version Invalid'),
618 \Psr\Log\LogLevel::ERROR,
619 'fa-database'
620 );
621 }
622 elseif (stripos($dbVersion, 'upgrade')) {
623 // if db.ver indicates a partially upgraded db
624 $messages[] = new CRM_Utils_Check_Message(
625 __FUNCTION__,
626 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)),
627 ts('Database Partially Upgraded'),
628 \Psr\Log\LogLevel::ALERT,
629 'fa-database'
630 );
631 }
632 else {
633 $codeVersion = CRM_Utils_System::version();
634
635 // if db.ver < code.ver, time to upgrade
636 if (version_compare($dbVersion, $codeVersion) < 0) {
637 $messages[] = new CRM_Utils_Check_Message(
638 __FUNCTION__,
639 ts('New codebase version detected. You must visit <a href=\'%1\'>upgrade screen</a> to upgrade the database.', array(1 => $upgradeUrl)),
640 ts('Database Upgrade Required'),
641 \Psr\Log\LogLevel::ALERT,
642 'fa-database'
643 );
644 }
645
646 // if db.ver > code.ver, sth really wrong
647 if (version_compare($dbVersion, $codeVersion) > 0) {
648 $messages[] = new CRM_Utils_Check_Message(
649 __FUNCTION__,
650 ts('Your database is marked with an unexpected version number: %1. The v%2 codebase may not be compatible with your database state.
651 You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase
652 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.',
653 array(1 => $dbVersion, 2 => $codeVersion)
654 ),
655 ts('Database In Unexpected Version'),
656 \Psr\Log\LogLevel::ERROR,
657 'fa-database'
658 );
659 }
660 }
661
662 return $messages;
663 }
664
665 /**
666 * ensure that all CiviCRM tables are InnoDB
667 * @return array
668 */
669 public function checkDbEngine() {
670 $messages = array();
671
672 if (CRM_Core_DAO::isDBMyISAM(150)) {
673 $messages[] = new CRM_Utils_Check_Message(
674 __FUNCTION__,
675 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.'),
676 ts('MyISAM Database Engine'),
677 \Psr\Log\LogLevel::ERROR,
678 'fa-database'
679 );
680 }
681 return $messages;
682 }
683
684 }