Exemplo n.º 1
0
 public function run()
 {
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     jAppManager::close();
     if ($this->verbose()) {
         $reporter = new textInstallReporter();
     } else {
         $reporter = new textInstallReporter('error');
     }
     $installer = new jInstaller($reporter);
     $installer->installApplication();
     try {
         jAppManager::clearTemp(jApp::tempBasePath());
     } catch (Exception $e) {
         if ($e->getCode() == 2) {
             echo "Error: bad path in jApp::tempBasePath(), it is equals to '" . jApp::tempBasePath() . "' !!\n";
             echo "       Jelix cannot clear the content of the temp directory.\n";
             echo "       you must clear it your self.\n";
             echo "       Correct the path in the application.init.php or create the directory\n";
         } else {
             echo "Error: " . $e->getMessage();
         }
     }
     jAppManager::open();
 }
Exemplo n.º 2
0
 public function run()
 {
     try {
         $tempPath = jApp::tempBasePath();
         if ($tempPath == DIRECTORY_SEPARATOR || $tempPath == '' || $tempPath == '/') {
             echo "Error: bad path in jApp::tempBasePath(), it is equals to '" . $tempPath . "' !!\n";
             echo "       Jelix cannot clear the content of the temp directory.\n";
             echo "       Correct the path in your application.init.php or create the corresponding directory\n";
             exit(1);
         }
         if (!jFile::removeDir($tempPath, false, array('.svn', '.dummy'))) {
             echo "Some temp files were not removed\n";
         } else {
             if ($this->verbose()) {
                 echo "All temp files have been removed\n";
             }
         }
     } catch (Exception $e) {
         if ($this->config->helpLang == 'fr') {
             echo "Un ou plusieurs répertoires n'ont pas pu être supprimés.\n" . "Message d'erreur : " . $e->getMessage() . "\n";
         } else {
             echo "One or more directories couldn't be deleted.\n" . "Error: " . $e->getMessage() . "\n";
         }
     }
 }
Exemplo n.º 3
0
 public static function read($configFile, $allModuleInfo = false, $isCli = false, $pseudoScriptName = '')
 {
     $tempPath = jApp::tempBasePath();
     $configPath = jApp::configPath();
     if ($tempPath == '/') {
         throw new Exception('Application temp directory doesn\'t exist !', 3);
     }
     if (!is_writable($tempPath)) {
         throw new Exception('Application temp base directory is not writable -- (' . $tempPath . ')', 4);
     }
     if (!is_writable(jApp::logPath())) {
         throw new Exception('Application log directory is not writable -- (' . jApp::logPath() . ')', 4);
     }
     self::$commonConfig = jIniFile::read($configPath . 'defaultconfig.ini.php', true);
     $config = jIniFile::read(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     if (self::$commonConfig) {
         self::_mergeConfig($config, self::$commonConfig);
     }
     if ($configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Configuration file is missing -- {$configFile} ", 5);
         }
         if (false === ($userConfig = parse_ini_file($configPath . $configFile, true))) {
             throw new Exception("Syntax error in the configuration file -- {$configFile}", 6);
         }
         self::_mergeConfig($config, $userConfig);
     }
     $config = (object) $config;
     self::prepareConfig($config, $allModuleInfo, $isCli, $pseudoScriptName);
     self::$commonConfig = null;
     return $config;
 }
