public function setup() { //Setup session stuff SilkSession::setup(); //Load up the configuration file if (is_file(join_path(ROOT_DIR, 'config', 'setup.yml'))) { $config = SilkYaml::load(join_path(ROOT_DIR, 'config', 'setup.yml')); } else { die("Config file not found!"); } //Add class path entries if (isset($config['class_autoload'])) { foreach ($config['class_autoload'] as $dir) { add_class_directory(join_path(ROOT_DIR, $dir)); } } //Setup the database connection if (!isset($config['database']['dsn'])) { die("No database information found in the configuration file"); } if (null == SilkDatabase::connect($config['database']['dsn'], $config['debug'], true, $config['database']['prefix'])) { die("Could not connect to the database"); } silk()->set('config', $config); //Load components SilkComponentManager::load(); }
public static function load() { if (self::find_components()) { $component_dir = join_path(ROOT_DIR, 'components'); foreach (self::get_instance()->components as $one_component) { add_class_directory(join_path($component_dir, $one_component, 'models')); add_class_directory(join_path($component_dir, $one_component, 'controllers')); } } }
/** * Setup a dependency to another component so models can be shared * Just a wrapper for add_class_directory() * @author Greg Froese * * @param unknown_type $component_name */ function add_component_dependent($component_name) { add_class_directory(join_path(dirname(dirname(SILK_LIB_DIR)), "components", $component_name, "models")); // $GLOBALS["class_dirs"][] = join_path(dirname(dirname(SILK_LIB_DIR)), "app", "components", $component_name, "models"); // unset ($GLOBALS['dirscan']); }