MDL-21042 report_security: don't display warning for riskbackup unnecessarily
authorPaul Holden <pholden@greenhead.ac.uk>
Fri, 6 Jan 2012 11:52:31 +0000 (11:52 +0000)
committerMark Nelson <markn@moodle.com>
Thu, 7 Aug 2014 02:53:54 +0000 (19:53 -0700)
report/security/locallib.php

index 793ae7f..e9e654a 100644 (file)
@@ -766,7 +766,12 @@ function report_security_check_riskbackup($detailed=false) {
     $systemrolecount = empty($systemroles) ? 0 : count($systemroles);
     $overriddenrolecount = empty($overriddenroles) ? 0 : count($overriddenroles);
 
-    $result->status  = REPORT_SECURITY_WARNING; // there is always at least one admin
+    if (max($usercount, $systemrolecount, $overriddenrolecount) > 0) {
+        $result->status = REPORT_SECURITY_WARNING;
+    } else {
+        $result->status = REPORT_SECURITY_OK;
+    }
+
     $a = (object)array('rolecount'=>$systemrolecount,'overridecount'=>$overriddenrolecount,'usercount'=>$usercount);
     $result->info = get_string('check_riskbackup_warning', 'report_security', $a);