Skip to content

Commit

Permalink
fixed a configuration bug
Browse files Browse the repository at this point in the history
  • Loading branch information
azt3k committed Jun 2, 2015
1 parent ee5111f commit 6905622
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions code/SmtpMailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ class SmtpMailer extends Mailer {

public $mailer = null;

/**
* @config
*/
private static $conf = array(
private static $defaults = array(
'default_from' => array(
'name' => 'admin',
'email' => 'admin@localhost'
Expand All @@ -23,6 +20,11 @@ class SmtpMailer extends Mailer {
'lang' => 'en'
);

/**
* @config
*/
private static $conf = array();

/**
* Constructor
*
Expand All @@ -45,14 +47,15 @@ public static function set_conf($conf) {
* @return stdClass
*/
public static function get_conf() {
return (object) static::$conf;
return (object) static::array_merge_recursive_distinct(static::$defaults, static::$conf);
}

/**
* @return void
*/
protected static function set_conf_from_yaml() {
$conf = (array) Config::inst()->get('SmtpMailer', 'conf');
// die(print_r($conf,1));
if (!empty($conf))
static::$conf = static::array_merge_recursive_distinct(static::$conf, $conf);
}
Expand Down

0 comments on commit 6905622

Please sign in to comment.