summaryrefslogtreecommitdiffstats
path: root/application/Bootstrap.php
diff options
context:
space:
mode:
Diffstat (limited to 'application/Bootstrap.php')
-rw-r--r--application/Bootstrap.php57
1 files changed, 57 insertions, 0 deletions
diff --git a/application/Bootstrap.php b/application/Bootstrap.php
new file mode 100644
index 0000000..35400b1
--- /dev/null
+++ b/application/Bootstrap.php
@@ -0,0 +1,57 @@
+<?php
+
+class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
+{
+ protected function _initAutoload()
+ {
+ $moduleLoader = new Zend_Application_Module_Autoloader(
+ array(
+ 'namespace' => '',
+ 'basePath' => APPLICATION_PATH
+ )
+ );
+ return $moduleLoader;
+ }
+
+ protected function _initDbSetup()
+ {
+ $logger = new Zend_Log();
+ $w = new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/debug.log');
+
+ $logger->addWriter($w);
+
+ $this->bootstrap('Db');
+ $db = $this->getResource('Db');
+ $tables = $db->listTables();
+ if(empty($tables)) {
+ $sql = file_get_contents(APPLICATION_PATH . '/configs/db.sql');
+ $logger->info("Setup DB");
+ $sqlcommands = explode(";\n",$sql);
+ try{
+ foreach($sqlcommands as $s) {
+ $db->getConnection()->exec($s);
+ }
+ }
+ catch (Exception $e) {
+ $logger->warn($e->getMessage());
+ }
+ } else {
+ $logger->info("Skip DB setup");
+
+ }
+ return;
+ }
+
+ public function _initViewHelpers()
+ {
+ $this->bootstrap('layout');
+ $layout = $this->getResource('layout');
+ $view = $layout->getView();
+ $view->doctype('XHTML1_STRICT');
+ $view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8');
+ $view->headTitle()->setSeparator(' :: ');
+ $view->headTitle('OpenSLX PBS');
+ }
+
+}
+