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

Administrator Admin, 2006-10-19 22:50

View differences:

t3lib/config_default.php (working copy)
97 97
		'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.
98 98

  
99 99
		'requiredExt' => 'cms,version,lang,sv',			// String list: List of extensions which are REQUIRED and cannot be unloaded by the Extension Manager!
100
		'excludeForPackaging' => '(CVS|\..*|.*~)',		// 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!
100 101
		'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...)
101 102
		'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!
102 103
		'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)
2555 2555
	 * @param	string		$extensionList is the comma list of extensions to read only (blank = all)
2556 2556
	 * @param	boolean		If set, then the path is prepended the filenames. Otherwise only the filenames are returned in the array
2557 2557
	 * @param	string		$order is sorting: 1= sort alphabetically, 'mtime' = sort by modification time.
2558
	 * @param string		A comma seperated list of filenames to exclude, no wildcards
2558 2559
	 * @return	array		Array of the files found
2559 2560
	 */
2560
	function getFilesInDir($path,$extensionList='',$prependPath=0,$order='')	{
2561
	function getFilesInDir($path,$extensionList='',$prependPath=0,$order='',$excludePattern='')	{
2561 2562

  
2562 2563
			// Initialize variabels:
2563 2564
		$filearray = array();
......
2573 2574
					if (@is_file($path.'/'.$entry))	{
2574 2575
						$fI = pathinfo($entry);
2575 2576
						$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)
2576
						if (!$extensionList || t3lib_div::inList($extensionList,strtolower($fI['extension'])))	{
2577
						if (!$extensionList || t3lib_div::inList($extensionList,strtolower($fI['extension'])) && (strlen($excludePattern) && !preg_match('/^'.$excludePattern.'$/',$entry)))	{
2577 2578
						    $filearray[$key]=($prependPath?$path.'/':'').$entry;
2578
							if ($order=='mtime') {$sortarray[$key]=filemtime($path.'/'.$entry);}
2579
								if ($order=='mtime') {$sortarray[$key]=filemtime($path.'/'.$entry);}
2579 2580
								elseif ($order)	{$sortarray[$key]=$entry;}
2580 2581
						}
2581 2582
					}
......
2609 2610
	 * @param	string		$extList: Comma list of file extensions: Only files with extensions in this list (if applicable) will be selected.
2610 2611
	 * @param	boolean		$regDirs: If set, directories are also included in output.
2611 2612
	 * @param	integer		$recursivityLevels: The number of levels to dig down...
2613
	 * @param string		$excludePattern: regex pattern of files/directories to exclude
2612 2614
	 * @return	array		An array with the found files/directories.
2613 2615
	 */
2614
	function getAllFilesAndFoldersInPath($fileArr,$path,$extList='',$regDirs=0,$recursivityLevels=99)	{
2616
	function getAllFilesAndFoldersInPath($fileArr,$path,$extList='',$regDirs=0,$recursivityLevels=99,$excludePattern='')	{
2615 2617
		if ($regDirs)	$fileArr[] = $path;
2616
		$fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path,$extList,1,1));
2618
		$fileArr = array_merge($fileArr, t3lib_div::getFilesInDir($path,$extList,1,1,$excludePattern));
2617 2619

  
2618 2620
		$dirs = t3lib_div::get_dirs($path);
2619 2621
		if (is_array($dirs) && $recursivityLevels>0)	{
2620 2622
			foreach ($dirs as $subdirs)	{
2621
				if ((string)$subdirs!='')	{
2622
					$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$path.$subdirs.'/',$extList,$regDirs,$recursivityLevels-1);
2623
				if ((string)$subdirs!='' && (strlen($excludePattern) && !preg_match('/^'.$excludePattern.'$/',$subdirs)))	{
2624
					$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$path.$subdirs.'/',$extList,$regDirs,$recursivityLevels-1,$excludePattern);
2623 2625
				}
2624 2626
			}
2625 2627
		}
typo3/mod/tools/em/class.em_index.php (working copy)
339 340
	function init()	{
340 341
		global $BE_USER,$LANG,$BACK_PATH,$TYPO3_CONF_VARS;
341 342

  
342
		// Setting paths of install scopes:
343
			// Setting paths of install scopes:
343 344
		$this->typePaths = Array (
344 345
			'S' => TYPO3_mainDir.'sysext/',
345 346
			'G' => TYPO3_mainDir.'ext/',
......
351 352
			'L' => '../../../../'.TYPO3_mainDir
352 353
		);
353 354

  
354
		// Setting module configuration:
355
		$this->excludeForPackaging = $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging'];
356

  
357
			// Setting module configuration:
355 358
		$this->MCONF = $GLOBALS['MCONF'];
356 359

  
357
		// Setting GPvars:
360
			// Setting GPvars:
358 361
		$this->CMD = t3lib_div::_GP('CMD');
359 362
		$this->lookUpStr = trim(t3lib_div::_GP('_lookUp'));
360 363
		$this->listRemote = t3lib_div::_GP('ter_connect');
......
2266 2271
		if ($extPath)	{
2267 2272
			// Read files:
2268 2273
			$fileArr = array();
2269
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath);
2274
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath,'',0,99,$this->excludeForPackaging);
2270 2275

  
2271 2276
			// Start table:
2272 2277
			$lines = array();
......
3338 3343
	 * @see makeDetailedExtensionAnalysis()
3339 3344
	 */
3340 3345
	function getClassIndexLocallangFiles($absPath,$table_class_prefix,$extKey)	{
3341
		$filesInside = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(),$absPath,'php,inc'),$absPath);
3346
		$filesInside = t3lib_div::removePrefixPathFromList(t3lib_div::getAllFilesAndFoldersInPath(array(),$absPath,'php,inc',0,99,$this->excludeForPackaging),$absPath);
3342 3347
		$out = array();
3343 3348

  
3344 3349
		foreach($filesInside as $fileName)	{
......
3883 3888

  
3884 3889
			// Get files for extension:
3885 3890
			$fileArr = array();
3886
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath);
3891
			$fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath,'',0,99,$this->excludeForPackaging);
3887 3892

  
3888 3893
			// Calculate the total size of those files:
3889 3894
			$totalSize = 0;
(8-8/9)