Example #1
0
 /**
  * initialize the installation
  *
  * it reads configurations files of all entry points, and prepare object for
  * each module, needed to install/upgrade modules.
  * @param ReporterInterface $reporter  object which is responsible to process messages (display, storage or other..)
  * @param string $lang  the language code for messages
  */
 function __construct(ReporterInterface $reporter, $lang = '')
 {
     $this->reporter = $reporter;
     $this->messages = new Checker\Messages($lang);
     $localConfig = App::configPath('localconfig.ini.php');
     if (!file_exists($localConfig)) {
         $localConfigDist = App::configPath('localconfig.ini.php.dist');
         if (file_exists($localConfigDist)) {
             copy($localConfigDist, $localConfig);
         } else {
             file_put_contents($localConfig, ';<' . '?php die(\'\');?' . '>');
         }
     }
     $this->mainConfig = new \Jelix\IniFile\MultiIniModifier(\Jelix\Core\Config::getDefaultConfigFile(), App::mainConfigFile());
     $this->localConfig = new \Jelix\IniFile\MultiIniModifier($this->mainConfig, $localConfig);
     $this->installerIni = $this->getInstallerIni();
     $urlfile = App::appConfigPath($this->localConfig->getValue('significantFile', 'urlengine'));
     $this->xmlMapFile = new \Jelix\Routing\UrlMapping\XmlMapModifier($urlfile, true);
     $appInfos = new \Jelix\Core\Infos\AppInfos();
     $this->readEntryPointsData($appInfos);
     $this->installerIni->save();
     // be sure temp path is ready
     $chmod = $this->mainConfig->getValue('chmodDir');
     \jFile::createDir(App::tempPath(), intval($chmod, 8));
 }