Added getting site config from DB

This commit is contained in:
Deon George
2011-09-29 17:13:32 +10:00
parent b6802e4b5d
commit 147d035e46
6 changed files with 77 additions and 40 deletions

View File

@@ -1,6 +1,27 @@
<?php defined('SYSPATH') or die('No direct access allowed.');
class Config extends lnApp_Config {
// Our setup object
public $so;
/**
* Load our site configuration from the DB
*
* We cant do this in __construct(), since Kohana hasn't been fully initialised yet.
*/
public function loadsite() {
// Anti-loop, if we have loaded our record, just return;
if ($this->so AND $this->so->loaded())
return $this;
$this->so = ORM::factory('setup',array('nonssl_url'=>URL::base('http')));
if (! $this->so->loaded())
throw new Kohana_Exception(_('Site [:site] not defined in DB?'),array(':site'=>URL::base('http')));
return $this;
}
/**
* Find a list of all database enabled modules
*