Changeset 1162

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

worked on the API of the futur installer

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/installer/jInstallerApp.class.php

    r1026 r1162  
    2121abstract class jInstallerApp extends jInstallerBase { 
    2222 
    23  
    24  
    25  
    2623    /** 
    2724    * Install modules by respecting dependencies 
  • trunk/lib/jelix/installer/jInstallerBase.class.php

    r1026 r1162  
    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 component (module or plugin)  
    1615* @package     jelix 
    1716* @subpackage  installer 
     
    2120abstract class jInstallerBase { 
    2221 
    23     /** 
    24      * @var jIInstallReporter 
    25      */ 
    26     public $reporter; 
    27  
    28  
    29     function __construct($reporter, $basePath) { 
    30         $this->reporter = $reporter; 
    31         $this->basePath = $basePath; 
     22    function __construct($name) { 
     23         
    3224    } 
    3325 
     26    abstract function isInstalled(); 
     27    abstract function isActivated(); 
     28 
    3429    /** 
    35      * main method for the installation 
     30     * install the component. It just call the _install.php of the component 
     31     * 
     32     * It should expose a variable $installer to the _install.php, 
     33     * $installer should be the current instance of this class. 
    3634     */ 
    3735    abstract function install(); 
    3836 
    3937    /** 
    40      * main method for the uninstallation 
     38     * uninstall the component. It just call the _uninstall.php 
     39     * of the component 
     40     * 
     41     * It should expose a variable $installer to the _uninstall.php, 
     42     * $installer should be the current instance of this class. 
    4143     */ 
    4244    abstract function uninstall(); 
     45 
     46    /** 
     47     * activate the component. 
     48     * It just call the _activate.php of the component ? 
     49     * 
     50     * It should expose a variable $installer to the _activate.php, 
     51     * $installer should be the current instance of this class. 
     52     */ 
     53    abstract function activate(); 
     54 
     55    /** 
     56     * deactivate the component. It just call the _deactivate.php 
     57     * of the component 
     58     * 
     59     * It should expose a variable $installer to the _deactivate.php, 
     60     * $installer should be the current instance of this class. 
     61     */ 
     62    abstract function deactivate(); 
    4363 
    4464    /** 
     
    85105    } 
    86106} 
    87  
  • trunk/lib/jelix/installer/jInstallerModule.class.php

    r1026 r1162  
    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 jInstallerModule extends jInstallerBase { 
     20class jInstallerModule extends jInstallerBase { 
     21 
     22 
     23    /** 
     24     * The module should be present in the application. 
     25     * @param string $name the name of the module 
     26     */ 
     27    function __construct($name) { 
     28        // read the module.xml 
     29    } 
     30 
     31    /** 
     32     * @return boolean true if the module is installed 
     33     */ 
     34    function isInstalled() { 
     35         
     36    } 
     37 
     38    /** 
     39     * install the module, by checking dependencies. 
     40     * @throw jException  if an error occurs during the install. 
     41     */ 
     42    function install() { 
     43 
     44        // * check that all dependencies are ok : the needed modules and plugins 
     45        // should be present in the application, even if this modules or plugins 
     46        // are not install 
     47        // * start the install of all needed modules and plugins before installing 
     48        // the module. Check before isInstalled() of the module/plugin 
     49        // If an exception occured during the install of this dependencies 
     50        // we should call uninstall of previous modules/plugins well installed and which 
     51        // install() has returned true. throw the exception 
     52        // * if ok, install the module, by calling the _install.php script 
     53        // * if error, uninstall dependencies which have just been installed, 
     54        //   undo things which have made during the install of the module, and 
     55        //   throw an exception 
     56    } 
     57     
     58    /** 
     59     * uninstall the module, by checking dependencies. 
     60     * @throw jException  if an error occurs during the install. 
     61     */ 
     62    function uninstall() { 
     63        // * check that all dependencies are ok : the needed modules and plugins 
     64        // should be present in the application 
     65        // * start the uninstall of all needed modules and plugins before installing 
     66        // the module.  
     67        // * if ok, uninstall the module, by calling the _uninstall.php script       
     68    } 
     69     
     70    function activate() { 
     71    } 
     72     
     73    function deactivate() { 
     74         
     75    } 
     76     
     77 
    2278 
    2379} 
  • trunk/testapp/install/installer.php

    r830 r1162  
    1010*/ 
    1111 
    12 class appInstaller extends jInstallerApp { 
    13  
    14     function install(){ 
    15         //$this->copyDirectoryContent($this->basePath.'/www', JELIX_APP_WWW_PATH.'test'); 
    16         $this->reporter->message("Test ok"); 
    17         //$this->execSQLScript('install'); 
    18     } 
    19  
    20     function uninstall(){ 
    21         //$this->execSQLScript('uninstall'); 
    22     } 
    23 } 
    2412 
    2513?> 
Download in other formats: Unified Diff Zip Archive