本文整理汇总了PHP中Zend_Config_Ini::__set方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Config_Ini::__set方法的具体用法?PHP Zend_Config_Ini::__set怎么用?PHP Zend_Config_Ini::__set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Config_Ini
的用法示例。
在下文中一共展示了Zend_Config_Ini::__set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dbprocessAction
/**
* Process the entered database configuration
*/
public function dbprocessAction()
{
$installSession = new Zend_Session_Namespace('Loomp_Install');
$this->view->loggedIn = $installSession->loggedIn;
if (!$this->view->loggedIn) {
return $this->_helper->redirector('index');
}
$request = $this->getRequest();
// Check if we have a POST request
if (!$request->isPost()) {
return $this->_helper->redirector('database');
}
// Get our form and validate it
$form = $this->getDatabaseConfigForm();
if (!$form->isValid($request->getPost())) {
// Invalid entries
$this->view->form = $form;
return $this->render('database');
// re-render the login form
}
$dbConfig = $form->getValues();
$this->view->dbConfig = $form->getValues();
try {
// set system db configuration to form data in order to test connection
$curConf = Zend_Registry::getInstance()->configuration->loomp->db;
$curConf->type = $dbConfig['type'];
$curConf->host = $dbConfig['host'];
$curConf->name = $dbConfig['database'];
$curConf->user = $dbConfig['username'];
$curConf->pass = $dbConfig['password'];
$this->getDbConnection();
// write connection parameter to local config
$this->resetLocalConfigFile();
$localConfig = new Zend_Config_Ini(LOCAL_CONFIG_FILE, APPLICATION_ENVIRONMENT, true);
$localConfig->__set("loomp.db.type", $dbConfig['type']);
$localConfig->__set("loomp.db.host", $dbConfig['host']);
$localConfig->__set("loomp.db.name", $dbConfig['database']);
$localConfig->__set("loomp.db.user", $dbConfig['username']);
$localConfig->__set("loomp.db.pass", $dbConfig['password']);
$request = new Zend_Controller_Request_Http();
$localConfig->__set("server.path", $request->getBaseUrl());
$localConfig->__set("server.host", $_SERVER['HTTP_HOST']);
$localConfig->__set("rap.path", $request->getBaseUrl() . "/data");
$localConfig->__set("loomp.base", (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $request->getBaseUrl());
$localConfig->__set("install.password", $installSession->installPassword);
$writer = new Zend_Config_Writer_Ini();
$writer->write(LOCAL_CONFIG_FILE, $localConfig, true);
$this->getLog()->debug("Local config has been written to disk");
$config = Zend_Registry::getInstance()->configuration;
$config->merge($localConfig);
} catch (Exception $e) {
$this->addFlashMessage("Local configuration file could not be written.");
$this->getLog()->err("Error while writing local configuration: " . $e->getMessage());
return $this->_helper->redirector('database');
}
return $this->_helper->redirector('update');
}