예제 #1
0
파일: Mailer.php 프로젝트: rodacom/jelix
 /**
  * initialize some member
  */
 function __construct($exception = true)
 {
     $config = \Jelix\Core\App::config();
     $this->defaultLang = $config->locale;
     $this->CharSet = $config->charset;
     $this->Mailer = $config->mailer['mailerType'];
     if ($config->mailer['mailerType']) {
         $this->Mailer = $config->mailer['mailerType'];
     }
     $this->Hostname = $config->mailer['hostname'];
     $this->Sendmail = $config->mailer['sendmailPath'];
     $this->Host = $config->mailer['smtpHost'];
     $this->Port = $config->mailer['smtpPort'];
     $this->Helo = $config->mailer['smtpHelo'];
     $this->SMTPAuth = $config->mailer['smtpAuth'];
     $this->SMTPSecure = $config->mailer['smtpSecure'];
     $this->Username = $config->mailer['smtpUsername'];
     $this->Password = $config->mailer['smtpPassword'];
     $this->Timeout = $config->mailer['smtpTimeout'];
     if ($config->mailer['webmasterEmail'] != '') {
         $this->From = $config->mailer['webmasterEmail'];
     }
     $this->FromName = $config->mailer['webmasterName'];
     $this->filePath = \Jelix\Core\App::varPath($config->mailer['filesDir']);
     $this->copyToFiles = $config->mailer['copyToFiles'];
     parent::__construct(true);
 }
예제 #2
0
 public function run()
 {
     $this->loadAppConfig();
     $config = \Jelix\Core\App::config();
     $model_lang = $this->getParam('model_lang', $config->locale);
     $lang = $this->getParam('lang');
     foreach ($config->_modulesPathList as $module => $dir) {
         $source_dir = $dir . 'locales/' . $model_lang . '/';
         if (!file_exists($source_dir)) {
             continue;
         }
         if ($this->getOption('-to-overload')) {
             $target_dir = \Jelix\Core\App::varPath('overloads/' . $module . '/locales/' . $lang . '/');
         } else {
             $target_dir = \Jelix\Core\App::varPath('locales/' . $lang . '/' . $module . '/locales/');
         }
         jFile::createDir($target_dir);
         if ($dir_r = opendir($source_dir)) {
             while (FALSE !== ($fich = readdir($dir_r))) {
                 if ($fich != "." && $fich != ".." && is_file($source_dir . $fich) && strpos($fich, '.' . $config->charset . '.properties') && !file_exists($target_dir . $fich)) {
                     copy($source_dir . $fich, $target_dir . $fich);
                     if ($this->verbose()) {
                         echo "Copy Locales file {$fich} from {$source_dir} to {$target_dir}.\n";
                     }
                 }
             }
             closedir($dir_r);
         }
     }
 }
예제 #3
0
 public function run()
 {
     $paths = array();
     $paths[] = \Jelix\Core\App::tempBasePath();
     $paths[] = \Jelix\Core\App::logPath();
     $paths[] = \Jelix\Core\App::varPath('mails');
     $paths[] = \Jelix\Core\App::varPath('db');
     foreach ($paths as $path) {
         $this->setRights($path);
     }
 }
예제 #4
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $paths = array();
     $paths[] = \Jelix\Core\App::tempBasePath();
     $paths[] = \Jelix\Core\App::logPath();
     $paths[] = \Jelix\Core\App::varPath('mails');
     $paths[] = \Jelix\Core\App::varPath('db');
     foreach ($paths as $path) {
         $this->setRights($path);
     }
 }
