Changeset 1093

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

little improvement for ticket #82

Files:

Legend:

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

    r1092 r1093  
    1414 
    1515    public  $name = 'createmodule'; 
    16     public  $allowed_options=array('-nosubdir'=>false, '-nocontroller'=>false, '-cmdline'=>false, '-addinstallzone'=>false); 
     16    public  $allowed_options=array('-nosubdir'=>false, '-nocontroller'=>false, '-cmdline'=>false, '-addinstallzone'=>false, '-defaultmodule'=>false); 
    1717    public  $allowed_parameters=array('module'=>true); 
    1818 
    19     public  $syntaxhelp = "[-nosubdir] [-nocontroller] [-cmdline] MODULE"; 
     19    public  $syntaxhelp = "[-nosubdir] [-nocontroller] [-cmdline] [-addinstallzone] [-defaultmodule] MODULE"; 
    2020    public  $help=array( 
    2121        'fr'=>" 
     
    2828    -cmdline (facultatif) : crée le module avec un contrôleur pour la ligne de commande 
    2929    -addinstallzone (facultatif) : ajoute la zone check_install pour une nouvelle application 
     30    -defaultmodule (facultatif) : le module devient le module par defaut de l'application 
     31 
    3032    MODULE : le nom du module à créer.", 
    3133        'en'=>" 
     
    3638    -cmdline (optional): create a controller for command line (jControllerCmdLine) 
    3739    -addinstallzone (optional) : add the check_install zone for new application 
     40    -defaultmodule (optional) : the new module become the default module 
    3841    MODULE: name of the new module." 
    3942    ); 
     
    8083                        JELIX_APP_CONFIG_PATH.'xmlrpc/config.ini.php', 
    8184                        ); 
    82         foreach($inifiles as $filename) { 
     85        $isdefault = $this->getOption('-defaultmodule'); 
     86        foreach($inifiles as $k=> $filename) { 
    8387            try { 
    8488                $ini = new jIniFileModifier($filename); 
    85                 if ($ini->getValue('startModule') == '') 
     89                if ($isdefault && $k == 0) { 
     90                    $ini->setValue('startModule', $this->_parameters['module']); 
     91                    $ini->setValue('startAction', 'default:index'); 
     92                } 
     93                else if ($ini->getValue('startModule') == '') 
    8694                    $ini->setValue('startModule', $this->_parameters['module']); 
    8795                $ini->save(); 
Download in other formats: Unified Diff Zip Archive