<?php

/**-----------------------------------------------
*
* Rooty, 2018 <rooty@rooty.me>
*
*
* This software is protected by copyright, please
* read the file COPYRIGHT.
* This program is distributed in the hope that it
* will be useful, but without any warranty; without
* even the implied warranty of merchantability or
* fitness for a particular purpose. Please
* read the file LICENCE.
*
* Ce fichier contient la classe InstallManager (gestion des installations granilim)
* @copyright Copyright &copy; 2009-2018, Rooty
* @author Rooty <www.rooty.me|rooty@rooty.me>
* @since 2004/06/07
* @version 0.3
* @link www.rooty.me
* @package object_coordination
* @subpackage InstallManager
*/
if ( !defined('SYSTEM_IN') )
{
die("Hacking attempt");
}

/**
* Classe InstallFactory
*
* Classe de gestion de récupération du driver
*
* @package object_coordination
* @subpackage InstallManager
*/
Class InstallFactory
{
/**
* récupération du driver de l'instalaltion
* @return objet driver de l'installation
*/
	function getInstallDriver($pkgName, $rootDir){
		$path=$rootDir;
		$tmp=mb_split("-", $pkgName);
		if ( (is_dir($path)) && (file_exists($path."/installdriver".$tmp[1].".php")) ){
			# on utilise le driver de l'install
			include_once($path."/installdriver".$tmp[1].".php");
			if (class_exists('installdriver'.$tmp[1])){
				eval('$return= new installdriver'.$tmp[1].'("'.$pkgName.'", "'.$rootDir.'");');
				return $return;
			}
		}
		# on utilise le driver / défaut
		return new InstallDriver($pkgName, $rootDir);
	}
}
?>
