Changeset 1092

Show
Ignore:
Timestamp:
09/16/08 22:41:23 (4 months ago)
Author:
laurentj
Message:

ticket #82: bad module name in config file when creating application with nodefaultmodule and then creating a new module

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix-scripts/commands/createapp.cmd.php

    r1018 r1092  
    1616 
    1717    public  $name = 'createapp'; 
    18     public  $allowed_options=array('-nodefaultmodule'=>false, '-withcmdline'=>false); 
     18    public  $allowed_options=array('-nodefaultmodule'=>false, '-withcmdline'=>false, '-withrpc'=>false); 
    1919    public  $allowed_parameters=array(); 
    2020 
     
    6767       $this->createDir(JELIX_APP_CONFIG_PATH); 
    6868       $this->createDir(JELIX_APP_CONFIG_PATH.'index/'); 
    69        $this->createDir(JELIX_APP_CONFIG_PATH.'jsonrpc/'); 
    70        $this->createDir(JELIX_APP_CONFIG_PATH.'xmlrpc/'); 
    7169       $this->createDir(JELIX_APP_VAR_PATH.'overloads/'); 
    7270       $this->createDir(JELIX_APP_VAR_PATH.'themes/'); 
     
    104102       $this->createFile(JELIX_APP_PATH.'application.init.php','application.init.php.tpl',$param); 
    105103 
    106        $param = array('appname'=>$GLOBALS['APPNAME']); 
     104       $param = array('appname'=>$GLOBALS['APPNAME'], 'modulename'=>''); 
    107105       $param['rp_jelix'] = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_LIB_PATH, true); 
    108106       $param['rp_app']   = jxs_getRelativePath(JELIX_APP_WWW_PATH, JELIX_APP_PATH, true); 
     
    115113            $cmd->init(array('-addinstallzone'=>true),array('module'=>$GLOBALS['APPNAME'])); 
    116114            $cmd->run(); 
    117             $this->createFile(JELIX_APP_PATH.'modules/'.$GLOBALS['APPNAME'].'/templates/main.tpl', 'main.tpl.tpl',$param); 
     115            $param['modulename'] = $GLOBALS['APPNAME']; 
     116            $this->createFile(JELIX_APP_PATH.'modules/'.$GLOBALS['APPNAME'].'/templates/main.tpl', 'main.tpl.tpl', $param); 
    118117       } 
    119118 
     
    126125            $this->createDir(JELIX_APP_CMD_PATH); 
    127126            $this->createDir(JELIX_APP_CONFIG_PATH.'cmdline'); 
    128             $this->createFile(JELIX_APP_CONFIG_PATH.'cmdline/config.ini.php','var/config/cmdline/config.ini.php.tpl',$param); 
     127            $this->createFile(JELIX_APP_CONFIG_PATH.'cmdline/config.ini.php','var/config/cmdline/config.ini.php.tpl', $param); 
    129128            $param['rp_cmd'] =jxs_getRelativePath(JELIX_APP_PATH, JELIX_APP_CMD_PATH,true); 
    130129            $this->createFile(JELIX_APP_CMD_PATH.'cmdline.php','scripts/cmdline.php.tpl',$param); 
     
    132131 
    133132       if($this->getOption('-withrpc')){ 
     133          $this->createDir(JELIX_APP_CONFIG_PATH.'jsonrpc/'); 
     134          $this->createDir(JELIX_APP_CONFIG_PATH.'xmlrpc/'); 
    134135          $this->createFile(JELIX_APP_WWW_PATH.'jsonrpc.php','www/jsonrpc.php.tpl',$param); 
    135136          $this->createFile(JELIX_APP_WWW_PATH.'xmlrpc.php','www/xmlrpc.php.tpl',$param); 
  • trunk/lib/jelix-scripts/commands/createmodule.cmd.php

    r1018 r1092  
    4141 
    4242    public function run(){ 
    43        $path= $this->getModulePath($this->_parameters['module'], false); 
     43        jxs_init_jelix_env(); 
     44        $path= $this->getModulePath($this->_parameters['module'], false); 
    4445 
    45        if(file_exists($path)){ 
    46           die("Error: module '".$this->_parameters['module']."' already exists"); 
    47        
    48        $this->createDir($path); 
    49        $this->createFile($path.'module.xml','module.xml.tpl',array('name'=>$this->_parameters['module'])); 
     46        if(file_exists($path)){ 
     47            die("Error: module '".$this->_parameters['module']."' already exists"); 
     48       
     49        $this->createDir($path); 
     50        $this->createFile($path.'module.xml','module.xml.tpl',array('name'=>$this->_parameters['module'])); 
    5051 
    51        if(!$this->getOption('-nosubdir')){ 
    52           $this->createDir($path.'classes/'); 
    53           $this->createDir($path.'zones/'); 
    54           $this->createDir($path.'controllers/'); 
    55           $this->createDir($path.'templates/'); 
    56           $this->createDir($path.'classes/'); 
    57           $this->createDir($path.'daos/'); 
    58           $this->createDir($path.'forms/'); 
    59           $this->createDir($path.'locales/'); 
    60           $this->createDir($path.'locales/en_EN/'); 
    61           $this->createDir($path.'locales/fr_FR/'); 
    62        
     52        if(!$this->getOption('-nosubdir')){ 
     53            $this->createDir($path.'classes/'); 
     54            $this->createDir($path.'zones/'); 
     55            $this->createDir($path.'controllers/'); 
     56            $this->createDir($path.'templates/'); 
     57            $this->createDir($path.'classes/'); 
     58            $this->createDir($path.'daos/'); 
     59            $this->createDir($path.'forms/'); 
     60            $this->createDir($path.'locales/'); 
     61            $this->createDir($path.'locales/en_EN/'); 
     62            $this->createDir($path.'locales/fr_FR/'); 
     63       
    6364 
    64        if(!$this->getOption('-nocontroller')){ 
    65          $agcommand = jxs_load_command('createctrl'); 
    66          $options = array(); 
    67          if ($this->getOption('-cmdline')) { 
    68             $options = array('-cmdline'=>true); 
    69          } 
    70          if ($this->getOption('-addinstallzone')) { 
    71             $options = array('-addinstallzone'=>true); 
    72          } 
    73          $agcommand->init($options,array('module'=>$this->_parameters['module'], 'name'=>'default','method'=>'index')); 
    74          $agcommand->run(); 
    75        } 
     65        if(!$this->getOption('-nocontroller')){ 
     66            $agcommand = jxs_load_command('createctrl'); 
     67            $options = array(); 
     68            if ($this->getOption('-cmdline')) { 
     69               $options = array('-cmdline'=>true); 
     70            } 
     71            if ($this->getOption('-addinstallzone')) { 
     72                $options = array('-addinstallzone'=>true); 
     73            } 
     74            $agcommand->init($options,array('module'=>$this->_parameters['module'], 'name'=>'default','method'=>'index')); 
     75            $agcommand->run(); 
     76        } 
     77        $inifiles = array(JELIX_APP_CONFIG_PATH.'index/config.ini.php', 
     78                        JELIX_APP_CONFIG_PATH.'cmdline/config.ini.php', 
     79                        JELIX_APP_CONFIG_PATH.'jsonrpc/config.ini.php', 
     80                        JELIX_APP_CONFIG_PATH.'xmlrpc/config.ini.php', 
     81                        ); 
     82        foreach($inifiles as $filename) { 
     83            try { 
     84                $ini = new jIniFileModifier($filename); 
     85                if ($ini->getValue('startModule') == '') 
     86                    $ini->setValue('startModule', $this->_parameters['module']); 
     87                $ini->save(); 
     88            }catch(Exception $e){} 
     89        } 
    7690    } 
    7791} 
  • trunk/lib/jelix-scripts/jelix.php

    r1018 r1092  
    22/** 
    33* @package     jelix-scripts 
    4 * @version     $Id$ 
    54* @author      Jouanneau Laurent 
    65* @contributor Loic Mathaud 
  • trunk/lib/jelix-scripts/templates/var/config/cmdline/config.ini.php.tpl

    r809 r1092  
    22;for security reasons , don't remove or modify the first line 
    33 
    4 startModule = "%%appname%%" 
     4startModule = "%%modulename%%" 
    55startAction = "default:index" 
  • trunk/lib/jelix-scripts/templates/var/config/index/config.ini.php.tpl

    r838 r1092  
    22;for security reasons , don't remove or modify the first line 
    33 
    4 startModule = "%%appname%%" 
     4startModule = "%%modulename%%" 
    55startAction = "default:index" 
    66 
  • trunk/lib/jelix-scripts/templates/var/config/jsonrpc/config.ini.php.tpl

    r838 r1092  
    22;for security reasons , don't remove or modify the first line 
    33 
    4 startModule = "%%appname%%" 
     4startModule = "%%modulename%%" 
    55startAction = "default:index" 
    66 
  • trunk/lib/jelix-scripts/templates/var/config/soap/config.ini.php.tpl

    r879 r1092  
    22;for security reasons , don't remove or modify the first line 
    33 
    4 startModule = "%%appname%%" 
     4startModule = "%%modulename%%" 
    55startAction = "default:index" 
    66 
  • trunk/lib/jelix-scripts/templates/var/config/xmlrpc/config.ini.php.tpl

    r838 r1092  
    22;for security reasons , don't remove or modify the first line 
    33 
    4 startModule = "%%appname%%" 
     4startModule = "%%modulename%%" 
    55startAction = "default:index" 
    66 
Download in other formats: Unified Diff Zip Archive