joer80 Posted February 10, 2016 Author Share Posted February 10, 2016 Got it installed manually! Thanks! You guys should add it. I think it is a good way to access variables without touching the database and unnecessary creating tables. Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 11, 2016 Share Posted February 11, 2016 I just wanted to add my approach of using a static method on my extended multisite module together with a cached list of domain names: https://github.com/LostKobrakai/MultisiteExtended/blob/master/MultisiteExtended.module#L341-L364 3 Link to comment Share on other sites More sharing options...
bernhard Posted May 11, 2017 Share Posted May 11, 2017 i came up with this solution today: WARNING: your site/config.php should NOT be writable by your php user, so you would have to be careful about file permissions: https://processwire.com/docs/security/file-permissions/ usage: updateConfig('/path/to/your/site/config.php', [ 'httpHosts' => ['domain1.example.com', 'domain2.example.com'], 'dbName' => 'my_db', 'dbUser' => 'my_db_user', 'dbPass' => 'my_db_password', ]); function: /** * update config file */ function updateConfig($file, $options = []) { if(!is_file($file)) return 'file not found'; $content = file_get_contents($file); // loop all set options foreach($options as $key => $val) { $search = '/\$config->'.$key.'(.*);/'; if(is_array($val)) $replace = '$config->'.$key.' = array(\'' . implode("','", $val) . '\');'; elseif(is_int($val)) $replace = '$config->'.$key.' = ' . $val . ';'; elseif(is_string($val)) $replace = '$config->'.$key.' = \'' . $val . '\';'; else return 'value must be array, integer or string'; $content = preg_replace($search, $replace, $content); } return file_put_contents($file, $content); } maybe it helps someone 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now