/** * */ public function confDbAction(array $paDbConf = null) { $this->setClientFolder($this->getRequestArg('folder', null, true)); $lsDbPath = $this->_sClientPath . DS . 'config' . DS . 'db.php'; $laDbClientConf = (require $lsDbPath); if ($paDbConf == null) { $lsDbDriver = $this->getRequestArg('driver', $laDbClientConf['production']['driver']); $lsDbCharset = $this->getRequestArg('charset', $laDbClientConf['production']['charset']); $lsDbHost = $this->getRequestArg('host', $laDbClientConf['production']['hostname']); $lsDbPort = $this->getRequestArg('port', $laDbClientConf['production']['port']); $lsDbUser = $this->getRequestArg('user', $laDbClientConf['production']['username']); $lsDbPass = $this->getRequestArg('pass', $laDbClientConf['production']['password']); $lsDbName = $this->getRequestArg('dbname', $laDbClientConf['production']['database'], true); $paDbConf = array('driver' => $lsDbDriver, 'charset' => $lsDbCharset, 'hostname' => $lsDbHost, 'port' => $lsDbPort, 'username' => $lsDbUser, 'password' => $lsDbPass, 'database' => $lsDbName); } $laDbClientConf['production']['driver'] = $paDbConf['driver']; $laDbClientConf['production']['charset'] = $paDbConf['charset']; $laDbClientConf['production']['hostname'] = $paDbConf['hostname']; $laDbClientConf['production']['port'] = $paDbConf['port']; $laDbClientConf['production']['username'] = $paDbConf['username']; $laDbClientConf['production']['password'] = $paDbConf['password']; $laDbClientConf['production']['database'] = $paDbConf['database']; $laDbClientConf['development']['driver'] = $paDbConf['driver']; $laDbClientConf['development']['charset'] = $paDbConf['charset']; $laDbClientConf['development']['hostname'] = $paDbConf['hostname']; $laDbClientConf['development']['port'] = $paDbConf['port']; $laDbClientConf['development']['username'] = $paDbConf['username']; $laDbClientConf['development']['password'] = $paDbConf['password']; $laDbClientConf['development']['database'] = $paDbConf['database']; $lsFileContent = System::arrayToFile($laDbClientConf); System::saveFile($lsDbPath, $lsFileContent); }
/** * * @param string $psPathConfig */ public function setModuleAutoload($psPathConfig) { $lsModulesPath = $psPathConfig . DS . "modules.php"; $lsAclPath = $psPathConfig . DS . "acl.php"; $lsMenuPath = $psPathConfig . DS . "menu.php"; if (file_exists($lsModulesPath)) { $laModules = (include $lsModulesPath); $laModules['available'][$this->_sModuleName] = true; $lsFileContent = System::arrayToFile($laModules); System::saveFile($lsModulesPath, $lsFileContent); } if (file_exists($lsAclPath)) { $laAcl = (include $lsAclPath); $laAcl['acl']['resources']['allow'][$this->_sModuleName] = array('index' => 'admin', 'trash' => 'admin', 'add' => 'admin', 'edit' => 'admin', 'view' => 'admin', 'move' => 'admin', 'delete' => 'admin', 'move-list' => 'admin', 'delete-list' => 'admin', 'search-select' => 'admin', 'search' => 'admin', 'message' => 'guest'); $lsFileContent = System::arrayToFile($laAcl); System::saveFile($lsAclPath, $lsFileContent); } if (file_exists($lsMenuPath)) { $laMenu = (include $lsMenuPath); $lsRoute = String::slugfy($this->_sModuleName); $lsModuleLabel = preg_replace("/_/", " ", ucfirst($lsRoute)); $laMenu['admin'][$this->_sModuleName] = array('accesskey' => '', 'label' => $lsModuleLabel, 'link' => "{$lsRoute}", 'description' => '', 'icon' => 'glyphicon glyphicon-cog', 'submenu' => null); $lsFileContent = System::arrayToFile($laMenu); System::saveFile($lsMenuPath, $lsFileContent); } }