[TYPO3-dev] version number of extension

Franz Holzinger franz at fholzinger.com
Sat Jul 8 08:21:15 CEST 2006


I have copied this function from t3lib/class.t3lib_superadmin.php and 
adapted it:


/**
	* Gets information for an extension, eg. version and 
most-recently-edited-script
	*
	* @param	string		Path to local extension folder
	* @param	string		Extension key
	* @return	array		Information array (unless an error occured)
	*/
function getExtensionInfo($path,$extKey)	{
	$file = $path.'/ext_emconf.php';
	if (@is_file($file))	{
		$_EXTKEY = $extKey;
		$EM_CONF = array();
		include($file);

		$eInfo = array();
			// Info from emconf:
		$eInfo['title'] = $EM_CONF[$extKey]['title'];
		$eInfo['version'] = $EM_CONF[$extKey]['version'];
		$eInfo['CGLcompliance'] = $EM_CONF[$extKey]['CGLcompliance'];
		$eInfo['CGLcompliance_note'] = $EM_CONF[$extKey]['CGLcompliance_note'];
		if (is_array($EM_CONF[$extKey]['constraints']) && 
is_array($EM_CONF[$extKey]['constraints']['depends']))	{
			$eInfo['TYPO3_version'] = 
$EM_CONF[$extKey]['constraints']['depends']['typo3'];
		} else {
			$eInfo['TYPO3_version'] = $EM_CONF[$extKey]['TYPO3_version'];
		}
		$filesHash = 
unserialize($EM_CONF[$extKey]['_md5_values_when_last_written']);

		$eInfo['manual'] = @is_file($path.'/doc/manual.sxw');

		return $eInfo;
	} else return 'ERROR: No emconf.php file: '.$file;
}


This shall be put somewhere to make it available for all extensions.

Greets,

Franz




More information about the TYPO3-dev mailing list