developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Opened 13 years ago

Closed 10 years ago

Last modified 9 years ago

#31 closed task (fixed)

système d’installation/désinstallation d’un module

Reported by: laurentj Owned by: laurentj
Priority: highest Milestone: Jelix 1.2 beta
Component: jelix:installer Version: 1.0alpha4
Severity: major Keywords: installer
Cc: Blocked By:
Blocking: #967 Documentation needed: no
Hosting Provider: Php version:

Description (last modified by laurentj)

jelix devrait fournir des outils pour installer, desinstaller un module. Voir fr/drafts/gestion_modules?

Ce ticket correspond à une première étape : il s'agirait simplement de lire le contenu d'un répertoire install d'un module déjà copié dans l'application, et d'executer les scripts sql et autres pour activer le module. (et l'inverse pour le desinstaller/désactiver)

Attachments (4)

jInstallerModulesMgr.class.php (9.0 KB) - added by foxmask 11 years ago.
class to be able to install / unistall / activate / deactivate modules
moduleinstall.lang.patch (1.8 KB) - added by foxmask 11 years ago.
moduleinstaller language file
moduleinstaller.lang.patch (2.9 KB) - added by foxmask 11 years ago.
les messages de l'installeur
Installer.patch (18.8 KB) - added by foxmask 11 years ago.
Patch of classes jInstaller+jInstallerModule+jInstallerApp

Download all attachments as: .zip

Change History (32)

comment:1 Changed 12 years ago by laurentj

  • Keywords install update added
  • Milestone changed from Jelix 1.0 to Jelix 1.0beta3
  • Priority changed from normal to high
  • Version changed from 1.0alpha5 to 1.0alpha4

comment:2 Changed 12 years ago by laurentj

  • Priority changed from high to highest

comment:3 Changed 12 years ago by laurentj

  • Milestone changed from Jelix 1.0beta3 to Jelix 1.0

comment:4 Changed 12 years ago by laurentj

  • Description modified (diff)
  • Keywords update removed
  • Milestone changed from Jelix 1.0 to Jelix 1.1
  • Severity changed from critical to major
  • Summary changed from système d’installation/mise à jour/désinstallation d’un module to système d’installation/désinstallation d’un module

comment:5 Changed 11 years ago by laurentj

  • Documentation needed unset
  • Milestone changed from Jelix 1.1 to Jelix 1.2

comment:6 Changed 11 years ago by laurentj

  • Keywords installer added; install removed
  • Milestone changed from Jelix 1.2 to Jelix 1.1
  • Owner set to laurentj
  • Status changed from new to assigned

Ok, I take it.

comment:7 Changed 11 years ago by laurentj

  • Milestone changed from Jelix 1.1 beta 1 to Jelix 1.1 beta 2

comment:8 Changed 11 years ago by laurentj

  • Milestone changed from Jelix 1.1 beta 2 to Jelix 1.2

Changed 11 years ago by foxmask

class to be able to install / unistall / activate / deactivate modules

comment:9 Changed 11 years ago by foxmask

  • review set to review+

comment:10 Changed 11 years ago by foxmask

  • review changed from review+ to review?

oops ;)

Changed 11 years ago by foxmask

moduleinstaller language file

comment:11 Changed 11 years ago by laurentj

  • review changed from review? to review-

Please follow the guidelines to propose a patch (see documentation on the wiki) : provides a REAL patch, made from the trunk directory, thanks.

follow phpdoc syntax in the comments and add comment for each properties.

class jInstallerModulesMgr extends jInstallerModule {  

why ?

Your class is strange : it manages a specific module (since we need to indicate a module name on the constructor), but there are also some methods which act on all modules...

 if ($idModule!='')
     $this->idModule = $idModule;

why ? a simple assignation is enough.

