/** * Do some checks in the begin. * * @return void */ public function init() { $this->_helper->viewRenderer->setNoRender(); $this->view->clearVars(); $front = Zend_Controller_Front::getInstance(); $response = $front->getRequest(); $webPath = $response->getScheme() . '://' . $response->getHttpHost() . $response->getBasePath() . '/'; $this->view->webPath = $webPath; $this->view->message = array(); $this->view->success = array(); $this->view->error = array(); $this->view->exportModules = Setup_Models_Migration::getModulesToMigrate(); $this->_helper->viewRenderer->setNoRender(); try { $this->_setup = new Setup_Models_Setup(); $message = $this->_setup->getMessage(); if (!empty($message)) { $this->view->message = $message; } else { $this->view->success = "Server OK"; } } catch (Exception $error) { $this->view->error = explode("\n", $error->getMessage()); } }
/** * Do some checks in the begin. * * @return void */ public function init() { $this->_helper->viewRenderer->setNoRender(); $this->view->clearVars(); $front = Zend_Controller_Front::getInstance(); $response = $front->getRequest(); $this->view->message = array(); $this->view->success = ""; $this->view->error = array(); $this->view->exportModules = Setup_Models_Migration::getModulesToMigrate(); $this->_helper->viewRenderer->setNoRender(); try { $this->_setup = new Setup_Models_Setup(); $message = $this->_setup->getMessage(); $this->view->message = $message; } catch (Exception $error) { $this->view->error = explode("\n", $error->getMessage()); } }
/** * Install itself. * * @param array $params Array with the POST values. * * @return void */ public function install($params) { $options = array(); $options['useExtraData'] = (bool) $params['useExtraData']; $dbParser = new Phprojekt_DbParser($options, $this->_db); $dbParser->parseData(PHPR_ROOT_PATH . DIRECTORY_SEPARATOR . 'application'); // Update admin Pass $this->_db->update('setting', array('value' => md5('phprojektmd5' . $params['adminPass'])), 'id = 1'); // Update test Pass $this->_db->update('setting', array('value' => md5('phprojektmd5' . $params['testPass'])), 'user_id = 2 AND key_value = \'password\''); // Migration if (file_exists($params['migrationConfigFile'])) { try { $migration = new Setup_Models_Migration($params['migrationConfigFile'], $params['diffToUtc'], $this->_db); $migration->migrateTables(); } catch (Exception $error) { echo $error->getMessage(); } } // Create config file $config = new Setup_Models_Config(); $content = $config->getDefaultProduction($params['dbUser'], $params['dbPass'], $params['dbName'], 'Pdo_Mysql', $params['dbHost']); $baseDir = str_replace('htdocs/setup.php', '', $_SERVER['SCRIPT_FILENAME']); $configFile = $baseDir . "configuration.ini"; file_put_contents($configFile, $content); // Delete a session if exists $_SESSION = array(); foreach ($_COOKIE as $key => $value) { setcookie($key, "", 1); } Zend_Session::writeClose(); }