From: Coleman Watts Date: Thu, 22 Oct 2015 15:42:14 +0000 (-0400) Subject: CRM-13823 - Cleanup and add icons to system status messages X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=165aab596062b3b7cbc9113ee5dfbdf60590c583;p=civicrm-core.git CRM-13823 - Cleanup and add icons to system status messages --- diff --git a/CRM/Utils/Check/Case.php b/CRM/Utils/Check/Case.php index 3a5c3f0326..85bc78d215 100644 --- a/CRM/Utils/Check/Case.php +++ b/CRM/Utils/Check/Case.php @@ -52,7 +52,7 @@ class CRM_Utils_Check_Case { } /** - * Run some sanity checks. + * Run all checks in this class. * * @return array */ @@ -81,13 +81,17 @@ class CRM_Utils_Check_Case { elseif ($normalFile && $mungedFile) { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts('Case type "%2" has duplicate XML files ("%3" and "%4").
Read more about this warning', array( - 1 => CRM_Utils_System::getWikiBaseURL() . __FUNCTION__, - 2 => $caseTypeName, - 3 => $normalFile, - 4 => $mungedFile, - )), - ts('CiviCase') + ts('Case type "%1" has duplicate XML files ("%2" and "%3")', array( + 1 => $caseTypeName, + 2 => $normalFile, + 3 => $mungedFile, + )) . + '
' . + ts('Read more about this warning') . + '', + ts('CiviCase'), + \Psr\Log\LogLevel::WARNING, + 'fa-puzzle-piece' ); } elseif ($normalFile && !$mungedFile) { @@ -96,13 +100,17 @@ class CRM_Utils_Check_Case { elseif (!$normalFile && $mungedFile) { $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts('Case type "%2" corresponds to XML file ("%3") The XML file should be named "%4".
Read more about this warning', array( - 1 => CRM_Utils_System::getWikiBaseURL() . __FUNCTION__, - 2 => $caseTypeName, - 3 => $mungedFile, - 4 => "{$caseTypeName}.xml", - )), - ts('CiviCase') + ts('Case type "%1" corresponds to XML file ("%2") The XML file should be named "%3".', array( + 1 => $caseTypeName, + 2 => $mungedFile, + 3 => "{$caseTypeName}.xml", + )) . + '
' . + ts('Read more about this warning') . + '', + ts('CiviCase'), + \Psr\Log\LogLevel::WARNING, + 'fa-puzzle-piece' ); } elseif (!$normalFile && !$mungedFile) { diff --git a/CRM/Utils/Check/Env.php b/CRM/Utils/Check/Env.php index 27708274e3..8015126cc5 100644 --- a/CRM/Utils/Check/Env.php +++ b/CRM/Utils/Check/Env.php @@ -33,7 +33,7 @@ class CRM_Utils_Check_Env { /** - * Run some sanity checks. + * Run all checks in this class. * * @return array */ @@ -63,26 +63,28 @@ class CRM_Utils_Check_Env { if (version_compare(phpversion(), CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER) < 0) { $messages[] = new CRM_Utils_Check_Message( - 'checkPhpVersion', + __FUNCTION__, 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.', array( 1 => phpversion(), 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER, )), ts('PHP Out-of-Date'), - \Psr\Log\LogLevel::NOTICE + \Psr\Log\LogLevel::NOTICE, + 'fa-server' ); } else { $messages[] = new CRM_Utils_Check_Message( - 'checkPhpVersion', + __FUNCTION__, ts('This system uses PHP version %1 which meets or exceeds the minimum recommendation of %2.', array( 1 => phpversion(), 2 => CRM_Upgrade_Incremental_General::MIN_RECOMMENDED_PHP_VER, )), ts('PHP Up-to-Date'), - \Psr\Log\LogLevel::INFO + \Psr\Log\LogLevel::INFO, + 'fa-server' ); } @@ -101,14 +103,15 @@ class CRM_Utils_Check_Env { $sqlNow = CRM_Core_DAO::singleValueQuery("SELECT date_format(now(), '%Y-%m-%d %H:%i')"); if (!CRM_Utils_Time::isEqual($phpNow, $sqlNow, 2.5 * 60)) { $messages[] = new CRM_Utils_Check_Message( - 'checkMysqlTime', + __FUNCTION__, ts('Timestamps reported by MySQL (eg "%2") and PHP (eg "%3" ) are mismatched.
Read more about this warning', array( 1 => CRM_Utils_System::getWikiBaseURL() . 'checkMysqlTime', 2 => $sqlNow, 3 => $phpNow, )), ts('Timestamp Mismatch'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-server' ); } @@ -124,11 +127,12 @@ class CRM_Utils_Check_Env { $config = CRM_Core_Config::singleton(); if ($config->debug) { $messages[] = new CRM_Utils_Check_Message( - 'checkDebug', + __FUNCTION__, ts('Warning: Debug is enabled in system settings. This should not be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))), ts('Debug Mode Enabled'), - \Psr\Log\LogLevel::WARNING + \Psr\Log\LogLevel::WARNING, + 'fa-bug' ); } @@ -148,11 +152,12 @@ class CRM_Utils_Check_Env { || $mailingInfo['outBound_option'] == CRM_Mailing_Config::OUTBOUND_OPTION_MOCK) ) { $messages[] = new CRM_Utils_Check_Message( - 'checkOutboundMail', + __FUNCTION__, ts('Warning: Outbound email is disabled in system settings. Proper settings should be enabled on production servers.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))), ts('Outbound Email Disabled'), - \Psr\Log\LogLevel::WARNING + \Psr\Log\LogLevel::WARNING, + 'fa-envelope' ); } @@ -188,10 +193,11 @@ class CRM_Utils_Check_Env { if (!empty($msg)) { $messages[] = new CRM_Utils_Check_Message( - 'checkDomainNameEmail', + __FUNCTION__, $msg, ts('Complete Setup'), - \Psr\Log\LogLevel::WARNING + \Psr\Log\LogLevel::WARNING, + 'fa-check-square-o' ); } @@ -210,11 +216,12 @@ class CRM_Utils_Check_Env { CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG" ) { $message = new CRM_Utils_Check_Message( - 'checkDefaultMailbox', + __FUNCTION__, ts('Please configure a default mailbox for CiviMail.', array(1 => CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1"))), ts('Configure Default Mailbox'), - \Psr\Log\LogLevel::WARNING + \Psr\Log\LogLevel::WARNING, + 'fa-envelope' ); $message->addHelp(ts('Learn more in the user guide', array(1 => 'http://book.civicrm.org/user/advanced-configuration/email-system-configuration/'))); $messages[] = $message; @@ -245,28 +252,31 @@ class CRM_Utils_Check_Env { if ($lastCron > gmdate('U') - 3600) { $messages[] = new CRM_Utils_Check_Message( - 'checkLastCron', + __FUNCTION__, $msg, ts('Cron Running OK'), - \Psr\Log\LogLevel::INFO + \Psr\Log\LogLevel::INFO, + 'fa-clock-o' ); } elseif ($lastCron > gmdate('U') - 86400) { $message = new CRM_Utils_Check_Message( - 'checkLastCron', + __FUNCTION__, $msg, ts('Cron Not Running'), - \Psr\Log\LogLevel::WARNING + \Psr\Log\LogLevel::WARNING, + 'fa-clock-o' ); $message->addHelp(ts('Learn more in the Administrator\'s Guide supplement', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'))); $messages[] = $message; } else { $message = new CRM_Utils_Check_Message( - 'checkLastCron', + __FUNCTION__, $msg, ts('Cron Not Running'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-clock-o' ); $message->addHelp(ts('Learn more in the Administrator\'s Guide supplement', array(1 => 'http://wiki.civicrm.org/confluence/display/CRMDOC/Managing+Scheduled+Jobs'))); $messages[] = $message; @@ -291,12 +301,13 @@ class CRM_Utils_Check_Env { 1 => $newerVersion['version'], 2 => $vc->localVersion, ); + // LTS = long-term support version if ($newerVersion['status'] == 'lts') { - $vInfo[1] .= ' ' . ts('(long-term support)'); // LTS = long-term support version + $vInfo[1] .= ' ' . ts('(long-term support)'); } if ($newerVersion['upgrade'] == 'security') { - // For most new versions, just make them notice + // Security $severity = \Psr\Log\LogLevel::CRITICAL; $message = ts('New security release %1 is available. The site is currently running %2.', $vInfo); } @@ -313,8 +324,9 @@ class CRM_Utils_Check_Env { } else { $vNum = $vc->localVersion; + // LTS = long-term support version if ($newerVersion['status'] == 'lts') { - $vNum .= ' ' . ts('(long-term support)'); // LTS = long-term support version + $vNum .= ' ' . ts('(long-term support)'); } $severity = \Psr\Log\LogLevel::INFO; @@ -322,18 +334,20 @@ class CRM_Utils_Check_Env { } $messages[] = new CRM_Utils_Check_Message( - 'checkVersion', + __FUNCTION__, $message, ts('Update Status'), - $severity + $severity, + 'fa-cloud-upload' ); } else { $messages[] = new CRM_Utils_Check_Message( - 'checkVersion', + __FUNCTION__, ts('The check for new versions of CiviCRM has been disabled.'), ts('Update Check Disabled'), - \Psr\Log\LogLevel::NOTICE + \Psr\Log\LogLevel::NOTICE, + 'fa-times-circle-o' ); } @@ -357,53 +371,58 @@ class CRM_Utils_Check_Env { if (empty($basedir)) { // no extension directory $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, ts('Your extensions directory is not set. Click here to set the extensions directory.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/path', 'reset=1'))), ts('Extensions directory not writable'), - \Psr\Log\LogLevel::NOTICE + \Psr\Log\LogLevel::NOTICE, + 'fa-plug' ); return $messages; } if (!is_dir($basedir)) { $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, ts('Your extensions directory path points to %1, which is not a directory. Please check your file system.', array(1 => $basedir)), ts('Extensions directory incorrect'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-plug' ); return $messages; } elseif (!is_writable($basedir)) { $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, ts('Your extensions directory, %1, is not writable. Please change your file permissions.', array(1 => $basedir)), ts('Extensions directory not writable'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-plug' ); return $messages; } if (empty($extensionSystem->getDefaultContainer()->baseUrl)) { $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, ts('The extensions URL is not properly set. Please go to the URL setting page and correct it.', array(1 => CRM_Utils_System::url('civicrm/admin/setting/url', 'reset=1'))), - ts('Extensions directory not writable'), - \Psr\Log\LogLevel::ERROR + ts('Extensions url missing'), + \Psr\Log\LogLevel::ERROR, + 'fa-plug' ); return $messages; } if (!$extensionSystem->getBrowser()->isEnabled()) { $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, ts('Not checking remote URL for extensions since ext_repo_url is set to false.'), ts('Extensions check disabled'), - \Psr\Log\LogLevel::NOTICE + \Psr\Log\LogLevel::NOTICE, + 'fa-plug' ); return $messages; } @@ -413,10 +432,11 @@ class CRM_Utils_Check_Env { } catch (CRM_Extension_Exception $e) { $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, $e->getMessage(), ts('Extension download error'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-plug' ); return $messages; } @@ -424,13 +444,14 @@ class CRM_Utils_Check_Env { if (!$remotes) { // 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. $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, 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 download and install extensions manually (depending on access to your web server).', array( 1 => CRM_Utils_System::majorVersion(), 2 => 'href="http://wiki.civicrm.org/confluence/display/CRMDOC/Extensions"', )), ts('No Extensions Available for this Version'), - \Psr\Log\LogLevel::NOTICE + \Psr\Log\LogLevel::NOTICE, + 'fa-plug' ); return $messages; } @@ -486,10 +507,11 @@ class CRM_Utils_Check_Env { // OK, return several data rows $messages[] = new CRM_Utils_Check_Message( - 'checkExtensions', + __FUNCTION__, $msg, ts('Extension Updates'), - CRM_Utils_Check::severityMap($severity, TRUE) + CRM_Utils_Check::severityMap($severity, TRUE), + 'fa-plug' ); return $messages; @@ -505,11 +527,12 @@ class CRM_Utils_Check_Env { if (CRM_Extension_Upgrades::hasPending()) { $messages[] = new CRM_Utils_Check_Message( - 'checkExtensionUpgrades', + __FUNCTION__, ts('Extension upgrades are pending. Please visit the upgrade page to run them.', array(1 => CRM_Utils_System::url('civicrm/admin/extensions/upgrade', 'reset=1'))), ts('Run Extension Upgrades'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-plug' ); } return $messages; @@ -527,27 +550,30 @@ class CRM_Utils_Check_Env { if (!$dbVersion) { // if db.ver missing $messages[] = new CRM_Utils_Check_Message( - 'checkDbVersion', + __FUNCTION__, ts('Version information found to be missing in database. You will need to determine the correct version corresponding to your current database state.'), ts('Database Version Missing'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-database' ); } elseif (!CRM_Utils_System::isVersionFormatValid($dbVersion)) { $messages[] = new CRM_Utils_Check_Message( - 'checkDbVersion', + __FUNCTION__, ts('Database is marked with invalid version format. You may want to investigate this before you proceed further.'), ts('Database Version Invalid'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-database' ); } elseif (stripos($dbVersion, 'upgrade')) { // if db.ver indicates a partially upgraded db $messages[] = new CRM_Utils_Check_Message( - 'checkDbVersion', + __FUNCTION__, ts('Database check failed - the database looks to have been partially upgraded. You must reload the database with the backup and try the upgrade process again.', array(1 => $upgradeUrl)), ts('Database Partially Upgraded'), - \Psr\Log\LogLevel::ALERT + \Psr\Log\LogLevel::ALERT, + 'fa-database' ); } else { @@ -556,24 +582,26 @@ class CRM_Utils_Check_Env { // if db.ver < code.ver, time to upgrade if (version_compare($dbVersion, $codeVersion) < 0) { $messages[] = new CRM_Utils_Check_Message( - 'checkDbVersion', + __FUNCTION__, ts('New codebase version detected. You must visit upgrade screen to upgrade the database.', array(1 => $upgradeUrl)), ts('Database Upgrade Required'), - \Psr\Log\LogLevel::ALERT + \Psr\Log\LogLevel::ALERT, + 'fa-database' ); } // if db.ver > code.ver, sth really wrong if (version_compare($dbVersion, $codeVersion) > 0) { $messages[] = new CRM_Utils_Check_Message( - 'checkDbVersion', + __FUNCTION__, ts('Your database is marked with an unexpected version number: %1. The v%2 codebase may not be compatible with your database state. You will need to determine the correct version corresponding to your current database state. You may want to revert to the codebase you were using until you resolve this problem.
OR if this is a manual install from git, you might want to fix civicrm-version.php file.', array(1 => $dbVersion, 2 => $codeVersion) ), ts('Database In Unexpected Version'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-database' ); } } @@ -590,10 +618,11 @@ class CRM_Utils_Check_Env { if (CRM_Core_DAO::isDBMyISAM(150)) { $messages[] = new CRM_Utils_Check_Message( - 'checkDbEngine', + __FUNCTION__, 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.'), ts('MyISAM Database Engine'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-database' ); } return $messages; diff --git a/CRM/Utils/Check/Message.php b/CRM/Utils/Check/Message.php index dbaf7ed92b..3e3e8c481d 100644 --- a/CRM/Utils/Check/Message.php +++ b/CRM/Utils/Check/Message.php @@ -58,6 +58,12 @@ class CRM_Utils_Check_Message { */ private $help; + /** + * @var string + * crm-i css class + */ + private $icon; + /** * * @var bool @@ -77,7 +83,7 @@ class CRM_Utils_Check_Message { * * @see Psr\Log\LogLevel */ - public function __construct($name, $message, $title, $level = \Psr\Log\LogLevel::WARNING) { + public function __construct($name, $message, $title, $level = \Psr\Log\LogLevel::WARNING, $icon = NULL) { $this->name = $name; $this->message = $message; $this->title = $title; @@ -86,6 +92,7 @@ class CRM_Utils_Check_Message { $level = CRM_Utils_Check::severityMap($level); } $this->level = $level; + $this->icon = $icon; } /** @@ -143,6 +150,7 @@ class CRM_Utils_Check_Message { 'title' => $this->title, 'severity' => $this->level, 'is_visible' => $this->isVisible, + 'icon' => $this->icon, ); if (!empty($this->help)) { $array['help'] = $this->help; diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index 672d81aa0a..001c5104d9 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -50,7 +50,7 @@ class CRM_Utils_Check_Security { } /** - * Run some sanity checks. + * Run all checks in this class. * * @return array */ @@ -110,9 +110,11 @@ class CRM_Utils_Check_Security { . '
' . 'Read more about this warning'; $messages[] = new CRM_Utils_Check_Message( - 'checkLogFileIsNotAccessible', + __FUNCTION__, ts($msg, array(1 => $log_url, 2 => $docs_url)), - ts('Security Warning') + ts('Security Warning'), + \Psr\Log\LogLevel::WARNING, + 'fa-lock' ); } } @@ -151,7 +153,7 @@ class CRM_Utils_Check_Security { $heuristicUrl = $this->guessUrl($privateDir); if ($this->isDirAccessible($privateDir, $heuristicUrl)) { $messages[] = new CRM_Utils_Check_Message( - 'checkUploadsAreNotAccessible', + __FUNCTION__, ts('Files in the data directory (%2) should not be downloadable.' . '
' . 'Read more about this warning', @@ -161,7 +163,8 @@ class CRM_Utils_Check_Security { 3 => $heuristicUrl, )), ts('Private Files Readable'), - \Psr\Log\LogLevel::WARNING + \Psr\Log\LogLevel::WARNING, + 'fa-lock' ); } } @@ -205,10 +208,11 @@ class CRM_Utils_Check_Security { 'Read more about this warning'; $docs_url = $this->createDocUrl('checkDirectoriesAreNotBrowseable'); $messages[] = new CRM_Utils_Check_Message( - 'checkDirectoriesAreNotBrowseable', + __FUNCTION__, ts($msg, array(1 => $publicDir, 2 => $publicDir, 3 => $docs_url)), ts('Browseable Directories'), - \Psr\Log\LogLevel::ERROR + \Psr\Log\LogLevel::ERROR, + 'fa-lock' ); } } @@ -254,10 +258,11 @@ class CRM_Utils_Check_Security { foreach ($files as $file) { if (file_exists($file[0])) { $messages[] = new CRM_Utils_Check_Message( - 'checkFilesAreNotPresent', + __FUNCTION__, ts('File \'%1\' presents a security risk and should be deleted.', array(1 => $file)), ts('Unsafe Files'), - $file[1] + $file[1], + 'fa-lock' ); } } @@ -281,11 +286,13 @@ class CRM_Utils_Check_Security { if (!empty($list)) { $messages[] = new CRM_Utils_Check_Message( - 'checkCxnOverrides', + __FUNCTION__, ts('The system administrator has disabled security settings (%1). Connections to remote applications are insecure.', array( 1 => implode(', ', $list), )), - ts('Security Warning') + ts('Security Warning'), + \Psr\Log\LogLevel::WARNING, + 'fa-lock' ); } diff --git a/ang/crmStatusPage/StatusPage.html b/ang/crmStatusPage/StatusPage.html index 327cc625b4..ded27d0e4c 100644 --- a/ang/crmStatusPage/StatusPage.html +++ b/ang/crmStatusPage/StatusPage.html @@ -2,11 +2,7 @@
-
- -
-

{{ts('Help messages will be displayed here')}}

-
+

Status Page


@@ -14,7 +10,9 @@
-

{{status.title}} +

+ + {{status.title}}