/** * save the global configuration data. */ public function save() { // Get access to the ini file $iniFile = jApp::configPath('lizmapLogConfig.ini.php'); $ini = new jIniFileModifier($iniFile); foreach ($this->properties as $prop) { if ($this->{$prop} != '') { $ini->setValue($prop, $this->{$prop}, 'general'); } else { $ini->removeValue($prop, 'general'); } } // Save the ini file $ini->save(); return $ini->isModified(); }
/** * says if the ini content has been modified * @return boolean * @since 1.2 */ public function isModified() { return $this->master->isModified() || $this->overrider->isModified(); }
function install() { $profilesfile = jApp::configPath('profiles.ini.php'); if (!file_exists($profilesfile)) { file_put_contents($profilesfile, ";<?php die(''); ?>\n;for security reasons, don't remove or modify the first line"); } $profiles = new jIniFileModifier($profilesfile); $profilesdistfile = jApp::configPath('profiles.ini.php.dist'); $distcreated = false; if (!file_exists($profilesdistfile)) { file_put_contents($profilesdistfile, ";<?php die(''); ?>\n;for security reasons, don't remove or modify the first line"); $distcreated = true; } $profilesdist = new jIniFileModifier($profilesdistfile); $dbprofile = $this->config->getValue('dbProfils'); if (!$dbprofile) { $dbprofile = 'dbprofils.ini.php'; } $dbprofilefile = jApp::configPath($dbprofile); if (file_exists($dbprofilefile)) { $dbProfiles = new jIniFileModifier($dbprofilefile); $profiles->import($dbProfiles, 'jdb', ':'); unlink($dbprofilefile); } $dbprofilefile = jApp::configPath('dbprofils.ini.php.dist'); if (file_exists($dbprofilefile)) { $dbProfiles = new jIniFileModifier($dbprofilefile); $profilesdist->import($dbProfiles, 'jdb', ':'); unlink($dbprofilefile); } $kvprofilefile = jApp::configPath('kvprofiles.ini.php'); if (file_exists($kvprofilefile)) { $dbProfiles = new jIniFileModifier($kvprofilefile); $profiles->import($dbProfiles, 'jkvdb', ':'); unlink($kvprofilefile); } $kvprofilefile = jApp::configPath('kvprofiles.ini.php.dist'); if (file_exists($kvprofilefile)) { $dbProfiles = new jIniFileModifier($kvprofilefile); $profilesdist->import($dbProfiles, 'jkvdb', ':'); unlink($kvprofilefile); } $soapprofilefile = jApp::configPath('soapprofiles.ini.php'); if (file_exists($soapprofilefile)) { $soapProfiles = new jIniFileModifier($soapprofilefile); $profiles->import($soapProfiles, 'jsoapclient', ':'); unlink($soapprofilefile); } $soapprofilefile = jApp::configPath('soapprofiles.ini.php.dist'); if (file_exists($soapprofilefile)) { $soapProfiles = new jIniFileModifier($soapprofilefile); $profilesdist->import($soapProfiles, 'jsoapclient', ':'); unlink($soapprofilefile); } $cacheprofilefile = jApp::configPath('cache.ini.php'); if (file_exists($cacheprofilefile)) { $cacheProfiles = new jIniFileModifier($cacheprofilefile); $profiles->import($cacheProfiles, 'jcache', ':'); unlink($cacheprofilefile); } $cacheprofilefile = jApp::configPath('cache.ini.php.dist'); if (file_exists($cacheprofilefile)) { $cacheProfiles = new jIniFileModifier($cacheprofilefile); $profilesdist->import($cacheProfiles, 'jcache', ':'); unlink($cacheprofilefile); } $profiles->save(); if ($profilesdist->isModified()) { $profilesdist->save(); } else { if ($distcreated) { unlink($profilesdistfile); } } $this->config->getMaster()->removeValue('dbProfils'); $this->config->getOverrider()->removeValue('dbProfils'); $this->config->getMaster()->removeValue('cacheProfiles'); $this->config->getOverrider()->removeValue('cacheProfiles'); }