Bug #16419 » exclude-in-EM-v3.patch

Administrator Admin, 2006-12-12 18:16

View differences:

t3lib/config_default.php (working copy)
98 98
		'em_mirrorListURL' => 'http://repositories.typo3.org/mirrors.xml.gz',				// Allows to preset the URL for fetching the extension repository mirror list from. Used in the Extension Manager.
99 99

  
100 100
		'requiredExt' => 'cms,version,lang,sv',			// String list: List of extensions which are REQUIRED and cannot be unloaded by the Extension Manager!
101
		'excludeForPackaging' => '(CVS|\..*|.*~|.*\.bak)',		// String list: List of directories and files which will not be packaged into extensions nor taken into account otherwise by the Extension Manager. Perl regular expression syntax!
101 102
		'extCache' => 1,						// Int. 0,1,2,3: 0: ext-scripts (ext_localconf.php and ext_tables.php) are NOT cached, but included every time. 1: scripts cached to typo3conf/temp_CACHED_[sitePathHash]* (saves some milliseconds even with PHP accelerators), 2: scripts cached and prefix includes a hash based on the 'extList' string, 3: scripts cached to typo3conf/temp_CACHED_* (no hash included at all...)
102 103
		'extList' => 'tsconfig_help,context_help,extra_page_cm_options,impexp,belog,aboutmodules,setup,install',						// String list: List of extensions which are enabled for this install. Use the Extension Manager (EM) to manage this!
