Skip to content

Commit

Permalink
mnet MDL-19239 changed all instances of fetching config from db to us…
Browse files Browse the repository at this point in the history
…e get_config
  • Loading branch information
Penny Leach committed Jan 11, 2010
1 parent 62bb387 commit bac44e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions mnet/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function get_keypair() {
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
Expand All @@ -84,7 +84,7 @@ function get_keypair() {
// 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();
Expand All @@ -99,7 +99,7 @@ function get_keypair() {

// 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;
Expand Down
2 changes: 1 addition & 1 deletion mnet/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit bac44e6

Please sign in to comment.