예제 #5
0
파일: Checker.php 프로젝트: mdouchin/jelix
 function checkAppPaths()
 {
     $ok = true;
     if (!defined('JELIX_LIB_PATH') || !App::isInit()) {
         throw new \Exception($this->messages->get('path.core'));
     }
     if (!file_exists(App::tempBasePath()) || !is_writable(App::tempBasePath())) {
         $this->error('path.temp');
         $ok = false;
     }
     if (!file_exists(App::logPath()) || !is_writable(App::logPath())) {
         $this->error('path.log');
         $ok = false;
     }
     if (!file_exists(App::varPath())) {
         $this->error('path.var');
         $ok = false;
     }
     if (!file_exists(App::appConfigPath())) {
         $this->error('path.config');
         $ok = false;
     }
     if (!file_exists(App::configPath())) {
         $this->error('path.config');
         $ok = false;
     } elseif ($this->checkForInstallation) {
         if (!is_writable(App::configPath())) {
             $this->error('path.config.writable');
             $ok = false;
         }
         if (file_exists(App::configPath('profiles.ini.php')) && !is_writable(App::configPath('profiles.ini.php'))) {
             $this->error('path.profiles.writable');
             $ok = false;
         }
         if (file_exists(App::configPath('installer.ini.php')) && !is_writable(App::configPath('installer.ini.php'))) {
             $this->error('path.installer.writable');
             $ok = false;
         }
     }
     if (!file_exists(App::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'));
     }
     return $ok;
 }
예제 #6
0
 protected function _createPath()
 {
     if (!isset(App::config()->_modulesPathList[$this->module])) {
         if ($this->module == 'jelix') {
             throw new Exception('jelix module is not enabled !!');
         }
         throw new \Jelix\Core\Selector\Exception('jelix~errors.selector.module.unknown', $this->toString());
     }
     $locales = array($this->locale);
     $lang = substr($this->locale, 0, strpos($this->locale, '_'));
     // FIXME we should drop support of such locales 'en_EN', and supports directory with lang name 'en'
     // study impact of such changes
     $generic_locale = $lang . '_' . strtoupper($lang);
     if ($this->locale !== $generic_locale) {
         $locales[] = $generic_locale;
     }
     foreach ($locales as $locale) {
         // check if the locale has been overloaded
         $overloadedPath = App::varPath('overloads/' . $this->module . '/locales/' . $locale . '/' . $this->resource . $this->_suffix);
         if (is_readable($overloadedPath)) {
             $this->_path = $overloadedPath;
             $this->_where = 'overloaded/';
             $this->_cacheSuffix = '.' . $locale . '.' . $this->charset . '.php';
             return;
         }
         // check if the locale is available in the locales directory
         $localesPath = App::varPath('locales/' . $locale . '/' . $this->module . '/locales/' . $this->resource . $this->_suffix);
         if (is_readable($localesPath)) {
             $this->_path = $localesPath;
             $this->_where = 'locales/';
             $this->_cacheSuffix = '.' . $locale . '.' . $this->charset . '.php';
             return;
         }
         // else check for the original locale file in the module
         $path = App::config()->_modulesPathList[$this->module] . 'locales/' . $locale . '/' . $this->resource . $this->_suffix;
         if (is_readable($path)) {
             $this->_where = 'modules/';
             $this->_path = $path;
             $this->_cacheSuffix = '.' . $locale . '.' . $this->charset . '.php';
             return;
         }
     }
     // to avoid infinite loop in a specific lang or charset, we should check if we don't
     // try to retrieve the same message as the one we use for the exception below,
     // and if it is this message, it means that the error message doesn't exist
     // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset
     if ($this->toString() == 'jelix~errors.selector.invalid.target') {
         $l = 'en_US';
         $c = 'UTF-8';
     } else {
         $l = null;
         $c = null;
     }
     throw new \Jelix\Core\Selector\Exception('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c);
 }
예제 #7
0
파일: jApp.php 프로젝트: rodacom/jelix
 public static function varPath($file = '')
 {
     return \Jelix\Core\App::varPath($file);
 }
예제 #8
0
 protected function _createPath()
 {
     if (!isset(App::config()->_modulesPathList[$this->module])) {
         if ($this->module == 'jelix') {
             throw new Exception('jelix module is not enabled !!');
         }
         throw new \Jelix\Core\Selector\Exception('jelix~errors.selector.module.unknown', $this->toString());
     }
     $this->_cacheSuffix = '.' . $this->locale . '.' . $this->charset . '.php';
     // check if the locale has been overloaded in var/
     $overloadedPath = App::varPath('overloads/' . $this->module . '/locales/' . $this->locale . '/' . $this->resource . $this->_suffix);
     if (is_readable($overloadedPath)) {
         $this->_path = $overloadedPath;
         $this->_where = 'var/overloaded/';
         return;
     }
     // check if the locale is available in the locales directory in var/
     $localesPath = App::varPath('locales/' . $this->locale . '/' . $this->module . '/locales/' . $this->resource . $this->_suffix);
     if (is_readable($localesPath)) {
         $this->_path = $localesPath;
         $this->_where = 'var/locales/';
         return;
     }
     // check if the locale has been overloaded in app/
     $overloadedPath = App::appPath('app/overloads/' . $this->module . '/locales/' . $this->locale . '/' . $this->resource . $this->_suffix);
     if (is_readable($overloadedPath)) {
         $this->_path = $overloadedPath;
         $this->_where = 'app/overloaded/';
         return;
     }
     // check if the locale is available in the locales directory in app/
     $localesPath = App::appPath('app/locales/' . $this->locale . '/' . $this->module . '/locales/' . $this->resource . $this->_suffix);
     if (is_readable($localesPath)) {
         $this->_path = $localesPath;
         $this->_where = 'app/locales/';
         return;
     }
     // else check for the original locale file in the module
     $path = App::config()->_modulesPathList[$this->module] . 'locales/' . $this->locale . '/' . $this->resource . $this->_suffix;
     if (is_readable($path)) {
         $this->_where = 'modules/';
         $this->_path = $path;
         return;
     }
     // to avoid infinite loop in a specific lang or charset, we should check if we don't
     // try to retrieve the same message as the one we use for the exception below,
     // and if it is this message, it means that the error message doesn't exist
     // in the specific lang or charset, so we retrieve it in en_EN language and UTF-8 charset
     if ($this->toString() == 'jelix~errors.selector.invalid.target') {
         $l = 'en_US';
         $c = 'UTF-8';
     } else {
         $l = null;
         $c = null;
     }
     throw new \Jelix\Core\Selector\Exception('jelix~errors.selector.invalid.target', array($this->toString(), "locale"), 1, $l, $c);
 }
예제 #9
0
 function __construct($sel)
 {
     $this->_basePath = \Jelix\Core\App::varPath();
     parent::__construct($sel);
 }
예제 #10
0
 protected function _createSkeleton($appPath, $appName, $wwwpath, InputInterface $input)
 {
     $this->createDir($appPath);
     $this->createDir(App::tempBasePath());
     $this->createDir($wwwpath);
     $varPath = App::varPath();
     $configPath = App::configPath();
     $this->createDir($varPath);
     $this->createDir(App::logPath());
     $this->createDir(App::appConfigPath());
     $this->createDir($configPath);
     $this->createDir(App::appConfigPath('index/'));
     $this->createDir(App::appPath('app/overloads/'));
     $this->createDir(App::appPath('app/themes'));
     $this->createDir(App::appPath('app/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(App::appPath('app/responses'));
     $this->createDir($appPath . 'tests');
     $this->createDir(App::scriptsPath());
     $param = array();
     if ($input->getOption('nodefaultmodule')) {
         $param['tplname'] = 'jelix~defaultmain';
         $param['modulename'] = 'jelix';
     } else {
         $moduleName = $input->getOption('modulename');
         if (!$moduleName) {
             // note: since module name are used for name of generated name,
             // only this characters are allowed
             $moduleName = preg_replace('/([^a-zA-Z_0-9])/', '_', $appName);
         }
         $param['modulename'] = $moduleName;
         $param['tplname'] = $moduleName . '~main';
     }
     $param['config_file'] = 'index/config.ini.php';
     $param['rp_temp'] = Path::shortestPath($appPath, App::tempBasePath()) . '/';
     $param['rp_var'] = Path::shortestPath($appPath, App::varPath()) . '/';
     $param['rp_log'] = Path::shortestPath($appPath, App::logPath()) . '/';
     $param['rp_conf'] = Path::shortestPath($appPath, $configPath) . '/';
     $param['rp_www'] = Path::shortestPath($appPath, $wwwpath) . '/';
     $param['rp_cmd'] = Path::shortestPath($appPath, App::scriptsPath()) . '/';
     $param['rp_jelix'] = Path::shortestPath($appPath, JELIX_LIB_PATH) . '/';
     $param['rp_lib'] = Path::shortestPath($appPath, LIB_PATH) . '/';
     $param['rp_vendor'] = '';
     foreach (array(LIB_PATH . 'vendor/', LIB_PATH . '../vendor/', LIB_PATH . '../../../') as $path) {
         if (file_exists($path)) {
             $param['rp_vendor'] = Path::shortestPath($appPath, realpath($path) . '/') . '/';
             break;
         }
     }
     $param['rp_app'] = Path::shortestPath($wwwpath, $appPath) . '/';
     $this->createFile(App::logPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'mails/.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'sessions/.dummy', 'dummy.tpl', array());
     $this->createFile(App::appPath() . 'app/overloads/.dummy', 'dummy.tpl', array());
     $this->createFile(App::appPath() . 'app/themes/default/.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'uploads/.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . 'plugins/.dummy', 'dummy.tpl', array());
     $this->createFile(App::scriptsPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(App::tempBasePath() . '.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . '.htaccess', 'htaccess_deny', $param, "Configuration file for Apache");
     $this->createFile($appPath . '.gitignore', 'git_ignore.tpl', $param, ".gitignore");
     $this->createFile($appPath . 'jelix-app.json', 'jelix-app.json.tpl', $param, "Project description file");
     $this->createFile($appPath . 'composer.json', 'composer.json.tpl', $param, "Composer file");
     $this->createFile($appPath . 'cmd.php', 'cmd.php.tpl', $param, "Script for developer commands");
     $this->createFile(App::appConfigPath('mainconfig.ini.php'), 'app/config/mainconfig.ini.php.tpl', $param, "Main configuration file");
     $this->createFile($configPath . 'localconfig.ini.php.dist', 'var/config/localconfig.ini.php.tpl', $param, "Configuration file for specific environment");
     $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(App::appConfigPath('urls.xml'), 'app/config/urls.xml.tpl', $param, "URLs mapping file");
     $this->createFile(App::appConfigPath('index/config.ini.php'), 'app/config/index/config.ini.php.tpl', $param, "Entry point configuration file");
     $this->createFile($appPath . 'app/responses/myHtmlResponse.class.php', 'app/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(rtrim(App::tempBasePath(), '/'));
     if ($temp != rtrim($appPath, '/')) {
         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");
         }
     } else {
         $gitignore = file_get_contents($appPath . '.gitignore') . "\n" . basename(rtrim(App::tempBasePath(), '/')) . "/*\n";
         file_put_contents($appPath . '.gitignore', $gitignore);
     }
     $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']);
     if ($param['rp_vendor']) {
         $param['php_rp_vendor'] = $this->convertRp($param['rp_vendor']);
         $this->createFile($appPath . 'application.init.php', 'application2.init.php.tpl', $param, "Bootstrap file");
     } else {
         $this->createFile($appPath . 'application.init.php', 'application.init.php.tpl', $param, "Bootstrap file");
     }
     return $param;
 }
예제 #11
-1
 public function run()
 {
     $appPath = $this->getParam('path');
     $appPath = $this->getRealPath($appPath);
     $appName = basename($appPath);
     $appPath .= '/';
     if (file_exists($appPath . '/jelix-app.json') || file_exists($appPath . '/project.xml')) {
         throw new Exception("this application is already created");
     }
     $this->config = JelixScript::loadConfig($appName);
     $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);
     App::setEnv('jelix-scripts');
     JelixScript::checkTempPath();
     if ($p = $this->getOption('-wwwpath')) {
         $wwwpath = path::real($appPath . $p, false) . '/';
     } else {
         $wwwpath = App::wwwPath();
     }
     $this->createDir($appPath);
     $this->createDir(App::tempBasePath());
     $this->createDir($wwwpath);
     $varPath = App::varPath();
     $configPath = App::configPath();
     $this->createDir($varPath);
     $this->createDir(App::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 . 'responses');
     $this->createDir($appPath . 'tests');
     $this->createDir(App::scriptsPath());
     $param = array();
     if ($this->getOption('-nodefaultmodule')) {
         $param['tplname'] = 'jelix~defaultmain';
         $param['modulename'] = 'jelix';
     } else {
         $moduleName = $this->getOption('-modulename');
         if (!$moduleName) {
             // note: since module name are used for name of generated name,
             // only this characters are allowed
             $moduleName = preg_replace('/([^a-zA-Z_0-9])/', '_', $appName);
         }
         $param['modulename'] = $moduleName;
         $param['tplname'] = $moduleName . '~main';
     }
     $param['config_file'] = 'index/config.ini.php';
     $param['rp_temp'] = $this->getRelativePath($appPath, App::tempBasePath());
     $param['rp_var'] = $this->getRelativePath($appPath, App::varPath());
     $param['rp_log'] = $this->getRelativePath($appPath, App::logPath());
     $param['rp_conf'] = $this->getRelativePath($appPath, $configPath);
     $param['rp_www'] = $this->getRelativePath($appPath, $wwwpath);
     $param['rp_cmd'] = $this->getRelativePath($appPath, App::scriptsPath());
     $param['rp_jelix'] = $this->getRelativePath($appPath, JELIX_LIB_PATH);
     $param['rp_vendor'] = '';
     foreach (array(LIB_PATH . 'vendor/', LIB_PATH . '../vendor/', LIB_PATH . '../../../') as $path) {
         if (file_exists($path)) {
             $param['rp_vendor'] = $this->getRelativePath($appPath, realpath($path) . '/');
             break;
         }
     }
     $param['rp_app'] = $this->getRelativePath($wwwpath, $appPath);
     $this->createFile(App::logPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'mails/.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'sessions/.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'overloads/.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'themes/default/.dummy', 'dummy.tpl', array());
     $this->createFile(App::varPath() . 'uploads/.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . 'plugins/.dummy', 'dummy.tpl', array());
     $this->createFile(App::scriptsPath() . '.dummy', 'dummy.tpl', array());
     $this->createFile(App::tempBasePath() . '.dummy', 'dummy.tpl', array());
     $this->createFile($appPath . '.htaccess', 'htaccess_deny', $param, "Configuration file for Apache");
     $this->createFile($appPath . '.gitignore', 'git_ignore.tpl', $param, ".gitignore");
     $this->createFile($appPath . 'jelix-app.json', 'jelix-app.json.tpl', $param, "Project description file");
     $this->createFile($appPath . 'composer.json', 'composer.json.tpl', $param, "Composer file");
     $this->createFile($appPath . 'cmd.php', 'cmd.php.tpl', $param, "Script for developer commands");
     $this->createFile($configPath . 'mainconfig.ini.php', 'var/config/mainconfig.ini.php.tpl', $param, "Main configuration file");
     $this->createFile($configPath . 'localconfig.ini.php.dist', 'var/config/localconfig.ini.php.tpl', $param, "Configuration file for specific environment");
     $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($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(rtrim(App::tempBasePath(), '/'));
     if ($temp != rtrim($appPath, '/')) {
         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");
         }
     } else {
         $gitignore = file_get_contents($appPath . '.gitignore') . "\n" . basename(rtrim(App::tempBasePath(), '/')) . "/*\n";
         file_put_contents($appPath . '.gitignore', $gitignore);
     }
     $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']);
     if ($param['rp_vendor']) {
         $param['php_rp_vendor'] = $this->convertRp($param['rp_vendor']);
         $this->createFile($appPath . 'application.init.php', 'application2.init.php.tpl', $param, "Bootstrap file");
     } else {
         $this->createFile($appPath . 'application.init.php', 'application.init.php.tpl', $param, "Bootstrap file");
     }
     $installer = new \Jelix\Installer\Installer(new \Jelix\Installer\Reporter\Console('warning'));
     $installer->installApplication();
     $moduleok = true;
     if (!$this->getOption('-nodefaultmodule')) {
         try {
             $cmd = JelixScript::getCommand('createmodule', $this->config);
             $options = $this->getCommonActiveOption();
             $options['-addinstallzone'] = true;
             $options['-noregistration'] = 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();
     }
 }