103 104
		'extConf' => array(						// Config-options for extensions, stored as serialized arrays by extension-keys. Handled automatically by the EM.
t3lib/class.t3lib_div.php (working copy)
2561 2561
	 * @param	string		$extensionList is the comma list of extensions to read only (blank = all)
2562 2562
	 * @param	boolean		If set, then the path is prepended the filenames. Otherwise only the filenames are returned in the array
2563 2563
	 * @param	string		$order is sorting: 1= sort alphabetically, 'mtime' = sort by modification time.
2564
	 * @param string		A comma seperated list of filenames to exclude, no wildcards
2564 2565
	 * @return	array		Array of the files found
2565 2566
	 */
2566
	function getFilesInDir($path,$extensionList='',$prependPath=0,$order='')	{
2567
	function getFilesInDir($path,$extensionList='',$prependPath=0,$order='',$excludePattern='')	{
2567 2568

  
2568 2569
			// Initialize variabels:
2569 2570
		$filearray = array();
......
2579 2580
					if (@is_file($path.'/'.$entry))	{
2580 2581
						$fI = pathinfo($entry);
2581 2582
						$key = md5($path.'/'.$entry);	// Don't change this ever - extensions may depend on the fact that the hash is an md5 of the path! (import/export extension)
2582
						if (!$extensionList || t3lib_div::inList($extensionList,strtolower($fI['extension'])))	{
2583
						if ((!$extensionList || t3lib_div::inList($extensionList,strtolower($fI['extension']))) && (!strlen($excludePattern) || !preg_match('/^'.$excludePattern.'$/',$entry)))	{
2583 2584
						    $filearray[$key]=($prependPath?$path.'/':'').$entry;
2584
							if ($order=='mtime') {$sortarray[$key]=filemtime($path.'/'.$entry);}
2585
								if ($order=='mtime') {$sortarray[$key]=filemtime($path.'/'.$entry);}
2585 2586
								elseif ($order)	{$sortarray[$key]=$entry;}
2586 2587
						}
2587 2588
					}
......
2615 2616
	 * @param	string		$extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected.
2616 2617
	 * @param	boolean		$regDirs: If set, directories are also included in output.
2617 2618
	 * @param	integer		$recursivityLevels: The number of levels to dig down...
2619
	 * @param string		$excludePattern: regex pattern of files/directories to exclude
2618 2620
	 * @return	array		An array with the found files/directories.
2619 2621
	 */
2620
	function getAllFilesAndFoldersInPath($fileArr,$path,$extList='',$regDirs=0,$recursivityLevels=99)	{
2622
	function getAllFilesAndFoldersInPath($fileArr,$path,$extList='',$regDirs=0,$recursivityLevels=99,$excludePattern='')	{
2621 2623
		if ($regDirs)	$fileArr[] = $path;
2622
		$fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path,$extList,1,1));
2624
		$fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path,$extList,1,1,$excludePattern));
2623 2625

  
2624 2626
		$dirs = t3lib_div::get_dirs($path);
2625 2627
		if (is_array($dirs) && $recursivityLevels>0)	{
2626 2628
			foreach ($dirs as $subdirs)	{
2627
				if ((string)$subdirs!='')	{
2628
					$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$path.$subdirs.'/',$extList,$regDirs,$recursivityLevels-1);
2629
				if ((string)$subdirs!='' && (!strlen($excludePattern) || !preg_match('/^'.$excludePattern.'$/',$subdirs)))	{
2630
					$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$path.$subdirs.'/',$extList,$regDirs,$recursivityLevels-1,$excludePattern);
2629 2631
				}
2630 2632
			}
2631 2633
		}
typo3/mod/tools/em/class.em_index.php (working copy)
342 342
	function init()	{
343 343
		global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS;
344 344

  
345
		// Setting paths of install scopes:
345
			// Setting paths of install scopes:
346 346
		$this->typePaths = Array (
347 347
			'S' => TYPO3_mainDir.'sysext/',
348 348
			'G' => TYPO3_mainDir.'ext/',
......
354 354
			'L' => '../../../../'.TYPO3_mainDir
355 355
		);
356 356

  
357
		// Setting module configuration:
357
		$this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
358

  
359
			// Setting module configuration:
358 360
		$this->MCONF = $GLOBALS['MCONF'];
359 361

  
360
		// Setting GPvars:
362
			// Setting GPvars:
361 363
		$this->CMD = t3lib_div::_GP('CMD');
362 364
		$this->lookUpStr = trim(t3lib_div::_GP('_lookUp'));
363 365
		$this->listRemote = t3lib_div::_GP('ter_connect');
......
2307 2309
		if ($extPath)	{
2308 2310
			// Read files:
2309 2311
			$fileArr = array();
2310
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath);
2312
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath,'',0,99,$this->excludeForPackaging);
2311 2313

  
2312 2314
			// Start table:
2313 2315
			$lines = array();
......
3010 3012
							$list[$extKey]['doubleInstall'].= $type;
3011 3013
							$list[$extKey]['type'] = $type;
3012 3014
							$list[$extKey]['EM_CONF'] = $emConf;
3013
							$list[$extKey]['files'] = t3lib_div::getFilesInDir($path.$extKey);
3015
							$list[$extKey]['files'] = t3lib_div::getFilesInDir($path.$extKey, '', 0, '', $this->excludeForPackaging);
3014 3016

  
3015 3017
							$this->setCat($cat,$list[$extKey], $extKey);
3016 3018
						}
......
3383 3385
	 * @see makeDetailedExtensionAnalysis()
3384 3386
	 */
3385 3387
	function getClassIndexLocallangFiles($absPath,$table_class_prefix,$extKey)	{
3386
		$filesInside = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(),$absPath,'php,inc'),$absPath);
3388
		$filesInside = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(),$absPath,'php,inc',0,99,$this->excludeForPackaging),$absPath);
3387 3389
		$out = array();
3388 3390

  
3389 3391
		foreach($filesInside as $fileName)	{
......
3928 3930

  
3929 3931
			// Get files for extension:
3930 3932
			$fileArr = array();
3931
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath);
3933
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath,'',0,99,$this->excludeForPackaging);
3932 3934

  
3933 3935
			// Calculate the total size of those files:
3934 3936
			$totalSize = 0;
(9-9/9)