From: Penny Leach Date: Mon, 11 Jan 2010 22:53:11 +0000 (+0000) Subject: mnet MDL-19239 changed all instances of fetching config from db to use get_config X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=bac44e6dc962eab59181f4ec4f8f97fe1e9c95c6;p=moodle.git mnet MDL-19239 changed all instances of fetching config from db to use get_config --- diff --git a/mnet/environment.php b/mnet/environment.php index e4f6f6f800..5cc649b2e9 100644 --- a/mnet/environment.php +++ b/mnet/environment.php @@ -70,7 +70,7 @@ class mnet_environment { if (!empty($this->keypair)) return true; $this->keypair = array(); - $keypair = $DB->get_field('config_plugins', 'value', array('plugin'=>'mnet', 'name'=>'openssl')); + $keypair = get_config('mnet', 'openssl'); if (!empty($keypair)) { // Explode/Implode is faster than Unserialize/Serialize @@ -84,7 +84,7 @@ class mnet_environment { // Key generation/rotation // 1. Archive the current key (if there is one). - $result = $DB->get_field('config_plugins', 'value', array('plugin'=>'mnet', 'name'=>'openssl_history')); + $result = get_config('mnet', 'openssl_history'); if(empty($result)) { set_config('openssl_history', serialize(array()), 'mnet'); $openssl_history = array(); @@ -99,7 +99,7 @@ class mnet_environment { // 2. How many old keys do we want to keep? Use array_slice to get // rid of any we don't want - $openssl_generations = $DB->get_field('config_plugins', 'value', array('plugin'=>'mnet', 'name'=>'openssl_generations')); + $openssl_generations = get_config('mnet', 'openssl_generations'); if(empty($openssl_generations)) { set_config('openssl_generations', 3, 'mnet'); $openssl_generations = 3; diff --git a/mnet/lib.php b/mnet/lib.php index 4a02505e8e..f56e9d3769 100644 --- a/mnet/lib.php +++ b/mnet/lib.php @@ -314,7 +314,7 @@ function mnet_get_keypair() { global $CFG, $DB;; static $keypair = null; if (!is_null($keypair)) return $keypair; - if ($result = $DB->get_field('config_plugins', 'value', array('plugin'=>'mnet', 'name'=>'openssl'))) { + if ($result = get_config('mnet', 'openssl')) { list($keypair['certificate'], $keypair['keypair_PEM']) = explode('@@@@@@@@', $result); $keypair['privatekey'] = openssl_pkey_get_private($keypair['keypair_PEM']); $keypair['publickey'] = openssl_pkey_get_public($keypair['certificate']);