/**
  * @param jIniFileModifier $ini
  */
 protected function modifyIni($ini)
 {
     $ini->removeValue('minifyCheckCacheFiletime', 'jResponseHtml');
     $ini->removeValue('jsUniqueUrlId', 'jResponseHtml');
     $ini->removeValue('cssUniqueUrlId', 'jResponseHtml');
     if ($ini->getValue('minifyCSS', 'jResponseHtml') || $ini->getValue('minifyJS', 'jResponseHtml')) {
         $plugin = $ini->getValue('plugins', 'jResponseHtml');
         if ($plugin == '') {
             $plugin .= "minify";
         } else {
             $plugin .= ",minify";
         }
         $ini->setValue('plugins', $plugin, 'jResponseHtml');
     }
 }
 public function removeValue($name, $section = 0, $key = null, $removePreviousComment = true, $masterOnly = false)
 {
     $this->master->removeValue($name, $section, $key, $removePreviousComment);
     if ($masterOnly) {
         return;
     }
     $this->overrider->removeValue($name, $section, $key, $removePreviousComment);
 }
 /**
  * @param jIniFileModifier $ini
  */
 protected function modifyIni($ini)
 {
     if ($ini->isSection('mailLogger')) {
         // in a previous update (newerrormanager), emailHeaders was
         // moved with the value of email, so we should delete it
         // except if it has been changed since..
         $logEmail = $ini->getValue('email', 'mailLogger');
         $logEmailHeaders = $ini->getValue('emailHeaders', 'mailLogger');
         if ($logEmail == $logEmailHeaders) {
             $ini->removeValue('emailHeaders', 'mailLogger');
         }
     }
 }
 /**
  * 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();
 }
 function install()
 {
     if (self::$key === null) {
         self::$key = jAuth::getRandomPassword(30, true);
     }
     $conf = $this->config->getValue('auth', 'coordplugins');
     if ($conf != '1') {
         $conff = jApp::configPath($conf);
         if (file_exists($conff)) {
             $ini = new jIniFileModifier($conff);
             $ini->removeValue('persistant_crypt_key');
             $ini->save();
         }
     }
     $localConfigIni = $this->entryPoint->localConfigIni;
     $localConfigIni->getMaster()->setValue('persistant_crypt_key', self::$key, 'coordplugin_auth');
 }
 function install()
 {
     $isMaster = false;
     $autoLocaleFile = $this->config->getOverrider()->getValue('autolocale', 'coordplugins');
     if ($autoLocaleFile == '') {
         $autoLocaleFile = $this->config->getMaster()->getValue('autolocale', 'coordplugins');
         $isMaster = true;
     }
     if ($autoLocaleFile == '' || !$this->firstExec('autolocale:' . $autoLocaleFile)) {
         return;
     }
     $ini = new jIniFileModifier(jApp::configPath($autoLocaleFile));
     $availableLocales = $ini->getValue('availableLanguageCode');
     if ($isMaster) {
         $this->config->getMaster()->setValue('availableLocales', $availableLocales);
     } else {
         $this->config->getOverrider()->setValue('availableLocales', $availableLocales);
     }
     $ini->removeValue('availableLanguageCode');
     $ini->save();
 }
Exemplo n.º 7
0
 /**
  * private function to handle the configuration migration
  */
 private function _updateConfig()
 {
     /**
      *
      * DataBase CONFIG FILE : dbprofils.ini.php
      *
      */
     $dBini = new jIniFileModifier(jApp::configPath() . 'dbprofils.ini.php');
     $dBini->setValue('jacl2_profile', 'havefnubb');
     $dBini->save();
     /**
      *
      * Main CONFIG FILE : defaultconfig.ini.php
      *
      */
     $iniDef = new jIniFileModifier(jApp::configPath() . 'defaultconfig.ini.php');
     $this->defaultModulesPath = $iniDef->getValue('modulesPath');
     //need to add app:admin-modules to the modulesPath
     if (strpos($this->defaultModulesPath, 'app:admin-modules/') === false) {
         $this->defaultModulesPath .= ',app:admin-modules/';
     }
     // need to add jelix-admin-modules to user jauthdb_admin
     if (strpos($this->defaultModulesPath, 'lib:jelix-admin-modules/') === false) {
         $this->defaultModulesPath = 'lib:jelix-admin-modules/,' . $this->defaultModulesPath;
     }
     // let's migrate config, section by section
     $this->defaultCheckTrustedModules = $iniDef->getValue('checkTrustedModules');
     if ($this->defaultCheckTrustedModules === null) {
         $this->defaultCheckTrustedModules = false;
     }
     $this->defaultTrustedModules = $iniDef->getValue('trustedModules');
     if ($this->defaultTrustedModules === null) {
         $this->defaultTrustedModules = '';
     }
     $allModulePath = $this->getModulesPath($this->defaultModulesPath, $this->defaultCheckTrustedModules ? 1 : 2);
     if ($this->defaultCheckTrustedModules) {
         $list = preg_split('/ *, */', $this->defaultTrustedModules);
         foreach ($list as $module) {
             if (isset($allModulePath[$module])) {
                 $allModulePath[$module]->access = 2;
             }
         }
     }
     $this->defaultUnusedModules = $iniDef->getValue('unusedModules');
     if ($this->defaultUnusedModules) {
         $list = preg_split('/ *, */', $this->defaultUnusedModules);
         foreach ($list as $module) {
             if (isset($allModulePath[$module])) {
                 $allModulePath[$module]->access = 0;
             }
         }
     }
     foreach ($allModulePath as $name => $module) {
         $iniDef->setValue($name . '.access', $module->access, 'modules');
     }
     $iniDef->removeValue('checkTrustedModules');
     $iniDef->removeValue('trustedModules');
     $iniDef->removeValue('unusedModules');
     $iniDef->removeValue('hiddenModules');
     //modulesPath
     $iniDef->setValue('modulesPath', $this->defaultModulesPath);
     //section [coordplugins]
     $iniDef->removeValue('hfnuinstalled', 'coordplugins');
     //[basic_significant_urlengine_entrypoints]
     $iniDef->setValue('forums', 'on', 'basic_significant_urlengine_entrypoints');
     $iniDef->setValue('install', 'on', 'basic_significant_urlengine_entrypoints');
     //section [simple_urlengine_entrypoints]
     $iniDef->setValue('forums', '@classic', 'simple_urlengine_entrypoints');
     //section [datepickers]
     $iniDef->setValue('green', 'jelix/js/jforms/datepickers/green/init.js', 'datepickers');
     $iniDef->setValue('dust', 'jelix/js/jforms/datepickers/dust/init.js', 'datepickers');
     $iniDef->setValue('emplode', 'jelix/js/jforms/datepickers/emplode/init.js', 'datepickers');
     $iniDef->setValue('default', 'jelix/js/jforms/datepickers/default/init.js', 'datepickers');
     //section [wikieditors]
     $iniDef->setValue('default.engine.name', 'wr3', 'wikieditors');
     $iniDef->setValue('default.wiki.rules', 'wr3_to_xhtml', 'wikieditors');
     $iniDef->setValue('default.engine.file', 'jelix/markitup/jquery.markitup.js', 'wikieditors');
     $iniDef->setValue('default.image.path', 'jelix/markitup/sets/wr3/images/', 'wikieditors');
     $iniDef->setValue('default.skin', 'jelix/markitup/skins/simple/style.css', 'wikieditors');
     //section [havefnubb]
     $iniDef->setValue('version', '1.4.0', 'havefnubb');
     $iniDef->save();
     /**
      *
      * Flood CONFIG FILE : havefnubb/flood.coord.ini.php
      *
      */
     //floodcoord.ini.php of the forums entrypoint
     $floodCoordIni = new jIniFileModifier(jApp::configPath() . 'havefnubb/flood.coord.ini.php');
     //drop deprecated parms
     $floodCoordIni->removeValue('elapsed_time_between_two_post_by_same_ip');
     $floodCoordIni->removeValue('elapsed_time_after_posting_before_editing');
     //add new parms
     $floodCoordIni->setValue('only_same_ip', 0);
     $floodCoordIni->setValue('time_interval', 30);
     $floodCoordIni->setValue('elapsed_time_between_two_post', 0);
     $floodCoordIni->save();
     /**
      *
      * ACL CONFIG FILE : havefnubb/jacl2.coord.ini.php
      *
      */
     $jacl2Config = new jIniFileModifier(jApp::configPath() . 'havefnubb/jacl2.coord.ini.php');
     $jacl2Config->setValue('on_error_action', 'havefnubb~hfnuerror:badright');
     $jacl2Config->save();
     /**
      *
      * AUTH CONFIG FILE : hfnuadmin/auth.coord.ini.php
      *
      */
     $adminAuthConfig = new jIniFileModifier(jApp::configPath() . 'hfnuadmin/auth.coord.ini.php');
     $adminAuthConfig->setValue('timeout', 0);
     $adminAuthConfig->setValue('dao', 'jcommunity~user', 'Db');
     $adminAuthConfig->save();
     /**
      *
      * CONFIG FILE of each entry point : havefnubb/config.ini.php  +
      *                                   hfnuadmin/config.ini.php
      *
      */
     $entryPointConfigFiles = array(jApp::configPath() . 'havefnubb/config.ini.php', jApp::configPath() . 'hfnuadmin/config.ini.php');
     $help = "<p>In each config files of your entry points, fill this parameters:<br/>" . "<ul><li> checkTrustedModules=on</li>" . "<li>trustedModules: list of modules accessible from the web</li>" . "<li> unusedModules: those you don't use at all</li>" . "<li>For other modules you use but which should not be accessible from the web, nothing to do.</li></ul>";
     $otherModulePath = array();
     foreach ($entryPointConfigFiles as $currentIni) {
         $iniConfig = new jIniFileModifier($currentIni);
         //common tasks
         $modulesPath = $iniConfig->getValue('modulesPath');
         if (!$modulesPath) {
             $modulesPath = $this->defaultModulesPath;
         }
         //need to add app:admin-modules to the modulesPath of the admin entrypoint
         if (strpos($modulesPath, 'app:admin-modules/') === false) {
             $modulesPath .= ',app:admin-modules/';
         }
         if (strpos($modulesPath, 'lib:jelix-admin-modules/') === false) {
             $modulesPath = 'lib:jelix-admin-modules/,' . $modulesPath;
         }
         $checkTrustedModules = $iniConfig->getValue('checkTrustedModules');
         if ($checkTrustedModules === null) {
             $checkTrustedModules = $this->defaultCheckTrustedModules;
         }
         if (!$checkTrustedModules) {
             throw new Exception("checkTrustedModules should be set to 'on' in config files.\n{$help}");
             return "checkTrustedModules should be set to 'on' in config files.\n{$help}";
         }
         $trustedModules = $iniConfig->getValue('trustedModules');
         if (!$trustedModules) {
             $trustedModules = $this->defaultTrustedModules;
         }
         if ($trustedModules == '') {
             throw new Exception("trustedModules should be filled in config files.\n{$help}");
             return "trustedModules should be filled in config files.\n{$help}";
         }
         // add the new admin module to the $trustedModules
         if ($currentIni == jApp::configPath() . 'hfnuadmin/config.ini.php') {
             $trustedModules .= 'activeusers_admin, hfnuadmin, jelixcache, modulesinfo, servinfo';
         }
         $unusedModules = $iniConfig->getValue('unusedModules');
         if (!$unusedModules) {
             $unusedModules = $this->defaultUnusedModules;
         }
         $epModulePath = $this->getModulesPath($modulesPath, 1);
         $list = preg_split('/ *, */', $trustedModules);
         foreach ($list as $module) {
             if (isset($epModulePath[$module])) {
                 $epModulePath[$module]->access = 2;
             }
         }
         if ($unusedModules) {
             $list = preg_split('/ *, */', $unusedModules);
             foreach ($list as $module) {
                 if (isset($epModulePath[$module])) {
                     $epModulePath[$module]->access = 0;
                 }
             }
         }
         foreach ($epModulePath as $name => $module) {
             if (!isset($allModulePath[$name]) || $allModulePath[$name]->access != $module->access) {
                 $iniConfig->setValue($name . '.access', $module->access, 'modules');
             }
             if (!isset($allModulePath[$name]) && !isset($otherModulePath[$name])) {
                 $otherModulePath[$name] = $module;
             }
         }
         $iniConfig->removeValue('checkTrustedModules');
         $iniConfig->removeValue('trustedModules');
         $iniConfig->removeValue('unusedModules');
         $iniConfig->removeValue('hiddenModules');
         // end common tasks
         //specific tasks
         if ($currentIni == jApp::configPath() . 'havefnubb/config.ini.php') {
             //[coordplugins]
             //drop deprecated parms
             $iniConfig->removeValue('hfnuinstalled', 'coordplugins');
             $iniConfig->removeValue('timeout', 'coordplugins');
             //add new parms
             $iniConfig->setValue('activeusers', 'activeusers.coord.ini.php', 'coordplugins');
             //[urlengine]
             //remove this unuseful section
             $iniConfig->removeValue('engine', 'urlengine');
             $iniConfig->removeValue('enableParser', 'urlengine');
             $iniConfig->removeValue('multiview', 'urlengine');
             $iniConfig->removeValue('defaultEntrypoint', 'urlengine');
             $iniConfig->removeValue('entrypointExtension', 'urlengine');
             $iniConfig->removeValue('notfoundAct', 'urlengine');
         } elseif ($currentIni == jApp::configPath() . 'hfnuadmin/config.ini.php') {
             $iniConfig->removeValue('engine', 'urlengine');
             //add a new section [activeusers_admin]
             $iniConfig->setValue('pluginconf', 'activeusers.coord.ini.php', 'activeusers_admin');
         }
         $iniConfig->save();
     }
     /**
      *
      * DROP DEPRECATED FILE
      *
      */
     @unlink(jApp::configPath() . 'havefnubb/timeout.coord.ini.php');
     @unlink(jApp::configPath() . 'havefnubb/hfnuinstalled.coord.ini.php');
     //this file has been integrated inside the defaultconfig.ini.php
     //in the section [wikieditor]
     //so drop it
     @unlink(jApp::configPath() . 'wikitoolbar.ini.php');
 }
 /**
  * declare a new db profile. if the content of the section is not given,
  * it will declare an alias to the default profile
  * @param string $name  the name of the new section/alias
  * @param null|string|array  $sectionContent the content of the new section, or null
  *     to create an alias.
  * @param boolean $force true:erase the existing profile
  * @return boolean true if the ini file has been changed
  */
 protected function declareDbProfile($name, $sectionContent = null, $force = true)
 {
     $profiles = new jIniFileModifier(jApp::configPath('profiles.ini.php'));
     if ($sectionContent == null) {
         if (!$profiles->isSection('jdb:' . $name)) {
             // no section
             if ($profiles->getValue($name, 'jdb') && !$force) {
                 // already a name
                 return false;
             }
         } else {
             if ($force) {
                 // existing section, and no content provided : we erase the section
                 // and add an alias
                 $profiles->removeValue('', 'jdb:' . $name);
             } else {
                 return false;
             }
         }
         $default = $profiles->getValue('default', 'jdb');
         if ($default) {
             $profiles->setValue($name, $default, 'jdb');
         } else {
             // default is a section
             $profiles->setValue($name, 'default', 'jdb');
         }
     } else {
         if ($profiles->getValue($name, 'jdb') !== null) {
             if (!$force) {
                 return false;
             }
             $profiles->removeValue($name, 'jdb');
         }
         if (is_array($sectionContent)) {
             foreach ($sectionContent as $k => $v) {
                 $profiles->setValue($k, $v, 'jdb:' . $name);
             }
         } else {
             $profile = $profiles->getValue($sectionContent, 'jdb');
             if ($profile !== null) {
                 $profiles->setValue($name, $profile, 'jdb');
             } else {
                 $profiles->setValue($name, $sectionContent, 'jdb');
             }
         }
     }
     $profiles->save();
     jProfiles::clear();
     return true;
 }
