Exemple #1
0
 /**
  * @param \Jelix\IniFile\IniModifier    $mainConfig   the mainconfig.ini.php file
  * @param string $configFile the path of the configuration file, relative
  *                           to the var/config directory
  * @param string $file the filename of the entry point
  * @param string $type type of the entry point ('classic', 'cli', 'xmlrpc'....)
  */
 function __construct(\Jelix\IniFile\IniModifier $mainConfig, $configFile, $file, $type)
 {
     $this->type = $type;
     $this->isCliScript = $type == 'cmdline';
     $this->configFile = $configFile;
     $this->scriptName = $this->isCliScript ? $file : '/' . $file;
     $this->file = $file;
     $this->configIni = new \Jelix\IniFile\MultiIniModifier($mainConfig, \Jelix\Core\App::configPath($configFile));
     $compiler = new \Jelix\Core\Config\Compiler($configFile, $this->scriptName, $this->isCliScript);
     $this->config = $compiler->read(true);
     $this->modulesInfos = $compiler->getModulesInfos();
 }
Exemple #2
0
 /**
  * @param \Jelix\IniFile\MultiIniModifier $mainConfig   the mainconfig.ini.php file combined with defaultconfig.ini.php
  * @param \Jelix\IniFile\MultiIniModifier $localConfig   the localconfig.ini.php file combined with $mainConfig
  * @param string $configFile the path of the configuration file, relative
  *                           to the app/config directory
  * @param string $file the filename of the entry point
  * @param string $type type of the entry point ('classic', 'cli', 'xmlrpc'....)
  */
 function __construct(\Jelix\IniFile\MultiIniModifier $mainConfig, \Jelix\IniFile\MultiIniModifier $localConfig, $configFile, $file, $type)
 {
     $this->type = $type;
     $this->isCliScript = $type == 'cmdline';
     $this->configFile = $configFile;
     $this->scriptName = $this->isCliScript ? $file : '/' . $file;
     $this->file = $file;
     $this->mainConfigIni = $mainConfig;
     $this->localConfigIni = $localConfig;
     $appConfigPath = \Jelix\Core\App::appConfigPath($configFile);
     if (!file_exists($appConfigPath)) {
         \jFile::createDir(dirname($appConfigPath));
         file_put_contents($appConfigPath, ';<' . '?php die(\'\');?' . '>');
     }
     $this->epConfigIni = new \Jelix\IniFile\IniModifier($appConfigPath);
     $varConfigPath = \Jelix\Core\App::configPath($configFile);
     if (!file_exists($varConfigPath)) {
         \jFile::createDir(dirname($varConfigPath));
         file_put_contents($varConfigPath, ';<' . '?php die(\'\');?' . '>');
     }
     $this->localEpConfigIni = new \Jelix\IniFile\IniModifier($varConfigPath);
     $this->fullConfigIni = new \Jelix\IniFile\MultiIniModifier($localConfig, $this->epConfigIni);
     $this->fullConfigIni = new \Jelix\IniFile\MultiIniModifier($this->fullConfigIni, $this->localEpConfigIni);
     $compiler = new \Jelix\Core\Config\Compiler($configFile, $this->scriptName, $this->isCliScript);
     $this->config = $compiler->read(true);
     $this->modulesInfos = $compiler->getModulesInfos();
 }