当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Config_Ini::__set方法代码示例

本文整理汇总了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');
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:60,代码来源:InstallController.php


注:本文中的Zend_Config_Ini::__set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。