Changeset 1164

Show
Ignore:
Timestamp:
11/18/08 15:36:49 (2 months ago)
Author:
laurentj
Message:

worked on the API of jInstaller
added a new class, jIniMultiFilesModifier, to facilitate the modification of the configuration of an entry point

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/build/manifests/jelix-lib.mn

    r1163 r1164  
    237237  jIniFile.class.php 
    238238  jIniFileModifier.class.php 
     239  jIniMultiFilesModifier.class.php 
    239240* jJson.class.php 
    240241* jJsonRpc.class.php 
  • trunk/lib/jelix/installer/jInstaller.class.php

    r1162 r1164  
    1111*/ 
    1212class jInstaller { 
     13 
     14    /** 
     15     * @return jInstallerApp 
     16     */ 
     17    static function getApplication() { 
     18         
     19         
     20    } 
    1321 
    1422    /** 
     
    6674     */ 
    6775    static function getModulesList($status = 0) { 
     76 
    6877    } 
    6978 
     
    107116     
    108117    } 
     118 
    109119} 
  • trunk/lib/jelix/installer/jInstallerApp.class.php

    r1162 r1164  
    1212/** 
    1313* EXPERIMENTAL 
    14 * a class to install an application. You should override it into a install/install.php file. The  
    15 * class should be named appInstaller 
     14* a class to install an application. 
    1615* @package     jelix 
    1716* @subpackage  installer 
     
    1918* @since 1.1 
    2019*/ 
    21 abstract class jInstallerApp extends jInstallerBase { 
     20class jInstallerApp extends jInstallerBase { 
    2221 
    2322    /** 
    24     * Install modules by respecting dependencies 
    25     */ 
    26     function installModules() { 
    27         throw new Exception("installModules not implemented"); 
     23     *  
     24     * @param string $path the path of the application directory 
     25     */ 
     26    function __construct($path) { 
     27        // read the project.xml 
     28        // and set the $path property 
    2829    } 
    2930 
    30     function uninstallModules() { 
    31         throw new Exception("uninstallModules not implemented"); 
     31    /** 
     32     * get on object to modify the config file of an entry point  
     33     * @param string $filename relative path to the var/config directory 
     34     * @return jIniMultiFilesModifier 
     35     */ 
     36    function getConfig($entrypoint) { 
     37         
     38         throw new Exception('not implemented'); 
     39         
     40        //TODO 
     41        // get the path of the config file corresponding to the entrypoint, 
     42        // from the project.xml 
     43        $filename = ''; 
     44        return new jIniMutliFilesModifier(JELIX_APP_CONFIG_PATH.'defaultconfig.ini.php', 
     45                                          JELIX_APP_CONFIG_PATH.$filename); 
     46    } 
     47 
     48    function addEntryPoint($filename, $type, $configFilename) { 
     49        throw new Exception('not implemented'); 
     50        // should modify the project.xml 
     51        // if the config file doesn't exist, create it 
     52        // if the entrypoint doesn't exist, create it, with the given type 
     53    } 
     54 
     55 
     56    function removeEntryPoint($filename) { 
     57        throw new Exception('not implemented'); 
     58        // should modify the project.xml 
     59        // if the config file is not used by another entrypoint, remove it 
    3260    } 
    3361 
  • trunk/lib/jelix/installer/jInstallerBase.class.php

    r1162 r1164  
    1919*/ 
    2020abstract class jInstallerBase { 
    21  
     21     
     22    /** 
     23     * the path of the directory of the component 
     24     * it should be set by the constructor 
     25     */ 
     26    protected $path = ''; 
     27     
    2228    function __construct($name) { 
    2329         
     
    2531 
    2632    abstract function isInstalled(); 
     33 
    2734    abstract function isActivated(); 
    2835 
     
    6471    /** 
    6572     * import a sql script into the given profile. 
    66      * @param string $name the part of the file name : $name.databasetype.sql 
    67      *               for example, if you provide example.mysql.sql and example.pgsql.sql, give 'example' 
     73     * 
     74     * The name of the script should be store in install/sql/$name.databasetype.sql 
     75     * in the directory of the component. (replace databasetype by mysql, pgsql etc.) 
     76     *  
     77     * @param string $name the name of the script, without suffixes 
    6878     */ 
    69     function execSQLScript($name, $profil='') { 
    70         $tools = jDb::getTools($profil); 
    71         $p = jDb::getProfil ($profil); 
     79    public function execSQLScript($name, $profile='') { 
     80        $tools = jDb::getTools($profile); 
     81        $p = jDb::getProfil ($profile); 
    7282        $driver = $p['driver']; 
    7383        if($driver == 'pdo'){ 
     
    7585            $driver = $m[1]; 
    7686        } 
    77         $tools->execSQLScript($this->basePath.$name.'.'.$driver.'.sql'); 
    78     } 
    79  
    80     /** 
    81      * @param string $filename relative path to the var/config directory 
    82      * @return jIniFileModifier 
    83      */ 
    84     function getConfig($filename) { 
    85         return new jIniFileModifier(JELIX_APP_CONFIG_PATH.$filename); 
     87        $tools->execSQLScript($this->path.'install/sql/'.$name.'.'.$driver.'.sql'); 
    8688    } 
    8789 
     
    9092     * @param string $targetPath 
    9193     */ 
    92     function copyDirectoryContent($sourcePath, $targetPath) { 
     94    static function copyDirectoryContent($sourcePath, $targetPath) { 
    9395        jFile::createDir($targetPath); 
    9496        $dir = new DirectoryIterator($sourcePath); 
     
    105107    } 
    106108} 
     109 
  • trunk/lib/jelix/installer/jInstallerModule.class.php

    r1162 r1164  
    2020class jInstallerModule extends jInstallerBase { 
    2121 
     22    protected $application; 
    2223 
    2324    /** 
    2425     * The module should be present in the application. 
    2526     * @param string $name the name of the module 
     27     * @param jInstallerApp $application 
    2628     */ 
    27     function __construct($name) { 
     29    function __construct($name, $application) { 
    2830        // read the module.xml 
     31        // and set the $path property 
    2932    } 
    3033 
     
    7477         
    7578    } 
    76      
    77  
    78  
    7979} 
    8080 
  • trunk/lib/jelix/installer/jInstallerPlugin.class.php

    r1026 r1164  
    1212/** 
    1313* EXPERIMENTAL 
    14 * a class to install a module. You should override it into a install/install.php file. The  
    15 * class should be named appInstaller 
     14* a class to install a module. 
    1615* @package     jelix 
    1716* @subpackage  installer 
     
    1918* @since 1.1 
    2019*/ 
    21 abstract class jInstallerPlugin extends jInstallerBase { 
     20class jInstallerPlugin extends jInstallerBase { 
    2221 
     22    protected $application; 
     23 
     24    /** 
     25     * The plugin should be present in the application. 
     26     * @param string $type the type of the plugin ('acl', 'auth', 'tpl', 'urls'...) 
     27     * @param string $name the name of the plugin 
     28     * @param jInstallerApp $application 
     29     */ 
     30    function __construct($type, $name, $application) { 
     31        // read the module.xml 
     32        // and set the $path property 
     33    } 
    2334 
    2435} 
Download in other formats: Unified Diff Zip Archive