Changeset 1164
- Timestamp:
- 11/18/08 15:36:49 (2 months ago)
- Files:
-
- trunk/build/manifests/jelix-lib.mn (modified) (1 diff)
- trunk/lib/jelix/installer/jInstaller.class.php (modified) (3 diffs)
- trunk/lib/jelix/installer/jInstallerApp.class.php (modified) (2 diffs)
- trunk/lib/jelix/installer/jInstallerBase.class.php (modified) (6 diffs)
- trunk/lib/jelix/installer/jInstallerModule.class.php (modified) (2 diffs)
- trunk/lib/jelix/installer/jInstallerPlugin.class.php (modified) (2 diffs)
- trunk/lib/jelix/utils/jIniMultiFilesModifier.class.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/manifests/jelix-lib.mn
r1163 r1164 237 237 jIniFile.class.php 238 238 jIniFileModifier.class.php 239 jIniMultiFilesModifier.class.php 239 240 * jJson.class.php 240 241 * jJsonRpc.class.php trunk/lib/jelix/installer/jInstaller.class.php
r1162 r1164 11 11 */ 12 12 class jInstaller { 13 14 /** 15 * @return jInstallerApp 16 */ 17 static function getApplication() { 18 19 20 } 13 21 14 22 /** … … 66 74 */ 67 75 static function getModulesList($status = 0) { 76 68 77 } 69 78 … … 107 116 108 117 } 118 109 119 } trunk/lib/jelix/installer/jInstallerApp.class.php
r1162 r1164 12 12 /** 13 13 * 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. 16 15 * @package jelix 17 16 * @subpackage installer … … 19 18 * @since 1.1 20 19 */ 21 abstractclass jInstallerApp extends jInstallerBase {20 class jInstallerApp extends jInstallerBase { 22 21 23 22 /** 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 28 29 } 29 30 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 32 60 } 33 61 trunk/lib/jelix/installer/jInstallerBase.class.php
r1162 r1164 19 19 */ 20 20 abstract 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 22 28 function __construct($name) { 23 29 … … 25 31 26 32 abstract function isInstalled(); 33 27 34 abstract function isActivated(); 28 35 … … 64 71 /** 65 72 * 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 68 78 */ 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); 72 82 $driver = $p['driver']; 73 83 if($driver == 'pdo'){ … … 75 85 $driver = $m[1]; 76 86 } 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'); 86 88 } 87 89 … … 90 92 * @param string $targetPath 91 93 */ 92 function copyDirectoryContent($sourcePath, $targetPath) {94 static function copyDirectoryContent($sourcePath, $targetPath) { 93 95 jFile::createDir($targetPath); 94 96 $dir = new DirectoryIterator($sourcePath); … … 105 107 } 106 108 } 109 trunk/lib/jelix/installer/jInstallerModule.class.php
r1162 r1164 20 20 class jInstallerModule extends jInstallerBase { 21 21 22 protected $application; 22 23 23 24 /** 24 25 * The module should be present in the application. 25 26 * @param string $name the name of the module 27 * @param jInstallerApp $application 26 28 */ 27 function __construct($name ) {29 function __construct($name, $application) { 28 30 // read the module.xml 31 // and set the $path property 29 32 } 30 33 … … 74 77 75 78 } 76 77 78 79 79 } 80 80 trunk/lib/jelix/installer/jInstallerPlugin.class.php
r1026 r1164 12 12 /** 13 13 * 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. 16 15 * @package jelix 17 16 * @subpackage installer … … 19 18 * @since 1.1 20 19 */ 21 abstractclass jInstallerPlugin extends jInstallerBase {20 class jInstallerPlugin extends jInstallerBase { 22 21 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 } 23 34 24 35 }
