From 9979ff93d8ac205c0d4a3c0a484a6d7330823225 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 5 Feb 2014 10:04:01 -0800 Subject: [PATCH] CRM_Utils_Check_Security - Split allChecks in two: * checkAll - Simply aggregates the other checks * showPeriodicAlerts - Application logic for when/how to run check --- CRM/Core/Page.php | 2 +- CRM/Utils/Check/Security.php | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CRM/Core/Page.php b/CRM/Core/Page.php index 4fc023cac4..520a6f4feb 100644 --- a/CRM/Core/Page.php +++ b/CRM/Core/Page.php @@ -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)) { diff --git a/CRM/Utils/Check/Security.php b/CRM/Utils/Check/Security.php index 35b47cfbd4..d3d3d4dec6 100644 --- a/CRM/Utils/Check/Security.php +++ b/CRM/Utils/Check/Security.php @@ -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(); } /** -- 2.25.1