Exemplo n.º 4
0
 /**
  * read the given ini file, for the current entry point, or for the entrypoint given
  * in $pseudoScriptName. Merge it with the content of defaultconfig.ini.php
  * It also calculates some options.
  * If you are in a CLI script but you want to load a configuration file for a web entry point
  * or vice-versa, you need to indicate the $pseudoScriptName parameter with the name of the entry point
  * @param string $configFile the config file name
  * @param boolean $allModuleInfo may be true for the installer, which needs all informations
  *                               else should be false, these extra informations are
  *                               not needed to run the application
  * @param boolean $isCli  indicate if the configuration to read is for a CLI script or no
  * @param string $pseudoScriptName the name of the entry point, relative to the base path,
  *              corresponding to the readed configuration
  * @return object an object which contains configuration values
  */
 public static function read($configFile, $allModuleInfo = false, $isCli = false, $pseudoScriptName = '')
 {
     $tempPath = jApp::tempBasePath();
     $configPath = jApp::configPath();
     if ($tempPath == '/') {
         // if it equals to '/', this is because realpath has returned false in the application.init.php
         // so this is because the path doesn't exist.
         throw new Exception('Application temp directory doesn\'t exist !', 3);
     }
     if (!is_writable($tempPath)) {
         throw new Exception('Application temp base directory is not writable -- (' . $tempPath . ')', 4);
     }
     if (!is_writable(jApp::logPath())) {
         throw new Exception('Application log directory is not writable -- (' . jApp::logPath() . ')', 4);
     }
     $config = jelix_read_ini(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     self::$commonConfig = clone $config;
     @jelix_read_ini($configPath . 'defaultconfig.ini.php', $config);
     if ($configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Configuration file is missing -- {$configFile}", 5);
         }
         if (false === @jelix_read_ini($configPath . $configFile, $config)) {
             throw new Exception("Syntax error in the configuration file -- {$configFile}", 6);
         }
     }
     self::prepareConfig($config, $allModuleInfo, $isCli, $pseudoScriptName);
     self::$commonConfig = null;
     return $config;
 }
Exemplo n.º 5
0
 protected function _execute(InputInterface $input, OutputInterface $output)
 {
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     \jAppManager::close();
     $module = $input->getArgument('module');
     if ($this->verbose()) {
         $reporter = new \textInstallReporter();
     } else {
         $reporter = new \textInstallReporter('error');
     }
     $installer = new \jInstaller($reporter);
     if ($this->allEntryPoint) {
         $installer->uninstallModules(array($module));
     } else {
         $installer->uninstallModules(array($module), $this->entryPointName);
     }
     try {
         \jAppManager::clearTemp(\jApp::tempBasePath());
     } catch (\Exception $e) {
         if ($e->getCode() == 2) {
             $output->writeln("Error: bad path in jApp::tempBasePath(), it is equals to '" . jApp::tempBasePath() . "' !!");
             $output->writeln("       Jelix cannot clear the content of the temp directory.");
             $output->writeln("       you must clear it your self.");
             $output->writeln("       Correct the path in application.init.php or create the directory");
         } else {
             $output->writeln("<error>Error: " . $e->getMessage() . "</error>");
         }
     }
     \jAppManager::open();
 }
Exemplo n.º 6
0
 public function run()
 {
     $paths = array();
     $paths[] = jApp::tempBasePath();
     $paths[] = jApp::logPath();
     $paths[] = jApp::varPath('mails');
     $paths[] = jApp::varPath('db');
     foreach ($paths as $path) {
         $this->setRights($path);
     }
 }
 public function run()
 {
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     jAppManager::close();
     $module = $this->getParam('module');
     $modulesList = $this->getParam('...', array());
     array_unshift($modulesList, $module);
     $parameters = $this->getOption('-p');
     if ($parameters && count($modulesList) > 1) {
         throw new Exception('Parameters are for only one module');
     }
     if ($parameters) {
         $params = explode(';', $parameters);
         $parameters = array();
         foreach ($params as $param) {
             $kp = explode("=", $param);
             if (count($kp) > 1) {
                 $parameters[$kp[0]] = $kp[1];
             } else {
                 $parameters[$kp[0]] = true;
             }
         }
     }
     if ($this->verbose()) {
         $reporter = new textInstallReporter();
     } else {
         $reporter = new textInstallReporter('error');
     }
     $installer = new jInstaller($reporter);
     if ($this->allEntryPoint) {
         if ($parameters) {
             $installer->setModuleParameters($modulesList[0], $parameters);
         }
         $installer->installModules($modulesList);
     } else {
         if ($parameters) {
             $installer->setModuleParameters($modulesList[0], $parameters, $this->entryPointName);
         }
         $installer->installModules($modulesList, $this->entryPointName);
     }
     try {
         jAppManager::clearTemp(jApp::tempBasePath());
     } catch (Exception $e) {
         if ($e->getCode() == 2) {
             echo "Error: bad path in jApp::tempBasePath(), it is equals to '" . jApp::tempBasePath() . "' !!\n";
             echo "       Jelix cannot clear the content of the temp directory.\n";
             echo "       you must clear it your self.\n";
             echo "       Correct the path in application.init.php or create the directory\n";
         } else {
             echo "Error: " . $e->getMessage();
         }
     }
     jAppManager::open();
 }