Exemplo n.º 9
0
 function process()
 {
     $ini = new jIniFileModifier(jApp::configPath('profiles.ini.php'));
     $hasErrors = false;
     $_SESSION['dbprofiles']['data'] = $_POST;
     foreach ($_SESSION['dbprofiles']['profiles'] as $profile) {
         $errors = array();
         $params = array();
         $driver = $_POST['driver'][$profile];
         $usepdo = false;
         if (substr($driver, -4) == '_pdo') {
             $ini->setValue('usepdo', true, $profile);
             $usepdo = true;
             $realdriver = substr($driver, 0, -4);
         } else {
             $ini->removeValue('usepdo', $profile);
             $realdriver = $driver;
         }
         $ini->removeValue('dsn', $profile);
         if (isset($_POST['persistent'][$profile]) && $_POST['persistent'][$profile] == 'on') {
             $ini->setValue('persistent', true, $profile);
         } else {
             $ini->removeValue('persistent', $profile);
         }
         if (isset($_POST['force_encoding'][$profile]) && $_POST['force_encoding'][$profile] == 'on') {
             $ini->setValue('force_encoding', true, $profile);
         } else {
             $ini->removeValue('force_encoding', $profile);
         }
         $ini->setValue('table_prefix', $_POST['table_prefix'][$profile], $profile);
         $database = trim($_POST['database'][$profile]);
         if ($database == '') {
             $errors[] = $this->locales['error.missing.database'];
             continue;
         }
         $params['database'] = $database;
         $ini->setValue('database', $database, $profile);
         $params['driver'] = $realdriver;
         $ini->setValue('driver', $realdriver, $profile);
         if ($realdriver != 'sqlite') {
             $host = trim($_POST['host'][$profile]);
             if ($host == '' && $realdriver != 'pgsql') {
                 $errors[] = $this->locales['error.missing.host'];
             } else {
                 $ini->setValue('host', $host, $profile);
                 $params['host'] = $host;
             }
             $port = trim($_POST['port'][$profile]);
             if ($port != '') {
                 $ini->setValue('port', $port, $profile);
                 $params['port'] = $port;
             }
             $user = trim($_POST['user'][$profile]);
             if ($user == '') {
                 $errors[] = $this->locales['error.missing.user'];
             } else {
                 $ini->setValue('user', $user, $profile);
                 $params['user'] = $user;
             }
             $password = trim($_POST['password'][$profile]);
             $passwordRequired = isset($this->config['passwordRequired']) && $this->config['passwordRequired'];
             if ($password == '' && $passwordRequired) {
                 $errors[] = $this->locales['error.missing.password'];
             } else {
                 $ini->setValue('password', $password, $profile);
                 $params['password'] = $password;
             }
             if (trim($_POST['passwordconfirm'][$profile]) != $password) {
                 $errors[] = $this->locales['error.invalid.confirm.password'];
             }
             if ($realdriver == 'pgsql') {
                 $search_path = trim($_POST['search_path'][$profile]);
                 $params['search_path'] = $search_path;
                 if ($search_path != '') {
                     $ini->setValue('search_path', $search_path, $profile);
                 }
             }
         }
         if (!count($errors)) {
             try {
                 if ($usepdo) {
                     $m = 'check_PDO';
                 } else {
                     $m = 'check_' . $realdriver;
                 }
                 $this->{$m}($params);
             } catch (Exception $e) {
                 $errors[] = $e->getMessage();
             }
         }
         if (count($errors)) {
             $hasErrors = true;
         }
         $_SESSION['dbprofiles']['data']['errors'][$profile] = $errors;
     }
     if ($hasErrors) {
         return false;
     }
     $ini->save();
     unset($_SESSION['dbprofiles']);
     return 0;
 }