 #we want all the modules in modulesPath except the core and jelix one.
  if (preg_match('#/([A-Za-z0-9_-]+)/$#',$path,$m) and ! preg_match('#[core||jelix]-modules#',$path)) {

just simple compare the key to "jelix", it is an associative array.. And in the future, if module will be added in core-module, we just modify this test.

$this->modules[$this->id] = simplexml_load_file($path.'/module.xml');

The id and the name of a module is not the same thing. In your class, you use the name, not the id... The id of a module is a unique identifier in the world (the name is not always uniq). You should use the id indicated in the module.xml file. The name of the module is only the name of the directory of the module.

    $this->modules[$this->id]['root_writable'] = is_writable($path);
    $this->modules[$this->id]['root'] = $this->mroot;

why do you add this attributes in the xml file ? it is not allowed by the schema. $this->modules[$this->id] should be only an array.

$this->id = null;

$this->mroot = null;

I don't understand why you set id and mroot and then you set them to null just after...

public function install() {
    try {
...
  } catch (Exception $e) {
      return $e->getMessage();
  }
  return null;
}    

Since you do nothing with the exception, remove this try/catch. Don't stop the propagation of an exception if you don't have a good reason. Same comment for all other method.

 $i = $this->loadModuleFile($this->modules[$this->idModule]['root'].'/install/_install.php');
 if ($i === true) {

Remove this $i variable or change the name for a more explicit name

if (!jFile::write($this->modules[$this->idModule['root'].'/_installed_version',$this->modules[$this->idModule]['version'])) {

All files created dynamically should be stored in the var/some/where directory , not in modules directory since it is not writable directories. Same comments for all other method.

 throw new Exception(jLocale::get('moduleinstaller.cannot.installed.module'));

Use jException instead of Exception. Same comments for all other method.

deleteModule : no verification if the module has been uninstall correctly before ? I think deleteModule and uninstall should be merged, and uninstall could have a boolean parameter to indicate if we delete or not the module.

getActivatedModules, getDeactivatedModules, getInstalledModules : they should call a common protected method since their code is identical.. and no getUninstalledModules ?

	private function loadModuleFile($________) {

		if (!file_exists($________)) {

			return;

		}

		

		return require $________;

	}

You don't have a better explicit name ? and s/loadModuleFile/runInstallFile

public function moduleInfo($id,$info) {

	$xmlStr = file_get_contents($this->modules[$id]['root'].'/module.xml');

	$xmlStr = str_replace("xmlns=","a=",$xmlStr);

	$xml    = simplexml_load_string($xmlStr);		


	$result = $xml->xpath($info);


	return isset($result[0]) ? $result[0] : null;

}

Horrible ! don't erase the xmlns attribute ! see my response on the forum.

Why this file installedVersion ?

comment:12 Changed 11 years ago by laurentj

  • Component changed from jelix to jelix:installer
  • Owner changed from laurentj to foxmask
  • Status changed from assigned to new

comment:13 Changed 11 years ago by foxmask

as discussed - wait for your new spec ;)

Changed 11 years ago by foxmask

les messages de l'installeur

Changed 11 years ago by foxmask

Patch of classes jInstaller+jInstallerModule+jInstallerApp

comment:14 Changed 11 years ago by foxmask

  • review changed from review- to review?

a first try to patch the installer :)

comment:15 Changed 10 years ago by foxmask

  • Owner changed from foxmask to laurentj
  • review changed from review? to review-

j'attends ton cahier des charges ;)

comment:16 Changed 10 years ago by laurentj

  • Blocking 261 added
  • review review- deleted

Le coeur du système d'installation commence à prendre forme. Voir r1451, r1452. Il manque encore des tests, et certainement des apis facilitant l'écriture des scripts d'installation. Rien de définitif donc pour le moment, mais ça commence à fonctionner.

comment:17 Changed 10 years ago by laurentj

  • Blocking 262 added; 261 removed

comment:18 Changed 10 years ago by laurentj

Encore du gros travail de fait sur le coeur, qui a été encore changé. Maintenant les modules doivent fournir des classes d'installation. Le système se charge aussi d'executer maintenant les mises à jour.

voir http://hg.jelix.org/jelix/jelix-trunk/rev/89cd614647c9

Il faut encore travailler sur le support des points d'entrée multiples et des profils jdb multiples.

comment:19 Changed 10 years ago by laurentj

  • Blocking 965, 966, 967, 968 added

comment:20 Changed 10 years ago by laurentj

The installer is now mostly finished ! http://hg.jelix.org/jelix/jelix-trunk/rev/eeaed5ae1bf4

Need certainly still some few works, but this will be for other tickets...

comment:21 Changed 10 years ago by foxmask

very g00d news ;)

comment:22 Changed 10 years ago by laurentj

  • Resolution set to fixed
  • Status changed from new to closed

comment:23 Changed 10 years ago by laurentj

  • Blocking 965 removed

comment:24 Changed 9 years ago by laurentj

  • Blocking 966 removed

comment:25 Changed 9 years ago by laurentj

  • Blocking 968 removed

comment:26 Changed 9 years ago by laurentj

  • Documentation needed set

comment:27 Changed 9 years ago by laurentj

  • Documentation needed unset

comment:28 Changed 9 years ago by laurentj

  • Blocking 262 removed
Note: See TracTickets for help on using tickets.