Exemplo n.º 8
0
 protected function _execute(InputInterface $input, OutputInterface $output)
 {
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     \Jelix\Core\AppManager::close();
     $module = $input->getArgument('module');
     $parameters = $input->getOption('parameters');
     if ($parameters) {
         $params = explode(';', $parameters);
         $parameters = array();
         foreach ($params as $param) {
             $kp = explode("=", $param);
             if (count($kp) > 1) {
                 $parameters[$kp[0]] = $kp[1];
             } else {
                 $parameters[$kp[0]] = true;
             }
         }
     }
     if ($this->verbose()) {
         $reporter = new \Jelix\Installer\Reporter\Console();
     } else {
         $reporter = new \Jelix\Installer\Reporter\Console('error');
     }
     $installer = new \Jelix\Installer\Installer($reporter);
     if ($this->allEntryPoint) {
         if ($parameters) {
             $installer->setModuleParameters($module, $parameters);
         }
         $installer->installModules(array($module));
     } else {
         if ($parameters) {
             $installer->setModuleParameters($module, $parameters, $this->entryPointName);
         }
         $installer->installModules(array($module), $this->entryPointName);
     }
     try {
         \Jelix\Core\AppManager::clearTemp(\jApp::tempBasePath());
     } catch (\Exception $e) {
         if ($e->getCode() == 2) {
             $output->writeln("Error: bad path in \\Jelix\\Core\\App::tempBasePath(), it is equals to '" . App::tempBasePath() . "' !!");
             $output->writeln("       Jelix cannot clear the content of the temp directory.");
             $output->writeln("       you must clear it your self.");
             $output->writeln("       Correct the path in application.init.php or create the directory");
         } else {
             $output->writeln("<error>Error: " . $e->getMessage() . "</error>");
         }
     }
     \Jelix\Core\AppManager::open();
 }
Exemplo n.º 9
0
 /**
  * read the given ini file, for the current entry point, or for the entrypoint given
  * in $pseudoScriptName. Merge it with the content of defaultconfig.ini.php
  * It also calculates some options.
  * If you are in a CLI script but you want to load a configuration file for a web entry point
  * or vice-versa, you need to indicate the $pseudoScriptName parameter with the name of the entry point
  * @param string $configFile the config file name
  * @param boolean $allModuleInfo may be true for the installer, which needs all informations
  *                               else should be false, these extra informations are
  *                               not needed to run the application
  * @param boolean $isCli  indicate if the configuration to read is for a CLI script or no
  * @param string $pseudoScriptName the name of the entry point, relative to the base path,
  *              corresponding to the readed configuration
  * @return object an object which contains configuration values
  */
 public static function read($configFile, $allModuleInfo = false, $isCli = false, $pseudoScriptName = '')
 {
     $tempPath = jApp::tempBasePath();
     $configPath = jApp::configPath();
     if ($tempPath == '/') {
         // if it equals to '/', this is because realpath has returned false in the application.init.php
         // so this is because the path doesn't exist.
         throw new Exception('Application temp directory doesn\'t exist !', 3);
     }
     if (!is_writable($tempPath)) {
         throw new Exception('Application temp base directory (' . $tempPath . ') is not writable', 4);
     }
     self::$commonConfig = jIniFile::read($configPath . 'defaultconfig.ini.php', true);
     #if ENABLE_PHP_JELIX
     $config = jelix_read_ini(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     @jelix_read_ini($configPath . 'defaultconfig.ini.php', $config);
     if ($configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Config file {$configFile} is missing !", 5);
         }
         if (false === @jelix_read_ini($configPath . $configFile, $config)) {
             throw new Exception("Syntax error in the config file {$configFile} !", 6);
         }
     }
     #else
     $config = jIniFile::read(JELIX_LIB_CORE_PATH . 'defaultconfig.ini.php');
     if (self::$commonConfig) {
         self::_mergeConfig($config, self::$commonConfig);
     }
     if ($configFile != 'defaultconfig.ini.php') {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Config file {$configFile} is missing !", 5);
         }
         if (false === ($userConfig = parse_ini_file($configPath . $configFile, true))) {
             throw new Exception("Syntax error in the config file {$configFile} !", 6);
         }
         self::_mergeConfig($config, $userConfig);
     }
     $config = (object) $config;
     #endif
     self::prepareConfig($config, $allModuleInfo, $isCli, $pseudoScriptName);
     self::$commonConfig = null;
     return $config;
 }
