forked from civicrm/civicrm-core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request civicrm#8 from ginkgostreet/status-page-1
CRM-13823 Move dashboard notices to system check
- Loading branch information
Showing
7 changed files
with
113 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,8 +50,6 @@ public function run() { | |
$resources->addScriptFile('civicrm', 'js/jquery/jquery.dashboard.js', 0, 'html-header', FALSE); | ||
$resources->addStyleFile('civicrm', 'css/dashboard.css'); | ||
|
||
$config = CRM_Core_Config::singleton(); | ||
|
||
$resetCache = CRM_Utils_Request::retrieve('resetCache', 'Positive', CRM_Core_DAO::$_nullObject); | ||
|
||
CRM_Utils_System::setTitle(ts('CiviCRM Home')); | ||
|
@@ -71,50 +69,6 @@ public function run() { | |
$this->assign('hookContentPlacement', $contentPlacement); | ||
} | ||
|
||
//check that default FROM email address, owner (domain) organization name and default mailbox are configured. | ||
$fromEmailOK = TRUE; | ||
$ownerOrgOK = TRUE; | ||
$defaultMailboxOK = TRUE; | ||
|
||
// Don't put up notices if user doesn't have administer CiviCRM permission | ||
if (CRM_Core_Permission::check('administer CiviCRM')) { | ||
$destination = CRM_Utils_System::url( | ||
'civicrm/dashboard', | ||
'reset=1', | ||
FALSE, NULL, FALSE | ||
); | ||
|
||
$destination = urlencode($destination); | ||
|
||
list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE); | ||
|
||
if (!$domainEmailAddress || $domainEmailAddress == '[email protected]') { | ||
$fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}"); | ||
$this->assign('fixEmailUrl', $fixEmailUrl); | ||
$fromEmailOK = FALSE; | ||
} | ||
|
||
$domain = CRM_Core_BAO_Domain::getDomain(); | ||
$domainName = $domain->name; | ||
if (!$domainName || $domainName == 'Default Domain Name') { | ||
$fixOrgUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1&civicrmDestination={$destination}"); | ||
$this->assign('fixOrgUrl', $fixOrgUrl); | ||
$ownerOrgOK = FALSE; | ||
} | ||
|
||
if (in_array('CiviMail', $config->enableComponents) && | ||
CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG" | ||
) { | ||
$fixDefaultMailbox = CRM_Utils_System::url('civicrm/admin/mailSettings', "reset=1&civicrmDestination={$destination}"); | ||
$this->assign('fixDefaultMailbox', $fixDefaultMailbox); | ||
$defaultMailboxOK = FALSE; | ||
} | ||
} | ||
|
||
$this->assign('fromEmailOK', $fromEmailOK); | ||
$this->assign('ownerOrgOK', $ownerOrgOK); | ||
$this->assign('defaultMailboxOK', $defaultMailboxOK); | ||
|
||
$communityMessages = CRM_Core_CommunityMessages::create(); | ||
if ($communityMessages->isEnabled()) { | ||
$message = $communityMessages->pick(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,9 @@ public function checkAll() { | |
$messages = array_merge( | ||
$this->checkMysqlTime(), | ||
$this->checkDebug(), | ||
$this->checkOutboundMail() | ||
$this->checkOutboundMail(), | ||
$this->checkDomainNameEmail(), | ||
$this->checkDefaultMailbox() | ||
); | ||
return $messages; | ||
} | ||
|
@@ -66,7 +68,7 @@ public function checkMysqlTime() { | |
2 => $sqlNow, | ||
3 => $phpNow, | ||
)), | ||
ts('Environment Settings'), | ||
ts('Timestamp Mismatch'), | ||
\Psr\Log\LogLevel::ERROR | ||
); | ||
} | ||
|
@@ -86,7 +88,7 @@ public function checkDebug() { | |
'checkDebug', | ||
ts('Warning: Debug is enabled in <a href="%1">system settings</a>. This should not be enabled on production servers.', | ||
array(1 => CRM_Utils_System::url('civicrm/admin/setting/debug', 'reset=1'))), | ||
ts('Debug Mode'), | ||
ts('Debug Mode Enabled'), | ||
\Psr\Log\LogLevel::WARNING | ||
); | ||
} | ||
|
@@ -110,12 +112,74 @@ public function checkOutboundMail() { | |
'checkOutboundMail', | ||
ts('Warning: Outbound email is disabled in <a href="%1">system settings</a>. Proper settings should be enabled on production servers.', | ||
array(1 => CRM_Utils_System::url('civicrm/admin/setting/smtp', 'reset=1'))), | ||
ts('Outbound Email Settings'), | ||
ts('Outbound Email Disabled'), | ||
\Psr\Log\LogLevel::WARNING | ||
); | ||
} | ||
|
||
return $messages; | ||
} | ||
|
||
/** | ||
* Check that domain email and org name are set | ||
* @return array | ||
*/ | ||
|
||
public function checkDomainNameEmail() { | ||
$messages = array(); | ||
|
||
list($domainEmailName, $domainEmailAddress) = CRM_Core_BAO_Domain::getNameAndEmail(TRUE); | ||
$domain = CRM_Core_BAO_Domain::getDomain(); | ||
$domainName = $domain->name; | ||
$fixEmailUrl = CRM_Utils_System::url("civicrm/admin/domain", "action=update&reset=1"); | ||
|
||
if (!$domainEmailAddress || $domainEmailAddress == '[email protected]') { | ||
if (!$domainName || $domainName == 'Default Domain Name') { | ||
$msg = ts("Please enter your organization's <a href=\"%1\">name, primary address, and default FROM Email Address</a> (for system-generated emails).", | ||
array(1 => $fixEmailUrl)); | ||
} | ||
else { | ||
$msg = ts('Please enter a <a href="%1">default FROM Email Address</a> (for system-generated emails).', | ||
array(1 => $fixEmailUrl)); | ||
} | ||
} | ||
elseif (!$domainName || $domainName == 'Default Domain Name') { | ||
$msg = ts("Please enter your organization's <a href=\"%1\">name and primary address</a>.", | ||
array(1 => $fixEmailUrl)); | ||
} | ||
$messages[] = new CRM_Utils_Check_Message( | ||
'checkDomainNameEmail', | ||
$msg, | ||
ts('Complete Setup'), | ||
\Psr\Log\LogLevel::WARNING | ||
); | ||
|
||
return $messages; | ||
} | ||
|
||
/** | ||
* Checks if a default bounce handling mailbox is set up | ||
* @return array | ||
*/ | ||
|
||
public function checkDefaultMailbox() { | ||
$messages = array(); | ||
$config = CRM_Core_Config::singleton(); | ||
|
||
if (in_array('CiviMail', $config->enableComponents) && | ||
CRM_Core_BAO_MailSettings::defaultDomain() == "EXAMPLE.ORG" | ||
) { | ||
$message = new CRM_Utils_Check_Message( | ||
'checkDefaultMailbox', | ||
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 | ||
); | ||
$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/'))); | ||
$messages[] = $message; | ||
} | ||
|
||
return $messages; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters