Example #1
0
 public static function bootstrap()
 {
     //
     // set the include_path
     set_include_path(implode(PATH_SEPARATOR, array('/usr/share/php/libzend-framework-php', realpath(APPLICATION_PATH . '/../glo-framework/library'), realpath(APPLICATION_PATH . '/../glo-generated'), realpath(APPLICATION_PATH . '/../library'), realpath(APPLICATION_PATH . '/../vendor'), get_include_path())));
     //
     // set up the autoloader
     require_once 'Zend/Loader/Autoloader.php';
     require_once 'Glo/Loader.php';
     $autoLoader = Zend_Loader_Autoloader::getInstance();
     $autoLoader->pushAutoloader(array('Glo_Loader', 'loadClass'));
     $autoLoader->setFallbackAutoloader(true);
     //
     // register the config
     $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', Glo_Environment::get(), array('allowModifications' => TRUE));
     $registry = Zend_Registry::getInstance();
     $registry->set('config', $config);
     //
     // initialize the Zend Application
     require_once 'Zend/Application.php';
     $application = new Zend_Application(Glo_Environment::get(), APPLICATION_PATH . '/configs/application.ini');
     //
     // register the database configuration
     $bootstrap = $application->getBootstrap();
     $bootstrap->bootstrap('multidb');
     $resource = $bootstrap->getResource('multidb');
     Zend_Registry::set("conn_read", $resource->getDb('read'));
     Zend_Registry::set("conn_read_volatile", $resource->getDb('read_volatile'));
     Zend_Registry::set("conn_write", $resource->getDb('write'));
     return $application;
 }
Example #2
0
 /**
  * setEnvironment
  *
  * Allows one to override the default behavior of this class and 
  * set the environment manually.  This may be necessary of you are
  * running dev or qa code in a spot that this class would mistake
  * for some other environment.
  */
 public static function set($const = null)
 {
     if ($const) {
         self::$_environment = $const;
     } elseif (getenv('APPLICATION_ENV')) {
         self::$_environment = getenv('APPLICATION_ENV');
     } else {
         throw new Exception('No environment specified.');
     }
     return;
 }