Exemplo n.º 10
0
 public static function clearTemp($path = '')
 {
     if ($path == '') {
         $path = jApp::tempBasePath();
         if ($path == '') {
             throw new Exception("default temp base path is not defined", 1);
         }
     }
     if ($path == DIRECTORY_SEPARATOR || $path == '' || $path == '/') {
         throw new Exception('given temp path is invalid', 2);
     }
     if (!file_exists($path)) {
         throw new Exception('given temp path does not exists', 3);
     }
     if (!is_writeable($path)) {
         throw new Exception('given temp path does not exists', 4);
     }
     jFile::removeDir($path, false);
 }
Exemplo n.º 11
0
 protected function _execute(InputInterface $input, OutputInterface $output)
 {
     \Jelix\Core\AppManager::close();
     if ($this->verbose()) {
         $reporter = new \Jelix\Installer\Reporter\Console('notice', 'Low-level migration');
     } else {
         $reporter = new \Jelix\Installer\Reporter\Console('error', 'Low-level migration');
     }
     // launch the low-level migration
     $migrator = new \Jelix\Installer\Migration($reporter);
     $migrator->migrate();
     // we can now launch the installer/updater
     if ($this->verbose()) {
         $reporter = new \Jelix\Installer\Reporter\Console();
     } else {
         $reporter = new \Jelix\Installer\Reporter\Console('error');
     }
     $installer = new \Jelix\Installer\Installer($reporter);
     if ($input->getOption('entry-point')) {
         $installer->installEntryPoint($this->entryPointId);
     } else {
         $installer->installApplication();
     }
     try {
         \Jelix\Core\AppManager::clearTemp(\Jelix\Core\App::tempBasePath());
     } catch (\Exception $e) {
         if ($e->getCode() == 2) {
             $output->writeln("<error>Error: bad path in jApp::tempBasePath(), it is equals to '" . jApp::tempBasePath() . "' !!</error>");
             $output->writeln("       Jelix cannot clear the content of the temp directory.");
             $output->writeln("       you must clear it your self.");
             $output->writeln("       Correct the path in the application.init.php or create the directory");
         } else {
             $output->writeln("<error>Error: " . $e->getMessage() . "</error>");
         }
     }
     \Jelix\Core\AppManager::open();
 }
 function checkAppPaths()
 {
     $ok = true;
     if (!defined('JELIX_LIB_PATH') || !jApp::isInit()) {
         throw new Exception($this->messages->get('path.core'));
     }
     if (!file_exists(jApp::tempBasePath()) || !is_writable(jApp::tempBasePath())) {
         $this->error('path.temp');
         $ok = false;
     }
     if (!file_exists(jApp::logPath()) || !is_writable(jApp::logPath())) {
         $this->error('path.log');
         $ok = false;
     }
     if (!file_exists(jApp::varPath())) {
         $this->error('path.var');
         $ok = false;
     }
     if (!file_exists(jApp::configPath())) {
         $this->error('path.config');
         $ok = false;
     } elseif ($this->checkForInstallation) {
         if (!is_writable(jApp::configPath())) {
             $this->error('path.config.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('profiles.ini.php')) && !is_writable(jApp::configPath('profiles.ini.php'))) {
             $this->error('path.profiles.writable');
             $ok = false;
         }
         if (file_exists(jApp::mainConfigFile()) && !is_writable(jApp::mainConfigFile())) {
             $this->error('path.mainconfig.writable');
             $ok = false;
         } elseif (file_exists(jApp::configPath('defaultconfig.ini.php')) && !is_writable(jApp::configPath('defaultconfig.ini.php'))) {
             $this->error('path.mainconfig.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('installer.ini.php')) && !is_writable(jApp::configPath('installer.ini.php'))) {
             $this->error('path.installer.writable');
             $ok = false;
         }
     }
     if (!file_exists(jApp::wwwPath())) {
         $this->error('path.www');
         $ok = false;
     }
     foreach ($this->otherPaths as $path) {
         $realPath = jFile::parseJelixPath($path);
         if (!file_exists($realPath)) {
             $this->error('path.custom.not.exists', array($path));
             $ok = false;
         } else {
             if (!is_writable($realPath)) {
                 $this->error('path.custom.writable', array($path));
                 $ok = false;
             } else {
                 $this->ok('path.custom.ok', array($path));
             }
         }
     }
     if ($ok) {
         $this->ok('paths.ok');
     } else {
         throw new Exception($this->messages->get('too.critical.error'));
     }
     /*if(!isset($GLOBALS['config_file']) ||
          empty($GLOBALS['config_file']) ||
          !file_exists(jApp::configPath($GLOBALS['config_file']))){
           throw new Exception($this->messages->get('config.file'));
       }*/
     return $ok;
 }
Exemplo n.º 13
0
 public static function setTempBasePath($path)
 {
     self::$tempBasePath = $path;
 }
Exemplo n.º 14
0
 function checkAppPaths()
 {
     $ok = true;
     if (!defined('JELIX_LIB_PATH') || !jApp::isInit()) {
         throw new Exception($this->messages->get('path.core'));
     }
     if (!file_exists(jApp::tempBasePath()) || !is_writable(jApp::tempBasePath())) {
         $this->error('path.temp');
         $ok = false;
     }
     if (!file_exists(jApp::logPath()) || !is_writable(jApp::logPath())) {
         $this->error('path.log');
         $ok = false;
     }
     if (!file_exists(jApp::varPath())) {
         $this->error('path.var');
         $ok = false;
     }
     if (!file_exists(jApp::configPath())) {
         $this->error('path.config');
         $ok = false;
     } elseif ($this->checkForInstallation) {
         if (!is_writable(jApp::configPath())) {
             $this->error('path.config.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('profiles.ini.php')) && !is_writable(jApp::configPath('profiles.ini.php'))) {
             $this->error('path.profiles.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('defaultconfig.ini.php')) && !is_writable(jApp::configPath('defaultconfig.ini.php'))) {
             $this->error('path.defaultconfig.writable');
             $ok = false;
         }
         if (file_exists(jApp::configPath('installer.ini.php')) && !is_writable(jApp::configPath('installer.ini.php'))) {
             $this->error('path.installer.writable');
             $ok = false;
         }
     }
     if (!file_exists(jApp::wwwPath())) {
         $this->error('path.www');
         $ok = false;
     }
     foreach ($this->otherPaths as $path) {
         $realPath = str_replace(array('app:', 'lib:', 'var:', 'www:'), array(jApp::appPath(), LIB_PATH, jApp::varPath(), jApp::wwwPath()), $path);
         if (!file_exists($realPath)) {
             $this->error('path.custom.not.exists', array($path));
             $ok = false;
         } else {
             if (!is_writable($realPath)) {
                 $this->error('path.custom.writable', array($path));
                 $ok = false;
             } else {
                 $this->ok('path.custom.ok', array($path));
             }
         }
     }
     if ($ok) {
         $this->ok('paths.ok');
     } else {
         throw new Exception($this->messages->get('too.critical.error'));
     }
     return $ok;
 }
Exemplo n.º 15
0
 static function checkTempPath()
 {
     $tempBasePath = jApp::tempBasePath();
     // we always clean the temp directory. But first, let's check the temp path (see ticket #840)...
     if ($tempBasePath == DIRECTORY_SEPARATOR || $tempBasePath == '' || $tempBasePath == '/') {
         throw new Exception("Error: bad path in jApp::tempBasePath(), it is equals to '" . $tempBasePath . "' !!\n" . "       Jelix cannot clear the content of the temp directory.\n" . "       Correct the path for the temp directory or create the directory you\n" . "       indicated with jApp in your application.init.php.\n");
     }
     jFile::removeDir(jApp::tempPath(), false, array('.svn', '.dummy'));
 }
Exemplo n.º 16
0
 public function run()
 {
     require_once LIB_PATH . 'clearbricks/jelix.inc.php';
     require_once JELIX_LIB_PATH . 'installer/jInstaller.class.php';
     $appPath = $this->getParam('path');
     $appPath = $this->getRealPath($appPath);
     $appName = basename($appPath);
     $appPath .= '/';
     if (file_exists($appPath)) {
         throw new Exception("this application is already created");
     }
     $this->config = JelixScript::loadConfig($appName);
     $this->config->infoIDSuffix = $this->config->newAppInfoIDSuffix;
     $this->config->infoWebsite = $this->config->newAppInfoWebsite;
     $this->config->infoLicence = $this->config->newAppInfoLicence;
     $this->config->infoLicenceUrl = $this->config->newAppInfoLicenceUrl;
     $this->config->infoLocale = $this->config->newAppInfoLocale;
     $this->config->infoCopyright = $this->config->newAppInfoCopyright;
     $this->config->initAppPaths($appPath);
     jApp::setEnv('jelix-scripts');
     jApp::initLegacy();
     JelixScript::checkTempPath();
     if ($p = $this->getOption('-wwwpath')) {
         $wwwpath = path::real($appPath . $p, false) . '/';
     } else {
         $wwwpath = jApp::wwwPath();
     }
     $this->createDir($appPath);
     $this->createDir(jApp::tempBasePath());
     $this->createDir($wwwpath);
     $varPath = jApp::varPath();
     $configPath = jApp::configPath();
     $this->createDir($varPath);
     $this->createDir(jApp::logPath());
     $this->createDir($configPath);
     $this->createDir($configPath . 'index/');
     $this->createDir($varPath . 'overloads/');
     $this->createDir($varPath . 'themes/');
     $this->createDir($varPath . 'themes/default/');
     $this->createDir($varPath . 'uploads/');
     $this->createDir($varPath . 'sessions/');
     $this->createDir($varPath . 'mails/');
     $this->createDir($appPath . 'install');
     $this->createDir($appPath . 'modules');
     $this->createDir($appPath . 'plugins');
     $this->createDir($appPath . 'plugins/coord/');
     $this->createDir($appPath . 'plugins/tpl/');
     $this->createDir($appPath . 'plugins/tpl/common');
     $this->createDir($appPath . 'plugins/tpl/html');
     $this->createDir($appPath . 'plugins/tpl/text');
     $this->createDir($appPath . 'plugins/db/');
     $this->createDir($appPath . 'plugins/auth/');
     $this->createDir($appPath . 'responses');
     $this->createDir($appPath . 'tests');
     $this->createDir(jApp::scriptsPath());
     $param = array();
     $param['default_id'] = $appName . $this->config->infoIDSuffix;
     if ($this->getOption('-nodefaultmodule')) {
         $param['tplname'] = 'jelix~defaultmain';
         $param['modulename'] = 'jelix';
     } else {
         // note: since module name are used for name of generated name,
         // only this characters are allowed
         $param['modulename'] = preg_replace('/([^a-zA-Z_0-9])/', '_', $appName);
         $param['tplname'] = $param['modulename'] . '~main';
     }
     $param['config_file'] = 'index/config.ini.php';
     $param['rp_temp'] = $this->getRelativePath($appPath, jApp::tempBasePath());
     $param['rp_var'] = $this->getRelativePath($appPath, jApp::varPath());
     $param['rp_log'] = $this->getRelativePath($appPath, jApp::logPath());
     $param['rp_conf'] = $this->getRelativePath($appPath, $configPath);
     $param['rp_www'] = $this->getRelativePath($appPath, $wwwpath);
     $param['rp_cmd'] = $this->getRelativePath($appPath, jApp::scriptsPath());
     $param['rp_jelix'] = $this->getRelativePath($appPath, JELIX_LIB_PATH);
     $param['rp_app'] = $this->getRelativePath($wwwpath, $appPath);
     $this->createFile(jApp::logPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'mails/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'sessions/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'overloads/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::varPath() . 'themes/default/.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . 'plugins/.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::scriptsPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(jApp::tempBasePath() . '.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . '.htaccess', 'htaccess_deny', $param, "Configuration file for Apache");
     $this->createFile($appPath . 'project.xml', 'project.xml.tpl', $param, "Project description file");
     $this->createFile($appPath . 'cmd.php', 'cmd.php.tpl', $param, "Script for developer commands");
     $this->createFile($configPath . 'defaultconfig.ini.php', 'var/config/defaultconfig.ini.php.tpl', $param, "Main configuration file");
     $this->createFile($configPath . 'defaultconfig.ini.php.dist', 'var/config/defaultconfig.ini.php.tpl', $param, "Main configuration file for your repository");
     $this->createFile($configPath . 'profiles.ini.php', 'var/config/profiles.ini.php.tpl', $param, "Profiles file");
     $this->createFile($configPath . 'profiles.ini.php.dist', 'var/config/profiles.ini.php.tpl', $param, "Profiles file for your repository");
     $this->createFile($configPath . 'preferences.ini.php', 'var/config/preferences.ini.php.tpl', $param, "Preferences file");
     $this->createFile($configPath . 'urls.xml', 'var/config/urls.xml.tpl', $param, "URLs mapping file");
     //$this->createFile(JELIX_APP_CONFIG_PATH.'installer.ini.php', 'var/config/installer.ini.php.tpl', $param);
     $this->createFile($configPath . 'index/config.ini.php', 'var/config/index/config.ini.php.tpl', $param, "Entry point configuration file");
     $this->createFile($appPath . 'responses/myHtmlResponse.class.php', 'responses/myHtmlResponse.class.php.tpl', $param, "Main response class");
     $this->createFile($appPath . 'install/installer.php', 'installer/installer.php.tpl', $param, "Installer script");
     $this->createFile($appPath . 'tests/runtests.php', 'tests/runtests.php', $param, "Tests script");
     $temp = dirname(jApp::tempBasePath());
     if (file_exists($temp . '/.gitignore')) {
         $gitignore = file_get_contents($temp . '/.gitignore') . "\n" . $appName . "/*\n";
         file_put_contents($temp . '/.gitignore', $gitignore);
     } else {
         file_put_contents($temp . '/.gitignore', $appName . "/*\n");
     }
     $this->createFile($wwwpath . 'index.php', 'www/index.php.tpl', $param, "Main entry point");
     $this->createFile($wwwpath . '.htaccess', 'htaccess_allow', $param, "Configuration file for Apache");
     $param['php_rp_temp'] = $this->convertRp($param['rp_temp']);
     $param['php_rp_var'] = $this->convertRp($param['rp_var']);
     $param['php_rp_log'] = $this->convertRp($param['rp_log']);
     $param['php_rp_conf'] = $this->convertRp($param['rp_conf']);
     $param['php_rp_www'] = $this->convertRp($param['rp_www']);
     $param['php_rp_cmd'] = $this->convertRp($param['rp_cmd']);
     $param['php_rp_jelix'] = $this->convertRp($param['rp_jelix']);
     $this->createFile($appPath . 'application.init.php', 'application.init.php.tpl', $param, "Bootstrap file");
     $installer = new jInstaller(new textInstallReporter('warning'));
     $installer->installApplication();
     $moduleok = true;
     if (!$this->getOption('-nodefaultmodule')) {
         try {
             $cmd = JelixScript::getCommand('createmodule', $this->config);
             $options = $this->getCommonActiveOption();
             $options['-addinstallzone'] = true;
             $cmd->initOptParam($options, array('module' => $param['modulename']));
             $cmd->run();
             $this->createFile($appPath . 'modules/' . $param['modulename'] . '/templates/main.tpl', 'module/main.tpl.tpl', $param, "Main template");
         } catch (Exception $e) {
             $moduleok = false;
             echo "The module has not been created because of this error: " . $e->getMessage() . "\nHowever the application has been created\n";
         }
     }
     if ($this->getOption('-withcmdline')) {
         if (!$this->getOption('-nodefaultmodule') && $moduleok) {
             $agcommand = JelixScript::getCommand('createctrl', $this->config);
             $options = $this->getCommonActiveOption();
             $options['-cmdline'] = true;
             $agcommand->initOptParam($options, array('module' => $param['modulename'], 'name' => 'default', 'method' => 'index'));
             $agcommand->run();
         }
         $agcommand = JelixScript::getCommand('createentrypoint', $this->config);
         $options = $this->getCommonActiveOption();
         $options['-type'] = 'cmdline';
         $parameters = array('name' => $param['modulename']);
         $agcommand->initOptParam($options, $parameters);
         $agcommand->run();
     }
 }