From 2959719c58dca4e07f83619b366fb44bda6425df Mon Sep 17 00:00:00 2001 From: Daniel Thee Roperto Date: Mon, 19 Sep 2016 18:31:13 +1000 Subject: [PATCH] Minor changes in outagelib, added PhpDocs and simplified MOODLE_INTERNAL check. --- classes/outagelib.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/classes/outagelib.php b/classes/outagelib.php index 77b6854..4ee3275 100644 --- a/classes/outagelib.php +++ b/classes/outagelib.php @@ -20,9 +20,7 @@ use auth_outage_renderer; use Exception; use moodle_url; -if (!defined('MOODLE_INTERNAL')) { - die('Direct access to this script is forbidden.'); // It must be included from a Moodle page. -} +defined('MOODLE_INTERNAL') || die(); /** * Outage related functions. @@ -96,10 +94,19 @@ class outagelib { } } + /** + * Creates a configuration object ensuring all parameters are set, + * loading defaults even if the plugin is not configured. + * @return object Configuration object with all parameters set. + */ public static function get_config() { return (object)array_merge(self::get_config_defaults(), (array)get_config('auth_outage')); } + /** + * Creates the default configurations. If the plugin is not configured we should use those defaults. + * @return array Default configuration. + */ public static function get_config_defaults() { global $CFG;