Exemplo n.º 10
0
 function removeConfig($module)
 {
     //edit default config
     $defaultConfig = jApp::configPath('mainconfig.ini.php');
     $ini = new jIniFileModifier($defaultConfig);
     $ini->removeValue($module . '.access', 'modules');
     $ini->save();
     $ep = $ini->getValue("defaultEntrypoint", "urlengine");
     //edit installer file
     $installerConfig = jApp::configPath('installer.ini.php');
     $ini = new jIniFileModifier($installerConfig);
     $ini->removeValue($module . '.installed', $ep);
     $ini->removeValue($module . '.version', $ep);
     $ini->save();
     //entry point file
     //only for index
     $epConfig = jApp::configPath($ep . '/config.ini.php');
     $ini = new jIniFileModifier($epConfig);
     $ini->removeValue($module . '.access', 'modules');
     $ini->save();
 }
Exemplo n.º 11
0
 /**
  * update configuration files
  */
 protected function updateConfig()
 {
     // retrieve the default config
     $defaultconfig = new jIniFileModifier(jApp::configPath('defaultconfig.ini.php'));
     $this->defaultModulesPath = $defaultconfig->getValue('modulesPath');
     if (!$this->defaultModulesPath) {
         $this->defaultModulesPath = 'lib:jelix-modules/,app:modules/';
     }
     if ($this->checkStep("Update configuration files")) {
         $configList = array();
         $this->defaultCheckTrustedModules = $defaultconfig->getValue('checkTrustedModules');
         if ($this->defaultCheckTrustedModules === null) {
             $this->defaultCheckTrustedModules = false;
         }
         $this->defaultTrustedModules = $defaultconfig->getValue('trustedModules');
         if ($this->defaultTrustedModules === null) {
             $this->defaultTrustedModules = '';
         }
         $allModulePath = $this->getModulesPath($this->defaultModulesPath, $this->defaultCheckTrustedModules ? 1 : 2);
         if ($this->defaultCheckTrustedModules) {
             $list = preg_split('/ *, */', $this->defaultTrustedModules);
             foreach ($list as $module) {
                 if (isset($allModulePath[$module])) {
                     $allModulePath[$module]->access = 2;
                 }
             }
         }
         $this->defaultUnusedModules = $defaultconfig->getValue('unusedModules');
         if ($this->defaultUnusedModules) {
             $list = preg_split('/ *, */', $this->defaultUnusedModules);
             foreach ($list as $module) {
                 if (isset($allModulePath[$module])) {
                     $allModulePath[$module]->access = 0;
                 }
             }
         }
         foreach ($allModulePath as $name => $module) {
             $defaultconfig->setValue($name . '.access', $module->access, 'modules');
         }
         $defaultconfig->removeValue('checkTrustedModules');
         $defaultconfig->removeValue('trustedModules');
         $defaultconfig->removeValue('unusedModules');
         $defaultconfig->removeValue('hiddenModules');
         $configList['defaultconfig.ini.php'] = $defaultconfig;
         // read each entry point configuration
         $eplist = $this->getEntryPointsList();
         $help = "In each config files of your entry points, fill this parameters:\n" . "* checkTrustedModules=on\n" . "* trustedModules: list of modules accessible from the web\n" . "* unusedModules: those you don't use at all\n" . "For other modules you use but which should not be accessible from the web, nothing to do.\n";
         // list of modules which are not declared into the default config
         $otherModulePath = array();
         foreach ($eplist as $ep) {
             if (isset($configList[$ep['config']])) {
                 continue;
             }
             $config = new jIniFileModifier(jApp::configPath($ep['config']));
             $modulesPath = $config->getValue('modulesPath');
             if (!$modulesPath) {
                 $modulesPath = $this->defaultModulesPath;
             }
             $checkTrustedModules = $config->getValue('checkTrustedModules');
             if ($checkTrustedModules === null) {
                 $checkTrustedModules = $this->defaultCheckTrustedModules;
             }
             if (!$checkTrustedModules) {
                 throw new Exception("checkTrustedModules should be set to 'on' in config files.\n{$help}");
             }
             $trustedModules = $config->getValue('trustedModules');
             if (!$trustedModules) {
                 $trustedModules = $this->defaultTrustedModules;
             }
             if ($trustedModules == '') {
                 throw new Exception("trustedModules should be filled in config files.\n{$help}");
             }
             $unusedModules = $config->getValue('unusedModules');
             if (!$unusedModules) {
                 $unusedModules = $this->defaultUnusedModules;
             }
             $epModulePath = $this->getModulesPath($modulesPath, 1);
             $list = preg_split('/ *, */', $trustedModules);
             foreach ($list as $module) {
                 if (isset($epModulePath[$module])) {
                     $epModulePath[$module]->access = 2;
                 }
             }
             if ($unusedModules) {
                 $list = preg_split('/ *, */', $unusedModules);
                 foreach ($list as $module) {
                     if (isset($epModulePath[$module])) {
                         $epModulePath[$module]->access = 0;
                     }
                 }
             }
             foreach ($epModulePath as $name => $module) {
                 if (!isset($allModulePath[$name]) || $allModulePath[$name]->access != $module->access) {
                     $config->setValue($name . '.access', $module->access, 'modules');
                 }
                 if (!isset($allModulePath[$name]) && !isset($otherModulePath[$name])) {
                     $otherModulePath[$name] = $module;
                 }
             }
             $config->removeValue('checkTrustedModules');
             $config->removeValue('trustedModules');
             $config->removeValue('unusedModules');
             $config->removeValue('hiddenModules');
             $configList[$ep['config']] = $config;
         }
         // we save at the end, because an error could appear during the previous loop
         // and we don't want to save change if there are errors
         $defaultconfig->save();
         foreach ($configList as $config) {
             $config->save();
         }
     } else {
         // load list of modules for the next step
         $allModulePath = $this->getModulesPath($this->defaultModulesPath, 2);
         $eplist = $this->getEntryPointsList();
         // list of modules which are not declared into the default config
         $otherModulePath = array();
         foreach ($eplist as $ep) {
             if (isset($configList[$ep['config']])) {
                 continue;
             }
             $config = new jIniFileModifier(jApp::configPath($ep['config']));
             $modulesPath = $config->getValue('modulesPath');
             if (!$modulesPath) {
                 $modulesPath = $this->defaultModulesPath;
             }
             $epModulePath = $this->getModulesPath($modulesPath, 1);
             foreach ($epModulePath as $name => $module) {
                 if (!isset($allModulePath[$name]) && !isset($otherModulePath[$name])) {
                     $otherModulePath[$name] = $module;
                 }
             }
         }
     }
     if ($this->checkStep("Update module.xml files")) {
         foreach ($allModulePath as $name => $module) {
             $this->updateModuleXml($module);
         }
         foreach ($otherModulePath as $name => $module) {
             $this->updateModuleXml($module);
         }
     }
 }
Exemplo n.º 12
0
 /**
  * Removes a repository
  */
 public static function removeRepository($key)
 {
     if (!in_array($key, self::$repositories)) {
         if (!in_array($key, self::getRepositoryList())) {
             return false;
         }
     }
     // Get access to the ini file
     $iniFile = jApp::configPath('lizmapConfig.ini.php');
     $ini = new jIniFileModifier($iniFile);
     // Remove the section corresponding to the repository
     $section = 'repository:' . $key;
     if ($ini->isSection($section)) {
         $ini->removeValue(null, $section);
         $ini->save();
         self::getRepositoryList();
         if (array_key_exists($key, self::$repositoryInstances)) {
             unset(self::$repositoryInstances[$key]);
         }
         return true;
     }
     return false;
 }