Skip to content
Snippets Groups Projects
Commit 9979ff93 authored by totten's avatar totten
Browse files

CRM_Utils_Check_Security - Split allChecks in two:

 * checkAll - Simply aggregates the other checks
 * showPeriodicAlerts - Application logic for when/how to run check
parent a996bf82
No related branches found
No related tags found
No related merge requests found
......@@ -195,7 +195,7 @@ class CRM_Core_Page {
if (empty($_GET['snippet'])) {
// Version check and intermittent alert to admins
CRM_Utils_VersionCheck::singleton()->versionAlert();
CRM_Utils_Check_Security::singleton()->allChecks();
CRM_Utils_Check_Security::singleton()->showPeriodicAlerts();
// Debug msg once per hour
if ($config->debug && CRM_Core_Permission::check('administer CiviCRM') && CRM_Core_Session::singleton()->timer('debug_alert', 3600)) {
......
......@@ -75,6 +75,18 @@ class CRM_Utils_Check_Security {
}
}
/**
* Execute "checkAll"
*/
public function showPeriodicAlerts() {
if (CRM_Core_Permission::check('administer CiviCRM')) {
$session = CRM_Core_Session::singleton();
if ($session->timer('check_' . __CLASS__, self::CHECK_TIMER)) {
$this->checkAll();
}
}
}
/**
* Run some sanity checks.
*
......@@ -88,15 +100,10 @@ class CRM_Utils_Check_Security {
* @see Drupal's hook_requirements() -
* https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_requirements
*/
public function allChecks() {
if (CRM_Core_Permission::check('administer CiviCRM')) {
$session = CRM_Core_Session::singleton();
if ($session->timer('check_' . __CLASS__, self::CHECK_TIMER)) {
CRM_Utils_Check_Security::singleton()->checkLogFileIsNotAccessible();
CRM_Utils_Check_Security::singleton()->checkUploadsAreNotAccessible();
CRM_Utils_Check_Security::singleton()->checkDirectoriesAreNotBrowseable();
}
}
public function checkAll() {
CRM_Utils_Check_Security::singleton()->checkLogFileIsNotAccessible();
CRM_Utils_Check_Security::singleton()->checkUploadsAreNotAccessible();
CRM_Utils_Check_Security::singleton()->checkDirectoriesAreNotBrowseable();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment